// Turn off the alert pop up
wf.showAlertOnError = false;

// Tap into the validation routine and do our Ajax stuff
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['lasik_form1']), insertion:Insertion.Bottom, asynchronous:true});
	return wf.utilities.XBrowserPreventEventDefault(evt);
}
function sendmail() {
	//Make the Progress Bar Appear
	//new Effect.Appear('progress');
	showLayer('progress');
}
function handelrequest() {
	// Fade the Progress Bar
	//new Effect.Fade('progress');
	hideLayer('progress');
	// Make the form itsef wipe up
	//new Effect.BlindUp('form');
	hideLayer('form');
	// Show the result!
	//new Effect.Appear('result');
	showLayer('result');
}


function hideLayer(id) { 
  if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById(id).style.visibility = 'hidden';
  }
  else {
	if (document.layers) { // Netscape 4
	  document.id.visibility = 'hidden';
	}
	else { // IE 4
	  document.all.id.style.visibility = 'hidden';
	}
  }
}

function showLayer(id) {
 if (document.getElementById) { // DOM3 = IE5, NS6
 	document.getElementById(id).style.visibility = 'visible';
  }
  else {
	if (document.layers) { // Netscape 4
	  document.id.visibility = 'visible';
	}
	else { // IE 4
	  document.all.id.style.visibility = 'visible';
	}
  }
}