

function checkSchoolEmail(address){
	//get last three TLD chars
	var addArr = address.split(".");
	var lastTxt = addArr[addArr.length-1].toLowerCase();

	// if no .edu is found it means school email is not valid, set truthValue to false
	if(lastTxt!="edu") return false;
	else return true;
	
}
	
	
function checkValidEmailConstruction(address){
	
	//check to see if address is not present, missing the domain "." or "@" symbol and has no spaces
	if(address==null || address.length==0 || address.indexOf(".") == -1 || address.indexOf("@") == -1 || address.indexOf(" ")!= -1){ return false;}
	//check to see if user part of the address starts or ends with a period "." or if the domain starts with a period, both are not allowed
	if (address.charAt(1)=='.' || address.charAt(address.indexOf('@')-1)=="." || address.charAt(address.indexOf('@')+1) ){ return false;}
	//can not have more than one "@"
	if(address.indexOf('@') != address.lastIndexOf('@')){ return false;}
	// loop through   the address and make sure that only valid characters are used
	//for(var i = 0; i<address.length()  ; i++){
		//	if(address.charAt(i) ==		
	//	}
	return true;

}
	
function testEmail(node){
	if(checkSchoolEmail(node.value) ){} //&&checkValidEmailConstruction(node.value)){ }
	else { //if the e-mail address is not valid or a school email
		alert("Please register with a valid .edu address.");
		node.value = "";
		 theNode = node;
		// set time out brings the focus back after other prequeued procedures complete. 
		setTimeout(function(){setFocusOnNode(theNode);},500); 
	}
}

//sets the focus to the given element node
function setFocusOnNode(node){
	node.focus();
}

// check passwords as equal

// activate submit button only when all fields filled in 


