// JavaScript Document
// JavaScript Document
function checkIt(evt) { //allow only numbers into certain input fields
	evt = (evt) ? evt : window.event 
	var charCode = (evt.which) ? evt.which : evt.keyCode
	if (charCode > 31 && (charCode < 48 || charCode > 57)) {
		status = "This field accepts numbers only."
		return false
	}
	status =""
	return true
}
//address validator allows only numbers and characters
function letterCheck(field) { 
var valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
var ok = true;
var temp;
for (var i=0; i<field.value.length; i++) {
	temp = "" + field.value.substring(i, i+1);
	if (valid.indexOf(temp) == "-1") ok = false;
	}
	if (ok == false) {
	alert("Only letters are accepted in this field");
	field.focus();
	field.select();
	}
}

function checkrequired(which){
var pass=true
var msg;
msg = "__________________________________________________________________________________\n\n"
msg += "You need to provide the following information to submit this form\n\n";
msg += "FIRST NAME\n";
msg += "LAST NAME\n";
msg += "EMAIL ADDRESS\n\n";
msg += "This is the minimum amount of information we need to respond adequately to your inquiry\n";
msg += "Please make sure these fields are filled and press submit again\n";
msg += "__________________________________________________________________________________\n\n";
msg += "If you would rather contact us via phone, please call 617-500-4497\n\n";
if (document.images){
	for (i=0;i<which.length;i++){
		var tempobj=which.elements[i]
		if (tempobj.name.substring(0,8)=="required"){
			if (((tempobj.type=="text"||tempobj.type=="textarea")&&tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&tempobj.selectedIndex==-1)){
				pass=false
				break
				}
				}
				}
			}
			if (!pass){
			alert(msg);
			return false
		}
	else
	return true
}

//Email validator
function validateEmail(temp) { 
	var emailOk  = true
	var temp     = document.morfLiam.required_Email
	var atSym    = temp.value.indexOf('@')
	var period   = temp.value.lastIndexOf('.')
	var space    = temp.value.indexOf(' ')
	var length   = temp.value.length - 1  
if ((atSym < 1) ||                     
    (period <= atSym+1) ||             
    (period == length ) ||             
    (space  != -1))                    
   {  
      EmailOk = false
      alert('You need to enter a valid email address to proceed!\n\nTry inserting the @ symbol, a period as in (dot.com),\n\or remove any unnecesary spaces...')
      temp.focus()
	  temp.select();
   }
return emailOk
}
