// JavaScript Document

function FillCodeheader()
{   
        var Phone_Country_Code;        
        var TelePhone_Code;
        
        Phone_Country_Code= document.getElementById('ddlCountry');              
        TelePhone_Code= document.getElementById('phone1');          
        var countryValue=   Phone_Country_Code[Phone_Country_Code.selectedIndex].value;                    
        var countryCode= countryValue.split("-");
        TelePhone_Code.value  =countryCode[0]; 
          
          if(TelePhone_Code.value == '0')
            {
             TelePhone_Code.value ='';
            }
            setCountryFlagheader(countryCode[1]);
}

function setCountryFlagheader(countryValue) 
{
    var img1 = document.getElementById('imgcontactusheader'); 
    if (countryValue!='')
        {                   
        img1.src='/images/flags/' + countryValue +'.gif';
        }
    else
        {
        img1.src='/images/flags/us.gif';
        }
}
		searchCountryNameheader();

function searchCountryNameheader() 
{
	//debugger;
    var input=geoip_country_name();
    input = input.toUpperCase()
    var output=document.getElementById('ddlCountry').options;
	     
    for(var i=0;i<output.length;i++) {
    if(output[i].text.indexOf(input)==0)
        {
        output[i].selected=true;		
		 var countryValue=   output[i].value;                    
        var countryCode= countryValue.split("-");
		document.getElementById('phone1').value=countryCode[0]; 
        }
    if(geoip_country_name()==''){
      output[0].selected=true;
	  document.getElementById('phone1').value='1'; 
      }
    }
}