// JavaScript Document
// Validation Code 

// Validate URLs
// E-mail addresses

	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 validURL(theURL)
	{
		re = /^(https|http):\/\/\S+\.\S+$/i
		
		if(re.test(theURL))
		{ return true }
		else
		{ return false }

	}
	
	function fixStThomasEdu(theEmailField)
	{
		theEmailField.value = theEmailField.value.replace("stthomasedu", "stthomas.edu")
		theEmailField.value = theEmailField.value.replace("stthomased.u", "stthomas.edu")
		theEmailField.value = theEmailField.value.replace("sthomas.", "stthomas.")
		theEmailField.value = theEmailField.value.replace("stthomsa.", "stthomas.")
		theEmailField.value = theEmailField.value.replace("stthomase.", "stthomas.")
		theEmailField.value = theEmailField.value.replace("sttomas.", "stthomas.")
		theEmailField.value = theEmailField.value.replace("stthoomas.", "stthomas.")
		theEmailField.value = theEmailField.value.replace("stthomass.", "stthomas.")
		theEmailField.value = theEmailField.value.replace("sttthomas.", "stthomas.")
		theEmailField.value = theEmailField.value.replace("st.thomas.", "stthomas.")
		theEmailField.value = theEmailField.value.replace(".ed", ".edu")
		theEmailField.value = theEmailField.value.replace(".du", ".edu")
		theEmailField.value = theEmailField.value.replace(".eduu", ".edu")
		theEmailField.value = theEmailField.value.replace(".edy", ".edu")
	}