function CheckEmail(email){
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)) {
		return true
	}
	
	return (false)
}
function confirmpayment(){
	var myform = document.cartForm;
	var ctr = 0;
	
	if(myform.client.value == ""){
		ctr = 1;
		alert("You missed to enter Client Name!");
		myform.client.focus();	
	}
	else if(myform.phone.value == ""){
		ctr = 1;
		alert("You missed to enter your Phone Number!");
		myform.phone.focus();	
	}
	else if(myform.email.value == ""){
		ctr = 1;
		alert("You missed to enter your Email Address!");
		myform.email.focus();	
	}
	else if(CheckEmail(myform.email.value) == false){
		ctr = 1;
		alert("You have to enter your valid Email Address!");
		myform.email.focus();	
	}
	else if(myform.item_name_1.value == ""){
		ctr = 1;
		alert("You missed to enter the Invoice Number (Payment Details)!");
		myform.item_name_1.focus();	
	}
	else if(myform.amount_1.value == "" || myform.amount_1.value == "0.00"){
		ctr = 1;
		alert("You missed to enter your Amount value!");
		myform.amount_1.focus();	
	}
	
	if(ctr == 0){
		//myform.action = "https://www.paypal.com/cgi-bin/webscr";
		myform.submit();
	}
	
	
}

function resetpayment(){
	var myform = document.cartForm;
	myform.comp.value = "";	
	myform.client.value = "";
	myform.phone.value= "";
	myform.email.value= "";
	myform.item_name_1.value = "";
	myform.amount_1.value = "0.00";
}
//onKeyPress="return keyRestrict(event,'1234567890');"
function getKeyCode(e)
{
	if (window.event)
	   return window.event.keyCode;
	else if (e)
	   return e.which;
	else
	   return null;
}

function keyRestrict(e, validchars) { 
	var key='', keychar='';
	key = getKeyCode(e);
	if (key == null) return true;
	keychar = String.fromCharCode(key);
	keychar = keychar.toLowerCase();
	validchars = validchars.toLowerCase();
	if (validchars.indexOf(keychar) != -1)
		return true;
	if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27 )
		return true;
	return false;
}



