// IMPORTANT!!! All these functions and variables are included in registrationFormCheck.js
// Use when only e-mail validation is required.

var EMAIL_VALIDATION_STATE = 0;

function VerifyEmail(emailAddress)
{
	//alert("email " + emailAddress)
	var urlPart = "emailAddress=" + emailAddress;
	$.ajax(
	{	url: "/bzJApp/VerifyEmailAction.action?"+urlPart, 
		context: this,
		success: this.processVerifyEmail, 
		error : this.processFailure, 
		complete : this.processComplete
	});	
}

function processVerifyEmail (data, textStatus, XMLHttpRequest) {
	var emailerrormessage = document.getElementById('emailerrormessage');
	var email = document.getElementById('email');
	if(data == 1){
		emailerrormessage.innerHTML = 'Please enter a valid e-mail address <input type="hidden" name="emailValid" value="false" />';
		emailerrormessage.style.display = 'block';
		email.className = 'highlight';
	} else {
		emailerrormessage.innerHTML = '<input type="hidden" name="emailValid" value="true" />';
		emailerrormessage.style.display = 'none';
		email.className = 'cleanup';	
	}
}

function processFailure(XMLHttpRequest, textStatus, errorThrown) {
	logToWindow("verification - failed. " + textStatus);
	if (errorThrown != null)
	{
		processException(XMLHttpRequest, errorThrown);
	}
}//END: processFailure

function processComplete(XMLHttpRequest, textStatus) {
	logToWindow("verification - complete.");
}//END: processComplete

function processException(Req, Ex1) {
	logToWindow("verification - execption " + Ex1);
}//END: processException

