var Forestarn = {

	PasserAnnonce: function() {
		Modalbox.show("/proprietaire-forestier/MB_passer_annonce_form.html", {
			title: "PASSER UNE ANNONCE",
			width: 600
		});
	},

	MerciAnnonce: function() {
		Modalbox.show("/proprietaire-forestier/MB_merci_annonce.html", {
			title: "PASSER UNE ANNONCE",
			width: 600
		});
	},

	ErreurAnnonce: function() {
		Modalbox.show("/proprietaire-forestier/MB_erreur_annonce.php", {
			title: "PASSER UNE ANNONCE",
			width: 600
		});
	},

	CheckAnnonceForm: function() {
		var _fieldToCheck = [
			"nom_prenom",
			"adresse",
			"code_postal",
			"ville",
			"telephone",
			"titre_annonce",
			"annonce",
			"prix",
			"frais"
		];

		var isError = false;

		_fieldToCheck.each(function( _field ) {
			if( $F(_field).trim().empty() ) {
				$(_field).addClassName("highlight");
				isError = true;
			} else {
				$(_field).removeClassName("highlight");
			}
		});

		if( ! $F("email").isEmail() ) {
			$("email").addClassName("highlight");
			isError = true;
		} else {
			$("email").removeClassName("highlight");
		}


		if( isError ) {
			alert("Veuillez corriger les éléments mis en surbrillance.");
		}

		return !isError;
	},

	CheckContactForm: function() {
		$("SendMail_Button").writeAttribute("disabled", true);

		var _fieldToCheck = [
			"nom",
			"prenom",
			"message"
		];

		var isError = false;

		_fieldToCheck.each(function( _field ) {
			if( $F(_field).trim().empty() ) {
				$(_field).addClassName("highlight");
				isError = true;
			} else {
				$(_field).removeClassName("highlight");
			}
		});

		if( ! $F("email").isEmail() ) {
			$("email").addClassName("highlight");
			isError = true;
		} else {
			$("email").removeClassName("highlight");
		}


		if( isError ) {
			alert("Veuillez corriger les éléments mis en surbrillance.");
			$("SendMail_Button").writeAttribute("disabled", false);
		}

		return !isError;
	},

	MerciContact: function() {
		Modalbox.show("/MB_merci_contact.html", {
			title: "VOTRE MESSAGE A ÉTÉ ENVOYÉ",
			width: 600
		});
	},

	PlanAcces: function() {
		Modalbox.show("/MB_plan_acces.html", {
			title: "PLAN D'ACCES",
			width: 710
		});
	}

}