
function CreateXmlHttpObject()
{ //fuction to return the xml http object
	var xmlhttp=false;	
	try
	{
		xmlhttp=new XMLHttpRequest();//creates a new ajax object
	}
	catch(e)
	{		
		try
		{			
			xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");//this is for IE browser
		}
		catch(e)
		{
			try 
			{
				req = new ActiveXObject("Msxml2.XMLHTTP");//this is for IE browser
			}
			catch(e1)
			{
			 xmlhttp=false;//error creating object
		 }
	 }
 }
	return xmlhttp;
}
	
function CategoryGrab(strURL)
{    
 var req = CreateXmlHttpObject(); // fuction to get xmlhttp object
 if (req)
 {
  req.onreadystatechange = function()
  {
   if (req.readyState == 4) 
	  { //data is retrieved from server
    if (req.status == 200) 
   	{ // which reprents ok status                    
     document.getElementById('state').innerHTML=req.responseText;//put the results of the requests in or element
	    document.getElementById('city').innerHTML='';
    }
    else
    { 
     alert("There was a problem while using XMLHTTP:\n");
    }
   }            
  }        
  req.open("GET", strURL, true); //open url using get method
  req.send(null);//send the results
 }
}
function set_my_state(state)
{
 var string2= state.value;
 document.getElementById('my_state').value=string2;
}
function set_my_city(city)
{
 var string2= city.value;
 document.getElementById('my_city').value=string2;
}
function set_my_city_id(city)
{
 var string2= city.value;
 document.getElementById('my_city_id').value=string2;
}
function CategoryGrab1(strURL)
{      
 var string1=strURL.split("?idCat1=");
 var string2=string1[1].split("&");
 var req = CreateXmlHttpObject(); // fuction to get xmlhttp object
 if (req)
 {
  req.onreadystatechange = function()
  {
   if (req.readyState == 4) 
	  { //data is retrieved from server
    if (req.status == 200) 
	   { // which reprents ok status                    
     document.getElementById('my_state_id').value=string2;
     document.getElementById('city').innerHTML=req.responseText;//put the results of the requests in or element
    }
    else
    { 
     alert("There was a problem while using XMLHTTP:\n");
    }
   }            
  }        
  req.open("GET", strURL, true); //open url using get method
  req.send(null);//send the results
 }
}

function CategoryGrab3(strURL)
{      
 var req = CreateXmlHttpObject(); // fuction to get xmlhttp object
 if (req)
 {
  req.onreadystatechange = function()
  {
   if (req.readyState == 4) 
   { //data is retrieved from server
    if (req.status == 200) 
	{ // which reprents ok status                    
     document.getElementById('city').innerHTML=req.responseText;//put the results of the requests in or element
    }
    else
    { 
     alert("There was a problem while using XMLHTTP:\n");
    }
   }            
  }        
  req.open("GET", strURL, true); //open url using get method
  req.send(null);//send the results
 }
}
