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;
}
xmlHttp		=	 GetXmlHttpObject();
xmlHttp2		= GetXmlHttpObject();

function check_user(obj)
{
	var username = obj.user_id.value;
	var url	=	"ajax_respons.php?c="+username;	
	xmlHttp	=	GetXmlHttpObject();
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)	
	xmlHttp.onreadystatechange = function(){	
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){		
	    var txt	 = xmlHttp.responseText;
		 //alert(txt);
		 if(txt!=""){
		document.getElementById("txtHint1").innerHTML=xmlHttp.responseText 
				
		    }				 
		 
		}
	}
	
}

function cat_drop_down(catID,urlpath,divnm)
{
	
	var url	=	"ajax_respons.php?catId="+catID;
	//alert(url);
	xmlHttp2	=	GetXmlHttpObject();
	xmlHttp2.open("GET",url,true)
	xmlHttp2.send(null)
	xmlHttp2.onreadystatechange = function()
	{		
			if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete")
			{		
			
			  var txt	 = xmlHttp2.responseText;
			//alert(xmlHttp2.responseText);
					if(txt!="")
					 {
					var divid="cat_tree"+divnm;
					
					document.getElementById(divid).style.display='block';
					document.getElementById(divid).innerHTML=txt;							
					 }	
			  }
	
	}
	if(catID==51)
	document.getElementById("motorcategory").style.display="block";
	else
	document.getElementById("motorcategory").style.display="none";

	
}
function cat_drop_down_right(catID_right,urlpath,divnm)
{
	
	var url	=	"ajax_respons.php?catId_right="+catID_right;
	//alert(url);
	xmlHttp2	=	GetXmlHttpObject();
	xmlHttp2.open("GET",url,true)
	xmlHttp2.send(null)
	xmlHttp2.onreadystatechange = function()
	{		
			if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete")
			{		
			
			  var txt	 = xmlHttp2.responseText;
			//alert(xmlHttp2.responseText);
					if(txt!="")
					 {
					var  divid="cat_tree"+divnm;
					
					document.getElementById(divid).style.display='block';
					document.getElementById(divid).innerHTML=txt;							
					 }	
			  }
	
	}
	

}
function cat_drop_down2(subcatID)
{
	
	var url	=	"ajax_respons.php?subcatId="+subcatID;
	//alert(url);
	xmlHttp2	=	GetXmlHttpObject();
	xmlHttp2.open("GET",url,true)
	xmlHttp2.send(null)
	xmlHttp2.onreadystatechange = function()
	{		
			if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete")
			{		
			  var txt	 = xmlHttp2.responseText;
			  //alert(txt);
					 if(txt!="")
					 {
					document.getElementById("cat_tree2").innerHTML=xmlHttp2.responseText							
					 }	
			  }
	
	}
}
function addtokmplus(adv_id,cur_url)
{
	
	var url	=	"ajax_respons.php?adv_id="+adv_id;
	//alert(cur_url);
	xmlHttp2	=	GetXmlHttpObject();
	xmlHttp2.open("GET",url,true)
	xmlHttp2.send(null)
	xmlHttp2.onreadystatechange = function()
	{		
			if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete")
			{		
			
			  var txt	 = xmlHttp2.responseText;
			//alert(xmlHttp2.responseText);
					if(txt!="")
					 {
					alert(txt);
					location.href=cur_url;
					 }	
			  }
	
	}
	
}
function removekmplus(adv_id)
{
	
	var url	=	"ajax_respons.php?remoce_adv_id="+adv_id;
	//alert(url);
	xmlHttp2	=	GetXmlHttpObject();
	xmlHttp2.open("GET",url,true)
	xmlHttp2.send(null)
	xmlHttp2.onreadystatechange = function()
	{		
			if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete")
			{		
			
			  var txt	 = xmlHttp2.responseText;
			//alert(xmlHttp2.responseText);
					if(txt!="")
					 {
					alert(txt);
					location.href='km-plus.php';
					 }	
			  }
	
	}
	
}
