// JavaScript Document
//Checks the name of the html file and highlights the link that corresponds with the name of the html file.
var fileName = location.pathname.replace(/^.*[\\\/]/,"");
var appended = fileName.replace(/\.[^u]+/,"");
var productElement = document.getElementById(appended);
if (productElement != null)
{
	document.getElementById(appended).style.color = "#FFCC33";
}
if (document.getElementById('dyn_links') != null && productElement != null) {
    var a = document.getElementById(appended).offsetParent.offsetTop + document.getElementById(appended).offsetTop;
    var b = document.getElementById('dyn_links').offsetTop;
    var c = a-b;
    document.getElementById('dyn_links').scrollTop = c ; //might be able to use a parent tag here too
}


var currentLanguage = document.getElementById('current_country');
var currentRegion = document.getElementById('current_region');


if(currentLanguage.innerHTML != ""){
      var selectedDiv = document.getElementById(currentLanguage.innerHTML);
      if (selectedDiv != null) {
          var theImage = selectedDiv.getElementsByTagName('a');
        if (theImage != null) {
              theImage[0].style.color = "#FFCC33";
          }
         }
}


if(currentRegion.innerHTML != ""){
      var selectedDiv = document.getElementById(currentRegion.innerHTML);
      if (selectedDiv != null) {
          var theImage = selectedDiv.getElementsByTagName('a');
          if (theImage != null) {
             theImage[0].style.color = "#000000";
          }
      }
}


var urlAry = location.href.split('/');
var CC_LL = urlAry[urlAry.length-2];
var languages = document.getElementById('sel_box').options;
for (var cc_ll = 0;cc_ll<=languages.length-1;cc_ll++) {
	if (languages[cc_ll].value == CC_LL) {
		document.getElementById('sel_box').selectedIndex = cc_ll;
	}
}

function changecountry(ddl) {
	var newcountry = ddl.options[ddl.selectedIndex].value;
	location.href='../'+newcountry+'/'+fileName;
}



	

