var testresults
function checkemail(){
var str=document.form1.Email.value
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
testresults=true
else{
alert("Please input a valid email address!")
testresults=false
}
return (testresults)
}
function check_form() {
    if( document.form1.FirstName.value == "" )
	{ 
		alert("Please enter first name");
		document.form1.FirstName.focus()
		return false;
	} 
	if( document.form1.LastName.value == "" )
	{ 
		alert("Please enter last name");
		document.form1.LastName.focus()
		return false;
	}
		if(( document.form1.hphone1.value == "" ) || ( document.form1.hphone2.value == "" ) || ( document.form1.hphone3.value == "" ))
	{ 
		alert("Please enter home phone number ");
		document.form1.hphone1.focus()
		return false;
	}
var checkOK = "0123456789";
var checkStr = form1.hphone1.value;
var allValid = true;
var allNum = "";
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("Please enter only numbers in the phone field");
form1.hphone1.focus();
return (false);
}
var checkOK = "0123456789";
var checkStr = form1.hphone2.value;
var allValid = true;
var allNum = "";
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("Please enter only numbers in the phone field");
form1.hphone2.focus();
return (false);
}
var checkOK = "0123456789";
var checkStr = form1.hphone3.value;
var allValid = true;
var allNum = "";
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("Please enter only numbers in the phone field");
form1.hphone3.focus();
return (false);
}
	if( document.form1.Email.value == "" )
	{ 
		alert("Please enter email ");
		document.form1.Email.focus()
		return false;
    }
	if( document.form1.NegItems.value == "" )
	{ 
		alert("Please enter negative number of items on credit ");
		document.form1.NegItems.focus()
		return false;
    }
	return checkemail()	
}
var testresults
function checkemail1(){
var str=document.form1.Email.value
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
testresults=true
else{
alert("Please input a valid email address!")
testresults=false
}
return (testresults)
}
function check_form1() {
    if( document.form1.FirstName.value == "" )
	{ 
		alert("Please enter first name");
		document.form1.FirstName.focus()
		return false;
	}
	  if( document.form1.LastName.value == "" )
	{ 
		alert("Please enter last name");
		document.form1.LastName.focus()
		return false;
	}
		if(( document.form1.hphone1.value == "" ) || ( document.form1.hphone2.value == "" ) || ( document.form1.hphone3.value == "" ))
	{ 
		alert("Please enter home phone number ");
		document.form1.hphone1.focus()
		return false;
	}
var checkOK = "0123456789";
var checkStr = form1.hphone1.value;
var allValid = true;
var allNum = "";
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("Please enter only numbers in the phone field");
form1.hphone1.focus();
return (false);
}
var checkOK = "0123456789";
var checkStr = form1.hphone2.value;
var allValid = true;
var allNum = "";
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("Please enter only numbers in the phone field");
form1.hphone2.focus();
return (false);
}
var checkOK = "0123456789";
var checkStr = form1.hphone3.value;
var allValid = true;
var allNum = "";
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkOK.length;  j++)
if (ch == checkOK.charAt(j))
break;
if (j == checkOK.length)
{
allValid = false;
break;
}
if (ch != ",")
allNum += ch;
}
if (!allValid)
{
alert("Please enter only numbers in the phone field");
form1.hphone3.focus();
return (false);
}
	if( document.form1.Email.value == "" )
	{ 
		alert("Please enter email ");
		document.form1.Email.focus()
		return false;
    }
	return checkemail1()	
}
var testresults
function checkemail2(){
var str=document.form1.Email.value
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
if (filter.test(str))
testresults=true
else{
alert("Please input a valid email address!")
testresults=false
}
return (testresults)
}
function check_form2() {
  	if( document.form1.Email.value == "" )
	{ 
		alert("Please enter email ");
		document.form1.Email.focus()
		return false;
    }
	return checkemail2()	
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
