// JScript source code
// Author:  Marleen Caplan
// Date:  09/01/2003 - original code
				
function validateContactUs(){
// Rev:	7/8/2004 - all fields except telephone are now required fields
//							added validation routines for Name, Organization, State and Type 
	function isEmpty(s){
		var numBlanks = 0;
		var str = new String(s);
		for (i=0;i<str.length;i++){
			if (str.charAt(i)==" ") {
				numBlanks++;
			}
		}
		if (numBlanks==str.length) {
			return true;
		} 
		return false;
	}

	function isValidEmail(str) {
		if (str.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) return true;
		else return false;
	}	
	
	var errMsg = new String("");
	if (isEmpty(document.contactUs.nom.value)) errMsg += "\n     Your Name";	 
	if (isEmpty(document.contactUs.org.value)) errMsg += "\n     Organization";
	if (document.contactUs.ste.selectedIndex == 0) errMsg += "\n     State";
	if ((! document.contactUs.typ[0].checked) && (! document.contactUs.typ[1].checked) && (! document.contactUs.typ[2].checked) && (! document.contactUs.typ[3].checked))  errMsg += "\n     Type";	
	if (! isValidEmail(document.contactUs.em.value)) errMsg += "\n     Email Address";
	if (isEmpty(document.contactUs.msg.value)) errMsg += "\n     Message";
	if (errMsg.length>0) {
		errMsg =  "Please correct the following fields:" + errMsg;
		alert(errMsg);
		return false;
	}
	if (confirm("Please confirm the email address you are about to submit: "+document.contactUs.em.value+"\nIf this is not correct, click \"cancel\" and make any necessary changes. Otherwise click \"okay\"." )==false)  return false;
}


			function validateNewsReg() {
			//	Orig: 1/28/2005	
			
				var errMsg = new String(""); 
			
			
				function isEmpty(s){
	//alert("isEmpty");				
						var numBlanks = 0;
						var str = new String(s);		
						if (str.length<1) return true;									  
						for (var i=0;i<str.length;i++){
							if (str.charAt(i)==" ") {
								numBlanks++;
							}
						}
						if (numBlanks==str.length) {
							return true;
						} 
						return false;
					}

					function isValidEmail(str) {
	//alert("isValidEmail");				
						if (str.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1) return true;
						else return false;
					}		


//alert("validateNewsReg");				
//alert("errMsg ="+errMsg);				
//alert("document.frmNewsReg.fNom.value ="+document.frmNewsReg.fNom.value);				
				if (isEmpty(document.frmNewsReg.fNom.value)) errMsg += "\n     First Name";
//alert("errMsg ="+errMsg);				
				if (isEmpty(document.frmNewsReg.lNom.value)) errMsg += "\n     Last Name";
//alert("errMsg ="+errMsg);				
				if (isEmpty(document.frmNewsReg.org.value)) errMsg += "\n     Organization";	
//alert("errMsg ="+errMsg);				
				if (! document.frmNewsReg.typ[0].checked) {
					if (! document.frmNewsReg.typ[1].checked) {
						if (! document.frmNewsReg.typ[2].checked) {
							if (! document.frmNewsReg.typ[3].checked) {
									errMsg += "\n     Type of Ogranization";	
							}
						}
					}
				}
//alert("errMsg ="+errMsg);				
				if (! (document.frmNewsReg.ste.selectedIndex > 0)) errMsg += "\n     State";		
//alert("errMsg ="+errMsg);				
				if (! isValidEmail(document.frmNewsReg.em.value)) errMsg += "\n     Email Address";
//alert("errMsg ="+errMsg);				
				if (! document.frmNewsReg.fmt[0].checked) {
					if (! document.frmNewsReg.fmt[1].checked) {
						errMsg += "\n     Format";
					}
				}
//alert("errMsg ="+errMsg);				
				if (errMsg.length>0) {
					errMsg =  "Please correct the following fields:" + errMsg;
					alert(errMsg);
					return false;
				}
				if (confirm("Please confirm the email address you are about to submit:"+document.frmNewsReg.em.value+"\nIf this address is not correct, click \"cancel\" and make any necessary changes. Otherwise click \"okay\"." )==false)  return false;
			}
