var bolLtIE6 = false;
if($.browser.msie && (jQuery.browser.version < 6)) {bolLtIE6 = true}
var bolEqIE6 = false;
if($.browser.msie && (jQuery.browser.version == 6)) {bolEqIE6 = true}
/*From http://www.sitepoint.com/article/standards-compliant-world*/
function externalLinks() 
{
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) 
 {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") anchor.target = "_blank";
 }
}

function controlSidenav (objController)
{
	if(!bolLtIE6)
	{
		var strULID = "#" + objController.name;
		var strAID = "#" + objController.id;
		var bolVisibility = $(strULID).is(':visible');
		switch(bolVisibility)
		{
			case false:
				if (bolEqIE6) {$(strULID).css("display", "block");}
				else {$(strULID).slideDown("slow");}
				$(strAID).css("background-position","0 -7px");
			break
			case true:
				$(strULID).slideUp("slow");
				$(strAID).css("background-position","0 0");
			break
			default:
			return false;				
		}
	}
	else {return false;}
}

var intCurrentTextSize = 0.7;
function textSizer (textAction)
{
	if (document.body) 
	{
		switch (textAction)
		{
			case "+":
				if (intCurrentTextSize < 0.89) {intCurrentTextSize = intCurrentTextSize + 0.1;}
				break
			case "-":
				if (intCurrentTextSize > 0.5) {intCurrentTextSize = intCurrentTextSize - 0.1;}
				break
			default:
				alert("textSizer only accepts + or - as a parameter");
		}
		document.body.style.fontSize = intCurrentTextSize + "em";
	}
}

$(document).ready
(
	function()
	{
  	externalLinks();
	 	if(!bolLtIE6) 
	 	{
			$("#sidenav ul li ul").hide();
			$("#sidenav ul li ul li ul li ul li ul").show();
			$("a.action").css({background: "url(/assets/i/ico-sidenav.gif) 0 0"});
		}
		//Readjusts to fit in 800*600 width browser window
		if($(document).width() < 800) 
		{
			$("#home #page-header").css({background: "none", padding: "0", minHeight: "60px", height: "60px"});
			$("#home a#home-link").css({height: "36px", height: "36px", background: "url(/assets/i/bg-logo.gif) no-repeat 0 0", margin:"5px 0 0 0"});
			$("#home #global-search").css({marginTop: "5px"});
			$("#home ul#global-nav").css({marginBottom: "5px"});
			$("#container-1").css({background: "#fff", padding: "0"});
			//$("#footer").css({background: "url(/assets/i/bg-footer-800.gif) no-repeat 0 0", padding: "0", minHeight: "80px", height: "80px"});
			//$("#home #footer").css({background: "url(/assets/i/bg-footer-800.gif) no-repeat 0 0", padding: "0", minHeight: "43px", height: "43px"});
		}
 	}
);

