function echeck(str) {
		var at="@";
		var dot=".";
		var lat=str.indexOf(at);
		var lstr=str.length;
		var ldot=str.indexOf(dot);
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail ID");
		   return false;
		}
		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID");
		   return false;
		}
		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID");
		    return false;
		}
		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID");
		    return false;
		 }
		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID");
		    return false;
		 }
		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID");
		    return false;
		 }
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID");
		    return false;
		 }
}
function validate_billingfrm() {
	if ( document.billing_frm.firstname.value == '' ){
		alert("Please Enter First Name");
		document.billing_frm.firstname.focus();
		return false;		
	}
	if ( document.billing_frm.lastname.value == '' ){
		alert("Please Enter Last Name");
		document.billing_frm.lastname.focus();
		return false;		
	}
	if ( document.billing_frm.phone.value == '' ){
		alert("Please Enter Phone");
		document.billing_frm.phone.focus();
		return false;		
	}
	var f = document.billing_frm.email;
	if ( ( f.value == null ) || ( f.value == "" ) )	{
	    alert("Please Enter Email address!");
		f.focus();
		return false;
	}
	if ( echeck(f.value) == false )
	{
	    f.value = "";
		f.focus();
		return false;
	}
	if ( document.billing_frm.email.value != document.billing_frm.confirm_email.value ){
		alert("Email and Confirm Email does not match");
		document.billing_frm.confirm_email.focus();
		return false;		
	}
	if ( document.billing_frm.address.value == '' ){
		alert("Please Enter Address");
		document.billing_frm.address.focus();
		return false;		
	}
	if ( document.billing_frm.city.value == "" ){
		alert("Please Enter City");
		document.billing_frm.city.focus();
		return false;		
	}
	if ( document.billing_frm.zip.value == "" ){
		alert("Please Enter ZIP/Postal Code");
		document.billing_frm.zip.focus();
		return false;		
	}
	if ( document.billing_frm.state.value == "" ){
		alert("Please Select State");
		document.billing_frm.state.focus();
		return false;		
	}
}




