//-- Various shared scripts for cognitivevent.com - P R Carter, 2007 --//

var place,thestring;
var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;

function setVariables() {
	if (navigator.appName == "Netscape") { 
		v = ".top="; 
		dS = "document."; 
		sD = ""; 
		y = "window.pageYOffset+0"; 
	} else { 
		v = ".pixelTop="; 
		dS = ""; 
		sD = ".style"; 
		y = "document.body.scrollTop+0"; }
	}

function checkLocation() { 
	object = "leftnav"; 
	yy = eval(y); 
	eval(dS+object+sD+v+yy); 
	setTimeout("checkLocation()",700); 
	}

function test() {
	alert('huh');
	//alert(thestring);
	//alert(thestring + string);
}

function browserSniff() { 	//thanks to quirksmode!

	if (checkIt('konqueror')){
		browser = "Konqueror";
		OS = "Linux";
	}
	else if (checkIt('safari')) browser = "safari"
	else if (checkIt('omniweb')) browser = "omniWeb"
	else if (checkIt('opera')) browser = "opera"
	else if (checkIt('webtv')) browser = "webTV";
	else if (checkIt('icab')) browser = "icab"
	else if (checkIt('msie')) browser = "msie"
	else if (!checkIt('compatible')){
		browser = "nsnav"
		version = detect.charAt(8);
	} else browser = "An unknown browser";

	if (!version) version = detect.charAt(place + thestring.length);

	if (!OS){
		if (checkIt('linux')) OS = "Linux";
		else if (checkIt('x11')) OS = "Unix";
		else if (checkIt('mac')) OS = "Mac"
		else if (checkIt('win')) OS = "Windows"
		else OS = "an unknown operating system";
	}
	//alert("browser is: " + browser);
	if (browser == "opera"){
		document.body.style.fontSize = "100%";
		//document.getElementById("content").style.fontSize = "92%";
	} else if (browser == "nsnav"){
		document.getElementById("navlinks").styleClass = "navspanns";
	} else if (browser == "msie"){
		document.getElementById("navlinks").style.fontSize = "110%";
	}
	//alert("navlinks style is: " + document.getElementById("navlinks").styleClass);
}

function checkIt(string) {
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

function makeEmailLink(username, domain, subject_text, link_text) { 
	document.write("<a href=" + "mail" + "to:" + username + "@" + domain + "?Subject=" + subject_text + ">" + link_text + "<\/a>"); 
	} 

function makeEmailLinkExample(username, domain, subject_text, link_text) { 
	document.write("<a href=" + "mail" + "to:" + username + "@" + domain + "?Subject=" + subject_text + ">" + username + "@" + domain + "<\/a>"); 
	} 

function displayEmailLink(username,domain){ 
	document.write("<a href=" + "mail" + "to:" + username + "@" + domain + ">" + username + "@" + domain + "<\/a>"); 
	} 
