// JavaScript Document
//wf.showAlertOnError = false;
wf.functionName_formValidation = "myCustomValidation";
function myCustomValidation (evt) {
	if(wf.formValidation(evt)) new Ajax.Updater('result', 'sendmail.php',{onLoading:function(request){sendmail()},onComplete:function(request){handelrequest()},parameters:Form.serialize(document.forms['contact']), insertion:Insertion.Bottom, asynchronous:true});
	return wf.utilities.XBrowserPreventEventDefault(evt);
}
function sendmail() {
	//If there's an earlier error message, remove it
	var remove_error = document.getElementById('error_msg');
	remove_error.style.display = 'none';
	//Make the Progress Bar Appear
	new Effect.Appear('progress');
}
function handelrequest() {
	new Effect.Appear('result', { duration: 3.0 });
	new Effect.Fade('progress');
	new Effect.Highlight('result', { startcolor:'#ffffff', endcolor:'#ffffcc', duration: 2.5 });
	//new Effect.Fade('result');
	//new Effect.Appear('result');
	//new Effect.BlindUp('form');
}

wFORMS.behaviors['validation'].showAlert = function (nbTotalErrors) {
	var placeHolder = document.getElementById('error_msg');
	placeHolder.innerHTML = wFORMS.arrErrorMsg[8].replace('%%',nbTotalErrors); 
	placeHolder.style.display = 'block';
}