function ValidateField(objField, blnRequired, blnCode, blnNumeric, blnEmail, strFieldName)
{

var blnHold = true;
var strValue = objField.value;
if (blnRequired && strValue.length == 0)
	{
	blnHold = false;
	alert(strFieldName + " was left blank.\nThis field is required for registration");
	objField.focus();
	}
if (blnHold && blnCode && strValue.length > 0)
	{
//Regular Expression,,, this is the POSTAL CODE
PhoneNum='^[a-zA-Z]{1}[0-9]{1}[a-zA-Z]{1}[ ]{0,1}[0-9]{1}[a-zA-Z]{1}[0-9]{1}$';
  myReg=new RegExp(PhoneNum);

	if(!myReg.test(strValue))
		{
		blnHold = false;
		alert(strFieldName + " must be real postal code.\n Ex: R3R 3R3.");
		objField.focus();
		}
	}
if (blnHold && blnNumeric && strValue.length > 0)
	{
//Regular Expression,,, this is the phone number
PhoneNum='^[-+() 0-9.]{10,18}$';
  myReg=new RegExp(PhoneNum);

	if(!myReg.test(strValue))
		{
		blnHold = false;
		alert(strFieldName + " must be numeric\n and include Area Code First.");
		objField.focus();
		}
	}
if (blnHold && blnEmail && strValue.length > 0)
	{
//Regular Expression,,, this is the E Mail
PhoneNum='^[-a-zA-Z0-9_+.]{1,40}[@]{1}[a-zA-Z0-9]{2,40}[.]{0,1}[a-zA-Z0-9]{0,40}[.]{1}[a-zA-Z]{2,4}$';
  myReg=new RegExp(PhoneNum);

	if(!myReg.test(strValue))
		{
		blnHold = false;
		alert(strFieldName + " must be as\n Ex: john@doe.com");
		objField.focus();
		}
	}
return blnHold;
}



function ValidateForm()
{
var blnHold = true;
blnHold = ValidateField(document.vari.NAME, true, false, false, false, "Your Name");
if (blnHold)
	{
	blnHold = ValidateField(document.vari.ADDRESS, true, false, false, false, "Address");
	}
if (blnHold)
	{
	blnHold = ValidateField(document.vari.CITY, true, false, false, false, "City");
	}
if (blnHold)
	{
	blnHold = ValidateField(document.vari.POSTAL, true, true, false, false, "Postal Code");
	}
if (blnHold)
	{
	blnHold = ValidateField(document.vari.PHONE, true, false, true, false, "Phone");
	}
if (blnHold)
	{
	blnHold = ValidateField(document.vari.EMAIL, true, false, false, true, "E-Mail");
	}
return blnHold;
}
