function checkPCZip(FormName,ElemName1,ElemName2)
{
var theResult = true;
var Temp1 = document.forms[FormName].elements[ElemName1];
var Temp2 = document.forms[FormName].elements[ElemName2];
	if (Temp2.value=='Canada')              
	{
		var zipL = Temp1.value.replace(/ /g,'');
		if (zipL.length == 6){
			if((!isNaN(zipL.charAt(0)))||(isNaN(zipL.charAt(1)))||(!isNaN(zipL.charAt(2)))||(isNaN(zipL.charAt(3)))||(!isNaN(zipL.charAt(4)))||(isNaN(zipL.charAt(5)))){
				alert ('Please re-enter your Postal Code.');
				theResult =  false;
			}
		}else{
			alert ('Please re-enter your Postal Code.');
			theResult =  false;
		}
	}else{
		var zipL = Temp1.value.replace(/ /g,'');
		if (((zipL.length != 5)&&(zipL.length != 9))||(zipL != parseInt(zipL))){
			alert ('Please re-enter your Zip Code.');
			theResult =  false;
		}
	}
	return theResult;
}
function IsEmailValid(FormName,ElemName)
{
var pattern = /[^\@\d\w\._-]/;
var EmailOk  = true;
var Temp     = document.forms[FormName].elements[ElemName];
if (Temp.value.length>0){
    var Result   = Temp.value.match(pattern);
    var AtSym    = Temp.value.indexOf('@');
    var Period   = Temp.value.lastIndexOf('.');
    var Space    = Temp.value.indexOf(' ');
    var LAtSym   = Temp.value.lastIndexOf('@');
    var Length   = Temp.value.length - 1;   // Array is from 0 to length-1

    if ((AtSym < 1) ||                     // '@' cannot be in first position
        (Period <= AtSym+1) ||             // Must be at least one valid char btwn '@' and '.'
        (Period == Length ) ||             // Must be at least one valid char after '.'
        (Space  != -1) ||                  // No empty spaces permitted
        (Result) ||                        // Only '@','.','-','_',numbers and characters allowed
        (AtSym != LAtSym))                 // No more than one '@'
       {
		  //Temp.focus();
          EmailOk = false;
          alert('You have entered an invalid email address\nEmail must be in the form xxx@xxx.xxx\n\nPlease try again.');
       }
    return EmailOk;
    }
}
function checkContactInfo(theForm){
	var theForm = document.forms[0];
	if((!theForm.coname.value)||(!theForm.addr1.value)||(!theForm.city.value)||(!theForm.prov.value)||(!theForm.country.value)||(!theForm.pc.value)||(!theForm.contFname.value)||(!theForm.contLname.value)||(!theForm.contPos.value)||(!theForm.email.value)||(!theForm.area.value)||(!theForm.phone.value)){
		alert('Please fill in all required fields.');
		return false;
	}else{
		return true;
	}
}
