 function validate()
{
if (document.stepone.urname.value=="")
	{
	alert('Name cannot be blank');
	document.stepone.urname.focus();
	return false;
	}
if (document.stepone.x_Email.value=="")
	{
	alert('Email cannot be blank');
	document.stepone.x_Email.focus();
	return false;
	}
	emailStr=document.stepone.x_Email.value;
	var emailPat=/^(.+)@(.+)$/
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars="\[^\\s" + specialChars + "\]"
	var quotedUser="(\"[^\"]*\")"
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom=validChars + '+'
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
	var matchArray=emailStr.match(emailPat)
	if (matchArray==null) 
	{
	alert("Email address seems incorrect (check @ and .'s)");
	document.stepone.x_Email.focus();
	return false
	}
	var user=matchArray[1]
	var domain=matchArray[2]

	if (user.match(userPat)==null) 
	{
	alert("The username in Email doesn't seem to be valid.");
	document.stepone.x_Email.focus();
	return false
	}

	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) 
	{   
		  for (var i=1;i<=4;i++) 
		  {
			if (IPArray[i]>255) 
			{
				alert("Destination IP address is invalid!");
				document.stepone.x_Email.focus();

			return false
			}
		}
    return true
	}

	var domainArray=domain.match(domainPat)
	if (domainArray==null) 
	{
		alert("The email doesn't seem to be valid.");
		document.stepone.x_Email.focus();
		return false
	}

	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length
	if (domArr[domArr.length-1].length<2 || 
		domArr[domArr.length-1].length>3) {
	   
	   alert("The address must end in a three-letter domain, or two letter country.");
	   document.stepone.x_Email.focus();
	   return false
	}

	if (len<2) {
	   var errStr="This address is missing a hostname!"
	   alert(errStr);
	   return false
	}
	if (document.stepone.x_Email.value != document.stepone.x_Email_confirm.value)
	{
		alert('Email addresses do not match');
		document.stepone.x_Email.focus();
		return false;
	}

	if (document.stepone.phone.value=="")
	{
		alert('Phone number cannot be blank');
		document.stepone.phone.focus();
		return false;
	}

	if (document.stepone.x_Address.value=="")
	{
		alert('Address cannot be blank');
		document.stepone.x_Address.focus();
		return false;
	}
	if (document.stepone.x_City.value=="")
	{
		alert('City cannot be blank');
		document.stepone.x_City.focus();
		return false;
	}
	if (document.stepone.x_State.value=="")
	{
		alert('State cannot be blank');
		document.stepone.x_State.focus();
		return false;
	}
	if (document.stepone.x_Zip.value=="")
	{
		alert('Zip code cannot be blank');
		document.stepone.x_Zip.focus();
		return false;
	}

	if (document.stepone.x_Country.value=="")
	{
		alert('Country cannot be blank');
		document.stepone.x_Country.focus();
		return false;
	}

	if (document.stepone.tosagreement.checked==false)
	{
		alert('You must agree to our terms of service before continuing.');
		document.stepone.tosagreement.focus();
		return false;
	}
	return true;
}
function validateb()
{
if (document.steptwo.x_First_Name.value=="")
{
alert('Name in the card should not be blank');
document.steptwo.x_First_Name.focus();
return false;
}
if (document.steptwo.x_card_num.value=="")
{
alert('Card number should not be blank');
document.steptwo.x_card_num.focus();
return false;
}
if (document.steptwo.x_card_num.value.length <=8)
{
	alert('Card number is not valid');
	document.steptwo.x_card_num.focus();
	return false;
}
if (document.steptwo.x_card_code.value.length <=2)
{
alert('CVV number must be 3 or 4 digits ');
document.steptwo.x_card_code.focus();
return false;
}
document.steptwo.x_Exp_Date.value=document.steptwo.cardexpdate1.options[document.steptwo.cardexpdate1.selectedIndex].value+"/"+document.steptwo.cardexpdate2.options[document.steptwo.cardexpdate2.selectedIndex].value;
return true;
}
function cvv()
{
window.open("https://cybermidi.powweb.com/cvvinfo.php", "_new", "dependent=1,directories=0,height=400,location=0,menubar=0,screenx=0,screeny=0,resizable=no,screenx=0,screeny=0,,scrollbars=1,titlebar=0,toolbar=0,width=450,left=30,top=50");
}
function help()
{
window.open("popuphelp2.php", "_new", "dependent=1,directories=0,height=400,location=0,menubar=0,screenx=0,screeny=0,resizable=no,screenx=0,screeny=0,,scrollbars=1,titlebar=0,toolbar=0,width=450,left=30,top=50");
}
function helpselect()
{
window.open("popuphelpselect.php", "_new", "dependent=1,directories=0,height=400,location=0,menubar=0,screenx=0,screeny=0,resizable=no,screenx=0,screeny=0,,scrollbars=1,titlebar=0,toolbar=0,width=450,left=30,top=50");
}