function brows_check(){
	if (navigator.userAgent.indexOf("Firefox")!=-1){
		return "ff"; //ff for FireFox
	}else if (navigator.userAgent.indexOf("MSIE")!=-1){
		return "ie"; // ie for Internet Explorer
	}
	
}

function out(){
	//alert('profile updated successfully');
	//parent.parent.reload_pge();
	document.getElementById("msg").innerHTML="";
}

function GetXmlHttpObject()
{ 
	var objXMLHttp=null
	if (window.XMLHttpRequest)
	{
		objXMLHttp=new XMLHttpRequest()
	}
	else if (window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}

	return objXMLHttp
} 

function stateChanged3() 
{ 
	if(xmlHttp.readyState==1){
		document.getElementById("ind2").style.display="inline";
	}
	if(xmlHttp.readyState==2){
		document.getElementById("ind2").style.display="inline";
	}
	if(xmlHttp.readyState==3){
		document.getElementById("ind2").style.display="inline";
	}
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete" || xmlHttp.readyState==0)
	{ 
		//DataLd();
		document.getElementById("ind2").style.display="none";
		var dumy = xmlHttp.responseText;
		//document.getElementById("sbCats").innerHTML=dumy;
		
		//alert(dumy);
		
		var opts = dumy.split("_");
		document.add.city.disabled =false;	
		
		var theDropDown = document.getElementById("city")
		var numberOfOptions = theDropDown.options.length
		for (i=0; i<numberOfOptions; i++) 
		{
			//Note: Always remove(0) and NOT remove(i)
			theDropDown.remove(0)
		}
		
		for(var i=0; i<opts.length-1; i++ ){
			var opts_value = opts[i].split(",");
			document.add.city.options[i] = new  Option(opts_value[1],opts_value[0]);
		}
		
	}
	
}  
 

function getCities(){
	var form = document.add;
	if(form.country_id.value !=""){
		
		var country_id = form.country_id.value;
		
		<!-- ########## star form posting ######### -->
		xmlHttp=GetXmlHttpObject()
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 

		if(brows_check() == "ie"){
			var fChk = false;
		}else if(brows_check() == "ff"){
			var fChk = true;
		}
		xmlHttp.onreadystatechange=stateChanged3;
		xmlHttp.open("POST","includes/get_cities.php",fChk)
		// Set our POST header correctly…
		var params = "country_id="+country_id;
		
		//alert(params);
		
		xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlHttp.setRequestHeader("Content-length", params.length);
		xmlHttp.setRequestHeader("Connection", "close");
		  // Send the parms data…
		 xmlHttp.send(params);
	}else{
		form.city.disabled =true;	
	}
 }
