/* Browser check */

IS_DOM = (document.getElementById) ? true : false;

IS_IE = (document.all) ? true : false;

IS_IE50 = (navigator.userAgent.indexOf("IE 5.0") != -1);

IS_Mac = (navigator.appVersion.indexOf("Mac") != -1);



// preload rollovers

var aNavigation = new Array();

aNavigation = ["", "partner", "learn", "products", "about"];

for (i = 0; i <= 4; i++) { 

	eval("menu"+i+"on = new Image();"); eval("menu"+i+"off = new Image();");

	if (sSelectedButton == aNavigation[i]) {

		eval("menu"+(i)+"on.src = \"" + sFolderLevel + "img/buttons/l1-" + aNavigation[i] + "-r.jpg\";");

		eval("menu"+(i)+"off.src = \"" + sFolderLevel + "img/buttons/l1-" + aNavigation[i] + "-r.jpg\";");

	} else {

		eval("menu"+(i)+"on.src = \"" + sFolderLevel + "img/buttons/l1-" + aNavigation[i] + "-r.jpg\";");

		eval("menu"+(i)+"off.src = \"" + sFolderLevel + "img/buttons/l1-" + aNavigation[i] + "-0.jpg\";");

	}

}



// preload rollovers

var aNavigation = new Array();

aNavigation = ["", "about", "products", "learn", "partner"];

for (i = 0; i <= 5; i++) { 

	eval("C"+i+"on = new Image();"); eval("C"+i+"off = new Image();");

	if (sSelectedButton == aNavigation[i]) {

		eval("C"+(i)+"on.src = \"" + sFolderLevel + "img/buttons/cnst-" + aNavigation[i] + "-r.gif\";");

		eval("C"+(i)+"off.src = \"" + sFolderLevel + "img/buttons/cnst-" + aNavigation[i] + "-r.gif\";");

	} else {

		eval("C"+(i)+"on.src = \"" + sFolderLevel + "img/buttons/cnst-" + aNavigation[i] + "-r.gif\";");

		eval("C"+(i)+"off.src = \"" + sFolderLevel + "img/buttons/cnst-" + aNavigation[i] + "-0.gif\";");

	}

}



// General Site Functions

function imgOn(imgName) {

  if (IS_DOM) {

    document.getElementById(imgName).src = eval(imgName + "on.src");

  }

}

 

function imgOff(imgName) {

  if (IS_DOM) {

    document.getElementById(imgName).src = eval(imgName + "off.src");

  }

}



// image swapper

function changeImages() 

{

  if (document.getElementById) {

    for (var i = 0; i < changeImages.arguments.length; i += 2) { 

  		document.getElementById(changeImages.arguments[i]).src = eval(changeImages.arguments[i + 1] + ".src"); 

	}

  }

}



// FUNCTIONS TO CONTROL FAUX FORM ELEMENTS



// show or hide dropdown element based on current display state

function controlDropdown(oDropdown)

{

	if (IS_DOM) {

		if (oDropdown.style.overflow == "visible") {

			oDropdown.style.overflow = "hidden";

		} else {

			oDropdown.style.overflow = "visible";

		}

	}

}



// assign new value to form's element

function updateForm(sFormName, sInputName, sNewValue, oListElement)

{

	oList = oListElement.parentNode;

	oDiv = oList.parentNode;

	// show dropdown list

	controlDropdown(oDiv);

	

	// get form in question, find input requested and update its value

	oForm = document.forms[sFormName];

	oElement = oForm.elements[sInputName];

	oElement.value = sNewValue;

	

	// move selected element to top of list

	oList.insertBefore(oListElement, oList.firstChild); 

	// apply class to position new top item correctly

	oListElement.className = "firstItem";

	

	

	// display second drop down menu

	if (sInputName == "choice1") {

		var aMenus = document.getElementById("dropEnvelope").getElementsByTagName("div");

		for (var i = 0; i < aMenus.length; i++) {

			aMenus[i].style.visibility = "hidden";

		}

		if (sNewValue != '') {

			document.getElementById(sNewValue).style.visibility = "visible";

		}

	}

	

	//define target url

	if (oForm.choice1.value == "A") {

		oForm.action = "industry-solutions/solutions-landing-page1.htm";

	} else if (oForm.choice1.value == "B") {

		oForm.action = "industry-solutions/solutions-landing-page2.htm";

	} else if (oForm.choice1.value == "C") {

		oForm.action = "industry-solutions/solutions-landing-page3.htm";

	} else if (oForm.choice1.value == "D") {

		oForm.action = "industry-solutions/solutions-landing-page4.htm";

	} else if (oForm.choice1.value == "E") {

		oForm.action = "industry-solutions/solutions-landing-page5.htm";

	} else {

		oForm.action = "";

	}

	

	if (sInputName == "lookingFor") {		

		oForm.action += "#" + sNewValue;

	}

}



function submitResource(formObject,businessInterest,urlSuffix)

{

//	http://localhost:9080/web/products-services/index.htm



//	var urlPrefix = document.URL.substring(0,(document.URL.indexOf("us/en")));



	var urlPrefix = document.URL;

	var endIndex;

	

	for(i = 0;i < 3;i++){

		endIndex = urlPrefix.indexOf('/',endIndex + 1);

	}



	//urlPrefix = urlPrefix.substring(0,endIndex+1);

	urlPrefix = urlPrefix.substring(0,endIndex+1) + "web/";

	

	formObject.businessInterest.value=businessInterest;

	formObject.action =urlPrefix+urlSuffix;

	formObject.submit();

}

//Form validation
