
//BOF create account function

function AjaxFunction(cat_id)
{ //alert(cat_id);
	if (cat_id=="")
	  {
	  document.getElementById("subcat").innerHTML="";
	  return;
	  } 

     if(cat_id!=99)
     {
    	 /* When selected country is not india.     */
    	 document.getElementById("state").style.display="block";
    	 document.getElementById("city").style.display="block";
    	 document.getElementById("subcat_id").style.display="none";
    	 document.getElementById("subcity_id").style.display="none";
    	 
     }
     if(cat_id==99)
     {
    	 
    	 /* Other than india.     */
    	 document.getElementById("state").style.display="none";
    	 document.getElementById("city").style.display="none";
    	 document.getElementById("subcat_id").style.display="block";
    	 document.getElementById("subcity_id").style.display="block";
         }
	  
	if (window.XMLHttpRequest)
	  {
		// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			document.getElementById("subcat").innerHTML=xmlhttp.responseText;
		}
	  }
	xmlhttp.open("GET","dd.php?cat_id="+cat_id,true);
	xmlhttp.send();
	}



function AjaxFunction_city(city_id)
{ //alert(city_id);
	if (city_id=="")
	  {
	  document.getElementById("subcity").innerHTML="";
	  return;
	  } 
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{

		  var text = innerHTML=xmlhttp.responseText;
			var textLength = text.length;
			if(textLength == '2')
			{
              //alert('no value here');
              document.getElementById("subcity_id").style.display="none";
              document.getElementById("city").style.display="block";
			}
			else 
			{
				   document.getElementById("city").style.display="none";
		              document.getElementById("subcity_id").style.display="block";
		   }

			
			document.getElementById("subcity").innerHTML=xmlhttp.responseText;
		}
	  }
	xmlhttp.open("GET","city.php?city_id="+city_id,true);
	xmlhttp.send();
	}
-->

//For shipping

function AjaxFunction_shipping(cat_id)
{ //alert(cat_id);
	if (cat_id=="")
	  {
	  document.getElementById("subcat_shipping").innerHTML="";
	  return;
	  } 

     if(cat_id!=99)
     {
    	 document.getElementById("state_shipping").style.display="block";
    	 document.getElementById("city_shipping").style.display="block";
    	 document.getElementById("subcat_shipping_id").style.display="none";
    	 document.getElementById("subcity_shipping_id").style.display="none";
    	 
     }
     if(cat_id==99)
     {
    	 document.getElementById("state_shipping").style.display="none";
    	 document.getElementById("city_shipping").style.display="none";
    	 document.getElementById("subcat_shipping_id").style.display="block";
    	 document.getElementById("subcity_shipping_id").style.display="block";
         }
	  
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{

		  

			
			document.getElementById("subcat_shipping").innerHTML=xmlhttp.responseText;
		}
	  }
	xmlhttp.open("GET","dd.php?cat_id="+cat_id,true);
	xmlhttp.send();
	}


function AjaxFunction_city_shipping(city_id)
{ //alert(city_id);
	if (city_id=="")
	  {
	  document.getElementById("subcity_shipping").innerHTML="";
	  return;
	  } 
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{

		  var text = innerHTML=xmlhttp.responseText;
			var textLength = text.length;
			if(textLength == '2')
			{
            //alert('no value here');
            document.getElementById("subcity_shipping_id").style.display="none";
            document.getElementById("city_shipping").style.display="block";
			}

			else 
			{
				document.getElementById("city_shipping").style.display="none";
	            document.getElementById("subcity_shipping_id").style.display="block";

		    }
			
			document.getElementById("subcity_shipping").innerHTML=xmlhttp.responseText;
		}
	  }
	xmlhttp.open("GET","city.php?city_id="+city_id,true);
	xmlhttp.send();
	}

//End of create account function

//BOF new shipping address functions
function AjaxFunction(cat_id)
{ //alert(cat_id);
	if (cat_id=="")
	  {
	  document.getElementById("subcat").innerHTML="";
	  return;
	  }

	 if(cat_id!=99)
     {
    	 document.getElementById("state").style.display="block";
    	 document.getElementById("city").style.display="block";
    	 document.getElementById("selected_state").style.display="none";
    	 document.getElementById("selected_city").style.display="none";
    	 
     }
     if(cat_id==99)
     {   

    	 document.getElementById("state").style.display="none";
    	 document.getElementById("city").style.display="none";
    	 
    	 document.getElementById("selected_state").style.display="block";
    	 document.getElementById("selected_city").style.display="block";
    	
         }

	   
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			document.getElementById("subcat").innerHTML=xmlhttp.responseText;
		}
	  }
	xmlhttp.open("GET","dd.php?cat_id="+cat_id,true);
	xmlhttp.send();
	}



function AjaxFunction_city(city_id)
{ //alert(city_id);
	if (city_id=="")
	  {
	  document.getElementById("subcity").innerHTML="";
	  return;
	  } 
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	  }
	xmlhttp.onreadystatechange=function()
	  {
	  if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
         
		  var text = innerHTML=xmlhttp.responseText;
			var textLength = text.length;
			if(textLength == '2')
			{
              //alert('no value here');
              document.getElementById("selected_city").style.display="none";
              document.getElementById("city").style.display="block";
			}
			else 
			{  

				document.getElementById("city").style.display="none";
				document.getElementById("selected_city").style.display="block";
              
			}

			
			document.getElementById("subcity").innerHTML=xmlhttp.responseText;
		}
	  }
	xmlhttp.open("GET","city.php?city_id="+city_id,true);
	xmlhttp.send();
	}

//End new shipping address functions
