function nominatorLoginCheck( Form ){
var Alert = '';

	Form.email.value = trim(Form.email.value);
	Form.password.value = trim(Form.password.value);

	if ( !Form.email.value.match(/([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/)){
		Alert += "Email is blank or invalid.\n";		
	}

	if ( Form.password.value == "" ){
		Alert += "Password is blank or invalid.\n";		
	}

    if ( Alert != "" ){
		alert(Alert);
		
    }else{
    	//alert("Submit");    
		Form.submit();
	}

}

function nominatorForgotLoginCheck( Form ){
var Alert = '';

	if ( !Form.email.value.match(/([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/)){
		Alert += "Email is blank.\n";		
	}
	
    if ( Alert != "" ){
		alert(Alert);
		
    }else{
    	//alert("Submit");    
		Form.submit();
	}

}

function nominatorRegister(){

    location.href = "http://vesta.cumc.columbia.edu/horwitz/?nominatorRegister=1";

}

function fpasswd(){

    location.href = "http://vesta.cumc.columbia.edu/horwitz/?fpasswd=1";

}


function boardLogin(){

    location.href = "https://wind.columbia.edu/login?destination=http://vesta.cumc.columbia.edu/horwitz/?nomineeSummary=1";

}

function forgotPassword() {
	document.getElementById("forgotPasswordMsg").innerHTML = '<font color="red">Sending email ... </font>';
	new Ajax.Updater('forgotPasswordMsg','http://vesta.cpmc.columbia.edu/horwitz/password.php', 
	{ 
		method: 'post', 
		//asynchronous: false,
		parameters: 'forgotPasswordEmail='+document.getElementById("emailPassword").value
	});
	document.getElementById("forgotPasswordForm").style.display = 'none';
	document.getElementById("emailPassword").value = '';
}

function trim( value ) { return LTrim(RTrim(value)); }
function LTrim( value ) { var re = /\s*((\S+\s*)*)/; return value.replace(re, "$1"); }
function RTrim( value ) { var re = /((\s*\S+)*)\s*/; return value.replace(re, "$1"); }