showing = false;
newColor = '#666666';
newBgColor = '#FFCC00';
newBgImg = null;

oldColor = null;
oldBgColor = null;
oldBgImg = null;

function showMenu(obj,showObj,menuType,nClr,nBgImg,nBgClr)
{
	showObj = eval(showObj);
	if(nClr) 
	{
		newColor = nClr;
		oldColor = obj.style.color;
	}
	if(nBgClr) 
	{
		newBgColor = nBgClr;
		oldBgColor = obj.style.backgroundColor;
	}
	if(nBgImg) 
	{
		newBgImg = nBgImg;
		oldBgImg = obj.style.backgroundImage;
	}	
	obj.style.color = newColor;
	obj.style.backgroundColor = newBgColor;
	if(newBgImg!=null) obj.style.backgroundImage = 'url('+newBgImg+')';	
	if(showObj!=null &&!showing)
	{
		showObj.style.display = "";
		if(document.all)
		{
			if(menuType==null)
			{
				var myPageW = 780;
				if(document.all["MYPAGE"])
				{
					var myScrW = screen.width;
				}
				myLeft = (screen.width - myPageW)/2;
				
				var leftPos = obj.offsetLeft - 5;// + myLeft;
				var topPos = obj.offsetTop + obj.offsetHeight + 0;
				if(document.all['MYBANNER'])
				{
					leftPos += document.all['MYBANNER'].offsetLeft;
					topPos += document.all['MYBANNER'].offsetTop;
				}
				showObj.style.left = leftPos;
				showObj.style.top = topPos;
			}
			else
			{
				showObj.style.left = obj.offsetLeft + obj.offsetWidth + 20;
				showObj.style.top = obj.offsetTop + 2;
			}
		}
		else
		{
			var myPageW = 1026;
			if(document.all["MYPAGE"])
			{
				var myScrW = screen.width;
				if(myScrW > 800)
				{
					myPageW += 36;
				}
			}
			myLeft = (screen.width - myPageW)/2;
			if(menuType==null)
			{
				showObj.style.left = obj.offsetLeft + myLeft;
				showObj.style.top = obj.offsetTop + obj.offsetHeight + 0;
			}
			else
			{
				showObj.style.left = obj.offsetLeft + obj.offsetWidth + myLeft + 12;
				showObj.style.top = obj.offsetTop + 140;
			}
		}
		showing = true;
	}
	prevObj = obj;
}

function hideMenu(obj,showObj)
{
	showObj = eval(showObj);
	if(showObj!=null && showing) 
	{
		showing = false;
		showObj.style.display = 'none';
		if(prevObj != null) 
		{
			if(oldColor != null) prevObj.style.color = oldColor;
			if(oldBgColor != null) prevObj.style.backgroundColor = oldBgColor;
			if(oldBgImg != null) prevObj.style.backgroundImage = oldBgImg;
		}
	}
}
function showMe(obj)
{
	if(!showing) 
	{
		obj.style.display = '';
		showing = true;
		if(prevObj!=null)
		{
			prevObj.style.color = newColor;
			prevObj.style.backgroundColor = newBgColor;
			if(newBgImg!=null) prevObj.style.backgroundImage = 'url('+newBgImg+')';
		}
	}
}

function hideMe(obj)
{
	if(showing)
	{
		showing = false;
		obj.style.display = 'none';
		if(prevObj!=null) 
		{
			if(oldColor != null) prevObj.style.color = oldColor;
			if(oldBgColor != null) prevObj.style.backgroundColor = oldBgColor;
			if(oldBgImg != null) prevObj.style.backgroundImage = oldBgImg;
		}
	}
}

snewColor = null;
snewBgColor = null;
snewBgImg = null;

soldColor = null;
soldBgColor = null;
soldBgImg = null;

function changeColor(obj,snClr,snBgImg,snBgClr)
{
	snewColor = snClr;
	snewBgColor = snBgClr;
	snewBgImg = snBgImg;
	
	if(snewColor != null) 
	{
		soldColor = obj.style.color;
		obj.style.color = snewColor;
	}
	if(snewBgColor != null) 
	{
		soldBgColor = obj.style.backgroundColor;
		obj.style.backgroundColor = snewBgColor;
	}
	if(snewBgImg != null) 
	{
		soldBgImg = obj.style.backgroundImage;
		obj.style.backgroundImage = 'url('+snewBgImg+')';
	}
	
}

function restoreColor(obj)
{
	if(soldColor != null) obj.style.color = soldColor;
	if(soldBgColor != null) obj.style.backgroundColor = soldBgColor;
	if(soldBgImg != null) obj.style.backgroundImage = soldBgImg;
}

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 flashWrite(url,w,h,vars,id,bg)
{
	var flashStr=
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='"+w+"' height='"+h+"' id='"+id+"' align='middle'>"+
	"<param name='allowScriptAccess' value='always' />"+
	"<param name='movie' value='"+url+"' />"+
	"<param name='FlashVars' value='"+vars+"' />"+
	"<param name='wmode' value='transparent' />"+
	"<param name='menu' value='false' />"+
	"<param name='quality' value='high' />"+
	"<embed src='"+url+"' FlashVars='"+vars+"' wmode='transparent' menu='false' quality='high' width='"+w+"' height='"+h+"' allowScriptAccess='always' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />"+
	"</object>";
	document.write(flashStr);
}

function DisplayFloatBanner(side)
{
	if( side == 0 ) // ko in gi ca
	{
		return;
	}		
	if( FloatBanner.length == 0 )
	{
		return;
	}
		
	document.write('<table cellspacing=0 cellpadding=0 border=0>');
	
	if (side==1) // ben trai
	{
		for (i=0; i<FloatBanner.length; i++)
		{
			if(FloatBanner[i][4]=='0')
			{
				if(FloatBanner[i][0].indexOf(".swf")>0)
				{ 
					document.write('<tr><td>');
					flashWrite(PageHost.concat(FloatBanner[i][0]),FloatBanner[i][5],FloatBanner[i][6],FloatBanner[i][1]);
					document.write('</td></tr>');
	   		}
				else if(FloatBanner[i][1]=='')
				{
					document.write('<tr><td><a href="#"><img src="', PageHost.concat(FloatBanner[i][0]), '" width="',FloatBanner[i][5],'" border=0></a></td></tr>');
				}
				else 
				{
					document.write('<tr><td><a href="',FloatBanner[i][1],'"><img src="', PageHost.concat(FloatBanner[i][0]), '" width="',FloatBanner[i][5],'" border=0></a></td></tr>');
				}
			}
		}
	}
		
	if (side==2) // ben phai
	{
		for (i=0; i<FloatBanner.length; i++)
		{
			if(FloatBanner[i][4]=='1')
			{
				if(FloatBanner[i][0].indexOf(".swf")>0) 
				{
					document.write('<tr><td>');
					flashWrite(PageHost.concat(FloatBanner[i][0]),FloatBanner[i][5],FloatBanner[i][6],FloatBanner[i][1]);
					document.write('</td></tr>');
				}	
				else if(FloatBanner[i][1]=='')
				{
					document.write('<tr><td><a href="#"><img src="', PageHost.concat(FloatBanner[i][0]), '" width="',FloatBanner[i][5],'" border=0></a></td></tr>');
				}
				else 
				{
					document.write('<tr><td><a href="',FloatBanner[i][1],'"><img src="', PageHost.concat(FloatBanner[i][0]), '" width="',FloatBanner[i][5],'" border=0></a></td></tr>');
				}
			}
		}
	}
		
	document.write('</table>');
}

function FloatTopDiv()
{
	var ns = (navigator.appName.indexOf("Netscape") != -1);
	if(!ns)
	{
		startLX = ((document.body.clientWidth - 1244)/2) + 125 , startLY = 105;
		//startRX = ((document.body.clientWidth -770)/2) + 770 +2 , startRY = 62;
		startRX = ((document.body.clientWidth)/2) + 398 , startRY = 105;
	}
	else
	{
		startLX = ((document.body.clientWidth - 1247)/2) + 125 , startLY = 105;
		startRX = ((document.body.clientWidth - 780)/2) + 788 , startRY = 105;
	}
	var d = document;
	function ml(id)
	{
		var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
		el.sP=function(x,y){this.style.left=x;this.style.top=y;};
		el.x = startRX;
		el.y = startRY;
		return el;
	}
	function m2(id)
	{
		var e2=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
		e2.sP=function(x,y){this.style.left=x;this.style.top=y;};
		e2.x = startLX;
		e2.y = startLY;
		return e2;
	}
	window.stayTopLeft=function()
	{
		if (document.documentElement && document.documentElement.scrollTop)
			var pY =  document.documentElement.scrollTop;
		else if (document.body)
			var pY =  document.body.scrollTop;
		if (document.body.scrollTop > 30){startLY = 3;startRY = 3;} else {startLY = 105;startRY = 105;};
		ftlObj.y += (pY+startRY-ftlObj.y)/16;
		ftlObj.sP(ftlObj.x, ftlObj.y);
		ftlObj2.y += (pY+startLY-ftlObj2.y)/16;
		ftlObj2.sP(ftlObj2.x, ftlObj2.y);
		setTimeout("stayTopLeft()", 1);
	}
	ftlObj = ml("divAdRight");
	//stayTopLeft();
	ftlObj2 = m2("divAdLeft");
	stayTopLeft();
}

function ShowAdDiv()
{
	var objAdDivRight = document.getElementById("divAdRight");
	var objAdDivLeft = document.getElementById("divAdLeft");		
	
	if (document.body.clientWidth < 980)
	{
			objAdDivRight.style.display = "none";
		objAdDivLeft.style.display = "none";
	}
	else
	{
		objAdDivRight.style.display = "block";
		objAdDivLeft.style.display = "block";
		FloatTopDiv();
	}
}
///////////////check Form/////////////////////
function checkRegister()
{
	myFrm = document.frmRegister;
	var pwd = myFrm.password.value;
	var repwd = myFrm.repassword.value;
	if(!isEmail(myFrm.username.value))
	{
		alert("Vui long kiem tra lai dia chi email!");
		myFrm.username.focus();
		return false;
	}
	if(myFrm.password.value=='')
	{
		alert("Vui long kiem tra lai mat khau!");
		myFrm.password.focus();
		return false;
	}
	if(pwd!=repwd)
	{
		alert("Vui long kiem tra lai mat khau!");
		myFrm.password.focus();
		return false;
	}
	if(myFrm.name.value=='')
	{
		alert("Vui long go ten cua ban!");
		myFrm.name.focus();
		return false;
	}
	if(myFrm.tel.value!='' && !isNumber(myFrm.tel.value))
	{
		alert("Vui long go so dien thoai cua ban!");
		myFrm.tel.focus();
		return false;
	}
	if(myFrm.address.value=='')
	{
		alert("Vui long go dia chi cua ban!");
		myFrm.address.focus();
		return false;
	}
}
function checkForgetpass()
{
	myFrm = document.frmForgetpass;
	if(!isEmail(myFrm.email.value))
	{
		alert("Vui long kiem tra lai dia chi email!");
		myFrm.email.focus();
		return false;
	}
}
function checkPrivate()
{
	myFrm = document.frmPrivate;
	if(myFrm.name.value=='')
	{
		alert("Vui long go ten cua ban!");
		myFrm.name.focus();
		return false;
	}
	if(myFrm.tel.value!='' && !isNumber(myFrm.tel.value))
	{
		alert("Vui long go so dien thoai cua ban!");
		myFrm.tel.focus();
		return false;
	}
	if(myFrm.address.value=='')
	{
		alert("Vui long go dia chi cua ban!");
		myFrm.address.focus();
		return false;
	}
}
function checkChangepass()
{
	myFrm = document.frmChangepass;
	var pwd = myFrm.newpassword.value;
	var repwd = myFrm.renewpassword.value;
	if(myFrm.oldpassword.value=='')
	{
		alert("Vui long kiem tra lai mat khau!");
		myFrm.oldpassword.focus();
		return false;
	}
	if(myFrm.newpassword.value=='')
	{
		alert("Vui long kiem tra lai mat khau moi!");
		myFrm.newpassword.focus();
		return false;
	}
	if(pwd!=repwd)
	{
		alert("Vui long kiem tra lai mat khau!");
		myFrm.newpassword.focus();
		return false;
	}
}
function add_cart(){
	var frm = document.frmADD_CART;
	frm.submit();
}
function mouseDown(n) {
	if (parseInt(navigator.appVersion)>3) {
		var click=1;
		if (navigator.appName=="Netscape") click=n.which;
		else click=event.button;
		if (click!=1) {
			alert("Welcome to Along !");
		}
	}
	return true;
}
if (parseInt(navigator.appVersion)>3) {
	document.onmousedown = mouseDown;
	if (navigator.appName=="Netscape")
	document.captureEvents(Event.MOUSEDOWN);
}
//-->