var varAPsystemHis=0; 
var xmlHttp;
var flagEnterSearchContent = 0;
var curMenuSaleOf = 1;
var curHomeMenuSanPham = 1;
var curHomeMenuDanhThangDuLich = 1;
var curHomeMenuTinTuc = 0;
var curHomeSubMenuTinTuc = 1;

function collapse(idsupport)
{
  document.getElementById(idsupport).className = "menuNormal"
}
function expand(idsupport)
{
	document.getElementById(idsupport).className = "menuHover"
}
function expandSearchMore(idItem)
{
	if(document.getElementById(idItem).style.display == "none")
	{
		document.getElementById(idItem).style.display = "";
	}else
	{
		document.getElementById(idItem).style.display = "none";
	}
}
function expandCombobox(idsupport)
{
	if(document.getElementById(idsupport).className == "menuNormal")
	{
		document.getElementById(idsupport).className = "menuHover";
	}else
	{
		document.getElementById(idsupport).className = "menuNormal";
	}
}
function collapseCombobox(idsupport)
{
  	if(document.getElementById(idsupport) != null)
	{
		document.getElementById(idsupport).className = "menuNormal";
	}
}
function selectListBox(control, idTxtBox, idListBox)
{
	if(control != null)
	{
		//document.getElementById(idTxtBox).value = control.innerHTML.replace(/&amp;/g,"&");;
		document.getElementById(idTxtBox).innerHTML = control.innerHTML.replace(/&amp;/g,"&");;
		document.getElementById("hidSearch").value = control.id;
		document.getElementById(idListBox).className="hiddencbobox";
	}
}

function clickHomeSubMenuTinTuc(idLi, idA, order, lang_type)
{
	if(order!=curHomeSubMenuTinTuc)
	{
		if(order==1)
		{
			document.getElementById(idLi + order).className = "activeli";
			document.getElementById(idA + order).className = "acrive";	
			if(document.getElementById(idLi + 2)!=null){
				document.getElementById(idLi + 2).className = "";
				document.getElementById(idA + 2).className = "";
			}
			if(document.getElementById(idLi + 3)!=null){
				document.getElementById(idLi + 3).className = "";
				document.getElementById(idA + 3).className = "";
			}
		}
		if(order==2)
		{
			document.getElementById(idLi + order).className = "activeli";
			document.getElementById(idA + order).className = "acrive";	
			document.getElementById(idLi + 1).className = "temp";
			document.getElementById(idA + 1).className = "temp";
			if(document.getElementById(idLi + 3)!=null){
				document.getElementById(idLi + 3).className = "";
				document.getElementById(idA + 3).className = "";
			}
		}
		if(order==3)
		{
			document.getElementById(idLi + order).className = "activeli";
			document.getElementById(idA + order).className = "acrive";	
			document.getElementById(idLi + 1).className = "temp";
			document.getElementById(idA + 1).className = "temp";
			document.getElementById(idLi + 2).className = "temp";
			document.getElementById(idA + 2).className = "temp";
		}
		/*
		
		document.getElementById(idLi + order).className = "activeli";
		document.getElementById(idA + order).className = "acrive";
		class_ = "";
		if(curHomeSubMenuTinTuc==1)
		{
			class_ = "temp";
		}
		//alert(class_);
		for(i=1;i<order;i++)
		{
			document.getElementById(idLi + i).className = "temp";
			document.getElementById(idA + i).className = "temp";
		}
		for(i=order+1;i<3;i++)
		{
			document.getElementById(idLi + i).className = "temp";
			document.getElementById(idA + i).className = "temp";
		}*/
		curHomeSubMenuTinTuc = order;
		
		xmlHttpHomeSubMenuTinTuc=GetXmlHttpObject();
		if (xmlHttpHomeSubMenuTinTuc==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		
		var url= "/getHomeSubMenuTinTuc.asp";
		//idDanhMuc = document.getElementById("idDanhMuc").value;
		
		data="idDanhMuc=" + curHomeMenuTinTuc + "&lang_type=" + lang_type + "&order=" + order;
		if(document.getElementById("curTheLoai")!=null){
			data=data + "&curTheLoai=" + document.getElementById("curTheLoai").value;
		}
		
		document.getElementById("ListNews").innerHTML = "<div style='width:100%;text-align:center;'><img src='/images/loading.gif' style='margin-top:90px;margin-bottom:90px;' /></div>";
		xmlHttpHomeSubMenuTinTuc.onreadystatechange=getHomeSubMenuTinTuc;
		
		xmlHttpHomeSubMenuTinTuc.open ("POST", url, true )
		xmlHttpHomeSubMenuTinTuc.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttpHomeSubMenuTinTuc.send (data);
	}
}


function clickHomeNewsDanhThangDuLich_NhipSongNoiThat(id, lang_type)
{
		xmlHttpHomeNewsDanhThangDuLich_NhipSongNoiThat=GetXmlHttpObject();
		if (xmlHttpHomeNewsDanhThangDuLich_NhipSongNoiThat==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		
		var url= "/getHomeDetailDanhThangDuLich_NhipSongNoiThat.asp";
		//idDanhMuc = document.getElementById("idDanhMuc").value;
		
		data="id=" + id + "&lang_type=" + lang_type;
		
		document.getElementById("HomeDanhThangDuLich_Nhipsongnoithat_Content_Detail2").innerHTML = "<div style='width:100%;text-align:center;'><img src='/images/loading.gif' style='margin-top:70px;' /></div>";
		xmlHttpHomeNewsDanhThangDuLich_NhipSongNoiThat.onreadystatechange=getHomeDetailDanhThangDuLich_NhipSongNoiThat;
		
		xmlHttpHomeNewsDanhThangDuLich_NhipSongNoiThat.open ("POST", url, true )
		xmlHttpHomeNewsDanhThangDuLich_NhipSongNoiThat.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttpHomeNewsDanhThangDuLich_NhipSongNoiThat.send (data);
}

function getHomeDetailDanhThangDuLich_NhipSongNoiThat() 
{ 
	if (xmlHttpHomeNewsDanhThangDuLich_NhipSongNoiThat.readyState==4 || xmlHttpHomeNewsDanhThangDuLich_NhipSongNoiThat.readyState=="complete")
	{ 
	document.getElementById("HomeDanhThangDuLich_Nhipsongnoithat_Content_Detail2").innerHTML= xmlHttpHomeNewsDanhThangDuLich_NhipSongNoiThat.responseText;
	} 
} 


function clickHomeSubMenuTinTucPaging(order, page, lang_type)
{
		xmlHttpHomeSubMenuTinTucPaging=GetXmlHttpObject();
		if (xmlHttpHomeSubMenuTinTucPaging==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		
		var url= "/getHomeSubMenuTinTuc.asp";
		//idDanhMuc = document.getElementById("idDanhMuc").value;
		
		data="idDanhMuc=" + curHomeMenuTinTuc + "&p=" + page + "&lang_type=" + lang_type + "&order=" + order;
		
		if(document.getElementById("curTheLoai")!=null){
			data=data + "&curTheLoai=" + document.getElementById("curTheLoai").value;
		}
		
		document.getElementById("ListNews").innerHTML = "<div style='width:100%;text-align:center;'><img src='/images/loading.gif' style='margin-top:90px;margin-bottom:90px;' /></div>";
		xmlHttpHomeSubMenuTinTucPaging.onreadystatechange=getHomeSubMenuTinTucPaging;
		
		xmlHttpHomeSubMenuTinTucPaging.open ("POST", url, true )
		xmlHttpHomeSubMenuTinTucPaging.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttpHomeSubMenuTinTucPaging.send (data);
}

function getHomeSubMenuTinTucPaging() 
{ 
	if (xmlHttpHomeSubMenuTinTucPaging.readyState==4 || xmlHttpHomeSubMenuTinTucPaging.readyState=="complete")
	{ 
	document.getElementById("ListNews").innerHTML= xmlHttpHomeSubMenuTinTucPaging.responseText;
	} 
} 

function getHomeSubMenuTinTuc() 
{ 
	if (xmlHttpHomeSubMenuTinTuc.readyState==4 || xmlHttpHomeSubMenuTinTuc.readyState=="complete")
	{ 
	document.getElementById("ListNews").innerHTML= xmlHttpHomeSubMenuTinTuc.responseText;
	} 
} 


function clickHomeMenuTinTuc(idLi, idA, order, lang_type)
{
	
	if(order!=curHomeMenuTinTuc)
	{
		document.getElementById(idLi + order).className = "activeli";
		document.getElementById(idA + order).className = "acrive";
		if(document.getElementById(idLi + curHomeMenuTinTuc)!=null)
		{
			document.getElementById(idLi + curHomeMenuTinTuc).className = "";
			document.getElementById(idA + curHomeMenuTinTuc).className = "";
		}
		curHomeMenuTinTuc = order;
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		var url= "/getHomeDanhSachTinTheoDanhMuc.asp";
		data="idDanhMuc=" + order + "&lang_type=" + lang_type;
		
		document.getElementById("Home_Middle_Left_News").innerHTML = "<div style='width:100%;text-align:center;'><img src='/images/loading.gif' style='margin-top:100px;margin-bottom:100px;' /></div>";
		xmlHttp.onreadystatechange=getHomeDanhSachTinTheoDanhMuc;
		
		xmlHttp.open ("POST", url, true )
		xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttp.send (data);
	}
}
function getHomeDanhSachTinTheoDanhMuc() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("Home_Middle_Left_News").innerHTML= xmlHttp.responseText;
	} 
} 

function clickHomeMenuDanhThangDuLich(idLi, idA, order, lang_type)
{
	
	if(order!=curHomeMenuDanhThangDuLich)
	{
		document.getElementById(idLi + order).className = "activeli";
		document.getElementById(idA + order).className = "acrive";
		document.getElementById(idLi + curHomeMenuDanhThangDuLich).className = "";
		document.getElementById(idA + curHomeMenuDanhThangDuLich).className = "";
		document.getElementById("HomeDanhThangDuLichContent" + order).style.display="block";
		document.getElementById("HomeDanhThangDuLichContent" + curHomeMenuDanhThangDuLich).style.display="none";
		//alert(order);
		curHomeMenuDanhThangDuLich = order;
		
	}
	
	
	/*xmlHttpHomeListDanhThangDuLich_NhipSongNoiThat=GetXmlHttpObject();
	if (xmlHttpHomeListDanhThangDuLich_NhipSongNoiThat==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url= "getHomeListDanhThangDuLich_NhipSongNoiThat.asp";
	data="order=" + order + "&lang_type=" + lang_type;
	document.getElementById("HomeDanhThangDuLichContent").innerHTML = "<div style='width:100%;text-align:center;'><img src='images/loading.gif' style='margin-top:80px;margin-bottom:80px;' /></div>";
	
	xmlHttpHomeListDanhThangDuLich_NhipSongNoiThat.onreadystatechange=getHomeListDanhThangDuLich_NhipSongNoiThat;
	
	xmlHttpHomeListDanhThangDuLich_NhipSongNoiThat.open ("POST", url, true )
	xmlHttpHomeListDanhThangDuLich_NhipSongNoiThat.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlHttpHomeListDanhThangDuLich_NhipSongNoiThat.send (data);*/
}

function getHomeListDanhThangDuLich_NhipSongNoiThat() 
{ 
	if (xmlHttpHomeListDanhThangDuLich_NhipSongNoiThat.readyState==4 || xmlHttpHomeListDanhThangDuLich_NhipSongNoiThat.readyState=="complete")
	{ 
	document.getElementById("HomeDanhThangDuLichContent").innerHTML= xmlHttpHomeListDanhThangDuLich_NhipSongNoiThat.responseText;
	} 
} 


function clickHomeMenuSanPham(idLi, idA, order, lang_type)
{
	if(order!=curHomeMenuSanPham)
	{
		document.getElementById(idLi + order).className = "activeli";
		document.getElementById(idA + order).className = "acrive";
		if(document.getElementById(idLi + curHomeMenuSanPham)!=null)
		{
			document.getElementById(idLi + curHomeMenuSanPham).className = "";
			document.getElementById(idA + curHomeMenuSanPham).className = "";
		}
		curHomeMenuSanPham = order;
		xmlHttpHomeListSanPham=GetXmlHttpObject();
		
		if (xmlHttpHomeListSanPham==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		var url= "/getHomeListSanPham.asp";
		data="order=" + order + "&lang_type=" + lang_type;
		
		document.getElementById("Home_Middle_Left_Product").innerHTML = "<div style='width:100%;text-align:center;'><img src='/images/loading.gif' style='margin-top:130px;margin-bottom:125px;' /></div>";
		xmlHttpHomeListSanPham.onreadystatechange=getHomeListSanPham;
		
		xmlHttpHomeListSanPham.open ("POST", url, true )
		xmlHttpHomeListSanPham.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttpHomeListSanPham.send (data);
		
	}
}

function getHomeListSanPham() 
{ 
	if (xmlHttpHomeListSanPham.readyState==4 || xmlHttpHomeListSanPham.readyState=="complete")
	{ 
	document.getElementById("Home_Middle_Left_Product").innerHTML= xmlHttpHomeListSanPham.responseText;
	} 
}



function clickHomeMenuSanPham2(idLi, idA, order, lang_type) {
    if (order != curHomeMenuSanPham) {
        document.getElementById(idLi + order).className = "activeli";
        document.getElementById(idA + order).className = "acrive";
        if (document.getElementById(idLi + curHomeMenuSanPham) != null) {
            document.getElementById(idLi + curHomeMenuSanPham).className = "";
            document.getElementById(idA + curHomeMenuSanPham).className = "";
        }
        curHomeMenuSanPham = order;
        /*xmlHttpHomeListSanPham = GetXmlHttpObject();

        if (xmlHttpHomeListSanPham == null) {
            alert("Browser does not support HTTP Request")
            return
        }*/
        //var url = "getHomeListSanPham.asp";
        data = "order=" + order + "&lang_type=" + lang_type;

        //document.getElementById("Home_Middle_Left_Product").innerHTML = "<div style='width:100%;text-align:center;'><img src='images/loading.gif' style='margin-top:130px;margin-bottom:125px;' /></div>";
        document.getElementById("Home_Middle_Left_Product").innerHTML = "<iframe src='/getHomeListSanPham_2.asp?" + data + "' frameborder='0' scrolling='no' height='423' width='610'></iframe>";
        //xmlHttpHomeListSanPham.onreadystatechange = getHomeListSanPham2;

        //xmlHttpHomeListSanPham.open("POST", url, true)
        //xmlHttpHomeListSanPham.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        //xmlHttpHomeListSanPham.send(data);

    }
}


function clickMenuSaleOff(idLi, idA, order, lang_type)
{
	if(order!=curMenuSaleOf)
	{
		document.getElementById(idLi + order).className = "activeli";
		document.getElementById(idA + order).className = "acrive";
		document.getElementById(idLi + curMenuSaleOf).className = "";
		document.getElementById(idA + curMenuSaleOf).className = "";
		curMenuSaleOf = order;
	}
	
	/*
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url= "getListProduct_Product.asp";
	data="idQuality=" + idQuality + "&lang_type=" + lang_type;
	
	xmlHttp.onreadystatechange=getListProduct_Product;
	
	xmlHttp.open ("POST", url, true )
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlHttp.send (data);*/
}
function getListProduct_Product() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("ListProduct").innerHTML= xmlHttp.responseText;
	} 
} 

function clickTabNews_ProductPage(id,num_of_menu,lang_type)
{
	
	var mn = "TabNews" + id;
	var control = document.getElementById(mn);
	if(control != null)
	{
		var classtd = control.className;
		if (classtd != "TabNewsProductPageActive")
		{
			control.className = "TabNewsProductPageActive";
		}
		for(var i=1;i<=num_of_menu;i++)
		{
			if(i != id)	
			{
				var mninactive = "TabNews" + i;
				document.getElementById(mninactive).className = "TabNewsProductPage";	
			}
		}
	}
	
	xmlHttpListTabNews=GetXmlHttpObject();
	if (xmlHttpListTabNews==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url= "/getListTabNews_Product.asp";
	data="idm=" + id + "&lang_type=" + lang_type
	//alert(data);
	xmlHttpListTabNews.onreadystatechange=getListKGSNewsTab;
	
	xmlHttpListTabNews.open ("POST", url, true )
	xmlHttpListTabNews.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlHttpListTabNews.send (data);
}

function getListKGSNewsTab() 
{ 
	if (xmlHttpListTabNews.readyState==4 || xmlHttpListTabNews.readyState=="complete")
	{ 
	document.getElementById("listTabNews").innerHTML= xmlHttpListTabNews.responseText;
	} 
} 


function clickMenuCategoryList(id,num_of_menu,lang_type)
{
	idxCurPageListProduct_main = 1;
	var mn = "mncategorylist" + id;
	var control = document.getElementById(mn);
	if(control != null)
	{
		var classtd = control.className;
		if (classtd != "MenuCategoryListActive")
		{
			control.className = "MenuCategoryListActive";
		}
		for(var i=1;i<=num_of_menu;i++)
		{
			if(i != id)	
			{
				var mninactive = "mncategorylist" + i;
				document.getElementById(mninactive).className = "MenuCategoryList";	
			}
		}
		
		xmlHttpListProduct=GetXmlHttpObject();
		if (xmlHttpListProduct==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		
		var url= "/getListProduct_main.asp";
		data="idFilterProduct=" + id + "&lang_type=" + lang_type;
		
		xmlHttpListProduct.onreadystatechange=getListProduct_main;
		
		xmlHttpListProduct.open ("POST", url, true )
		xmlHttpListProduct.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttpListProduct.send (data);
	}
}
function getListProduct_main() 
{ 
	if (xmlHttpListProduct.readyState==4 || xmlHttpListProduct.readyState=="complete")
	{ 
	document.getElementById("ListProduct").innerHTML= xmlHttpListProduct.responseText;
	} 
} 

/*function clickMenuKienTrucTab(id,num_of_menu,lang_type)
{
	clearTimeout(timerKienTrucTab);
	idxCurPageListKientruc = 1;	
	var mn = "mncategorylist" + id;
	var control = document.getElementById(mn);
	curKienTrucTab = id;
	if(control != null)
	{
		var classtd = control.className;
		if (classtd != "MenuCategoryListActive")
		{
			control.className = "MenuCategoryListActive";
		}
		for(var i=1;i<=num_of_menu;i++)
		{
			if(i != id)	
			{
				var mninactive = "mncategorylist" + i;
				document.getElementById(mninactive).className = "MenuCategoryList";	
			}
		}
		
		xmlHttpListProduct=GetXmlHttpObject();
		if (xmlHttpListProduct==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		
		var url= "getListKientruc.asp";
		data="idFilterKienTruc=" + id + "&lang_type=" + lang_type;
		
		xmlHttpListProduct.onreadystatechange=getListKientruc;
		
		xmlHttpListProduct.open ("POST", url, true )
		xmlHttpListProduct.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttpListProduct.send (data);
		
	}
}
function getListKientruc() 
{ 
	if (xmlHttpListProduct.readyState==4 || xmlHttpListProduct.readyState=="complete")
	{ 
	document.getElementById("ListKienTruc").innerHTML= xmlHttpListProduct.responseText;
	} 
} */

function clickTabTypeProduct_ListProduct(id,num_of_menu,lang_type)
{
	idxCurPageListProduct_main = 1;
	var mn = "mncategorylist" + id;
	var control = document.getElementById(mn);
	if(control != null)
	{
		var classtd = control.className;
		if (classtd != "MenuCategoryListActive")
		{
			control.className = "MenuCategoryListActive";
		}
		for(var i=1;i<=num_of_menu;i++)
		{
			if(i != id)	
			{
				var mninactive = "mncategorylist" + i;
				document.getElementById(mninactive).className = "MenuCategoryList";	
			}
		}
		
		xmlHttpListProduct_ListProduct=GetXmlHttpObject();
		if (xmlHttpListProduct_ListProduct==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		
		var url= "/getListProduct_ListProduct.asp";

		data="idFilterProduct=" + id + "&lang_type=" + lang_type;
		
		xmlHttpListProduct_ListProduct.onreadystatechange=getListProduct_ListProduct;
		
		xmlHttpListProduct_ListProduct.open ("POST", url, true )
		xmlHttpListProduct_ListProduct.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttpListProduct_ListProduct.send (data);
	}
}
function getListProduct_ListProduct() 
{ 
	if (xmlHttpListProduct_ListProduct.readyState==4 || xmlHttpListProduct_ListProduct.readyState=="complete")
	{ 
	document.getElementById("ListProduct").innerHTML= xmlHttpListProduct_ListProduct.responseText;
	} 
} 

function clickTabTypeProduct_ProductDetail(id,num_of_menu,idType,price,lang_type)
{
	idxCurPageListProduct_main = 1;
	var mn = "mncategorylist" + id;
	var control = document.getElementById(mn);
	if(control != null)
	{
		var classtd = control.className;
		if (classtd != "MenuCategoryListActive")
		{
			control.className = "MenuCategoryListActive";
		}
		for(var i=1;i<=num_of_menu;i++)
		{
			if(i != id)	
			{
				var mninactive = "mncategorylist" + i;
				document.getElementById(mninactive).className = "MenuCategoryList";	
			}
		}
		
		xmlHttpListProductDetail=GetXmlHttpObject();
		if (xmlHttpListProductDetail==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		
		var url= "/getListProduct_ProductDetail.asp";
		data="idType=" + idType + "&price=" + price + "&lang_type=" + lang_type;
		
		xmlHttpListProductDetail.onreadystatechange=getListProduct__ProductDetail;
		
		xmlHttpListProductDetail.open ("POST", url, true )
		xmlHttpListProductDetail.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttpListProductDetail.send (data);
	}
}
function getListProduct__ProductDetail() 
{ 
	if (xmlHttpListProductDetail.readyState==4 || xmlHttpListProductDetail.readyState=="complete")
	{ 
	document.getElementById("ListProduct").innerHTML= xmlHttpListProductDetail.responseText;
	} 
} 

function overMenuCategoryList(id)
{
	var mn = "mncategorylist" + id;
	var control = document.getElementById(mn);
	if(control != null)
	{
		var classtd = control.className;
		if (classtd != "MenuCategoryListActive")
		{
			control.className = "MenuCategoryListHover";
		}
	}
}
function outMenuCategoryList(id)
{
	var mn = "mncategorylist" + id;
	var control = document.getElementById(mn);
	if(control != null)
	{
		var classtd = control.className;
		if (classtd != "MenuCategoryListActive")
		{
			control.className = "MenuCategoryList";
		}
	}
}

function GetXmlHttpObject()
{ 
var objXMLHttp=null
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
} 

function clickTabCategory(id, idCategory, lang_type)
{
	
	var mn = "mncategory" + id;
	var control = document.getElementById(mn);
	if(control != null)
	{
		var classtd = control.className;
		if (classtd != "TabCategoryActive")
		{
			control.className = "TabCategoryActive";
		}
		for(var i=1;i<=5;i++)
		{
			if(i != id)	
			{
				var mninactive = "mncategory" + i;
				if(document.getElementById(mninactive) != null)
				{
					document.getElementById(mninactive).className = "TabCategory";	
				}
			}
		}
	}
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url= "/getListSubCategory_main.asp";
	data="idCategory=" + idCategory + "&lang_type=" + lang_type
	
	xmlHttp.onreadystatechange=getListSubCategory_main;
	
	xmlHttp.open ("POST", url, true )
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlHttp.send (data);
}

function getListSubCategory_main() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("listSubCategory").innerHTML= xmlHttp.responseText;
	} 
} 


function clickTabCountryKientruc(id, idCountry, lang_type)
{
	idxCurPageListNewsKT = 1;
	var mn = "mncategory" + id;
	var control = document.getElementById(mn);
	if(control != null)
	{
		var classtd = control.className;
		if (classtd != "TabCategoryActive")
		{
			control.className = "TabCategoryActive";
		}
		for(var i=1;i<=5;i++)
		{
			if(i != id)	
			{
				var mninactive = "mncategory" + i;
				if(document.getElementById(mninactive) != null)
				{
					document.getElementById(mninactive).className = "TabCategory";	
				}
			}
		}
	}
	
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url= "/getListKTNewsOfCountry.asp";
	data="idCountry=" + idCountry + "&lang_type=" + lang_type
	
	xmlHttp.onreadystatechange=getListKTNewsOfCountry;
	
	xmlHttp.open ("POST", url, true )
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlHttp.send (data);
}

function getListKTNewsOfCountry() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("listKTNews").innerHTML= xmlHttp.responseText;
	} 
} 

function overTabCategory(id)
{
	var mn = "mncategory" + id;
	var control = document.getElementById(mn);
	if(control != null)
	{
		var classtd = control.className;
		if (classtd != "TabCategoryActive")
		{
			control.className = "TabCategoryHover";
		}
	}
}
function outTabCategory(id)
{
	var mn = "mncategory" + id;
	var control = document.getElementById(mn);
	if(control != null)
	{
		var classtd = control.className;
		if (classtd != "TabCategoryActive")
		{
			control.className = "TabCategory";
		}
	}
}
function clickTabDanhMuc_BangMau(id,num_of_menu)
{
	
	var mn = "mncategorylist" + id;
	var control = document.getElementById(mn);
	if(control != null)
	{
		var classtd = control.className;
		if (classtd != "MenuCategoryListActive")
		{
			control.className = "MenuCategoryListActive";
		}
		for(var i=1;i<=num_of_menu;i++)
		{
			if(i != id)	
			{
				var mninactive = "mncategorylist" + i;
				if (document.getElementById(mninactive)!=null)
				{
					document.getElementById(mninactive).className = "MenuCategoryList";	
				}
			}
		}
	}
}


function overTabNews_ProductPage(id)
{
	var mn = "TabNews" + id;
	var control = document.getElementById(mn);
	if(control != null)
	{
		var classtd = control.className;
		if (classtd != "TabNewsProductPageActive")
		{
			control.className = "TabNewsProductPageHover";
		}
	}
}
function outTabNews_ProductPage(id)
{
	var mn = "TabNews" + id;
	var control = document.getElementById(mn);
	if(control != null)
	{
		var classtd = control.className;
		if (classtd != "TabNewsProductPageActive")
		{
			control.className = "TabNewsProductPage";
		}
	}
}
function focusTextbox(control)
{
	if (flagEnterSearchContent == 0)
	{	
		control.value='';
		flagEnterSearchContent = 1;
	}
}
function blurTextbox(control,lang_type)
{
	if (control.value == "")
	{	
		if (lang_type=="en")
		{
			control.value='Enter search content here';
		}
		else if (lang_type=="vn")
		{
			control.value='Từ khóa tìm kiếm';	
		}
		
		flagEnterSearchContent = 0;
	}
}






var duration = 1000;  /* 1000 millisecond fade = 1 sec */
var steps = 10;       /* number of opacity intervals   */
var delay = 5000;     /* 5 sec delay before fading out */
var increase = 1;
var idxCurPageCategory_Product = 1;
function goNextCategory(totalPage, widthContainer)
{
	var nextPage = idxCurPageCategory_Product + 1;
	var controlPage = document.getElementById("pageCategory");
	if (controlPage!=null)
	{
		controlPage.style.left = parseInt(controlPage.offsetLeft - 1) + "px";
		setTimeout("subLeft('pageCategory',70,-" + widthContainer*idxCurPageCategory_Product + ")", 1/100000);
	}
	if(nextPage==2)
	{
		document.getElementById("previousCategory").style.display = "block";
		document.getElementById("inactivePreviousCategory").style.display = "none";	
	}
	if(nextPage==totalPage)
	{
		document.getElementById("inactiveNextCategory").style.display = "block";
		document.getElementById("nextCategory").style.display = "none";
	}
	idxCurPageCategory_Product = nextPage;
	
	/*var nextPage = idxCurPageCategory_Product + 1;
	var controlNextPage = document.getElementById("page"+nextPage);
	var controlCurPage = document.getElementById("page"+idxCurPageCategory_Product);
	if (controlNextPage!=null && controlCurPage!=null)
	{
		controlNextPage.style.left = parseInt(controlNextPage.offsetLeft - 1*idxCurPageCategory_Product) + "px";
		controlCurPage.style.left = parseInt(controlCurPage.offsetLeft - 1*idxCurPageCategory_Product) + "px";
		setTimeout("subLeftToDisplay('page" + nextPage + "',70,0)", 1/10);
		setTimeout("subLeftToHidden('page" + idxCurPageCategory_Product + "',70,-700)", 1/10);
	}
	if(nextPage==totalPage)
	{
		document.getElementById("inactiveNextCategory").style.display = "block";
		document.getElementById("nextCategory").style.display = "none";
	}
	idxCurPageCategory_Product = nextPage;*/
	
}
function goPreviousCategory(totalPage, widthContainer)
{
	var previousPage = idxCurPageCategory_Product -1;
	var controlPage = document.getElementById("pageCategory");
	if (controlPage!=null)
	{
		controlPage.style.left = parseInt(controlPage.offsetLeft + 1) + "px";
		setTimeout("addLeft('pageCategory',70,-" + widthContainer*(previousPage-1) + ")", 1/100000);
	}
	if(previousPage==1)
	{
		document.getElementById("previousCategory").style.display = "none";
		document.getElementById("inactivePreviousCategory").style.display = "block";	
	}
	if(previousPage<totalPage)
	{
		document.getElementById("inactiveNextCategory").style.display = "none";
		document.getElementById("nextCategory").style.display = "block";
	}
	idxCurPageCategory_Product = previousPage;
}


//========================================================================
//=====================START==============================================
//========================================================================
var idxCurPageListProduct_Product = 1;
function goNextListProduct(totalPage, widthContainer)
{
	var nextPage = idxCurPageListProduct_Product + 1;
	var controlPage = document.getElementById("pageProduct");
	if (controlPage!=null)
	{
		controlPage.style.left = parseInt(controlPage.offsetLeft - 1) + "px";
		setTimeout("subLeftListProduct('pageProduct',34,-" + widthContainer*idxCurPageListProduct_Product + ")", 1/100000);
	}
	if(nextPage==2)
	{
		document.getElementById("previousListProduct").style.display = "block";
		document.getElementById("inactivePreviousListProduct").style.display = "none";	
	}
	if(nextPage==totalPage)
	{
		document.getElementById("inactiveNextListProduct").style.display = "block";
		document.getElementById("nextListProduct").style.display = "none";
	}
	idxCurPageListProduct_Product = nextPage;

}
function goPreviousListProduct(totalPage, widthContainer)
{
	var previousPage = idxCurPageListProduct_Product -1;
	var controlPage = document.getElementById("pageProduct");
	if (controlPage!=null)
	{
		controlPage.style.left = parseInt(controlPage.offsetLeft + 1) + "px";
		setTimeout("addLeftListProduct('pageProduct',34,-" + widthContainer*(previousPage-1) + ")", 1/100000);
	}
	if(previousPage==1)
	{
		document.getElementById("previousListProduct").style.display = "none";
		document.getElementById("inactivePreviousListProduct").style.display = "block";	
	}
	if(previousPage<totalPage)
	{
		document.getElementById("inactiveNextListProduct").style.display = "none";
		document.getElementById("nextListProduct").style.display = "block";
	}
	idxCurPageListProduct_Product = previousPage;
}
function subLeftListProduct(controlName, idx, leftLimit)
{
	var curLeftControl = document.getElementById(controlName).offsetLeft;
	if(curLeftControl > leftLimit)
	{
		document.getElementById(controlName).style.left	= parseInt(curLeftControl - idx) + "px";
		setTimeout("subLeftListProduct('" + controlName + "',34," + leftLimit + ")", 1/100000);
	}
	
}
function addLeftListProduct(controlName, idx, leftLimit)
{
	var curLeftControl = document.getElementById(controlName).offsetLeft;
	//ex: leftLimit = 0;
	if(curLeftControl < leftLimit)
	{
		document.getElementById(controlName).style.left	= parseInt(curLeftControl + idx) + "px";
		setTimeout("addLeftListProduct('" + controlName + "',34," + leftLimit + ")", 1/100000);
	}
	
}
//========================================================================
//=====================END==============================================
//========================================================================



//========================================================================
//=====================START==============================================
//========================================================================
var idxCurPageListProduct_main = 1;
function goNextListProduct_main(totalPage, widthContainer)
{
	var nextPage = idxCurPageListProduct_main + 1;
	var controlPage = document.getElementById("pageProduct");
	if (controlPage!=null)
	{
		controlPage.style.left = parseInt(controlPage.offsetLeft - 1) + "px";
		setTimeout("subLeftListProduct_main('pageProduct',72,-" + widthContainer*idxCurPageListProduct_main + ")", 1/100000);
	}
	if(nextPage==2)
	{
		document.getElementById("previousListProduct").style.display = "block";
		document.getElementById("inactivePreviousListProduct").style.display = "none";	
	}
	if(nextPage==totalPage)
	{
		document.getElementById("inactiveNextListProduct").style.display = "block";
		document.getElementById("nextListProduct").style.display = "none";
	}
	idxCurPageListProduct_main = nextPage;

}
function goPreviousListProduct_main(totalPage, widthContainer)
{
	var previousPage = idxCurPageListProduct_main -1;
	var controlPage = document.getElementById("pageProduct");
	if (controlPage!=null)
	{
		controlPage.style.left = parseInt(controlPage.offsetLeft + 1) + "px";
		setTimeout("addLeftListProduct_main('pageProduct',72,-" + widthContainer*(previousPage-1) + ")", 1/100000);
	}
	if(previousPage==1)
	{
		document.getElementById("previousListProduct").style.display = "none";
		document.getElementById("inactivePreviousListProduct").style.display = "block";	
	}
	if(previousPage<totalPage)
	{
		document.getElementById("inactiveNextListProduct").style.display = "none";
		document.getElementById("nextListProduct").style.display = "block";
	}
	idxCurPageListProduct_main = previousPage;
}
function subLeftListProduct_main(controlName, idx, leftLimit)
{
	var curLeftControl = document.getElementById(controlName).offsetLeft;
	if(curLeftControl > leftLimit)
	{
		document.getElementById(controlName).style.left	= parseInt(curLeftControl - idx) + "px";
		setTimeout("subLeftListProduct_main('" + controlName + "',72," + leftLimit + ")", 1/100000);
	}
	
}
function addLeftListProduct_main(controlName, idx, leftLimit)
{
	var curLeftControl = document.getElementById(controlName).offsetLeft;
	//ex: leftLimit = 0;
	if(curLeftControl < leftLimit)
	{
		document.getElementById(controlName).style.left	= parseInt(curLeftControl + idx) + "px";
		setTimeout("addLeftListProduct_main('" + controlName + "',72," + leftLimit + ")", 1/100000);
	}
	
}
//========================================================================
//=====================END==============================================
//========================================================================


//*******************************************************************************************

//========================================================================
//=====================START==============================================
//========================================================================
function clickProduct(idProduct,lang_type)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url= "/getProduct.asp";
	data="idProduct=" + idProduct + "&lang_type=" + lang_type;
	
	xmlHttp.onreadystatechange=getProduct;
	
	xmlHttp.open ("POST", url, true )
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlHttp.send (data);
}

function getProduct() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("showLargeProduct").innerHTML= xmlHttp.responseText;
	} 
} 
//========================================================================
//=====================END==============================================
//========================================================================



//========================================================================
//=====================START==============================================
//========================================================================
var idxCurPageListKientruc = 1;
function goNextListKientruc(totalPage, widthContainer)
{
	var nextPage = idxCurPageListKientruc + 1;
	var controlPage = document.getElementById("pageProduct");
	if (controlPage!=null)
	{
		//controlPage.style.left = parseInt(controlPage.offsetLeft - 14) + "px";
		setTimeout("subLeftListKientruc('pageProduct',71,-" + widthContainer*idxCurPageListKientruc + ")", 1/100000);
	}
	if(nextPage==2)
	{
		document.getElementById("previousListProduct").style.display = "block";
		document.getElementById("inactivePreviousListProduct").style.display = "none";	
	}
	if(nextPage==totalPage)
	{
		document.getElementById("inactiveNextListProduct").style.display = "block";
		document.getElementById("nextListProduct").style.display = "none";
	}
	idxCurPageListKientruc = nextPage;

}
function goPreviousListKientruc(totalPage, widthContainer)
{
	var previousPage = idxCurPageListKientruc -1;
	var controlPage = document.getElementById("pageProduct");
	if (controlPage!=null)
	{
		//controlPage.style.left = parseInt(controlPage.offsetLeft + 14) + "px";
		setTimeout("addLeftListKientruc('pageProduct',71,-" + widthContainer*(previousPage-1) + ")", 1/100000);
	}
	if(previousPage==1)
	{
		document.getElementById("previousListProduct").style.display = "none";
		document.getElementById("inactivePreviousListProduct").style.display = "block";	
	}
	if(previousPage<totalPage)
	{
		document.getElementById("inactiveNextListProduct").style.display = "none";
		document.getElementById("nextListProduct").style.display = "block";
	}
	idxCurPageListKientruc = previousPage;
}
function subLeftListKientruc(controlName, idx, leftLimit)
{
	var curLeftControl = document.getElementById(controlName).offsetLeft;
	if(curLeftControl > leftLimit)
	{
		document.getElementById(controlName).style.left	= parseInt(curLeftControl - idx) + "px";
		setTimeout("subLeftListKientruc('" + controlName + "',71," + leftLimit + ")", 1/100000);
	}
	
}
function addLeftListKientruc(controlName, idx, leftLimit)
{
	var curLeftControl = document.getElementById(controlName).offsetLeft;
	//ex: leftLimit = 0;
	if(curLeftControl < leftLimit)
	{
		document.getElementById(controlName).style.left	= parseInt(curLeftControl + idx) + "px";
		setTimeout("addLeftListKientruc('" + controlName + "',71," + leftLimit + ")", 1/100000);
	}
	
}
//========================================================================
//=====================END==============================================
//========================================================================


//========================================================================
//=====================START (Phan trang Home Kien Truc)==============================================
//========================================================================
var idxCurPageListNewsKT = 1;
function goNextListNewsKT(totalPage, widthContainer)
{
	var nextPage = idxCurPageListNewsKT + 1;
	var controlPage = document.getElementById("pageListNewsKT");
	if (controlPage!=null)
	{
		controlPage.style.left = parseInt(controlPage.offsetLeft - 9) + "px";
		setTimeout("subLeftListNewsKT('pageListNewsKT',44,-" + widthContainer*idxCurPageListNewsKT + ")", 1/100000);
	}
	if(nextPage==2)
	{
		document.getElementById("previousListNewsKT").style.display = "block";
		document.getElementById("inactivePreviousListNewsKT").style.display = "none";	
	}
	if(nextPage==totalPage)
	{
		document.getElementById("inactiveNextListNewsKT").style.display = "block";
		document.getElementById("nextListNewsKT").style.display = "none";
	}
	idxCurPageListNewsKT = nextPage;

}
function goPreviousListNewsKT(totalPage, widthContainer)
{
	var previousPage = idxCurPageListNewsKT -1;
	var controlPage = document.getElementById("pageListNewsKT");
	if (controlPage!=null)
	{
		controlPage.style.left = parseInt(controlPage.offsetLeft + 9) + "px";
		setTimeout("addLeftListNewsKT('pageListNewsKT',44,-" + widthContainer*(previousPage-1) + ")", 1/100000);
	}
	if(previousPage==1)
	{
		document.getElementById("previousListNewsKT").style.display = "none";
		document.getElementById("inactivePreviousListNewsKT").style.display = "block";	
	}
	if(previousPage<totalPage)
	{
		document.getElementById("inactiveNextListNewsKT").style.display = "none";
		document.getElementById("nextListNewsKT").style.display = "block";
	}
	idxCurPageListNewsKT = previousPage;
}
function subLeftListNewsKT(controlName, idx, leftLimit)
{
	var curLeftControl = document.getElementById(controlName).offsetLeft;
	if(curLeftControl > leftLimit)
	{
		document.getElementById(controlName).style.left	= parseInt(curLeftControl - idx) + "px";
		setTimeout("subLeftListNewsKT('" + controlName + "',44," + leftLimit + ")", 1/100000);
	}
	
}
function addLeftListNewsKT(controlName, idx, leftLimit)
{
	var curLeftControl = document.getElementById(controlName).offsetLeft;
	//ex: leftLimit = 0;
	if(curLeftControl < leftLimit)
	{
		document.getElementById(controlName).style.left	= parseInt(curLeftControl + idx) + "px";
		setTimeout("addLeftListNewsKT('" + controlName + "',44," + leftLimit + ")", 1/100000);
	}
	
}
//========================================================================
//=====================END==============================================
//========================================================================




function subLeft(controlName, idx, leftLimit)
{
	var curLeftControl = document.getElementById(controlName).offsetLeft;
	if(curLeftControl > leftLimit)
	{
		document.getElementById(controlName).style.left	= parseInt(curLeftControl - idx) + "px";
		setTimeout("subLeft('" + controlName + "',70," + leftLimit + ")", 1/100000);
	}
	
}
function addLeft(controlName, idx, leftLimit)
{
	var curLeftControl = document.getElementById(controlName).offsetLeft;
	//ex: leftLimit = 0;
	if(curLeftControl < leftLimit)
	{
		document.getElementById(controlName).style.left	= parseInt(curLeftControl + idx) + "px";
		setTimeout("addLeft('" + controlName + "',70," + leftLimit + ")", 1/100000);
	}
	
}
/*function subLeftToHidden(controlName, idx, leftLimit)
{
	var curLeftControl = document.getElementById(controlName).offsetLeft;
	//ex: leftLimit = -700;
	if(curLeftControl > leftLimit)
	{
		document.getElementById(controlName).style.left	= parseInt(curLeftControl - idx) + "px";
	}
	setTimeout("subLeftToDisplay('" + controlName + "',70," + leftLimit + ")", 1/10);
}*/
function fadeIn(){
  for (i = 0; i <= 1; i += (1 / steps)) {
    setTimeout("setOpacity(" + i + ")", i * duration);
  }
}
function fadeOut() {
  for (i = 0; i <= 1; i += (1 / steps)) {
    setTimeout("setOpacity(" + (1 - i) + ")", i * duration);
  }
}
function setOpacity(level) {
  document.getElementById("category").style.opacity = level;
  document.getElementById("category").style.MozOpacity = level;
  document.getElementById("category").style.KhtmlOpacity = level;
  document.getElementById("category").style.filter = "alpha(opacity=" + (level * 100) + ");";
}

var tmp_offsetLeft_SubWindow = 0;
var tmp_offsetTop_SubWindow = 0;
function overProductLinkBottom(idLink,idSpan)
{
	//tmp_offsetLeft_SubWindow = document.getElementById(idSpan).offsetLeft;
	//tmp_offsetTop_SubWindow = document.getElementById(idSpan).offsetTop;
	if (document.getElementById(idSpan) != null)
	{
		document.getElementById(idSpan).style.display = "";
		document.getElementById(idSpan).style.left = parseInt(document.getElementById(idSpan).offsetLeft + 10) + "px" ;//parseInt(widthLink + 5) + "px" ;
		document.getElementById(idSpan).style.top = parseInt(document.getElementById(idSpan).offsetTop - 25) + "px"; //parseInt(topLink - 50) + "px";
		//alert(document.getElementById(idSpan).offsetLeft);
		//alert(tmp_offsetLeft_SubWindow);
	}
}
function outProductLinkBottom(idSpan)
{
	if (document.getElementById(idSpan) != null)
	{
//		alert(document.getElementById(idSpan).offsetLeft);
		document.getElementById(idSpan).style.left = parseInt(document.getElementById(idSpan).offsetLeft - 10) + "px" ;//parseInt(widthLink + 5) + "px" ;
		document.getElementById(idSpan).style.top = parseInt(document.getElementById(idSpan).offsetTop + 25) + "px";
		document.getElementById(idSpan).style.display = "none";
	}
}
function overCmbBoxItem(control)
{
	if (control !=null)	
	{
		control.className = "CmBoxHover";	
	}
}
function outCmbBoxItem(control)
{
	if (control !=null)	
	{
		control.className = "CmBox";	
	}
}
function clickCmbBoxItem(page_load, variable, itemValue)
{
	document.location.href=page_load + variable + "=" + itemValue;
}

function MouseOverPageNumber(control)
{
	if (control !=null)	
	{
		control.className = "PageNumberActive";	
	}
}
function MouseOverPageNumberSpan(control)
{
	if (control !=null)	
	{
		control.className = "PageNumberSpanActive";	
	}
}
function MouseOutPageNumber(control)
{
	if (control !=null)	
	{
		control.className = "PageNumberInActive";	
	}
}
function MouseOutPageNumberSpan(control)
{
	if (control !=null)	
	{
		control.className = "PageNumberSpanInActive";	
	}
}
function clickPage(page_load, page)
{
	document.location.href=page_load + "p=" + page;
}


function clickPageHomeProduct2(page, order, subOrder, lang_type) {
    /*xmlHttpPageHomeProduct = GetXmlHttpObject();
    if (xmlHttpPageHomeProduct == null) {
        alert("Browser does not support HTTP Request")
        return
    }
    var url = "getHomeListSanPham.asp";*/
    data = "p=" + page + "&order=" + order + "&subOrder=" + subOrder + "&lang_type=" + lang_type;
    document.location.href = "?" + data;
    //document.getElementById("Home_Middle_Left_Product").innerHTML = "<div style='width:100%;text-align:center;'><img src='images/loading.gif' style='margin-top:130px;margin-bottom:125px;' /></div>";
    //xmlHttpPageHomeProduct.onreadystatechange = getPageHomeProduct;

    //xmlHttpPageHomeProduct.open("POST", url, true)
    //xmlHttpPageHomeProduct.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    //xmlHttpPageHomeProduct.send(data);
}


function clickPageHomeProduct(page, order, subOrder, lang_type)
{
	xmlHttpPageHomeProduct=GetXmlHttpObject();
	if (xmlHttpPageHomeProduct==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url= "/getHomeListSanPham.asp";
	data="p=" + page + "&order=" + order + "&subOrder=" + subOrder + "&lang_type=" + lang_type;
	document.getElementById("Home_Middle_Left_Product").innerHTML = "<div style='width:100%;text-align:center;'><img src='/images/loading.gif' style='margin-top:130px;margin-bottom:125px;' /></div>";
	xmlHttpPageHomeProduct.onreadystatechange=getPageHomeProduct;
	
	xmlHttpPageHomeProduct.open ("POST", url, true )
	xmlHttpPageHomeProduct.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlHttpPageHomeProduct.send (data);
}

function getPageHomeProduct() 
{ 
	if (xmlHttpPageHomeProduct.readyState==4 || xmlHttpPageHomeProduct.readyState=="complete")
	{ 
		document.getElementById("Home_Middle_Left_Product").innerHTML= xmlHttpPageHomeProduct.responseText;
	} 
} 

//*******************************************************************************************

//========================================================================
//=====================Rotate 360==============================================
//========================================================================
function rotate360(idProduct)
{
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	{
		alert ("Browser does not support HTTP Request")
		return
	} 
	var url= "/getRotate360File.asp";
	data="idProduct=" + idProduct;
	
	xmlHttp.onreadystatechange=getRotate360File;
	
	xmlHttp.open ("POST", url, true )
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlHttp.send (data);
}

function getRotate360File() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
	document.getElementById("showLargeProduct").innerHTML= xmlHttp.responseText;
	} 
} 
//========================================================================
//=====================END==============================================
//========================================================================


//*******************************************************************************************
//========================================================================
//=====================Click Tag KT==============================================
//========================================================================
var idxCurTagKT = 1;
function clickTagKienTrucTab(id,num_of_menu,lang_type)
{
	idxCurTagKT = 1;
	var mn = "mnTagKTTab" + id;
	var control = document.getElementById(mn);
	if(control != null)
	{
		var classtd = control.className;
		if (classtd != "TagKTActive")
		{
			control.className = "TagKTActive";
		}
		for(var i=1;i<=num_of_menu;i++)
		{
			if(i != id)	
			{
				var mninactive = "mnTagKTTab" + i;
				document.getElementById(mninactive).className = "TagKT";	
			}
		}
		
		xmlHttpTagKT=GetXmlHttpObject();
		if (xmlHttpListProduct==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		
		var url= "/getListTagKientruc.asp";
		data="idTagKienTruc=" + id + "&lang_type=" + lang_type;
		
		xmlHttpTagKT.onreadystatechange=getListTagKientruc;
		
		xmlHttpTagKT.open ("POST", url, true )
		xmlHttpTagKT.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttpTagKT.send (data);
	}
}
function getListTagKientruc() 
{ 
	if (xmlHttpTagKT.readyState==4 || xmlHttpTagKT.readyState=="complete")
	{ 
	document.getElementById("listTagKienTruc").innerHTML= xmlHttpTagKT.responseText;
	} 
} 

function overTagKienTrucTab(id)
{
	var mn = "mnTagKTTab" + id;
	var control = document.getElementById(mn);
	if(control != null)
	{
		var classtd = control.className;
		if (classtd != "TagKTActive")
		{
			control.className = "TagKTHover";
		}
	}
}
function outTagKienTrucTab(id)
{
	var mn = "mnTagKTTab" + id;
	var control = document.getElementById(mn);
	if(control != null)
	{
		var classtd = control.className;
		if (classtd != "TagKTActive")
		{
			control.className = "TagKT";
		}
	}
}
//========================================================================
//=====================END==============================================
//========================================================================



//*******************************************************************************************
//========================================================================
//=====================getShortNewsKT==============================================
//========================================================================
function getShortNewsKT(id,lang_type)
{
		xmlHttpShortNewsKT=GetXmlHttpObject();
		if (xmlHttpListProduct==null)
		{
			alert ("Browser does not support HTTP Request")
			return
		} 
		
		var url= "/getShortNewsKT.asp";
		data="idn=" + id + "&lang_type=" + lang_type;
		
		xmlHttpShortNewsKT.onreadystatechange=returnShortNewsKT;
		
		xmlHttpShortNewsKT.open ("POST", url, true )
		xmlHttpShortNewsKT.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		xmlHttpShortNewsKT.send (data);
}
function returnShortNewsKT() 
{ 
	if (xmlHttpShortNewsKT.readyState==4 || xmlHttpShortNewsKT.readyState=="complete")
	{ 
	document.getElementById("shortNewsKT").innerHTML= xmlHttpShortNewsKT.responseText;
	} 
} 
//========================================================================
//=====================END==============================================
//========================================================================



//*******************************************************************************************
//========================================================================
//=====================ToggleMenu==============================================
//========================================================================
function ToggleMenu(charID, charButtonImgID, charRowID, order, num_of_menu)
{
	var idx = 1;
	var elm = document.getElementById(charID + order);
	var img = document.getElementById(charButtonImgID + order);	
	var row = document.getElementById(charRowID + order);	
	var className = elm.className;
	if(className=="TitleNewsTypeActive"){
		/*elm.className = "TitleNewsTypeInActive";
		img.src = "images/icon_tin.gif";
		row.className = "MenuSection";*/
	}else{
		if((elm!=null) && (img!=null) && (row!=null)){
			elm.className = "TitleNewsTypeActive";
			img.src = "/images/icon_tin_active.gif";
			row.className = "MenuSectionBlock";
			for(idx=1; idx <= num_of_menu; idx++)
			{
				var elm_other = document.getElementById(charID + idx);
				var img_other = document.getElementById(charButtonImgID + idx);	
				var row_other = document.getElementById(charRowID + idx);
				if(idx != order){
					if((elm_other!=null) && (img_other!=null) && (row_other!=null)){
						elm_other.className = "TitleNewsTypeInActive";
						img_other.src = "/images/icon_tin.gif";
						row_other.className = "MenuSection";	
					}
				}
			}
		}
	}
}
//========================================================================
//=====================END==============================================
//========================================================================



function Chk_strfunction(Cstring) {

	var arrInWord=new Array("select","update","delete","*","~","%","`","<",">","?","$","(","{","[","]","}",")",";","|","!");
	var i ;
	var t = Cstring;
	for ( i=0; i<arrInWord.length; i++ )
	{
		if (t.indexOf(arrInWord[i])>=0){
			return false;	
		}
		/*if( inword.indexOf(t.substring(i,i+1)) >=0){
			break;
		}
	
		if ( i !=arrInWord.length)
		{	
		return false;
		} 
	
		*/
	
	}
	return true ; 
}



/*====================================================*/
/*==========Light View Start==========================*/
function hideDiv() { 
if (document.getElementById) { // DOM3 = IE5, NS6 
document.getElementById('hideshow').style.visibility = 'hidden'; 
document.getElementById('ProductContainer').style.visibility = 'visible'; 
} 
else { 
if (document.layers) { // Netscape 4 
document.hideshow.visibility = 'hidden'; 
document.ProductContainer.visibility = 'visible'; 
} 
else { // IE 4 
document.all.hideshow.style.visibility = 'hidden'; 
document.all.ProductContainer.style.visibility = 'visible'; 
} 
} 
}

function showDiv() { 
if (document.getElementById) { // DOM3 = IE5, NS6 
document.getElementById('ProductContainer').style.visibility = 'hidden'; 
document.getElementById('hideshow').style.visibility = 'visible'; 
} 
else { 
if (document.layers) { // Netscape 4 
document.ProductContainer.visibility = 'hidden'; 
document.hideshow.visibility = 'visible'; 
} 
else { // IE 4 
document.all.ProductContainer.style.visibility = 'hidden'; 
document.all.hideshow.style.visibility = 'visible'; 
} 
} 
} 
/*====================================================*/
/*==========Light View End==========================*/



/*====================================================*/
/*==========Search on Top Start==========================*/
/*====================================================*/
function searchOnTop(lang_type)
{
	var txtSearch = document.getElementById("searchContent").value;
	var txtCriterial = document.getElementById("hidSearch").value;
	var urlSubmit = "/index.asp?m=lp&search=1";
//	alert("DSds\nsdsd");
//	return;
	//document.frmSearch.action='kientruc.asp';document.frmSearch.submit();
//	var searchContent = document.getElementById("searchContent").value;
	
	if(flagEnterSearchContent == 0)
	{

			if (lang_type=="en")
			{
				alert("Please enter search content!");
				document.getElementById("searchContent").focus();
				return false;
			}
			else
			{
				alert("Bạn chưa nhập nội dung cần tìm");
				document.getElementById("searchContent").focus();
				return false;
			}
	}
	if (Chk_strfunction(txtSearch)==false)
	{
		if (lang_type=="en")
		{
			alert('Invalid search content!\nSearch content should not contain "select,update,delete,*,~,%,`,<,>,?,$,(,{,[,],},),;,|,!" characters');
			document.getElementById("searchContent").focus();
			return false;
		}
		else
		{
			alert('Nội dung tìm kiếm không nên chứa từ hoặc ký tự "select,update,delete,*,~,%,`,<,>,?,$,(,{,[,],},),;,|,!"');
			document.getElementById("searchContent").focus();
			return false;
		}
	}
	
	if (txtCriterial==2){
		urlSubmit = "/index.asp?m=lp&search=1";//San pham
	}else if (txtCriterial==3){
		urlSubmit = "/index.asp?m=kt&search=1";//The gioi kien truc
	}else if (txtCriterial==4){
		urlSubmit = "/index.asp?m=nt&search=1";//Khong Gian Song
	}else if (txtCriterial==5){
		urlSubmit = "/index.asp?m=pt&search=1";//Phong thuy
	}
	
	//alert(txtCriterial);
	//alert(urlSubmit);
	//return
	document.getElementById("txtSearch").value = txtSearch;
	document.frmSearch.action=urlSubmit;
	document.frmSearch.submit();
	//document.getElementById("txtCriterial").value = txtCriterial;
	return true;
}
/*====================================================*/
/*==========Search on Top End==========================*/
/*====================================================*/



/*====================================================*/
/*==========Search on Left Product Start==========================*/
/*====================================================*/
function searchOnLeftProduct(lang_type,numP,numM,numT,numQ)
{
	strPrice = "";
	//GetPrice
	i = 1;
	for(i=1;i<=numP;i++)
	{
		control = "price"+i;
		var price = document.getElementById(control).checked;
		if(price==true)
		{
			strPrice = strPrice + document.getElementById(control).value + ",";
		}
	}
	if(strPrice=="")
	{
		alert("Bạn chưa chọn mức giá sản phẩm");
		return false;	
	}
	document.getElementById("pProduct").value = strPrice.substr(0,String(strPrice).length-1);
	//alert(strPrice.substr(0,strPrice.length - 1));
	//alert(document.getElementById("pProduct").value);
	
	//GetMaterial
	strMaterial = "";
	i = 1;
	for(i=1;i<=numM;i++)
	{
		control = "material"+i;
		var material = document.getElementById(control).checked;
		if(material==true)
		{
			strMaterial = strMaterial + document.getElementById(control).value + ",";
		}
	}
	if(strMaterial=="")
	{
		alert("Bạn chưa chọn nguyên liệu sản phẩm");
		return false;	
	}
	document.getElementById("mProduct").value = strMaterial.substr(0,String(strMaterial).length-1);
	//alert(strMaterial);
	
	
	//GetType
	strType = "";
	i = 1;
	for(i=1;i<=numT;i++)
	{
		control = "typeProduct"+i;
		var type = document.getElementById(control).checked;
		if(type==true)
		{
			strType = strType + document.getElementById(control).value + ",";
		}
	}
	if(strType=="")
	{
		alert("Bạn chưa chọn chủng loại sản phẩm");
		return false;	
	}
	document.getElementById("tProduct").value = strType.substr(0,String(strType).length-1);
	//alert(document.getElementById("tProduct").value);
	//return false;
	//GetQuality
	strQuality = "";
	i = 1;
	for(i=1;i<=numQ;i++)
	{
		control = "quality"+i;
		var quality = document.getElementById(control).checked;
		if(quality==true)
		{
			strQuality = strQuality + document.getElementById(control).value + ",";
		}
	}
	if(strQuality=="")
	{
		alert("Bạn chưa chọn tính chất sản phẩm");
		return false;	
	}
	document.getElementById("qProduct").value = strQuality.substr(0,String(strQuality).length-1);
	//alert(document.getElementById("qProduct").value);
	return true;
}
/*====================================================*/
/*==========Search on Left Product End==========================*/
/*====================================================*/



/*====================================================*/
/*==========OnKeyPress Start==========================*/
/*====================================================*/
function noNumbers(e,lang_type)
{
	var keynum
	var keychar
	var numcheck
	
	if(window.event) // IE
	{
		keynum = e.keyCode
	}
	else if(e.which) // Netscape/Firefox/Opera
	{
		keynum = e.which
	}
	//alert(keynum);
	if(keynum==13){
		searchOnTop(lang_type);	
	}
	//keychar = String.fromCharCode(keynum)
	//numcheck = /\d/
	//return !numcheck.test(keychar)
}
/*====================================================*/
/*==========OnKeyPress End==========================*/
/*====================================================*/



function checkAllCheckBox(firstId, chkAllId, num)
{
	
	valuea = document.getElementById(chkAllId).checked;
	i = 1;
	//alert("Aa");
	if(valuea==true)
	{
		for(i=1;i<=num;i++)
		{
			control = firstId+i;
			//alert("a");
			document.getElementById(control).checked = true;
		}
	}
	else if(valuea == false)
	{
		for(i=1;i<=num;i++)
		{
			control = firstId+i;
			//alert("b");
			document.getElementById(control).checked = false;
		}
	}
}


function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}


function checkCheckBoxSearchOnLeftProduct(pProduct, numP, mProduct, numM, tProduct, numT, qProduct, numQ)
{
	//Checked Price checkbox
	var idxP = 0;
	var tmppProduct = "," + pProduct + ","
	for(i=1;i<=numP;i++)
	{
		control = "price"+i;
		//alert("b");
		if(document.getElementById(control)!= null)
		{
			var vl = document.getElementById(control).value;
			if(tmppProduct.indexOf(","+vl+",")>=0)
			{
				document.getElementById(control).checked = true;
				idxP = idxP + 1;
			}
		}
	}
	if(idxP==numP)
	{
		document.getElementById("priceAll").checked = true;	
	}
	
	//Checked Material checkbox
	var idxM = 0;
	var tmpmProduct = "," + mProduct + ","
	//alert(numM);
	for(i=1;i<=numM;i++)
	{
		control = "material"+i;
		//alert("b");
		if(document.getElementById(control)!= null)
		{
			var vl = document.getElementById(control).value;
			if(tmpmProduct.indexOf(","+vl+",")>=0)
			{
				document.getElementById(control).checked = true;
				//alert(control);
				idxM = idxM + 1;
			}
		}
	}
	if(idxM==numM)
	{
		document.getElementById("materialAll").checked = true;	
	}
	
	//Checked Material checkbox
	var idxT = 0;
	var tmptProduct = "," + tProduct + ","
	for(i=1;i<=numT;i++)
	{
		control = "typeProduct"+i;
		//alert("b");
		if(document.getElementById(control)!= null)
		{
			var vl = document.getElementById(control).value;
			if(tmptProduct.indexOf(","+vl+",")>=0)
			{
				document.getElementById(control).checked = true;
				idxT = idxT + 1;
			}
		}
	}
	if(idxT==numT)
	{
		document.getElementById("typeProductAll").checked = true;	
	}
	
	
	//Checked Quality checkbox
	var idxQ = 0;
	var tmpqProduct = "," + qProduct + ","
	for(i=1;i<=numQ;i++)
	{
		control = "quality"+i;
		//alert("b");
		if(document.getElementById(control)!= null)
		{
			var vl = document.getElementById(control).value;
			if(tmpqProduct.indexOf(","+vl+",")>=0)
			{
				document.getElementById(control).checked = true;
				idxQ = idxQ + 1;
			}
		}
	}
	if(idxQ==numQ)
	{
		document.getElementById("qualityAll").checked = true;	
	}
}


//function clickHomeListNews


function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }
