	var xmlHttp 
	
	function GetXmlHttpObject(handler)
	{ 
		var objXmlHttp=null
		
		if (navigator.userAgent.indexOf("Opera")>=0)
		{
			alert("This example doesn't work in Opera") 
			return 
		}
		if (navigator.userAgent.indexOf("MSIE")>=0)
		{ 
			var strName="Msxml2.XMLHTTP"
			if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
			{
				strName="Microsoft.XMLHTTP"
			} 
			try
			{ 
				objXmlHttp=new ActiveXObject(strName)
				objXmlHttp.onreadystatechange=handler 
				return objXmlHttp
			} 
			catch(e)
			{ 
				alert("Error. Scripting for ActiveX might be disabled") 
				return 
			} 
		} 
		if (navigator.userAgent.indexOf("Mozilla")>=0)
		{
		    objXmlHttp=new XMLHttpRequest()
			objXmlHttp.onload=handler
			objXmlHttp.onerror=handler 
			return objXmlHttp
		}
	}  /*-- Function GetXmlHttpObject() Ends Here --*/
	
	/* function show state start here*/
	function show_States(str) {
        var base_path = document.getElementById('base_path').value;
        if(str != '' ){
	    	var url=base_path+"user/get_state_registration/"+str;
       		if(str!='none') {
		    	xmlHttp=GetXmlHttpObject(country_Changed_fun)
		    	xmlHttp.open("GET", url , true)
		    	xmlHttp.send(null) 
	    	}
	  	} 
	}  
	
	/*-- Function showCountries(str) Ends Here --*/
	
	function country_Changed_fun() 
	{   
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{
	      var str =xmlHttp.responseText;
	      return_value = str.split("###");
	    	if(trimString(return_value[0]) !='N'){	      		
	      		document.getElementById('id_hidden').value='';
	      		document.getElementById("city_id").value='';
	      		document.getElementById("city_other").value='';
		  		document.getElementById("state_other").value='';
		  		document.getElementById("city_id").disabled = true;	
	      		document.getElementById("location_state").style.display  = "block"; //state div block
		  		document.getElementById("location_state").innerHTML=xmlHttp.responseText //here we assign the object
		  		document.getElementById("location_city").style.display  = "block";  //city div block
		  		document.getElementById("location_state_no").style.display  = "none";//ajax other state textbox none state div none
		  		document.getElementById("location_city_no").style.display  = "none"; //ajax other city textbox city div none
		  		document.getElementById("auto_location_city").style.display  = "none";//auto complete div none
		  		document.getElementById("location_state_other_font").style.display  = 'none';//this state fond div none
		  		document.getElementById("location_city_other_font").style.display  = "none";
		  		
		  	}else{
		  		//if that country don t have the states
		  		document.getElementById("state_id").value="Other";
		  		document.getElementById("city_id").value="Other";//here we assign both value other
		  		document.getElementById("state_other").value='';
		  		document.getElementById("city_other").value='';
		  		document.getElementById("location_state").innerHTML=return_value[1] //here we assign the object
		  		document.getElementById("location_state_no").style.display  = "block";//block state text box
		  		document.getElementById("location_city_no").style.display  = "block"; //block city text box
		  		document.getElementById("location_state").style.display  = "none";
		  		document.getElementById("location_city").style.display  = "none"; 
		  		document.getElementById("auto_location_city").style.display  = "none";//none the auto complete div
		  		document.getElementById("location_state_other_font").style.display  = 'none';//this state fond div none
		  		document.getElementById("location_city_other_font").style.display  = "none";
		  	
		  	}	  
		}  
	}  
	/*-- Function countryChanged() Ends Here --*/
	
	/*-- function state change start here --*/ 
	function showCity(idval) {  
	    var base_path = document.getElementById('base_path').value;
        var coutry_id = document.getElementById('country_id').value;
        
	    if(idval!='') {
		    var url=base_path+"user/show_city/"+idval+"/"+coutry_id;
			    xmlHttp=GetXmlHttpObject(city_find)
				xmlHttp.open("GET", url , true)
				xmlHttp.send(null)
		   			
		}
	}
	function city_find() 
	{ 
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{ 
	      var str =xmlHttp.responseText;
	      return_value = str.split("###");
	    	if(trimString(return_value[0]) !='N'){
	      		if(trimString(return_value[0])=='j'){
	      			//the selected country is us we block the auto complete div
	      			document.getElementById("auto_location_city").style.display  = "block"; 
	      			document.getElementById("location_city").style.display  = "none";
			  		document.getElementById("location_city_no").style.display  = "none";
			  		document.getElementById("location_state_other_font").style.display  = "none";
			  		document.getElementById("location_state_no").style.display  = "none";
			  		document.getElementById("city_name").value='';
			  		document.getElementById("city_id").value=parseInt(0);
	      		}else{
		      		document.getElementById("city_other").value='';
		      		document.getElementById("location_city").style.display  = "block"; 
			  		document.getElementById("location_city").innerHTML=xmlHttp.responseText//here we assign the object
			  		document.getElementById("location_city_no").style.display  = "none";
			  		document.getElementById("location_state_other_font").style.display  = "none";
			  		document.getElementById("location_state_no").style.display  = "none";
			  		document.getElementById("auto_location_city").style.display  = "none";
			  		document.getElementById("location_city_other_font").style.display  = "none";
		  		}
		  	}else{
		  		document.getElementById("city_other").value='';
		  		document.getElementById("state_other").value='';
		  		document.getElementById("location_state_other_font").style.display  = "block";
		  		document.getElementById("location_city_other_font").style.display  = "none";
				document.getElementById("location_state_no").style.display  = "block";
		  		document.getElementById("location_city").innerHTML=return_value[1] //here we assign the object
		  		document.getElementById("city_id").value="Other";
		  		document.getElementById("location_city_no").style.display  = "block";
		  		document.getElementById("location_city").style.display  = "none"; 
		  		document.getElementById("auto_location_city").style.display  = "none";
		  	}	  
		}  
	}  
	/* function find city start here*/
	
	/* function find other city start here*/
	function showCity_value(str){
		if(str == 'Other'){
			document.getElementById("location_city_no").style.display  = "block"; 
			document.getElementById("location_city_other_font").style.display  = "block";
		}else{
			document.getElementById("location_city_no").style.display  = "none"; 
			document.getElementById("location_city_other_font").style.display  = "none";
		}
	}
 