var initFrmRequest1= function() {
	if (!$("Frmrequest1")) return;
	var alertXML = new fLoadXML("templates/fr/requestaccess1_fr.xml", true);
	alertXML.fSuccess = function(){
		document.frmContactValider = new validerAlert(
			"frmContactAlertBox", 
			"Frmrequest1", 
			"frmrequestSubmitStep1", 
			this.aXml['form'][0].field, 
			{
				txtColor: "#FFFFFF", 
				background: "#fff url(templates/fr/images/_alert_bar.gif) 0 0 no-repeat", 
				closeImage: "templates/fr/images/_alert_close.gif",
				border: "1px solid #859825",
				width: "178px"
			},
			false,
			showStep3Form
		);
	}
}
var initFrmRequest2= function() {
	if (!$("Frmrequest2")) return;
	var alertXML = new fLoadXML("templates/fr/requestaccess2_fr.xml", true);
	alertXML.fSuccess = function(){
		document.frmContactValider = new validerAlert(
			"frmRequest2AlertBox", 
			"Frmrequest2", 
			"frmrequestSubmitStep2", 
			this.aXml['form'][0].field, 
			{
				txtColor: "#FFFFFF", 
				background: "#fff url(templates/fr/images/_alert_bar.gif) 0 0 no-repeat", 
				closeImage: "templates/fr/images/_alert_close.gif",
				border: "1px solid #859825",
				width: "170px"
			},
			false,
			synRequest
		);
	}
}
function synRequest(){
	$('Frmrequest2').family.value=$('Frmrequest1').family.value;
	$('Frmrequest2').familyName.value=$('Frmrequest1').familyName.value;
	$('Frmrequest2').firstName.value=$('Frmrequest1').firstName.value;
	$('Frmrequest2').jobtitle.value=$('Frmrequest1').jobtitle.value;
	$('Frmrequest2').email.value=$('Frmrequest1').email.value;
	$('Frmrequest2').company.value=$('Frmrequest1').company.value;
	$('Frmrequest2').address.value=$('Frmrequest1').address.value;
	$('Frmrequest2').country.value=$('Frmrequest1').country.value;
	$('Frmrequest2').phone.value=$('Frmrequest1').phone.value;
	$('Frmrequest2').fax.value=$('Frmrequest1').fax.value;
	$('Frmrequest2').generalEmail.value=$('Frmrequest1').generalEmail.value;
	$('Frmrequest2').website.value=$('Frmrequest1').website.value;
	$('Frmrequest2').submit();
}
////////////////
var initFrmAgent= function() {
	if (!$("agentloginForm")) return;
	var alertXML = new fLoadXML("templates/fr/agent_access_fr.xml", true);
	alertXML.fSuccess = function(){
		document.frmContactValider = new validerAlert(
			"frmContactAlertBox", 
			"agentloginForm", 
			"frmagnetSubmit", 
			this.aXml['form'][0].field, 
			{
				txtColor: "#FFFFFF", 
				background: "#fff url(templates/fr/images/_alert_bar.gif) 0 0 no-repeat", 
				closeImage: "templates/fr/images/_alert_close.gif",
				border: "1px solid #859825",
				width: "170px"
			}/*,
			false,
			getTitle*/
		);
	}
}

//////////////////////////////

var initFrmContact = function() {
	if (!$("contactFrm")) return;
	var alertXML = new fLoadXML("contact_fr.xml", true);
	alertXML.fSuccess = function(){
		document.frmContactValider = new validerAlert(
			"frmContactAlertBox", 
			"contactFrm", 
			"submitContact", 
			this.aXml['form'][0].field, 
			{
				txtColor: "#FFFFFF", 
				background: "#fff url(templates/fr/images/_alert_bar.gif) 0 0 no-repeat", 
				closeImage: "templates/fr/images/_alert_close.gif",
				border: "1px solid #859825",
				width: "200px"
			},
			false,
			getTitle
		);
	}
}

var initFrmSearch = function() {
	if (!$("frmSearch")) return;
	var alertXML = new fLoadXML("search.xml", true);
	alertXML.fSuccess = function(){
		document.frmSearchValider = new validerAlert(
			"frmContactAlertBox1", 
			"frmSearch", 
			"searchButton", 
			this.aXml['form'][0].field, 
			{
				background: "#fff url(templates/fr/images/_alert_bar.gif) 0 0 no-repeat", 
				closeImage: "templates/fr/images/_alert_close.gif",
				border: "1px solid #859825",
				width: "183px"
			}
		);
	}
}

var initTailorFormStep = function() {
	if (!$("tailorForm1")) return;
	var alertXML = new fLoadXML("fr_tailor.xml", true);
	alertXML.fSuccess = function(){
		document.frmSearchValider = new validerAlert(
			"initFrmStep3AlertBox", 
			"tailorForm1", 
			"frmTailorSubmitStep1", 
			this.aXml['form'][0].field, 
			{
				background: "#fff url(templates/fr/images/_alert_bar.gif) 0 0 no-repeat", 
				closeImage: "templates/fr/images/_alert_close.gif",
				border: "1px solid #859825",
				width: "183px"
			},
			false,
			showStep2Form
		);
	}
		//
	if ($("none")) {
		//$("none").checked = true;
		$("none").addEvent("click", function(e){
			setEnabled(false);
		});
	}
	if ($("boardplan1")) {
		$("boardplan1").addEvent("click", function(e){
			setEnabled(true);
		});
	}
	if ($("boardplan2")) {
		$("boardplan2").addEvent("click", function(e){
			setEnabled(true);
		});
	}
	//
	setEnabled(!$("none").checked);
	function setEnabled(val) {
		if ($("rest1")) $("rest1").disabled = !val;
		if ($("rest2")) $("rest2").disabled = !val;
		if ($("rest3")) $("rest3").disabled = !val;
	}
	
}

var initTailorForm = function() {
	if (!$("tailorForm")) return;
	var alertXML = new fLoadXML("fr_tailor1.xml", true);
	alertXML.fSuccess = function(){
		document.frmSearchValider = new validerAlert(
			"initFrmStep3AlertBox", 
			"tailorForm", 
			"frmTailorSubmit", 
			this.aXml['form'][0].field, 
			{
				background: "#fff url(templates/fr/images/_alert_bar.gif) 0 0 no-repeat", 
				closeImage: "templates/fr/images/_alert_close.gif",
				border: "1px solid #859825",
				width: "183px"
			}
		);
	}
		//
	if ($("none")) {
		//$("none").checked = true;
		$("none").addEvent("click", function(e){
			setEnabled(false);
		});
	}
	if ($("boardplan1")) {
		$("boardplan1").addEvent("click", function(e){
			setEnabled(true);
		});
	}
	if ($("boardplan2")) {
		$("boardplan2").addEvent("click", function(e){
			setEnabled(true);
		});
	}
	//
	setEnabled(!$("none").checked);
	function setEnabled(val) {
		if ($("rest1")) $("rest1").disabled = !val;
		if ($("rest2")) $("rest2").disabled = !val;
		if ($("rest3")) $("rest3").disabled = !val;
	}
	
}


var initFrmNews = function() {
	if (!$("frmNews")) return;
	var alertXML = new fLoadXML("newsletter_form_fr.xml", true);
	alertXML.fSuccess = function(){
		document.frmNewsValider = new validerAlert(
			"frmNewsAlertBox", 
			"frmNews", 
			"frmNewsSubmit", 
			this.aXml['form'][0].field, 
			{
				txtColor: "#FFFFFF", 
				background: "#fff url(templates/fr/images/_alert_bar.gif) 0 0 no-repeat", 
				closeImage: "templates/fr/images/_alert_close.gif",
				border: "1px solid #859825",
				width: "178px"
			}
		);
	}
}

var initFrmPrices = function() {
	if (!$("frmPrices")) return;
	var alertXML = new fLoadXML("our_prices_fr.xml", true);
	alertXML.fSuccess = function(){
		document.frmPricesValider = new validerAlert(
			"frmPricesAlertBox", 
			"frmPrices", 
			"frmPricesSubmit", 
			this.aXml['form'][0].field, 
			{
				background: "#fff url(templates/fr/images/_alert_bar.gif) 0 0 no-repeat", 
				closeImage: "templates/fr/images/_alert_close.gif",
				border: "1px solid #859825",
				width: "175px"
			}
		);
	}
}
var initfrmpayment = function() {
	if (!$("frmpayment")) return;
	var alertXML = new fLoadXML("payment.xml", true);
	alertXML.fSuccess = function(){
		document.frmContactValider = new validerAlert(
			"frmPaymentAlertBox", 
			"frmpayment", 
			"paymentSubmit", 
			this.aXml['form'][0].field, 
			{
				background: "#fff url(templates/fr/images/_alert_bar.gif) 0 0 no-repeat", 
				closeImage: "templates/fr/images/_alert_close.gif",
				border: "1px solid #859825",
				width: "178px"
			}
		);
	}
}

var initFrmLogin = function() {
	if (!$("frmLogin")) return;
	var alertXML = new fLoadXML("login_fr.xml", true);
	alertXML.fSuccess = function(){
		document.FrmLoginValider = new validerAlert(
			"initFrmLoginAlertBox", 
			"frmLogin", 
			"loginSubmit", 
			this.aXml['form'][0].field, 
			{
				background: "#fff url(templates/fr/images/_alert_bar.gif) 0 0 no-repeat", 
				closeImage: "templates/fr/images/_alert_close.gif",
				border: "1px solid #859825",
				width: "178px"				
			}
		);
	}
}

var initFrmSend = function() {
	if (!$("sendFrm")) return;
	var alertXML = new fLoadXML("send_fr.xml", true);
	alertXML.fSuccess = function(){
		if(this.aXml['form'])
		document.frmSendValider = new validerAlert(
			"frmSendAlertBox", 
			"sendFrm", 
			"submitSend", 
			this.aXml['form'][0].field, 
			{
				txtColor: "#FFFFFF", 
				background: "#fff url(templates/fr/images/_alert_bar.gif) 0 0 no-repeat", 
				closeImage: "templates/fr/images/_alert_close.gif",
				border: "1px solid #859825",
				width: "175px"
			}	
		);
	}
}
var initFrmStep1 = function() {
	if (!$("step1Form")) return;
	var alertXML = new fLoadXML("step1_book_fr.xml", true);
	alertXML.fSuccess = function(){
		document.step1FormValider = new validerAlert(
			"initFrmStep1AlertBox", 
			"step1Form", 
			"submitStep1", 
			this.aXml['form'][0].field, 
			{
				background: "#fff url(templates/fr/images/_alert_bar.gif) 0 0 no-repeat", 
				closeImage: "templates/fr/images/_alert_close.gif",
				border: "1px solid #859825",
				width: "178px"
			}
		);
	}
}
var initFrmStep2 = function() {
	if (!$("step2Form")) return;
	var alertXML = new fLoadXML("step2_book_fr.xml", true);
	alertXML.fSuccess = function(){
		document.step2FormValider = new validerAlert(
			"initFrmStep1AlertBox", 
			"step2Form", 
			"submitStep2", 
			this.aXml['form'][0].field, 
			{
				background: "#fff url(templates/fr/images/_alert_bar.gif) 0 0 no-repeat", 
				closeImage: "templates/fr/images/_alert_close.gif",
				border: "1px solid #859825",
				width: "178px"
			}
		);
	}
}

var initFrmStep3 = function() {
	if (!$("step3Form")) return;
	var alertXML = new fLoadXML("step3_book_fr.xml", true);
	alertXML.fSuccess = function(){
		document.step3FormValider = new validerAlert(
			"initFrmStep1AlertBox", 
			"step3Form", 
			"submitStep3", 
			this.aXml['form'][0].field, 
			{
				background: "#fff url(templates/fr/images/_alert_bar.gif) 0 0 no-repeat", 
				closeImage: "templates/fr/images/_alert_close.gif",
				border: "1px solid #859825",
				width: "178px"
			}
		);
	}
	//
	//
	if ($("boardplan0")) {
		//$("boardplan0").checked = true;
		$("boardplan0").addEvent("click", function(e){
			setEnabled(false);
		});
	}
	if ($("boardplan1")) {
		$("boardplan1").addEvent("click", function(e){
			setEnabled(true);
		});
	}
	if ($("boardplan2")) {
		$("boardplan2").addEvent("click", function(e){
			setEnabled(true);
		});
	}
	//
	setEnabled(!$("boardplan0").checked);
	function setEnabled(val) {
		if ($("rest1")) $("rest1").disabled = !val;
		if ($("rest2")) $("rest2").disabled = !val;
		if ($("rest3")) $("rest3").disabled = !val;
	}
}
//
function resetFormContact() {
	$("sendFriend").style.display = "block";
	$("thankYou").style.display = "none";
}
//
function showThanks() {
	showFormContact(1);
	$("sendFriend").style.display = "none";
	$("thankYou").style.display = "block";
}
window.addEvent('load', function(){
    initFrmRequest1();
	initFrmRequest2();
	initFrmAgent();
    initFrmContact();
	initFrmSearch();
	initTailorForm();
	initTailorFormStep();
	initFrmNews();
	initfrmpayment();
	initFrmPrices();
	initFrmLogin();
	initFrmSend();
	initFrmStep1();
	initFrmStep2();
	initFrmStep3();
	});
