// JavaScript Document
var xmlHttp
//start code for mentering Services
function save_using_get(val)
{ 
		url="state.php?f="+val;
		xmlHttp=GetXmlHttpObject()
			if (xmlHttp==null)
			 {
			 alert ("Browser does not support HTTP Request")
			 return
			 }
		xmlHttp.open("GET",url,true)
		xmlHttp.onreadystatechange=get_message	
		xmlHttp.send(null)
}
function get_message() 
{ 
	 
	 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	 var responsevalue=xmlHttp.responseText.split('~');
	 document.getElementById("message").innerHTML=responsevalue[0];
	  document.getElementById("city123").innerHTML=responsevalue[1];
	 } 
} 

function getcity(val2)
{ 
 var cnt_id=document.getElementById('select1').value;
if(cnt_id=='101')
{
	url1="state.php?state="+val2;
		xmlHttp=GetXmlHttpObject()
			if (xmlHttp==null)
			 {
			 alert ("Browser does not support HTTP Request")
			 return
			 }
		xmlHttp.open("GET",url1,true)
		xmlHttp.onreadystatechange=function (){
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			 { 
			
			 document.getElementById("city123").innerHTML=xmlHttp.responseText 
			 } 
		}	
		xmlHttp.send(null)
}
}
function get_city() 
{ 
	 
	 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	
	 document.getElementById("city123").innerHTML=xmlHttp.responseText 
	 } 
} 


function save_using_get11(val5)
{ 
		url="state1.php?f="+val5;
		xmlHttp=GetXmlHttpObject()
			if (xmlHttp==null)
			 {
			 alert ("Browser does not support HTTP Request")
			 return
			 }
		xmlHttp.open("GET",url,true)
		xmlHttp.onreadystatechange=get_message11	
		xmlHttp.send(null)
}
function get_message11() 
{ 
	 
	 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	 var responsevalue=xmlHttp.responseText.split('~');
	 document.getElementById("message11").innerHTML=responsevalue[0];
	  document.getElementById("zon").innerHTML=responsevalue[1];
	 } 
} 

function getcity11(val2)
{ 
 var cnt_id=document.getElementById('select1').value;
if(cnt_id=='101')
{
url1="state1.php?state="+val2;
		xmlHttp=GetXmlHttpObject()
			if (xmlHttp==null)
			 {
			 alert ("Browser does not support HTTP Request")
			 return
			 }
		xmlHttp.open("GET",url1,true)
		xmlHttp.onreadystatechange=function (){
		if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
			 { 
			
			 document.getElementById("zon").innerHTML=xmlHttp.responseText 
			 } 
		}	
		xmlHttp.send(null)
}
}
function get_city() 
{ 
	 
	 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	
	 document.getElementById("zon").innerHTML=xmlHttp.responseText 
	 } 
} 
function get_cat(){
	
	
	//country=country+'~'+value
	
	var Jlocation = document.getElementById("Categ").options;
	var location="";
		for(var i=0;i<Jlocation.length;i++)
			{
				if(Jlocation[i].selected==true)
					{	
						if(location=="")
						location="'"+Jlocation[i].value+"'";
						else
						location="'"+Jlocation[i].value+"'"+','+location;
						
						var flag1 = 1;
					}
			}
	if(flag1==1){
		getloaction(location);
	}
	else{
	alert("No Category selected");
	}
}
// JavaScript Document


function getloaction(location)
{ 
		var url="getsubcat.php?loc="+location;
			xmlHttp=GetXmlHttpObject()
			if (xmlHttp==null)
			 {
			 alert ("Browser does not support HTTP Request")
			 return
			 }
		
		xmlHttp.onreadystatechange=subcat 
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
}//end of function  showotherdegree


function subcat() 
{ 
	 if (xmlHttp.readyState<=3)
	 { 
	 document.getElementById("lodingimg").innerHTML="<img src='images/ajax-loading.gif' border='0'>Loading Please Wait..."
	 }
	 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	 document.getElementById("SubCateg").innerHTML=xmlHttp.responseText 
	 } 
} //end of function otherdegree


//31-05-2010 multiple countries

function get_states(){
	

	//country=country+'~'+value
	
	var Jloc = document.getElementById("country").options;
	var stat="";
		for(var i=0;i<Jloc.length;i++)
			{
				if(Jloc[i].selected==true)
					{	
						if(stat=="")
						stat="'"+Jloc[i].value+"'";
						else
						stat="'"+Jloc[i].value+"'"+','+stat;
						
						var flag1 = 1;
					}
			}
	if(flag1==1){
		getstate(stat);
	}
	else{
	alert("No Country selected");
	}
}
// JavaScript Document

function getstate(stat)
{ 
		var url="getstates.php?st="+stat;
			
			
			xmlHttp=GetXmlHttpObject()
			if (xmlHttp==null)
			 {
			 alert ("Browser does not support HTTP Request")
			 return
			 }
		
		xmlHttp.onreadystatechange=states 
		xmlHttp.open("GET",url,true)
		xmlHttp.send(null)
}//end of function  showotherdegree



function states() 
{ 
	 if (xmlHttp.readyState<=3)
	 { 
	 document.getElementById("lodingimg").innerHTML="<img src='images/ajax-loading.gif' border='0'>Loading Please Wait..."
	 }
	 if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	 document.getElementById("States").innerHTML=xmlHttp.responseText 
	 } 
} //end of function otherdegree


//31-05-2010 multiple countries

//Ajax browser check function start
function GetXmlHttpObject()
{
var xmlHttp=null;
	try
	 {
	 // Firefox, Opera 8.0+, Safari
	 xmlHttp=new XMLHttpRequest();
	 }
	catch (e)
	 {
	 //Internet Explorer
		 try
		  {
		  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		  }
		 catch (e)
		  {
		  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		  }
	 }
return xmlHttp;
}

