
	function checkMandatory(oField, sMessage) {
        if ("" == oField.value) {
          alert(sMessage);
          oField.focus();
          return false;
        }
        return true;
     }

     function doSubmit() {
        var oForm = document.subscribe;
        if (!checkMandatory(oForm.operator, "You must enter your Operator Name")) {
          return false;
        }
        if (!checkMandatory(oForm.company, "You must enter your Company Name")) {
          return false;
        }
        if (!checkMandatory(oForm.streetAddress, "You must enter your Street Address")) {
          return false;
        }
        if (!checkMandatory(oForm.cityState, "You must enter your City and State")) {
          return false;
        }
        if (!checkMandatory(oForm.zip, "You must enter a valid Zip code")) {
          return false;
        }
	if (!checkMandatory(oForm.dayPhone, "You must enter a Daytime Phone Number")) {
          return false;
        } 
        if (!checkMandatory(oForm.email, "You must enter your email address")) {
          return false;
        }
	
	if (!isValidZip(oForm.Zip)) {
          oForm.Zip.focus();
          return false;
        }        
        
		     
	     function isDigit(c) {
		      return ( (c >= "0") && (c <= "9") )
	      }
	     function digitsOnly(str) {
	        var sSub;
	        var sOut = "";
	        for ( j=0;j<str.length;j++ ) {
	          sSub = str.substring(j,j+1);
	          if ( isDigit(sSub) ) sOut += sSub;
	        }
	        return sOut;
	      }      
	     
	     function isValidEmailAddress(theEmail) {
	        if (theEmail != "" && theEmail !="NA") {
	            re = /(^[A-Za-z0-9_])([A-Za-z0-9_.-]*)@((([A-Za-z0-9_-]{2,})\.){1,})(([A-Za-z]{2,})$)/;
	            return (re.test(theEmail));
	        }
	        return true;
	      }
		 
		 function trimLeft()
			{
				s = this;
				while(s.substring(0,1) == ' ') 
				        s = s.substring(1, s.length);
				return s;
			}
			
		 function trimRight()
			{
				s = this;
				while(s.substring(s.length - 1, s.length) == ' ')
			        s = s.substring(0, s.length-1);
				return s;
			}
			
		 function trim()
			{
				return this.trimLeft().trimRight();
			}
		function isValidZip(field) {
	
	theZip = field.value;
	if (theZip != "") 
	{
		theZip = theZip.digitsOnly();
		if(!(theZip.length == 5 || theZip.length == 9)) {
			return false;
		}
		if(theZip.length == 5) {
			field.value = theZip;
		}
		if(theZip.length == 9) {
			field.value = theZip.substring(0,5) + "-" + theZip.substring(5,9);
		}
	}
	return true;
}
	
		
		
}

