var SITE_ROOT_PATH	= "";
var IMAGE_PATH		= SITE_ROOT_PATH + "images/";
var SPACER_IMAGE	= IMAGE_PATH + "spacer.gif";
var n, ie, n6, ob;
if (document.all) {
  ie = true;
}
else if (document.layers) {
  n = true;
}
else if (document.getElementById) {
  n6 = true;
}
else {
  ob = true;
}

/* Set Navigation images into a preloaded Array */
	var toplinkImg = new Array()
	
	toplinkImg["toplink_investors_on"] = new Image(); toplinkImg["toplink_investors_on"].src = "images/toplink_investors_on.gif";
	toplinkImg["toplink_investors_off"] = new Image(); toplinkImg["toplink_investors_off"].src = "images/toplink_investors_off.gif";
	toplinkImg["toplink_jobs_on"] = new Image(); toplinkImg["toplink_jobs_on"].src = "images/toplink_jobs_on.gif";
	toplinkImg["toplink_jobs_off"] = new Image(); toplinkImg["toplink_jobs_off"].src = "images/toplink_jobs_off.gif";
	toplinkImg["toplink_clientex_on"] = new Image(); toplinkImg["toplink_clientex_on"].src = "images/toplink_clientex_on.gif";
	toplinkImg["toplink_clientex_off"] = new Image(); toplinkImg["toplink_clientex_off"].src = "images/toplink_clientex_off.gif";
	toplinkImg["toplink_contact_on"] = new Image(); toplinkImg["toplink_contact_on"].src = "images/toplink_contact_on.gif";
	toplinkImg["toplink_contact_off"] = new Image(); toplinkImg["toplink_contact_off"].src = "images/toplink_contact_off.gif";
	
	toplinkImg["toplink_company_on"] = new Image(); toplinkImg["toplink_company_on"].src = "images/toplink_company_on.gif";
	toplinkImg["toplink_company_off"] = new Image(); toplinkImg["toplink_company_off"].src = "images/toplink_company_off.gif";	 
	toplinkImg["toplink_services_on"] = new Image(); toplinkImg["toplink_services_on"].src = "images/toplink_services_on.gif";
	toplinkImg["toplink_services_off"] = new Image(); toplinkImg["toplink_services_off"].src = "images/toplink_services_off.gif";
	toplinkImg["toplink_casestudies_on"] = new Image(); toplinkImg["toplink_casestudies_on"].src = "images/toplink_casestudies_on.gif";
	toplinkImg["toplink_casestudies_off"] = new Image(); toplinkImg["toplink_casestudies_off"].src = "images/toplink_casestudies_off.gif";




function swapImage(name,state) 
{
	// based on supported technology
    if (document.getElementById)
    {
		document.getElementById(name).src = toplinkImg[name+"_"+state].src
	}
    else if (document.layers)
    {
		document.images[name].src = toplinkImg[name+"_"+state].src
	}
    else if (document.all)
    {
		document.images[name].src = toplinkImg[name+"_"+state].src
    }
	else
	{
		// Set non-supported browser to no rollover
	}
}	


function statusText(text)
{
	window.status=text;
	if (n6)
	{
		stat = window.status;
		stat=text;
	}
	return true;
}
function openWindow(handle, URL, top, left, width, height) 
{
	window.open(URL,handle,'toolbar=no,menubar=no,location=no,resizable=yes,width='+width+',height='+height+',top='+top+',left='+left)
}
	 		
function testLength(object,maxlength)
{
	if (object.value.length > maxlength)
	{
		return false
	}
	else
	{
		return true
	}
}
function writeDate(objMonth, objDay, objYear, objDateField)
{
	var strMonth = objMonth.options[objMonth.selectedIndex].value;
	var strDay   = objDay.options[objDay.selectedIndex].value;
	var strYear  = objYear.options[objYear.selectedIndex].value;
 	var daysInMonth = getDaysInMonth(strMonth,strYear)
	if (daysInMonth < strDay)
	{
		alert("There are only "+daysInMonth+" days in the month you've selected.\n\nThe last day for the month and year you have selected will be chosen.");
		objDay.options[daysInMonth-1].selected = true;
		var strDate  = strMonth + "/" + daysInMonth + "/" + strYear;
		objDateField.value = strDate;
	}
	else
	{
		var strDate  = strMonth + "/" + strDay + "/" + strYear;
		objDateField.value = strDate;
	}
}
function readDate(objMonth, objDay, objYear, objDateField)
{
	var strDate = objDateField.value
	strMonth = strDate.substring(0,strDate.indexOf("/"));
	var offset = strDate.length-4;
	var strYear  = strDate.substring(offset,strDate.length);
	var strDay   = strDate.substring((strDate.indexOf("/") + 1),strDate.indexOf("/"+strYear));
	objMonth.options[strMonth-1].selected = true;
	objDay.options[strDay-1].selected = true;
	for (var i = 0; i < objYear.length; i++)
	{
		if (objYear.options[i].value == strYear)
		{
			objYear.options[i].selected = true;
		}
	}
}
function getDaysInMonth(month,year)
{
	var days;
	if (month==1 || month==3 || month==5 || month==7 || month==8 || month==10 || month==12)
	{
		days=31;
	}
	else if (month==4 || month==6 || month==9 || month==11)
	{
		days=30;
	}
	else if (month==2)
	{
		if (isLeapYear(year))
		{
			days=29;
		}
			else
		{
			days=28;
		}
	}
	return (days);
}
function isLeapYear (Year)
{
	if (((Year % 4)==0) && ((Year % 100)!=0) || ((Year % 400)==0))
	{
		return (true);
	}
	else
	{
		return (false);
	}
}


/* CHECK WIDTH FUNCTIONS */
var frameWidth
var frameHeight
		function CheckWidthHome() {
			if (self.innerWidth){
				frameWidth = self.innerWidth;
				frameHeight = self.innerHeight;
			}
			else if (document.documentElement && document.documentElement.clientWidth)	{
				frameWidth = document.documentElement.clientWidth;
				frameHeight = document.documentElement.clientHeight;
			}
			else if (document.body)	{
				frameWidth = document.body.clientWidth;
				frameHeight = document.body.clientHeight;
			}
			if (frameWidth < 1000) {
				//alert(frameWidth)
				document.getElementById("HeadTable").style.width="760px"
				document.getElementById("BodyTable").style.width="760px"
				document.getElementById("FooterTable").style.width="760px"
				document.getElementById("MiddlePanelContent").style.display="none"
				
			} else {
				document.getElementById("HeadTable").style.width="100%"
				document.getElementById("BodyTable").style.width="100%"
				document.getElementById("FooterTable").style.width="100%"
				document.getElementById("MiddlePanelContent").style.display="inline"
				
				if (frameWidth < 1110) {
					if (document.getElementById("MiddlePanelCell").background!="images/middlepanel2.jpg") {
						document.getElementById("MiddlePanelCell").background="images/middlepanel2.jpg"
						document.getElementById("MiddlePanelText1").style.display="none"
						document.getElementById("MiddlePanelText2").style.display="none"
						document.getElementById("MiddlePanelText3").style.display="none"
					}
				
				} else {
					if (document.getElementById("MiddlePanelCell").background!="images/middlepanel.jpg") {
						document.getElementById("MiddlePanelCell").background="images/middlepanel.jpg"
						document.getElementById("MiddlePanelText1").style.display="inline"
						document.getElementById("MiddlePanelText2").style.display="inline"
						document.getElementById("MiddlePanelText3").style.display="inline"
					}
				}

			}
			//window.status = "Your Screen Resolution = " + self.screen.width + " : " + self.screen.height + "    Your Browser Document = " + frameWidth + " : " + frameHeight
		}
		
		
		function CheckWidthSecondary() {
			if (self.innerWidth){
				frameWidth = self.innerWidth;
				frameHeight = self.innerHeight;
			}
			else if (document.documentElement && document.documentElement.clientWidth)	{
				frameWidth = document.documentElement.clientWidth;
				frameHeight = document.documentElement.clientHeight;
			}
			else if (document.body)	{
				frameWidth = document.body.clientWidth;
				frameHeight = document.body.clientHeight;
			}
			if (frameWidth < 1000) {
				//alert(frameWidth)
				document.getElementById("HeadTable").style.width="760px"
				document.getElementById("SectionHead").style.width="760px"
				document.getElementById("BreadCrumbs").style.width = "760px"
				document.getElementById("BreadCrumbsCell").style.width = "735px"
				document.getElementById("BodyTable").style.width = "760px"
				document.getElementById("FooterTable").style.width="759px"
				document.getElementById("MiddlePanelSpacer").style.width = "460px"
				document.getElementById("SectionHeadImage").style.display = "none"
				document.getElementById("SectionHeadImage_sm").style.display = "inline"

				
			} else {
				document.getElementById("HeadTable").style.width="100%"
				document.getElementById("SectionHead").style.width="100%"
				document.getElementById("BreadCrumbs").style.width = "100%"
				document.getElementById("BreadCrumbsCell").style.width = "924px"
				document.getElementById("BodyTable").style.width = "100%"
				document.getElementById("MiddlePanelSpacer").style.width = "648px"
				document.getElementById("FooterTable").style.width="100%"
				document.getElementById("SectionHeadImage").style.display = "inline"
				document.getElementById("SectionHeadImage_sm").style.display = "none"

			}
			//	window.status = "Your Screen Resolution = " + self.screen.width + " : " + self.screen.height + "    Your Browser Document = " + frameWidth + " : " + frameHeight
		}

	function AdjustModules() {
		try
		{
			if (frameWidth < 1000) {
					//Body Text Modules
					document.getElementById("ModOne").align = ""
					document.getElementById("ModThree").align = ""
					document.getElementById("ModFive").align = ""
			} else {
					//Body Text Modules	
					document.getElementById("ModOne").align = "left"
					document.getElementById("ModThree").align = "left"
					document.getElementById("ModFive").align = "left"
			}
		}
		catch (ex)
		{
		
		}
	}