
function CheckCart(vartask){
	document.frmShowCart.task.value=vartask;
	document.frmShowCart.checkout.disabled=true;
	document.frmShowCart.update.disabled=true;
	document.frmShowCart.btncontinue.disabled=true;
	document.frmShowCart.submit();
	//loadPage('cart.php?task='+vartask);
}

function maskKeyPressNumFloat(objEvent) 
{
	var iKeyCode;  	
	iKeyCode = objEvent.keyCode;			
	if((iKeyCode>=48 && iKeyCode<=57) || iKeyCode==46) return true;
	return false;
}

//summary
function CheckCart2(vartask){
	if(CheckForm1()){
		document.frmShowCart.task.value=vartask;
		document.frmShowCart.checkout.disabled=true;
		document.frmShowCart.update.disabled=true;
		document.frmShowCart.submit();
	}
}
function CheckForm1()
{
	if(document.frmShowCart.txtName.value=="")
	{
		alert("Vui long dien ten cua ban.");
		document.frmShowCart.txtName.focus();
		return false;
		
		}
	if(document.frmShowCart.txtPhone.value=="")
	{
		alert("Vui long cho biet so phone cua ban.");
		document.frmShowCart.txtPhone.focus();
		return false;
		
	}
	if(document.frmShowCart.txtAddress.value=="")
	{
		alert("Vui long cho biet so dt cua ban");
		document.frmShowCart.txtAddress.focus();
		return false;
		
	}		
	re = new RegExp("([A-Za-z0-9_.-]){2,}@([A-Za-z0-9_.-]){2,}\.([A-Za-z0-9_.-]){2,}")
	if (document.frmShowCart.txtEmail.value.match(re) == null) 
	
		{
			alert("Vui nhap email chinh xac.");
			document.frmShowCart.txtEmail.focus();
			return false;
			
		}
					
		if(document.frmShowCart.txtComment.value=="")
		{
			alert("Vui long go vao noi dung.");
			document.frmShowCart.txtComment.focus();
			return false;
			
		}
	return true;
}
				
function PrintCart(){
	openWin2('printcart.php?optdiv=div', '_printcart', 800, 600);	
}

function openWin2(url,name,w,h) { 
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+1+',left='+winl+',scrollbars=yes,resizable=yes,menubar=no,toolbar=yes,status=yes'
	win = window.open(url, name, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
