function toggleDiv(id,flagit,int) {
if (flagit=="1"){
if (document.layers) document.layers[''+id+''].visibility = "show"
else if (document.all) document.all[''+id+''].style.visibility = "visible"
else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "show"
document.getElementById(''+id+'').style.display = "block"
if ((screen.height==768) && (screen.width==1024))
	document.getElementById(''+id+'').style.left = 122+152*int+"px"
else if ((screen.height==600) && (screen.width==800))
	document.getElementById(''+id+'').style.left = 10+152*int+"px"
else
	document.getElementById(''+id+'').style.left = 186+152*int+"px"
}
else
if (flagit=="0"){
if (document.layers) document.layers[''+id+''].visibility = "hide"
else if (document.all) document.all[''+id+''].style.visibility = "hidden"
else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "hidden"
}
}
//-->
function SwapImage_Over(id,imgsrc){
	document.getElementById(''+id+'').src=imgsrc
}
function SwapImage_Out(id,imgsrc){
	document.getElementById(''+id+'').src=imgsrc
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
//-->
// JavaScript Document
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function leftnavOnMouseOver(id){
	if(navOn == id){
	document.getElementById(id).style.cursor = "default";
	document.getElementById(id).style.borderTop = "1px solid #999999";
	document.getElementById(id).style.borderBottom = "2px solid #EEEEEE";
	document.getElementById(id).style.backgroundColor = "#E2E2E2";
	aniId = id;
	}
}

function leftnavOnMouseOut(id){
	if(navOn != id){
	document.getElementById(id).style.borderTop = "1px solid #CFCFCF";
	document.getElementById(id).style.borderBottom = "1px solid #CFCFCF";
	document.getElementById(id).style.backgroundColor = "#02387A";	
	}
}

function Popup(pages,w,h)
{
	var PopupWindow=null;
	settings='width='+ w + ',height='+ h + ',location=no,directories=no, menubar=no,toolbar=no,status=no,scrollbars=yes,resizable=yes, dependent=no';
	PopupWindow=window.open(pages,'Open_Windows',settings);
	PopupWindow.focus();				
}	

var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""

function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}

// ham them moi rating
function ajaxOnChange(Pages,Id_sanpham,Point,containerid){
var page_request = false
var url=Pages
url=url+"?ProductsCode="+Id_sanpham
url=url+"&Point="+Point
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
ViewResult_rate('Ajax/ViewResult_RateProducts.asp',Id_sanpham,'<img src=images/StarOn.gif>','<img src=images/StarOff.gif>','ViewResult')
}

// hien thi rating
function ViewResult_rate(Pages,Id_sanpham,StarOn,StarOff,containerid){
var page_request = false
var url=Pages
url=url+"?ProductsCode="+Id_sanpham
url=url+"&StarOn="+StarOn
url=url+"&StarOff="+StarOff
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if(page_request.readyState == 0) 
{ 
document.getElementById(containerid).innerHTML = "<img src='images/ajax-loader.gif'>"; 
//	return false;
}
if(page_request.readyState == 1) { 
document.getElementById(containerid).innerHTML = "<img src='images/ajax-loader.gif'>"; 
//	return false;
}
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}

//-->

