function GetXmlHttpObject()
{ 
	var objXMLHttp=null;
	if (window.XMLHttpRequest)
	{
		objXMLHttp=new XMLHttpRequest()
	}
	else if (window.ActiveXObject)
	{
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}
		return objXMLHttp
}

//-----------------------------------------------
// view_pro_hot
function getPageHotPro(page)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="view_pro_hot_ajax.php?page=" + page;
	
	xmlHttp.onreadystatechange=view_pro_hot 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


function view_pro_hot() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		var str=new String();
		str=xmlHttp.responseText;
		document.getElementById('pro_hot').innerHTML=str
	}
}
//active cat_pro

/*function activeCatPro(id, stat)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="active_cat_pro.php?id=" + id+"&stat="+stat;
	xmlHttp.onreadystatechange=do_active 
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}


function do_active() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		var str=new String();
		str=xmlHttp.responseText;
		document.getElementById('active').innerHTML=str
	}
}*/
function activeCatPro(doFunc, id, stat)
{
    xmlhttp=new XMLHttpRequest();
    xmlhttp.onreadystatechange= function() { 
        if (xmlhttp.readyState==4)
            if (xmlhttp.status==200)
                doFunc(xmlhttp, id);
    }
	var url="active_cat_pro.php?id=" + id+"&stat="+stat;
	
    xmlhttp.open("GET",url,true);
    xmlhttp.send(null);
	alert(arr.length);
}
function writeHTML(req, id) {
		
		var el = document.getElementById(id);
		
		el.innerHTML=req.responseText;	
	

}
//view product
function getPagePro(page,cat)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="view_pro_ajax.php?page=" + page+"&cat="+ cat;
	xmlHttp.onreadystatechange=view_pro
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function view_pro() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		var str=new String();
		str=xmlHttp.responseText;
		document.getElementById('product').innerHTML=str
	}
}

//view search
function getSearchPro(page, kind, key)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="view_search_ajax.php?page=" + page+"&loai="+ kind+"&key="+key;
	xmlHttp.onreadystatechange=view_search
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function view_search() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		var str=new String();
		str=xmlHttp.responseText;
		document.getElementById('search').innerHTML=str
	}
}

//hien gia van chuyen
function getPrice(date)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="checkdate_ajax.php?date=" + date;
	
	xmlHttp.onreadystatechange=view_price
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function view_price() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		var str=new String();
		str=xmlHttp.responseText;
		document.getElementById('PVC').innerHTML=str
		//document.getElementById('priceVC').value = str;
	}
}
