// JavaScript Document
// JavaScript Documentvar xmlHttp
// 01.SubLocations

function showProducts(xurl,str)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 

	var url=xurl;
	url=url+"?cat="+str
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=CategoryChanged 

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function CategoryChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("DivshowProducts").innerHTML=xmlHttp.responseText 
	} 
} 
//---------------------------------------------------------------------------------------------------------

function showProductsList(xurl,cat,str)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 

	var url=xurl;
	url=url+"?cat="+cat +"&subcat="+str
	url=url+"&sid="+Math.random()
	//alert(url);
	xmlHttp.onreadystatechange=SubCategoryChanged 

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function SubCategoryChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("DivshowProductsList").innerHTML=xmlHttp.responseText 
	} 
} 


//---------------------------------------------------------------------------------------------------------

function change_status(xurl,cat,str)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 

	var url=xurl;
	url=url+"?productid="+cat +"&status="+str
	url=url+"&sid="+Math.random()
	//alert(url);
	xmlHttp.onreadystatechange=change_statusChanged 

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function change_statusChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("changedStatus").innerHTML=xmlHttp.responseText 
	} 
} 

//---------------------------------------------------------------------------------------------------------

function change_user_status(xurl,cat,str,usertype)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 

	var url=xurl;
	url=url+"?userid="+cat +"&status="+str+"&user_type="+usertype
	url=url+"&sid="+Math.random()
	//alert(url);
	xmlHttp.onreadystatechange=change_user_statusChanged 

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function change_user_statusChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("changeduserStatus").innerHTML=xmlHttp.responseText 
	} 
} 

//---------------------------------------------------------------------------------------------------------

function more_images(xurl,product,catid,subid)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 

	var url=xurl;
	url=url+"?pid="+product+"&cid="+catid+"&subid="+subid

	url=url+"&sid="+Math.random()

	//alert(url);
	xmlHttp.onreadystatechange=more_images_Div 

	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function more_images_Div() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("more_images_list").innerHTML=xmlHttp.responseText 
	} 
} 

//---------------------------------------------------------------------------------------------------------

function GetXmlHttpObject()
{ 
	var objXMLHttp=null
	if (window.XMLHttpRequest)
	{
		objXMLHttp=new XMLHttpRequest()
	}
	else if (window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
	return objXMLHttp
}
