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
		
	}
}

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

function view_img() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		var str=new String();
		str=xmlHttp.responseText;
		document.getElementById('image').innerHTML=str
		//alert(str);
	}
}
//view product
function getPagePro(page,cat)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	
		var url="view_sp_cat.php?page=" + page+ "&cat_id="+ cat;
	
	//alert(url);
	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
		//alert(str);
	}
}


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

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


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

function view_sanpham_Parent() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{
		var str=new String();
		str=xmlHttp.responseText;
		document.getElementById('product').innerHTML=str
		//alert(str);
	}
}
//view product
function getPageVT(page,cat)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	
		var url="view_vattu.php?page=" + page+ "&cat_id="+ cat;
	
	//alert(url);
	xmlHttp.onreadystatechange=view_vt
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

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


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

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


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

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

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

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


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

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


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

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


//hien gia van chuyen
function getNCC(date,id)
{ 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url="view_sp_ncc.php?ncc_id="+id+"&page=" + date;
	
	xmlHttp.onreadystatechange=view_ncc_detail
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

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

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

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

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

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


function popwindow(pop,width,height)
{
	var url = pop;
	var wd = width;
	var he = height;

	window.open(url,"","toolbar=0,menubar=0,scrollbars=yes,resizable=yes,width=" + wd +",height=" + he + ";")
}


