//Copyright Steve Holt 2005  - contact via http://www.clockbeat.com

/*
If you wish to use this code in your own web site you must:
	Contact Steve (see above) and let him know where you are using it and how
	Provide a link on your site back to http://www.clockbeat.com
	Leave all these comments in place
	Not modify the code (contact Steve if you want to do that)
*/

var extraScript = null;

function applyScripts() {
	var menusel = new CSSSelect(".link a");
	var menus = menusel.getSelectedElements();
	for (var m in menus) {
		var atag = menus[m];
		var td = findParentByClass(atag, "link");
		var defcol = td.style.backgroundColor;
		var modcol = modifyColor(defcol, "sat", -5);
		if (modcol == null)
			modcol = "#E0E0F8";
		td.onmouseover = stringToEvent("this.style.backgroundColor='" + modcol + "';");
		td.onmouseout = stringToEvent("this.style.backgroundColor='" + defcol + "';");
		if (atag.target)
			td.onclick = stringToEvent("window.open('" + atag.href + "', '" + atag.target + "').focus(); return false;");
		else
			td.onclick = stringToEvent("location='" + atag.href + "';");
		td.style.cursor = "pointer";
	}
	if (extraScript)
		extraScript();
	var refpos = document.cookie.indexOf("cbref=");
	if (refpos == -1) {
		var ny = new Date();
		var nw = Math.floor(ny.getTime()/1000);
		ny.setFullYear(ny.getFullYear() + 1);
		document.cookie = "cbref=" + escape(document.referrer) + "; expires=" + ny.toGMTString() + "; path=/";
		document.cookie = "cbrefdt=" + escape(nw) + "; expires=" + ny.toGMTString() + "; path=/";
		document.cookie = "cbent=" + escape(location.pathname) + "; expires=" + ny.toGMTString() + "; path=/";
	}
}
