
function allowcookies() {
	var cookies = GetCookie("cookies");
	if (cookies.length = 0) {
		cookies = false;
	}
	return cookies;
}

function resetcookies() {
	EraseCookie("cookies");
	EraseCookie("accessibility");
	EraseCookie("navigation");
	alert("Your cookies have been expired");
	document.location.href = document.location.href;
}

function accessibility(n) {
	// Grab the area we want to resize
	e = document.getElementById("body");
	if (e == null) return;

	// set/get cookie
	if (n == null) {
		n = GetCookie("accessibility");
	} else {
		var cookie = false;
		if (allowcookies() == "true") {
			cookie = true;
		} else {
			if (confirm("Would you like your browser to remember this setting?" + 
					"\n\nClick OK to store your options. This will create a cookie on your computer to store your settings. No other information is stored and no information about you or your computer is used by us or passed to a third party." + 
					"\nThis requires cookies to be enabled in your browser settings." + 
					"\n\nClick CANCEL if you do not want the cookie or your settings stored.")) {
				cookie = true;
			}
		}
		
		if (cookie == true) {
			SetCookie("cookies", "true");
			SetCookie("accessibility", n);
		}
	}

	// set default
	if (n == null) {
		n = 0;
	}

	// Set the display to show the cookie info
	if (n == 0) document.getElementById("accessibility1").className = "active"; else document.getElementById("accessibility1").className = "box";
	if (n == 1) document.getElementById("accessibility2").className = "active"; else document.getElementById("accessibility2").className = "box";
	if (n == 2) document.getElementById("accessibility3").className = "active"; else document.getElementById("accessibility3").className = "box";
	if (n == 3) document.getElementById("accessibility4").className = "active"; else document.getElementById("accessibility4").className = "box";

	// Figure out the font size based on the option chosen
	if (n == 4) {
		n = 140;
	} else {
		n = 80 + n * 10;
	}

	// Set anything that can obviously be resized
	e.style.fontSize = n + "%";

	// Find all elements with tsx in the id or the classname
	// saves having to code an incrementor for the id, and
	// keeps compatibilty with older sites that already use the incrementor method
	var inc=0;
	var alltags= e.getElementsByTagName("span")
	
	// change font size of tags that need resizing
	for (i=0; i<alltags.length; i++) {
		if (alltags[i].id.indexOf("tsx") != -1 || alltags[i].className.indexOf("tsx") != -1) {
			alltags[i].style.fontSize = n + "%";
		}
	}
}

function navigation(display) {
	if (display == null) {
		display = GetCookie("navigation");
	}
	
	if (display.length > 0) {
		var cookie = false;
		if (allowcookies() == "true") {
			cookie = true;
		} else {
			if (confirm("Would you like your browser to remember this setting?" + 
					"\n\nClick OK to store your options. This will create a cookie on your computer to store your settings. No other information is stored and no information about you or your computer is used by us or passed to a third party." + 
					"\nThis requires cookies to be enabled in your browser settings." + 
					"\n\nClick CANCEL if you do not want the cookie or your settings stored.")) {
				cookie = true;
			}
		}

		if (cookie == true) {
			SetCookie("cookies", "true");
			SetCookie("navigation", display);
		}

		if (display == "block") {
			document.getElementById('scroller1').style.display = "block";
			document.getElementById('scroller2').style.display = "none";
		} else {
			document.getElementById('scroller1').style.display = "none";
			document.getElementById('scroller2').style.display = "block";
		}
	}
}

function scrollerEmail() {
    var email = window.open('mailto:?subject=' + escape(document.title) + '&body=' + escape('Take a look at this page!\n\n' + document.location.href));
    if (navigator.appVersion.indexOf("MSIE") == -1) {
        email.close();
    }
}

function scrollerBookmark() {
    if ((navigator.appVersion.indexOf("MSIE") > 0) && (parseInt(navigator.appVersion) >= 4)) {
        window.external.AddFavorite(location.href, document.title); 
    } else {
        alert("Please press <CTRL>+<D> to bookmark this page");
    }
}
