//	common.js	Shared JS routines
//
//	(c) Andy Belcher 2006
//
var domName		= "dandywebdesign.co.uk";
var wwwName		= "www."+domName;
//
function getObjectByAnyMeans(objId) {
	if(document.getElementById) {return document.getElementById(objId);}
	if(document.all)            {return eval("document.all." +objId);}
	if(document.layers)         {return eval("document.layers[" +objId+ "]");}
	return false;
	}
//
function dw(dwStr) {document.write(dwStr);}
//
function switchClass(lmtId,newClass)
	{getObjectByAnyMeans(lmtId).className = newClass;}
//
function switchText(lmtId,newText)
	{getObjectByAnyMeans(lmtId).innerHTML = newText;}
//
function browserUpgradeWarning() {
	dw("<div id=\"upgrade\"> "
		+ "Sorry, but your browser is either very old or not configured correctly, "
		+ "we shall assume the former! "
		+ "Some of the styling features within this site will not render "
		+ "correctly on your <strong>obsolete</strong> browser. You will still be "
		+ "able to use the site but it won't look as good. "
		+ "In the meantime you are strongly advised to upgrade your browser to "
		+ "<cite>at least</cite> <strong>Internet Explorer 5</strong>, <strong>Netscape6</strong>, "
		+ "or one of the other standards compliant browsers such as FireFox, "
		+ "Mozilla or Opera, these are fully compliant and will work correctly. "
		+ "<br />Try these links for more information: "
		+ "<a href=\"http://webstandards.org/act/campaign/buc/\" target=\"_blank\" "
		+ "title=\"The Browser Upgrade Campaign...\">&raquo;Browser Upgrade Campaign</a> "
		+ "&#8212;<a href=\"http://www.w3.org/QA/\" target=\"_blank\" "
		+ "title=\"Find out more about web standards QA from the W3C...\""
		+ ">&raquo;W3C QA</a></div>");
	}
//
function aSMT(tN,tD,dA,sU) {
	var aS = "{at)";var mT = "ma"+"ilt"+"o:";if(!tD) {tD = domName;}
	var tA = tN+"@"+tD;if(!dA) {dA = tN+aS+tD;}
	if(sU) {sU = "?s"+"ub"+"ject="+sU;} else {sU = "";}
	dw("<a href=\""+mT+tA+sU+"\" title=\"Ema"
		+ "il to "+dA+"\">"+dA+"</a>");
	}
//
//	COOKIE STUFF, read and write 'em
//
function writeCookie(ckName,ckVal,ckDays) {
	if(!ckName) {return;}
	if(!ckVal) {ckVal = "";}
	if(!ckDays) {ckDays = 1;}
	var expDate = new Date();
	var numDate = expDate.getTime();
	numDate += eval(3600000 * 24 * ckDays);
	expDate.setTime(numDate);
	var ckStr = ckName+"="+ckVal+"; path=/; expires="+expDate.toGMTString()+";";
	document.cookie = ckStr;
	}
//
function readCookie(ckName) {
	if(document.cookie.length > 0) 
		{ckStart = document.cookie.indexOf(ckName+"="); 
		if(ckStart != -1)
			{ckStart += ckName.length+1; 
			ckEnd = document.cookie.indexOf(";", ckStart);
			if(ckEnd == -1) {ckEnd = document.cookie.length;}
			return unescape(document.cookie.substring(ckStart,ckEnd));
			}
		}
	return "";
	}
//
function initMvBar() {} //Prevent demo pages from baulking ONLOAD
//
//	EOF
//
