function displayCountryDetails(hideid,showid)
{
    //alert(document.getElementById(hideid).style.display); 
    if(document.getElementById(hideid).style.display=="none")
    {   
        document.getElementById(hideid).style.display="";
        document.getElementById(showid).style.display="none";
        
        document.getElementById("country_hidden").setAttribute("alt","qualification####Select Country.")
        document.getElementById("city_hidden").setAttribute("alt","qualification####Select City.")
        document.getElementById("state_hidden").setAttribute("alt","qualification####Select Sate.")

        document.getElementById("divDisplayContent").innerHTML=" Change Country Details ";
    }
    else  if(document.getElementById(hideid).style.display=="")
    {
        document.getElementById(hideid).style.display="none";
        document.getElementById(showid).style.display="";


        


        //     document.getElementById("country_hidden").setAttribute("alt","qualification##Validate##Select Country.")
        document.getElementById("country_hidden").setAttribute("alt","qualification##Validate##Select Country.")
        document.getElementById("city_hidden").setAttribute("alt","qualification##Validate##Select City.")
        document.getElementById("state_hidden").setAttribute("alt","qualification##Validate##Select Sate.")
        document.getElementById("divDisplayContent").innerHTML=" Saved Country Details ";
       
            
    }


 
}

function getState(countryId) {
  // alert('ddfd'+countryId);
    // alert(document.getElementById("txtzipcode").alt);
    changediv();
    try{
        document.getElementById("city").options.length=1
        document.getElementById("state").options.length=1
    }catch(e){}
    //alert(countryId);
    if(countryId!="other")
    {

        document.getElementById('divTxtcountry').style.display="none";
		document.getElementById('countrydiv').innerHTML="";
        document.getElementById('statediv').innerHTML="";
        document.getElementById('citydiv').innerHTML="";
       // alert(document.getElementById("txtzipcode").alt)
	 try{ 	var ZipALTContent=document.getElementById("txtzipcode").alt;         
            ZipALTContent=ZipALTContent.replace("other","zipcode");  
            document.getElementById("txtzipcode").alt=ZipALTContent;                                  
            ZipALTContent=document.getElementById("txtmobile").alt;
            ZipALTContent=ZipALTContent.replace("isInteger","Mobilenumber");
            // ZipALTContent=ZipALTContent.replace("Enter valid  Mobile Number.","Enter Numbers only.");
            document.getElementById("txtmobile").alt=ZipALTContent;       
		  
           }catch(e)
        {
            
        }  var strURL="../GetStatesByCountry.php?country="+countryId;
             DisplayID="statediv";
              // alert(strURL)
               sendRequest_displayloading("text",strURL,DisplayID,false) ;
                               // alert("dddddd");
    }
    
    if(countryId=="other")
    {
        document.getElementById('divTxtcountry').style.display="";
        document.getElementById('countrydiv').innerHTML="<input type='text' id='txtcountry' name='txtcountry' maxlength='20' style=\"width:120px;\" onblur=\"validateName(this, '',true);\"    alt='validateName##Validate##Enter valid Country.' > <span class='div_ErrorMsg' id='inf_txtcountry'> </span>";
        document.getElementById('statediv').innerHTML="<input type='text' id='txtstate' name='txtstate' maxlength='20' style=\"width:120px;\" onblur=\"validateName(this, '',true);\"   alt='validateName##Validate##Enter valid State.' ><span class='div_ErrorMsg' id='inf_txtstate'> </span>";
        document.getElementById('citydiv').innerHTML="<input type='text' id='txtcity' name='txtcity' maxlength='20' style=\"width:120px;\" onblur=\"validateName(this, '',true);\"  alt='validateName##Validate##Enter valid City.'  ><span class='div_ErrorMsg' id='inf_txtcity'></span>";

       //****************** IF COUNTRY IS OTHER - No NEED TO VALIDATE ZIP CODE
        try{
         
        var ZipALTContent=document.getElementById("txtzipcode").alt;         
            ZipALTContent=ZipALTContent.replace("zipcode","other");  
            document.getElementById("txtzipcode").alt=ZipALTContent; 
                                 
            ZipALTContent=document.getElementById("txtmobile").alt;
            ZipALTContent=ZipALTContent.replace("Mobilenumber","isInteger");             
            // ZipALTContent=ZipALTContent.replace("Enter valid  Mobile Number.","Enter Numbers only.");
            document.getElementById("txtmobile").alt=ZipALTContent;
                                                                


        //  alert(document.getElementById("txtzipcode").alt);
        }catch(e)
        {
            
        }

    //****************** IF COUNTRY IS OTHER - No NEED TO VALIDATE ZIP CODE


       
		
    }

  
    if(countryId=="")
    {
       // changediv_sel();
        document.getElementById("city").options.length=1
        document.getElementById("state").options.length=1
    }


    try{
        var countryISDCode=CountryCodes_array[countryId];
        if(countryISDCode)
        {
            document.getElementById("div_countryCode").innerHTML=countryISDCode;
        }else
        {
            document.getElementById("div_countryCode").innerHTML="";
        }
    }catch(e)
    {

    }
}
//function getStates(countryId,selectedstate) {
//    //alert('ddfd');
//    var strURL="findState.php?country="+countryId+"&sel="+selectedstate;
//    var req = getXMLHTTP();
//
//    if (req) {
//
//        req.onreadystatechange = function() {
//            if (req.readyState == 4) {
//                // only if "OK"
//                if (req.status == 200) {
//                    document.getElementById('statediv').innerHTML=req.responseText;
//                } else {
//                    alert("There was a problem while using XMLHTTP:\n" + req.statusText);
//                }
//            }
//        }
//        req.open("GET", strURL, true);
//        req.send(null);
//    }
//}
function getCity(countryId,stateId) {
    //  alert("");
    var strURL="../GetCitiesByState.php?country="+countryId+"&state="+stateId;
    DisplayID="citydiv";
    //alert(strURL);
    sendRequest_displayloading("text",strURL,DisplayID,false) ;


}

//function getCitys(countryId,stateId,selected) {
//    var strURL="findCity.php?country="+countryId+"&state="+stateId+"&selected="+selected;
//    var req = getXMLHTTP();
//
//    if (req) {
//
//        req.onreadystatechange = function() {
//            if (req.readyState == 4) {
//                // only if "OK"
//                if (req.status == 200) {
//                    document.getElementById('citydiv').innerHTML=req.responseText;
//                } else {
//                    alert("There was a problem while using XMLHTTP:\n" + req.statusText);
//                }
//            }
//        }
//        req.open("GET", strURL, true);
//        req.send(null);
//    }
//
//}

function changediv()
{
    document.getElementById("countrysel").style.display = "block";
//countrysel.style.display = "block";
}

function changediv_sel()
{
    document.getElementById("countrysel").style.display = "none";

//countrysel.style.display = "none";
}
