// Email form - general three part validation and clear//


function validEmail(email) {
			invalidChars = " /:,;"
	
			if (email == "") {						
				return false
			}
			for (i=0; i<invalidChars.length; i++) {	
				badChar = invalidChars.charAt(i)
				if (email.indexOf(badChar,0) > -1) {
					return false
				}
			}
			atPos = email.indexOf("@",1)			
			if (atPos == -1) {
				return false
			}

			if (email.indexOf("@",atPos+1) != -1) {	
				return false
			}
			periodPos = email.indexOf(".",atPos)
			if (periodPos == -1) {					
				return false
			}
			if (periodPos+3 > email.length)	{		
				return false
			}
			return true
		}


function ConfirmCancel (){
  if (confirm("Are you sure you want to clear the form? Click OK to clear it."))
   {
      document.contactForm.reset()
   }
  return true
}


// contact form//

function validate() {
	if (document.contactForm.name.value == ""){
		alert("Please enter your name.")
		document.contactForm.name.focus()
		document.contactForm.name.select()
		return false
		}
		

	if (!validEmail(document.contactForm.emailAddr.value)) {
		alert("Invalid email address")
		document.contactForm.emailAddr.focus()
		document.contactForm.emailAddr.select()
		return false
	}

	
	eSubject = document.contactForm.subject.selectedIndex
	if (document.contactForm.subject.options[eSubject].value==""){
		alert("Please select a subject for your message.")
		document.contactForm.subject.focus()
		return false
		}	

	if (document.contactForm.message.value == ""){
		alert("Please enter a message.")
		document.contactForm.message.focus()
		document.contactForm.message.select()
		return false
		}

	return true
}


// add email to list//

function validateAdd() {
	
	if (!validEmail(document.emailForm.email.value)) {
		alert("Please enter a valid email address")
		document.emailForm.email.focus()
		document.emailForm.email.select()
		return false
	}


	return true
}


// show/hide for privacy link rollover//

function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

