//<!--
//Browser Detection
var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;

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 = "Internet Explorer"
else if (!checkIt('compatible'))
{
	browser = "Netscape Navigator"
	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";
}

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

//session cookies
function createCookie(name, value, days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0; i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

// Stylesheet Switcher for text sizes / text only
function getTextSize() {
	size = readCookie('textSize');
	if (size == 1){
		tsize = '74.5%';
	}else if (size == 2){
		tsize = '84.5%';
	}else if (size == 3){
		tsize = '104.5%';
	}else{
		tsize = '84.5%';
	}
	return null;
}
function getTextOnly() {
	tOnly = readCookie('textOnly');
	if (tOnly == '1'){
		tOnly = 1;
	}else{
		tOnly = 0;
	}
	return null;
}

//disable/enable embedded styles for text only
function disableEmbeddedStyles (){
	styleSheetList = document.getElementsByTagName("style");
	
     // Loop through all the stylesheets
     for(var j = 0; j < styleSheetList.length; j++)
     {
     	styleSheetList[j].disabled = true;
     }
}
function enableEmbeddedStyles (){
	styleSheetList = document.getElementsByTagName("style");
	        // Loop through all the stylesheets
	        for(var j = 0; j < styleSheetList.length; j++)
	        {
	            styleSheetList[j].disabled = false;
	        }
}
function toggleTextOnly(){
	getTextOnly();
	if(tOnly == '1') {
		createCookie('textOnly', '0')
	}else{
		createCookie('textOnly', '1')
	}
}

function setHome(location){
	// IE
	if (document.all){
	document.getElementById('setHome').style.behavior='url(#default#homepage)';
	document.getElementById('setHome').setHomePage(location);
	}

	// GECKO 6+
	else if (document.getElementById){
	  alert('Your browser does not support this feature. Drag the contents of the address bar to your home button to make this your home page.');
	}

	// UNKNOWN
	else {
	  alert('Your browser does not support this feature. Go to Preferences and choose \'Use Current Page\' under \'Home Page.\'');
	}

}
//-->
