// JavaScript Document
//STYLESHEETS
document.write("<style type='text/css'>");
document.write("#interface form, #interface form input, #content form select {font-size:small; unicode-bidi:embed}");
document.write("#interface input.text, #interface select.text, #interface textarea.text {width:300px}");
document.write("#interface select.text {width:225px}");
document.write("#unitedstates, #interface .ratoggle, #interface .ratoggle2 {display:block}");
document.write("#americas, #europe, #meafrica, #asiaoceania, #showunitedstates {display:none; color:#333}");
document.write("#interface form .region, #interface form input.region, #content form select .region {background-color:#BB2322; color:white; font-weight:bold}");
document.write("#showasia, #showamericas, #showmeafrica, #showeurope {color:#333}");
document.write("</style>");


//VARIABLES
var myCountryPick = Get_Cookie('ra_www_country');
var myLanguagePick = Get_Cookie('ra_www_lang');


//ANALYZE RADIO SELECTS
function analyseRadio(rad) {
var myPage;
	if (rad.value == "Americas") {
		document.getElementById("americas").style.display = "block";
		document.getElementById("europe").style.display = "none"; 
		document.getElementById("meafrica").style.display = "none"; 
		document.getElementById("asiaoceania").style.display = "none"; 
	}
	if (rad.value == "Europe") {
		document.getElementById("americas").style.display = "none";
		document.getElementById("europe").style.display = "block"; 
		document.getElementById("meafrica").style.display = "none"; 
		document.getElementById("asiaoceania").style.display = "none"; 
	}
	if (rad.value == "MEAfrica") {
		document.getElementById("americas").style.display = "none";
		document.getElementById("europe").style.display = "none"; 
		document.getElementById("meafrica").style.display = "block"; 
		document.getElementById("asiaoceania").style.display = "none"; 
	}
	if (rad.value == "AsiaOceania") {
		document.getElementById("americas").style.display = "none";
		document.getElementById("europe").style.display = "none"; 
		document.getElementById("meafrica").style.display = "none";  
		document.getElementById("asiaoceania").style.display = "block";
	}
}


//RADIO SELECTIONS
function displayAmericas() {
	document.getElementById("americas").style.display = 'block';
	document.getElementById("europe").style.display = 'none';
	document.getElementById("meafrica").style.display = 'none';
	document.getElementById("asiaoceania").style.display = 'none';
	document.regions.chooseregion[0].checked=true;
	Set_Cookie('ra_region','Americas','365','/','.rockwellautomation.com');
}
function displayEurope() {
	document.getElementById("americas").style.display = 'none';
	document.getElementById("europe").style.display = 'block';
	document.getElementById("meafrica").style.display = 'none';
	document.getElementById("asiaoceania").style.display = 'none';
	document.regions.chooseregion[1].checked=true;
	Set_Cookie('ra_region','Europe','365','/','.rockwellautomation.com');
}
function displayMEAfrica() {
	document.getElementById("americas").style.display = 'none';
	document.getElementById("europe").style.display = 'none';
	document.getElementById("meafrica").style.display = 'block';
	document.getElementById("asiaoceania").style.display = 'none';
	document.regions.chooseregion[2].checked=true;
	Set_Cookie('ra_region','MEAfrica','365','/','.rockwellautomation.com');
}
function displayAsia() {
	document.getElementById("americas").style.display = 'none';
	document.getElementById("europe").style.display = 'none';
	document.getElementById("meafrica").style.display = 'none';
	document.getElementById("asiaoceania").style.display = 'block';
	document.regions.chooseregion[3].checked=true;
	Set_Cookie('ra_region','AsiaOceania','365','/','.rockwellautomation.com');
}

	  
//CLEAR THE FORMS
function clearForms() {
	if ((myCountryPick  == "Canada") || (myCountryPick  == "United States") || (myCountryPick  =="Greenland") || (myCountryPick  =="Dominican Republic") ||  
		(myCountryPick  =="Bahamas") || (myCountryPick  =="Belize") || (myCountryPick  =="Bermuda") || (myCountryPick  =="Caribbean") || 	
		(myCountryPick  =="Jamaica") || (myCountryPick  =="Turks & Caicos Islands") || (myCountryPick  =="U.S. Virgin Islands") || 
		(myCountryPick  =="Argentina") || (myCountryPick  =="Bolivia") ||  (myCountryPick  == "Brazil") || (myCountryPick  =="Chile") || (myCountryPick  =="Colombia") || 
		(myCountryPick  =="Costa Rica")|| (myCountryPick  =="Ecuador") || (myCountryPick  =="El Salvador") || (myCountryPick  =="Guatemala") || 
		(myCountryPick  =="Honduras") || (myCountryPick  =="Mexico") || (myCountryPick  =="Nicaragua") || (myCountryPick  =="Panama") || 
		(myCountryPick  =="Paraguay") || (myCountryPick  =="Peru") || (myCountryPick  =="Puerto Rico") || (myCountryPick  =="Uruguay") || 
		(myCountryPick  =="Venezuela") ) {
		document.regions.chooseregion[0].checked=true;
		displayAmericas();
	}			 
 	else if   ((myCountryPick  == "Albania") || (myCountryPick  =="Algeria") || (myCountryPick  =="Austria") || (myCountryPick  =="Belgium") || (myCountryPick  =="Bulgaria") || 
				(myCountryPick  =="Central Eastern Europe") || (myCountryPick  =="Croatia") || (myCountryPick  =="Cyprus") || (myCountryPick  =="Czech") || 
				(myCountryPick  =="Denmark") || (myCountryPick  =="Estonia") || (myCountryPick  =="Finland") || (myCountryPick  =="France") || (myCountryPick  =="Germany") || 
				(myCountryPick  =="Greece") || (myCountryPick  =="Hungary") || (myCountryPick  =="Iceland") || (myCountryPick  =="Ireland") || (myCountryPick  =="Italy") || 
				(myCountryPick  =="Latvia") || (myCountryPick  =="Lithuania") || (myCountryPick  =="Luxemburg") || (myCountryPick  =="Malta") || 
				(myCountryPick  =="Montserrat") || (myCountryPick  =="Netherlands") || (myCountryPick  =="Norway") || 
				(myCountryPick  =="Poland") || (myCountryPick  =="Portugal") || (myCountryPick  =="Romania") || (myCountryPick  =="Russia") || (myCountryPick  =="Serbia") || 
				(myCountryPick  =="Slovakia") || (myCountryPick  =="Slovenia") || (myCountryPick  =="South Africa") || (myCountryPick  =="Spain") || 
				(myCountryPick  =="Sweden") || (myCountryPick  =="Switzerland") || (myCountryPick  =="Turkey") || (myCountryPick  =="United Kingdom") || 
				(myCountryPick  =="Virgin Islands")) {
		document.regions.chooseregion[1].checked=true;
		displayEurope();
	}	
	else if   ((myCountryPick  =="Angola") ||  (myCountryPick  =="Bahrain") ||  (myCountryPick  =="Botswana") ||  (myCountryPick  =="Egypt") ||  
		(myCountryPick  =="Israel") ||  (myCountryPick  =="Jordan") ||  (myCountryPick  =="Kenya")  ||  (myCountryPick  =="Kuwait") ||  
		(myCountryPick  =="Lebanon") || (myCountryPick  =="Libya") ||  (myCountryPick  =="Mauritius") ||  (myCountryPick  =="Morocco") || 
		(myCountryPick  =="Mozambique") || (myCountryPick  =="Namibia") ||  (myCountryPick  =="Nigeria") || (myCountryPick  =="Oman") ||  
		(myCountryPick  =="Pakistan") || (myCountryPick  =="Qatar") ||  (myCountryPick  =="Saudi Arabia") || (myCountryPick  =="South Africa") || 
		(myCountryPick  =="Tanzania") ||  (myCountryPick  =="Tunisia") ||  (myCountryPick  =="United Arab Emirates") ||  
		(myCountryPick  =="Yemen") || (myCountryPick  =="Zambia") ||  (myCountryPick  =="Zimbabwe") ) {
		document.regions.chooseregion[2].checked=true;
		displayMEAfrica();
	}	
	else if   ((myCountryPick  =="Australia") ||  (myCountryPick  =="China") ||  (myCountryPick  =="Fiji") || (myCountryPick  =="Hong Kong") ||  
		(myCountryPick  =="India") || (myCountryPick  =="Indonesia") ||  (myCountryPick  =="Japan") ||  (myCountryPick  =="Korea") || 
		(myCountryPick  =="Malaysia") || (myCountryPick  =="New Zealand") ||  (myCountryPick  =="Philippines") ||  (myCountryPick  =="Singapore") || 
		(myCountryPick  =="Taiwan") ||  (myCountryPick  =="Thailand") || (myCountryPick  =="Southeast Asia") || (myCountryPick  =="Vietnam")) {
		document.regions.chooseregion[3].checked=true;
		displayAsia();
	}	
	else {
		var i; for (i = 0; (i < document.forms.length); i++) {
		document.forms[i].reset();
		}
		document.regions.chooseregion[0].checked=true;
		displayAmericas();
	}
}


//TEST & PROD URLS
var myURL;
if (location.href.match('test')) {
	myURL = "http://test.rockwellautomation.com";
} else {
	myURL = "http://www.rockwellautomation.com";
}


//GO TO CORRECT FOLDER
function goAmericas() {
var goto;
	if (document.regionamericas.myAmerUrl.value == "Brazil") {
		Language = "Portuguese"
		goto = "/support/americas/brazil/"
		location.href = myURL + goto;
	} else 
	//SPANISH SPEAKING COUNTRIES IN THE AMERICAS
	if ( (document.regionamericas.myAmerUrl.value == "Argentina") || (document.regionamericas.myAmerUrl.value == "Bolivia") || 
		(document.regionamericas.myAmerUrl.value == "Chile") || (document.regionamericas.myAmerUrl.value == "Colombia") || 
		(document.regionamericas.myAmerUrl.value == "Costa Rica") || (document.regionamericas.myAmerUrl.value == "Ecuador") || 
		(document.regionamericas.myAmerUrl.value == "El Salvador") || (document.regionamericas.myAmerUrl.value == "Guatemala") || 
		(document.regionamericas.myAmerUrl.value == "Honduras") || (document.regionamericas.myAmerUrl.value == "Mexico") || 
		(document.regionamericas.myAmerUrl.value == "Nicaragua") || (document.regionamericas.myAmerUrl.value == "Panama") || 
		(document.regionamericas.myAmerUrl.value == "Paraguay") || (document.regionamericas.myAmerUrl.value == "Peru") || 
		(document.regionamericas.myAmerUrl.value == "Puerto Rico") || (document.regionamericas.myAmerUrl.value == "Uruguay") || 
		(document.regionamericas.myAmerUrl.value == "Venezuela") ) {
		Language = "Spanish"
		goto = "/support/americas/index_es.html"
		location.href = myURL + goto;
	} else {
		goto = "/support/americas/index_en.html"
		location.href = myURL + goto;
	}	
}
function goEurope() { 
	var goto = "/support/europe/"
	location.href = myURL + goto;
}
function goMeAfrica() { 
	var goto = "/support/meafrica/"
	location.href = myURL + goto;
}
function goAsiaOceania() { 
	var goto = "/support/asiaoceania/"
	location.href = myURL + goto;
}

var myContactPage = window.parent.location.href;