
$(document).ready(function(){
if (document.getElementById("horizontalNav"))
{
    // BEGIN: display / hide the top nav , breadcrumb and Back to Home Page Link 
        var displayFlag ="false";
        document.getElementById("masthead-links").innerHTML= '&nbsp;' ;
        var ref="" +(document.referrer);
        var loc="" +(document.location);
        len1=ref.length;
        if(len1==0)
        {
         document.getElementById("horizontalNav").innerHTML="";
         document.getElementById("horizontalNav").className = 'separator';
         document.getElementById("horizontalNav").style.background = 'transparent';
         document.getElementById("breadcrumbs").style.display="none";
         }
        else
        {
            temp = loc.lastIndexOf("/");
            temp1=ref.lastIndexOf("/");
            str=loc.substring(0,temp);
            str1=ref.substring(0,temp1);
            if(str==str1)
            {
                document.getElementById("horizontalNav").style.display="block";
                document.getElementById("back_to_home").style.display="none";
                displayFlag="true";
            }    
            else
            {         
                document.getElementById("horizontalNav").innerHTML="";
                document.getElementById("horizontalNav").className = 'separator';
                document.getElementById("horizontalNav").style.background = 'transparent';
                document.getElementById("breadcrumbs").style.display="none";
            }
        }
}
		if(document.getElementById("productlist") != null)
		{
			var productList = document.getElementById("productlist");
			var productListLiElement = productList.getElementsByTagName("li");
			for(i=0;i<productListLiElement.length;i++)
			{
				nodeId=productListLiElement.item(i).getElementsByTagName("a")[0].getAttribute("href");            
				productListLiElement.item(i).getElementsByTagName("a")[0].getAttributeNode("href").nodeValue=nodeId + "?Nav=" + displayFlag;
				nodeId=productListLiElement.item(i).getElementsByTagName("a")[0].getAttribute("href");
			}
		}
    // END: display / hide the top nav , breadcrumb and Back to Home Page Link 
      
    //BEGIN:Select the first radio button on load and to popuplate the dropdown accordingly
         if(!document.productSelector.audienceSelector)
         {
              return;     
         }
         else
         {              
            if(!document.productSelector.audienceSelector[0])
            {
              document.productSelector.audienceSelector.checked = true;
            }
            else
            {
               document.productSelector.audienceSelector[0].checked = true;
            }        
        }
        var nodeList=document.getElementsByTagName("input");
        var nodeCount=""+document.getElementsByTagName("input").length;
        var nodeId;
        for(i=0;i<nodeCount;i++)
        {
            nodeId=""+nodeList.item(i).getAttribute("id");
            nodeIdPrefix=nodeId.substring(0,7);
            if(nodeIdPrefix =="hidden_")
            {   
                dropdown(nodeId);
                return;
            }
        }
        dropdown("");
          return;
      //END:Select the first radio button on load and to popuplate the dropdown accordingly
    });

// Fuction used to populate the dropdown based on the selected radio button
function dropdown(id)
{   
    var select_1 = document.getElementById("select_country");
    var option_values=(""+document.getElementById(id).getAttribute("value")).split(';');
//19Jan,2008, Remedy#INC00000062086, internationalization
var msgSelectCountry=""+document.getElementById('selectCountry').innerHTML+"";
//19Jan,2008, artf858318, Remedy#INC00000062086, internationalization
//msgSelectCountry="--" + msgSelectCountry +"--"
    if (select_1 && select_1.hasChildNodes && select_1.removeChild) 
    {
        while (select_1.hasChildNodes()) 
        {
            select_1.removeChild(select_1.firstChild);
        }
    }
    var option=  document.createElement('option'); 
    var attr = document.createAttribute("value");
    attr.nodeValue = "";
    option.setAttributeNode(attr);
//19Jan,2008, Remedy#INC00000062086, internationalization
    option.appendChild(document.createTextNode(msgSelectCountry));
    select_1.appendChild(option);
    for(j=0;j<option_values.length-1;j++)
    {       
        var temp = ""+option_values[j];
        var index = temp.indexOf(':');
        var countryName = temp.substring(0,index);
        var countryURL = temp.substring(index+1);
        if(countryURL !="")
        {    
            var option=  document.createElement('option');
            var attr = document.createAttribute("value");
            attr.nodeValue = countryURL;
            option.setAttributeNode(attr);
            option.appendChild(document.createTextNode(countryName));
            select_1.appendChild(option);
        }
    } 
}

//Function used to submit the form and move to the new location 
function goTo(menu)
{   
//19Jan,2008, Remedy#INC00000062086, internationalization
var msgSelectValidCountry=""+document.getElementById('selectValidCountry').innerHTML+""; 
    ref = menu.countryList.options[menu.countryList.selectedIndex].value;
    target = "_self";
    if (ref != "") 
    {
        window.location=ref;
    }
    else
    {
        alert(msgSelectValidCountry); 
    }
}
