function deleteItem(iid){
	window.location="?view=deleteItem&iid="+iid;
}
function updateShipping(shipID,itemArray){
	window.location="?view=changeShip&shipID="+shipID+"&itemArray="+itemArray;
}
function updateQuant(quant,itemID){
	window.location="?view=changeQuant&quant="+quant+"&iid="+itemID;
}
function updateAddress(addID,itemID){
	window.location="?view=changeAdd&add="+addID+"&iid="+itemID;
}
function updateOpts(opt,itemID){
	window.location="?view=changeOpts&opt="+opt+"&iid="+itemID;
}
function openDiv(divid){
	document.getElementById(divid).style.display = 'block';
	document.getElementById(divid).style.zIndex="10000";
}

function winW() {
	if (window.innerWidth) return window.innerWidth;
	else if (document.documentElement && document.documentElement.clientWidth)
		return document.documentElement.clientWidth;
	else if (document.body && document.body.clientWidth)
		return document.body.clientWidth;
	else return null;
	}
	if (winW() < 1024){
		document.write("<link rel=\"stylesheet\" type=\"text/css\" media=\"screen\" href=\"css/short.css\" />")
	}
	// ]]>
	//var IE = document.all?true:false;
	//if (!IE) document.captureEvents(Event.MOUSEMOVE)
	//document.onmousemove = getMouseXY;
	//var tempX = 0;
	//var tempY = 0;
function getMouseXY(but) {
	var IE = document.all?true:false;
	if (IE) { // grab the x-y pos.s if browser is IE
	//	tempX = document.body.clientWidth-event.clientX + document.body.scrollLeft;
	//	tempY = document.body.clientHeight-event.clientY + document.body.scrollTop;
		popX = 0-event.clientX/2;
		popY = 0-event.clientY;
	}
	else {  // grab the x-y pos.s if browser is NS
		popX = 135;
		popY = 60;
	}
	addthis_pub  = 'RegionalBest';
	addthis_offset_top = popY;
	addthis_offset_left = popX;
	//alert(event.clientX+" : "+event.clientY);
	return addthis_open(but, '', '[URL]', '[TITLE]');
	//document.Show.MouseX.value = tempX;
	//document.Show.MouseY.value = tempY;
	//return true;
	}
function checkMe(){
	theMe = "<?= $_SESSION['me'] ?>";
	if(theMe!=="complete"){
		document.getElementById("meAdd").style.display = 'block';
		document.getElementById("meAdd").style.zIndex="10000";
	} else {
		window.location = "https://www.regionalbest.com/checkout/checkDel.php?view=breakdown";
	}
}
function closeDiv(divid){
	document.getElementById(divid).style.display = 'none';
}
function validate_email(field,alerttxt)
{
	with (field)
	{
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		if (apos<1||dotpos-apos<2) 
		{
			alert(alerttxt);return false;
		}
		else {
			return true;
		}
	}
}
function validate_required(field,alerttxt)
{
	with (field)
	{
		if (value==null||value=="")
		{
			alert(alerttxt);return false;
		}
		else
		{
			return true;
		}
	}
}
function validate_form(thisform)
{
	var fieldList="";
	with (thisform) {
		for(i=0;i<thisform.length;i++) {
			if(thisform.elements[i].name=="*email"){
				emlValid=validate_email(thisform.elements[i],"Please enter a valid e-mail address!");
				if (emlValid == false) {
					thisform.elements[i].focus();
					return false;
				}
			}
			if(thisform.elements[i].name=="*ccnum"){
				ccEntry=thisform.elements[i].value;
				if((ccEntry.length<13)||(ccEntry.length>17)){
					alert("Please enter a valid credit card number. (Must contain between 13 an 17 digits.)");
					thisform.elements[i].focus();
					return false;
				}
			}
			if((thisform.elements[i].name.charAt(0)=="*")&&((thisform.elements[i].value=="")||(thisform.elements[i].value==null))){
				fieldList+=thisform.elements[i].id + "\r\n";
				//return false;
			}
		}
		if(fieldList.length>1){
			alert("The following fields are required and have been left empty:\r\n"+fieldList+"Please complete these fields and resubmit.");
			return false;
		} else {
			return true;
		}
	}
}
function cancelorder()
{
	window.location = "http://www.regionalbest.com/";
	return false;
}
function checkNumeric(entry)
{
	var numeric = /^[0-9]*$/; 
	if (!numeric.test(entry.value)) 
	{
		alert("This field requires numeric entry only!");
	}
	entry.value = entry.value.replace(/[^0-9]/g,"");
}