// JavaScript Document
var xmlhttp = false;
try{
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");	
} catch(e){
	try{
		xmlthhp = new ActiveXObject("Microsoft.XMLHTTP");
	} catch(E){
		xmlhttp = false;
	}
}
if(!xmlhttp && typeof XMLHttpRequest != 'undefined'){
	xmlhttp = new XMLHttpRequest();
}
function ShowShoppingCart(){
	serverpage = "showcart.php";
	xmlhttp.open("GET", serverpage)
	xmlhttp.onreadystatechange = function(){
		if(xmlhttp.readyState == 4 && xmlhttp.status == 200){
			var $ZJ = xmlhttp.responseText.split(",");
			//alert(xmlhttp.responseText);
			var obj = document.getElementById("cart_2");
			if($ZJ[0] == 9){
				obj.innerHTML = '<table style="font-size:12px"><tr><td rowspan="3" style="font-size:16px; text-align:center;"><a href="https://www.buyicnow.com/checkout1.php" title="Check Out" style="color:#900;"><b>Cart<br />' + $ZJ[3] + '</td><td rowspan="3">&nbsp;</td><td class="rrright">Subtotal:</td><td>$' + $ZJ[4] + '</td></tr><tr><td class="rrright">Shipping:</td><td>$' + $ZJ[5] + ' ' + $ZJ[6] + '</td></tr><tr><td class="rrright">Total:</td><td>$' + ($ZJ[4] * 1.0 - (-$ZJ[5])).toFixed(2) + '</td></tr></table>';
				if($ZJ[1] > 0){
					for(var jj = 7; jj<$ZJ[1] - (-7); jj++){
						$chid = 'd'+ $ZJ[jj];
						$ss = document.getElementById($chid);
						if($ss){
							$ss.style.background = "#FF9";
							$ss.firstChild.innerHTML = 'Current > ';
						}
					}
					if($ZJ[2] > 0){
						for(var kk = $ZJ[1] - (-7); kk<$ZJ[2] - (-$ZJ[1]) - (-7); kk++){
							var $zD  = $ZJ[kk].split("_");
							$PiD = 'p'+$zD[0];
							$Dd  = document.getElementById($PiD);
							if($Dd){
								$Dd.innerHTML = '<a href="https://www.buyicnow.com/checkout1.php" style="color:#900; font-size:12px;">' + $zD[1] + 'x in Cart' + '</a>';
							}
						}
					}
				}
			}else{
				obj.innerHTML = '<table style="font-size:16px; margin-right:65px;" align="right"><tr><td>' + $ZJ[3] + '</td></tr></table>';
$ZJ[3]
			}
		}
	}
	xmlhttp.send(null);
}
function checkregis(form){
	if(form.loginname.value.length < 5  || form.loginname.value.length > 30 || form.loginname.value == 'Username/Email.'){
		return false;
	}
	if(form.loginpass.value.length < 8  || form.loginpass.value.length > 30 || form.loginpass.value == '********'){
		return false;
	}
	return true;
}
function checksearch(form){
	if(form.searchx.value.length < 2 || form.searchx.value.length > 30 || form.searchx.value == 'Product Search:'){
		return false;
	}
	return true;
}
function checkuname(form){
	if(form.uemail.value.length==0){
		return false;
	}
	return true;
}
function checkpass(form){
	if(form.unid.value.length==0){
		return false;
	}
	return true;
}
function checkvcode(form){
	if(form.activate.value.length != 8){
		return false;	
	}else{
		return true;
	}
}
function checkzjwt(form){
	if(form.wtname.value.length < 2  || form.wtname.value.length > 30){
		return false;
	}else if(form.wtemail.value.length < 6  || form.wtemail.value.length > 60){
		return false;
	}else if(form.wtnr.value.length < 6  || form.wtnr.value.length > 1000){
		return false;
	}else{
		return true;
	}
}
function zxtjwt(wh,ww){
	document.getElementById(wh).style.display = "block";
	document.getElementById(ww).style.display = "none";
}
function qxtjwt(wh,ww){
	document.getElementById(wh).style.display = "none";
	document.getElementById(ww).style.display = "block";
}
function checkmessage(form){
	var $result = true;
	document.getElementById('err_un').style.display = "none";
	document.getElementById('err_em').style.display = "none";
	document.getElementById('err_qu').style.display = "none";
	document.getElementById('err_co').style.display = "none";
	if(form.youremail.value.length < 1 || form.youremail.value.length > 20){
		document.getElementById('err_un').style.display = "block";
		form.youremail.focus();
		$result = false;
	}
	if(form.yourname.value.length < 6 || form.yourname.value.length > 60 || !checkEmail(form.yourname.value)){
		document.getElementById('err_em').style.display = "block";
		form.yourname.focus();
		$result = false;
	}
	if(form.yourmessage.value.length < 8 || form.yourmessage.value.length > 5000){
		document.getElementById('err_qu').style.display = "block";
		form.yourmessage.focus();
		$result = false;
	}
	if(form.checkcode.value.length != 4 || isNaN(form.checkcode.value)){
		document.getElementById('err_co').style.display = "block";
		form.checkcode.focus();
		$result = false;
	}
	return $result;
}
function checkEmail(email){
	var reEmail = /^(.*)@(.*)$/;
	if (!email.match(reEmail)&&email!=""){
		return false;
	}
	else return true;
}
function removeTr(wTr){
	var tr = wTr.parentNode.parentNode.parentNode; 
    tr.deleteRow(wTr.parentNode.parentNode.rowIndex); 
}