// JavaScript Document
String.prototype.trim = function() {

 // skip leading and trailing whitespace
 // and return everything in between
  var x=this;
  x=x.replace(/^\s*(.*)/, "$1");
  x=x.replace(/(.*?)\s*$/, "$1");
  return x;
}

function validateEmail(email)
{
	regmail = /^([a-zA-Z0-9\_\.\-]+)@(([a-zA-Z0-9\_\-]+)(\.)(\w+))/i;
	aRegMail = regmail.exec(email);
	if (email.length < 5 || aRegMail == null)
	{
		alert("Please enter the email address correctly");
		return false;
	}
	return true;
}
function isEmpty(checkThis)
{
	checkThis = checkThis.trim();
	if (checkThis == '' || checkThis == null) 
	{
		return true;
	}
}

function addToCart(pid)
{
	window.open('/cart.php?action=add&pid='+pid,'add2Cart','top=30,left=100,width=70,height=60,resizable=no,scrollbars=no');
}

function intOnly(i) {
	if(i.value.length>0) {
		i.value = i.value.replace(/[^\d]+/g, ''); 
	}
}

function noSpace(x) {

  x.value=x.value.replace(/^\s*(.*)/, "$1");
  x.value=x.value.replace(/(.*?)\s*$/, "$1");
}
