var _global 	= new Array();
var resetflds	= new Array("req","lang","email");
var b;
var fieldBorderColor = "#56adc6";
var fieldBorderWarningColor = "#FF0000";
var fieldLabelColor = "#43484a";
var fieldLabelWarningColor = "#FF0000";
/***************************   DISPLAY CONTROLLERS   ***************************/
function tryAgain(after) {
	display.hideElement(after);
	display.showElement("frm");
}
/*****************************	 FORM VALIDATORS   *****************************/
function FormValidated() {
	var isValid = true;
	if ( trim(xGetElementById("email").value) == '' || trim(xGetElementById("email").value) == _global['YOUR_EMAIL_ADDRESS'] || !testEmail(trim(xGetElementById("email").value)) ) isValid = elementValidator('email','',false,'form',fieldBorderWarningColor,fieldBorderColor);
	else b = elementValidator('email','',true,'form',fieldBorderWarningColor,fieldBorderColor);
	return isValid;
}
/******************************	 DATA RETRIEVAL   ******************************/
function resetPassword(lang) {
	if ( FormValidated() ) {
		display.hideElement("frm");
		display.showElement("processing");
		xGetElementById("req").value = "RESET_PASSWORD";
		var loader = new net.ContentLoader(CI_AJAX_PATH + "tools.cfm?lang=" + lang,onResetPasswordResult,onResetPasswordError,"POST",net.CreatePostString(null,resetflds));
	}
}
function onResetPasswordResult() {
	response = net.CleanResponse(this.req.responseText);
	if ( response == 'OK' )
		display.showElement("success");
	else if ( response == 'NOT_FOUND' )
		display.showElement("notfound");
	else if ( response == 'TOO_MANY_OCCURANCES' )
		display.showElement("cannotbereset");
	else
		display.showElement("unknown");
	display.hideElement("processing");
}
function onResetPasswordError() {
	display.hideElement("processing");
	display.showElement("unknown");
}
