// JavaScript Document


// ================================== CONNEXION TIGNADDICT
	function connexionTaOn(champ,valeur)
	{
		document.getElementById(champ).style.backgroundPosition = "0 -16px";
		if(document.getElementById(champ).value == valeur)
		{
			document.getElementById(champ).value = "";
		}
	}
	
	function connexionTaOff(champ,valeur)
	{
		document.getElementById(champ).style.backgroundPosition = "0 0";
		if(document.getElementById(champ).value == "")
		{
			document.getElementById(champ).value = valeur;
		}
	}
	
	function MM_swapImgRestore() { //v3.0
	  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}
	function MM_preloadImages() { //v3.0
	  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}
	
	function MM_findObj(n, d) { //v4.01
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}
	
	function MM_swapImage() { //v3.0
	  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
// ================================== CONNEXION TIGNADDICT


// ================================== CORRECTIF BARRE DE NAV
	function largeurDernierLienNav()
	{
		itemsNav = ["nav1","nav2","nav3","nav4","nav5","nav6","nav7","nav8"];
		nItems = itemsNav.length;
		largeurItems = 0;
		
		for(i=0; i<nItems; i++)
		{
			largeurItems += document.getElementById(itemsNav[i]).offsetWidth;
		}
		
		if(largeurItems < 940)
		{
			longNavLienFin = 940 - largeurItems;
			document.getElementById("navLienFin").style.width = longNavLienFin+"px";
		}
	}
// ================================== CORRECTIF BARRE DE NAV


// ================================== CHAMPS NEWSLETTER - RECHERCHE
	function champRechercheOn(champ)
	{
		document.getElementById(champ).style.backgroundPosition = "0 -16px";
	}
	
	function champRechercheOff(champ)
	{
		document.getElementById(champ).style.backgroundPosition = "0 0";
	}
	
	function checkCarNewsletter(evt) {
		var keyCode = evt.which ? evt.which : evt.keyCode;
		if (keyCode == 13) {
			if(document.getElementById('newsletterForm').newsletterChamp.value != '' && document.getElementById('newsletterForm').newsletterChamp.value != 'e-mail'){
				subscribeNewsletter();
			}else{
				alert("Veuillez saisir votre adresse e-mail.");
			}
			return false;
		}
	}
// ================================== CHAMPS NEWSLETTER - RECHERCHE


// ================================== METEO SWITCH
	var minuterieMeteo;
	
	function switchLaMeteo(urlMeteo, titleMeteo, urlSkiarea, titleSkiarea)
	{
		var lienMeteoDroite = document.getElementById("meteoDroite");
		
		if(document.getElementById("temps1").className == "visible"){
			document.getElementById("temps1").className = "invisible";
			document.getElementById("temps2").className = "visible";
			document.getElementById("temps3").className = "invisible";
		}else if(document.getElementById("temps2").className == "visible"){
			document.getElementById("temps1").className = "invisible";
			document.getElementById("temps2").className = "invisible";
			document.getElementById("temps3").className = "visible";
			// changement du lien + titre
			lienMeteoDroite.href = urlSkiarea;
			lienMeteoDroite.innerHTML = '&gt; <span id="titleMeteoSkiarea">'+titleSkiarea+'</span>';
		}else{
			document.getElementById("temps1").className = "visible";
			document.getElementById("temps2").className = "invisible";
			document.getElementById("temps3").className = "invisible";
			// changement du lien + titre
			lienMeteoDroite.href = urlMeteo;
			lienMeteoDroite.innerHTML = '&gt; <span id="titleMeteoSkiarea">'+titleMeteo+'</span>';
		}
	}
	
	function meteoSwitch(urlMeteo, titleMeteo, urlSkiarea, titleSkiarea)
	{
		minuterieMeteo = setInterval("switchLaMeteo('"+urlMeteo+"', '"+titleMeteo+"', '"+urlSkiarea+"', '"+titleSkiarea+"')",5000);
	}
// ================================== METEO SWITCH


// ================================== SURVOL WHATS HOT
	function equilibreLesColonnes(colonneGauche,colonneDroite,lienTamponGauche,lienTamponDroite)
	{
		hauteurGauche = document.getElementById(colonneGauche).offsetHeight;
		hauteurDroite = document.getElementById(colonneDroite).offsetHeight;
		
		if(hauteurDroite > hauteurGauche)
		{
			difference = (hauteurDroite - hauteurGauche) + 20;
			document.getElementById(lienTamponGauche).style.height = difference + "px";
		}
		
		else if(hauteurGauche > hauteurDroite)
		{
			difference = (hauteurGauche - hauteurDroite) + 20;
			document.getElementById(lienTamponDroite).style.height = difference + "px";
		}
	}

	function survolWhatsHotOn(bloc,lien1,lien2,lien3)
	{
		document.getElementById(bloc).style.backgroundColor = "#00b1ff";
		document.getElementById(lien1).style.color = "#fff";
		document.getElementById(lien2).style.color = "#fff";
		document.getElementById(lien3).style.color = "#fff";
	}
	
	function survolWhatsHotOff(bloc,fond,lien1,lien2,lien3)
	{
		if(fond == "fond1")
		{
			document.getElementById(bloc).style.backgroundColor = "#f2f2f2";
		}
		else
		{
			document.getElementById(bloc).style.backgroundColor = "#fff";
		}
		document.getElementById(lien1).style.color = "#333";
		document.getElementById(lien2).style.color = "#777";
		document.getElementById(lien3).style.color = "#00b1ff";
	}
// ================================== SURVOL WHATS HOT


// ================================== SURVOL BLOC SKI A TIGNES
	function survolSommaireOn(bloc,lien1,lien2,lien3)
	{
		document.getElementById(bloc).style.backgroundColor = "#00b1ff";
		document.getElementById(bloc).style.backgroundPosition = "right -200px";
		document.getElementById(lien1).style.color = "#00b1ff";
		document.getElementById(lien1).style.backgroundColor = "#fff";
		
		document.getElementById(lien2).style.color = "#fff";
		document.getElementById(lien3).style.color = "#fff";
	}
	
	function survolSommaireOff(bloc,fond,lien1,lien2,lien3)
	{
		if(fond == "fond1")
		{
			document.getElementById(bloc).style.backgroundColor = "#f2f2f2";
		}
		else
		{
			document.getElementById(bloc).style.backgroundColor = "#fff";
		}
		document.getElementById(bloc).style.backgroundPosition = "right 0";
		document.getElementById(lien1).style.color = "#fff";
		document.getElementById(lien1).style.backgroundColor = "#00b1ff";
		
		document.getElementById(lien2).style.color = "#777";
		document.getElementById(lien3).style.color = "#00b1ff";
	}
// ================================== SURVOL BLOC SKI A TIGNES


// ================================== PATCH CSS MOZILLA OPERA
	function patchMozilla(elPatche)
	{
		if (navigator.userAgent.indexOf("Firefox") != -1 || navigator.userAgent.indexOf("Opera") != -1)
		{
			document.getElementById(elPatche).style.bottom = "12px";
		}
	}
// ================================== PATCH CSS MOZILLA OPERA


// ================================== SURVOL VISUEL WEBCAM
	function survolVisuelWebcamOn()
	{
		document.getElementById("survolVisuelWebcam").className = "visible";
	}
	
	function survolVisuelWebcamOff()
	{
		document.getElementById("survolVisuelWebcam").className = "invisible";
	}
// ================================== SURVOL VISUEL WEBCAM


// ================================== SURVOL BLOCS DROITE
	function equilibreLesColonnes2(colonneGauche,colonneDroite,lienTamponGauche,lienTamponDroite)
	{
		hauteurGauche = document.getElementById(colonneGauche).offsetHeight;
		hauteurDroite = 0;
		if(document.getElementById(colonneDroite)){
			hauteurDroite = document.getElementById(colonneDroite).offsetHeight;
		}
		
		if(hauteurDroite > hauteurGauche)
		{
			difference = (hauteurDroite - hauteurGauche) + 10;
			document.getElementById(lienTamponGauche).style.height = difference + "px";
		}
		
		else if(hauteurGauche > hauteurDroite)
		{
			if(document.getElementById(lienTamponDroite)){
				difference = (hauteurGauche - hauteurDroite) + 10;
				document.getElementById(lienTamponDroite).style.height = difference + "px";
			}
		}
	}
	
	
	function survolBlocsDroiteOn(bloc,lien1,lien2)
	{
		document.getElementById(bloc).style.backgroundColor = "#2e2e2e";
		document.getElementById(bloc).style.backgroundPosition = "0 -300px";
		document.getElementById(lien1).style.color = "#fff";
		document.getElementById(lien2).style.color = "#fff";
	}
	
	function survolBlocsDroiteOff(bloc,fond,lien1,lien2)
	{
		document.getElementById(bloc).style.backgroundPosition = "0 0";
		if(fond == "fond1")
		{
			document.getElementById(bloc).style.backgroundColor = "#00b1ff";
			document.getElementById(lien1).style.color = "#fff";
			document.getElementById(lien2).style.color = "#fff";
		}
		else
		{
			document.getElementById(bloc).style.backgroundColor = "#fffc00";
			document.getElementById(lien1).style.color = "#000";
			document.getElementById(lien2).style.color = "#000";
		}
		
	}
// ================================== SURVOL BLOCS DROITE



// ================================== SURVOL BLOCS DROITE PLAN
	function survolBlocsPlanDroiteOn(element,lien1,lien2)
	{
		element.style.backgroundColor = "#2e2e2e";
		element.style.backgroundPosition = "right -200px";
		document.getElementById(lien1).style.color = "#fff";
		document.getElementById(lien2).style.color = "#fff";
	}
	
	function survolBlocsPlanDroiteOff(element,fond,lien1,lien2)
	{
		element.style.backgroundPosition = "right 0";
		if(fond == "fond1")
		{
			element.style.backgroundColor = "#00b1ff";
			document.getElementById(lien1).style.color = "#fff";
			document.getElementById(lien2).style.color = "#fff";
		}
		else
		{
			element.style.backgroundColor = "#fffc00";
			document.getElementById(lien1).style.color = "#000";
			document.getElementById(lien2).style.color = "#000";
		}
		
	}
// ================================== SURVOL BLOCS DROITE PLAN



// ================================== SURVOL OUVERTURE FERMETURE ACCORDEONS
	function survolAccordeonOn(element)
	{
		element.style.backgroundColor = "#e3e3e3";
	}
	
	function survolAccordeonOff(element)
	{
		element.style.backgroundColor = "#f2f2f2";
	}
	
	function survolAccordeonAnnuaireOn(element)
	{
		element.style.backgroundColor = "#e3e3e3";
		element.style.backgroundPosition = "0 -700px";
	}
	
	function survolAccordeonAnnuaireOff(element,fond)
	{
		if(fond == "fond1")
		{
			element.style.backgroundColor = "#f2f2f2";
		}
		else
		{
			element.style.backgroundColor = "#fff";
		}
		element.style.backgroundPosition = "0 0";
	}
	
	function ouvrirFermerAccordeon(accordeon,lienAccordeon,intitule1,intitule2)
	{
		if(document.getElementById(accordeon).className == "invisible")
		{
			for (i=0; i<blocsAccordeonsTab.length; i++)
			{
				if(accordeon == blocsAccordeonsTab[i])
				{
					document.getElementById(blocsAccordeonsTab[i]).className = "visible";
					document.getElementById(liensAccordeonsTab[i]).innerHTML = intitule2;
				}
				else
				{
					document.getElementById(blocsAccordeonsTab[i]).className = "invisible";
					document.getElementById(liensAccordeonsTab[i]).innerHTML = intitule1;
				}
			}
		}
		else
		{
			document.getElementById(accordeon).className = "invisible";
			document.getElementById(lienAccordeon).innerHTML = intitule1;
		}
	}
// ================================== SURVOL OUVERTURE FERMETURE ACCORDEONS


// ================================== COMBO ANNUAIRE
	function ouvrirFermerCombo(combo)
	{
		$("ul").each(function() {
			if ( $(this).hasClass("visible") ){
				$(this).toggleClass("invisible");
			}
		});
		
		if(document.getElementById(combo).className == "invisible")
		{
			document.getElementById(combo).className = "visible";
			if(combo != 'listemeetingSpaceRequired'){
				if(document.getElementById('comboListe6')){
					document.getElementById('comboListe6').style.position = "static";
				}
			}
		}
		else
		{
			document.getElementById(combo).className = "invisible";
			if(combo != 'listemeetingSpaceRequired'){
				if(document.getElementById('comboListe6')){
					document.getElementById('comboListe6').style.position = "relative";
				}
			}
		}
	}
	
	function ouvrirFermerCombo2(combo,combo2,combo3)
	{
		$("ul").each(function() {
			if ( $(this).hasClass("visible") ){
				$(this).toggleClass("invisible");
			}
		});
		
		if(document.getElementById(combo).className == "invisible")
		{
			document.getElementById(combo).className = "visible";
			if(document.getElementById(combo2)){
				document.getElementById(combo2).style.position = "static";
			}
			if(document.getElementById(combo3)){
				document.getElementById(combo3).style.position = "static";
			}
			if(document.getElementById('comboListe3')){
				document.getElementById('comboListe3').style.position = "static";
			}
			if(document.getElementById('comboListe4')){
				document.getElementById('comboListe4').style.position = "static";
			}
			if(document.getElementById('comboListe5')){
				document.getElementById('comboListe5').style.position = "static";
			}
		}
		else
		{
			document.getElementById(combo).className = "invisible";
			if(document.getElementById(combo2)){
				document.getElementById(combo2).style.position = "relative";
			}
			if(document.getElementById(combo3)){
				document.getElementById(combo3).style.position = "relative";
			}
			if(document.getElementById('comboListe3')){
				document.getElementById('comboListe3').style.position = "relative";
			}
			if(document.getElementById('comboListe4')){
				document.getElementById('comboListe4').style.position = "relative";
			}
			if(document.getElementById('comboListe5')){
				document.getElementById('comboListe5').style.position = "relative";
			}
		}
	}
	
	function ouvrirFermerCombo3(combo,combo2)
	{
		$("ul").each(function() {
			if ( $(this).hasClass("visible") ){
				$(this).toggleClass("invisible");
			}
		});
		
		if(document.getElementById(combo).className == "invisible")
		{
			document.getElementById(combo).className = "visible";
			if(document.getElementById(combo2)){
				document.getElementById(combo2).style.position = "static";
			}
		}
		else
		{
			document.getElementById(combo).className = "invisible";
			if(document.getElementById(combo2)){
				document.getElementById(combo2).style.position = "relative";
			}
		}
	}
	
	function majSelected(valeur,elSelected)
	{
		nouveauSelected = valeur.innerHTML;
		document.getElementById(elSelected).innerHTML = nouveauSelected;
	}
	
	function majSelectedContact(valeur,elSelected,indice)
	{
		nouveauSelected = valeur.innerHTML;
		document.getElementById(elSelected).innerHTML = nouveauSelected;
		document.getElementById("contactObjet").value = indice;
	}
	
	function majHidden(valeur,champHidden)
	{
		document.getElementById(champHidden).value = valeur;
		
		if(champHidden == 'hiddennbpersonne'){
			// affiche les sous-formulaires des personnes correspondants
			var reg = new RegExp("[|]+", "g");
			var nbPersonne = valeur.split(reg);
			
			// on les cache tous
			for(var i=1; i<=100; i++){
				if(document.getElementById('personne_'+i)){
					document.getElementById('personne_'+i).className = "invisible";
					// vidage des champs
					document.getElementById('nom_'+i).value = '';
					document.getElementById('prenom_'+i).value = '';
					document.getElementById('email_'+i).value = '';
					document.getElementById('portable_'+i).value = '';
					document.getElementById('hiddenfonction_'+i).value = '';
					//document.getElementById('cartepresse_'+i).value = '';
					document.getElementById('hiddenarrivee_'+i).value = '';
					document.getElementById('hiddendepart_'+i).value = '';
				}
			}
			for(var i=1; i<=nbPersonne[0]; i++){
				document.getElementById('personne_'+i).className = "visible";
			}
		}
		
		if(champHidden == 'resaParkingParking'){
			// il faut afficher la hauteur du parking, les navettes et le bon visuel
			$.ajax({
				dataType: 'xml',
				type: 'POST',
				data: 'idparking='+valeur,
				url: '/ajax/getparking/',
				success: function(reponse){
					var type = 0;
	                var errortxt = '';
				    $(reponse).find('error').each(
				    	function(){
							type = $(this).attr('type');
							errortxt = $(this).text();
						}
					);
				    appendHtml = "";
	                if(type == 0 && errortxt == ''){
	                	var parking = $(reponse).find('parking')  				 
			    		var title = parking.find('title').text();
			    		var locatorX = parking.find('locatorX').text();
			    		var locatorY = parking.find('locatorY').text();
			    		var locatorRadius = parking.find('locatorRadius').text();
			    		var map = parking.find('map').text();
			    		var hauteur = parking.find('hauteur').text();
			    		var nbPlaceDefault = parking.find('nbPlaceDefault').text();
			    		var navette = parking.find('navette').text();
			    		
			    		if(document.getElementById("type").value == 'auto'){
				    		$("#hauteurMaxParking").empty();
				    		$("#hauteurMaxParking").append(hauteur);
				    		document.getElementById("hauteurParking").value = hauteur;
				    		
				    		$("#horairesNavettes").empty();
				    		$("#horairesNavettes").append(navette);
			    		}
			    		
			    		// met a jour la localisation
			    		if(locatorX != '' && locatorY != '' && locatorRadius != '' && map != ''){
				    		var localisation = '';
				    		localisation += '<div id="localiserFlash"></div>';
				    		localisation += '<script type="text/javascript">';
				    		localisation += 'var so = new SWFObject("/swf/mapExplorer.swf", "main", "400", "240", "8", "#2E2E2E");';
				    		localisation += 'so.useExpressInstall("/swf/expressInstall.swf");';
				    		localisation += 'so.setAttribute("xiRedirectUrl", document.URL); ';
				    		localisation += 'so.addParam("scale","noscale");';
				    		localisation += 'so.addParam("wmode", "transparent");';
				    		localisation += 'so.addParam("allowFullscreen","true");';
				    		localisation += 'so.addVariable("modeEdit", false);';
				    		localisation += 'so.addVariable("urlMap", "'+map+'");';
				    		localisation += 'so.addVariable("urlScript", "");';
				    		localisation += 'so.addVariable("locator", "true");';
				    		localisation += 'so.addVariable("locatorX", "'+locatorX+'");';
				    		localisation += 'so.addVariable("locatorY", "'+locatorY+'");';
				    		localisation += 'so.addVariable("locatorRadius", "'+locatorRadius+'");';
				    		localisation += 'so.addVariable("urlMapList","Station,/swf/map/mapStation.swf;Le Villaret,/swf/map/mapStationVillaret.swf;Les Boisses,/swf/map/mapStationBoisses.swf;Les Brévières,/swf/map/mapStationBrevieres.swf;Le Franchet,/swf/map/mapStationFranchet.swf;La Reculaz,/swf/map/mapStationReculaz.swf");';
				    		localisation += 'so.addVariable("urlRoot", "");';
				    		localisation += 'so.addVariable("locatorName", "'+title+'");';
				    		localisation += 'so.write("localiserFlash");';
				    		localisation += '</script>';
				    		$("#resaParkingLocalisation").empty();
				    		$("#resaParkingLocalisation").append(localisation);
			    		}else{
			    			var localisation = '';
				    		localisation += '<div id="localiserFlash"></div>';
				    		localisation += '<script type="text/javascript">';
				    		localisation += 'var so = new SWFObject("/swf/mapExplorer.swf", "main", "400", "240", "8", "#2E2E2E");';
				    		localisation += 'so.useExpressInstall("/swf/expressInstall.swf");';
				    		localisation += 'so.setAttribute("xiRedirectUrl", document.URL); ';
				    		localisation += 'so.addParam("scale","noscale");';
				    		localisation += 'so.addParam("wmode", "transparent");';
				    		localisation += 'so.addParam("allowFullscreen","true");';
				    		localisation += 'so.addVariable("modeEdit", false);';
				    		localisation += 'so.addVariable("urlMap", "/swf/map/mapStation.swf");';
				    		localisation += 'so.addVariable("urlScript", "");';
				    		localisation += 'so.addVariable("locator", "false");';
				    		localisation += 'so.addVariable("locatorX", "");';
				    		localisation += 'so.addVariable("locatorY", "");';
				    		localisation += 'so.addVariable("locatorRadius", "");';
				    		localisation += 'so.addVariable("urlMapList","Station,/swf/map/mapStation.swf;Le Villaret,/swf/map/mapStationVillaret.swf;Les Boisses,/swf/map/mapStationBoisses.swf;Les Brévières,/swf/map/mapStationBrevieres.swf;Le Franchet,/swf/map/mapStationFranchet.swf;La Reculaz,/swf/map/mapStationReculaz.swf");';
				    		localisation += 'so.addVariable("urlRoot", "");';
				    		localisation += 'so.addVariable("locatorName", "");';
				    		localisation += 'so.write("localiserFlash");';
				    		localisation += '</script>';
				    		$("#resaParkingLocalisation").empty();
				    		$("#resaParkingLocalisation").append(localisation);
			    		}
				    }
				}
			});
			
			// verifie la hauteur parking/vehicule
			checkHauteur();
			
			// recalcul du tarif
			calculerTarif();
		}
	}
	
	function changeVisuelDroite()
	{
		// fonction a completer pour modifier le flash localisation parking dans le div resaParkingLocalisation, ajouter parametres si necessaires ici et dans l'appel de la fonction sur les liens de la combo parking
	}
// ================================== COMBO ANNUAIRE


// ================================== SURVOL BLOCS GAUCHE SECURITE DES PISTES
	function survolSecuOn(bloc,lien1,lien2,lien3)
	{
		document.getElementById(bloc).style.backgroundColor = "#00b1ff";
		document.getElementById(bloc).style.backgroundPosition = "right -600px";
		document.getElementById(lien1).style.color = "#00b1ff";
		document.getElementById(lien1).style.backgroundColor = "#fff";
		
		document.getElementById(lien2).style.color = "#fff";
		document.getElementById(lien3).className = "enSavoirPlus2";
	}
	
	function survolSecuOff(bloc,fond,lien1,lien2,lien3)
	{
		if(fond == "fond1")
		{
			document.getElementById(bloc).style.backgroundColor = "#f2f2f2";
		}
		else
		{
			document.getElementById(bloc).style.backgroundColor = "#fff";
		}
		document.getElementById(bloc).style.backgroundPosition = "right 0";
		document.getElementById(lien1).style.color = "#fff";
		document.getElementById(lien1).style.backgroundColor = "#00b1ff";
		
		document.getElementById(lien2).style.color = "#777";
		document.getElementById(lien3).className = "enSavoirPlus1";
	}
// ================================== SURVOL BLOCS GAUCHE SECURITE DES PISTES

// ================================== SURVOL BLOCS DROITE SECURITE DES PISTES
	function survolBlocsDroiteSecuOn(element,lien1)
	{
		element.style.backgroundColor = "#2e2e2e";
		element.style.backgroundPosition = "right -300px";
		document.getElementById(lien1).style.color = "#fff";
	}
	
	function survolBlocsDroiteSecuOff(element,fond,lien1)
	{
		element.style.backgroundPosition = "right 0";
		if(fond == "fond1")
		{
			element.style.backgroundColor = "#00b1ff";
			document.getElementById(lien1).style.color = "#fff";
		}
		else
		{
			element.style.backgroundColor = "#fffc00";
			document.getElementById(lien1).style.color = "#5a595c";
		}
	}
	
	
	function survolBlocsDroiteSecuOn2(element)
	{
		element.style.backgroundColor = "#2e2e2e";
		element.style.backgroundPosition = "right -300px";
	}
	
	function survolBlocsDroiteSecuOff2(element,fond)
	{
		element.style.backgroundPosition = "right 0";
		if(fond == "fond1")
		{
			element.style.backgroundColor = "#00b1ff";
		}
		else
		{
			element.style.backgroundColor = "#fffc00";
		}
	}
// ================================== SURVOL BLOCS DROITE SECURITE DES PISTES


// ================================== SURVOL BLOCS SPORTS
	function survolBlocSportOn(bloc,titre,lien)
	{
		document.getElementById(bloc).style.backgroundColor = "#00b1ff";
		document.getElementById(bloc).style.backgroundPosition = "0 -250px";
		document.getElementById(titre).style.color = "#00b1ff";
		document.getElementById(titre).style.backgroundColor = "#fff";
		document.getElementById(lien).className = "blocSportBordureVisible";
	}
	
	function survolBlocSportOff(bloc,titre,lien)
	{
		document.getElementById(bloc).style.backgroundColor = "#fff";
		document.getElementById(bloc).style.backgroundPosition = "0 0";
		document.getElementById(titre).style.color = "#fff";
		document.getElementById(titre).style.backgroundColor = "#00b1ff";
		document.getElementById(lien).className = "blocSportBordureInvisible";
	}
// ================================== SURVOL BLOCS SPORTS


	// ================================== OUVERTURE - FERMETURE ANIMATIONS
	function ouvertureFermetureAgenda(bloc,lien)
	{
		if(document.getElementById(bloc).className == "contenuAnimationInvisible")
		{
			for (i=0; i<blocsAgendaTab.length; i++)
			{
				if(bloc == blocsAgendaTab[i])
				{
					document.getElementById(blocsAgendaTab[i]).className = "contenuAnimationVisible";
					document.getElementById(liensAgendaTab[i]).style.fontWeight = "bold";
				}
				else
				{
					if(document.getElementById(blocsAgendaTab[i])){
						document.getElementById(blocsAgendaTab[i]).className = "contenuAnimationInvisible";
						document.getElementById(liensAgendaTab[i]).style.fontWeight = "normal";
					}
				}
			}
		}
		else
		{
			document.getElementById(bloc).className = "contenuAnimationInvisible";
			document.getElementById(lien).style.fontWeight = "normal";
		}
	}
// ================================== OUVERTURE - FERMETURE ANIMATIONS


// ======================================= VERIFICATION FORM CONTACT
	function statutCheckbox(checkbox,champHidden)
	{
		if(document.getElementById(checkbox).src.indexOf("case-a-cocher-off") != -1)
		{
			document.getElementById(checkbox).src = "/img/case-a-cocher-on.gif";
			document.getElementById(champHidden).value = true;
		}
		else
		{
			document.getElementById(checkbox).src = "/img/case-a-cocher-off.gif";
			document.getElementById(champHidden).value = false;
		}
	}
	
	function validationContact()
	{
		monform = document.contactForm;
		document.getElementById("contactChampNom").style.border = "2px solid #3e3e3e";
		document.getElementById("contactLabel1").style.color = "#000";
		document.getElementById("contactChampPrenom").style.border = "2px solid #3e3e3e";
		document.getElementById("contactLabel2").style.color = "#000";
		document.getElementById("contactChampEmail").style.border = "2px solid #3e3e3e";
		document.getElementById("contactLabel3").style.color = "#000";
		document.getElementById("contactChampObjet").style.border = "2px solid #3e3e3e";
		document.getElementById("contactLabel4").style.color = "#000";
		document.getElementById("contactChampMessage").style.border = "2px solid #3e3e3e";
		document.getElementById("contactLabel5").style.color = "#000";
		
		var erreurs;
		var nErreur = new Array();
		
		var reg_email = /^[A-Za-z0-9\.\-_]+[@][A-Za-z0-9\-\.]+[\.][A-Za-z][A-Za-z][A-Za-z]?$/;
		
		if (monform.contactChampNom.value=='')
		{
			nErreur.push(0);
			document.getElementById("contactChampNom").style.border = "2px solid #ff0000";
			document.getElementById("contactLabel1").style.color = "#ff0000";
		}
		
		if (monform.contactChampPrenom.value=='')
		{
			nErreur.push(1);
			document.getElementById("contactChampPrenom").style.border = "2px solid #ff0000";
			document.getElementById("contactLabel2").style.color = "#ff0000";
		}
		
		if (monform.contactChampEmail.value=='' || !reg_email.test(monform.contactChampEmail.value))
		{
			nErreur.push(2);
			document.getElementById("contactChampEmail").style.border = "2px solid #ff0000";
			document.getElementById("contactLabel3").style.color = "#ff0000";
		}
		
		if (monform.contactObjet.value=='' || monform.contactObjet.value == '1|-------------|')
		{
			nErreur.push(3);
			document.getElementById("contactChampObjet").style.border = "2px solid #ff0000";
			document.getElementById("contactLabel4").style.color = "#ff0000";
		}
		
		if (monform.contactChampMessage.value=='')
		{
			nErreur.push(1);
			document.getElementById("contactChampMessage").style.border = "2px solid #ff0000";
			document.getElementById("contactLabel5").style.color = "#ff0000";
		}
		
		erreurs = nErreur.length;
		if(erreurs>0)
		{
			return false;
		}
		return true;
	}
// ======================================= VERIFICATION FORM CONTACT


// ======================================= SURVOL TIGNES RESERVATION
	function survolReservationOn(bloc,lien)
	{
		document.getElementById(bloc).style.backgroundColor = "#dad70e";
		document.getElementById(lien).style.color = "#000";
	}
	
	function survolReservationOff(bloc,lien)
	{
		document.getElementById(bloc).style.backgroundColor = "#fffc00";
		document.getElementById(lien).style.color = "#777";
	}
// ======================================= SURVOL TIGNES RESERVATION


// ======================================= VERIFICATION CONNEXION MEDIATHEQUE
	function validationConnexionMedia()
	{
		monform = document.connexionMediaForm;
		document.getElementById("connexionLogin").style.border = "2px solid #3e3e3e";
		document.getElementById("connexionLabel1").style.color = "#000";
		document.getElementById("connexionMdp").style.border = "2px solid #3e3e3e";
		document.getElementById("connexionLabel2").style.color = "#000";
		
		
		var erreurs;
		var nErreur = new Array();
		
		if (monform.connexionLogin.value=='')
		{
			nErreur.push(0);
			document.getElementById("connexionIdentifiant").style.border = "2px solid #ff0000";
			document.getElementById("connexionLabel1").style.color = "#ff0000";
		}
		
		if (monform.connexionMdp.value=='')
		{
			nErreur.push(1);
			document.getElementById("connexionMdp").style.border = "2px solid #ff0000";
			document.getElementById("connexionLabel2").style.color = "#ff0000";
		}
		
		erreurs = nErreur.length;
		if(erreurs>0)
		{
			return false;
		}
		return true;
	}
// ======================================= VERIFICATION CONNEXION MEDIATHEQUE


// ======================================= VERIFICATION CONDITIONS MEDIATHEQUE
	function validationConditionsMedia()
	{
		monform = document.conditionsMediaForm;
		document.getElementById("conditionsLienCheckbox").style.color = "#474747";
		
		var erreurs;
		var nErreur = new Array();
		
		if (monform.conditionAccepte.value == false)
		{
			nErreur.push(0);
			document.getElementById("conditionsLienCheckbox").style.color = "#ff0000";
		}
		
		erreurs = nErreur.length;
		if(erreurs>0)
		{
			return false;
		}
		return true;
	}
// ======================================= VERIFICATION CONDITIONS MEDIATHEQUE


// ======================================= GESTION DES BOUTONS RADIO
	function statutRadio(radio1,champHidden,radio2,valeur)
	{
		if(document.getElementById(radio1).src.indexOf("radio-bouton-off.gif") != -1)
		{
			document.getElementById(radio1).src = "/img/radio-bouton-on.gif";
			document.getElementById(radio2).src = "/img/radio-bouton-off.gif";
			document.getElementById(champHidden).value = valeur;
		}
		else
		{
			document.getElementById(radio1).src = "/img/radio-bouton-off.gif";
			document.getElementById(champHidden).value = "";
		}
		
		if(valeur == 0){
			$('.forfaitN').hide();
		}else if(valeur == 1){
			$('.forfaitN').show();
		}	
	}
// ======================================= GESTION DES BOUTONS RADIO


// ======================================= OUVERTURE / FERMETURE FENETRE MODALE
	function ouvrirModale(nb)
	{
		hauteurLigne = 189;
		if(nb == 1)
		{
			posY = -250;
		}
		else
		{
			posY = -250 + (hauteurLigne*(nb-1));
		}
		document.getElementById('rechercheFenetreModale').style.top = posY+"px";
		document.getElementById('rechercheFenetreModale').className = "visible";
		
	}
	
	function fermerModale()
	{
		document.getElementById('rechercheFenetreModale').className = "invisible";
	}
// ======================================= OUVERTURE / FERMETURE FENETRE MODALE


// ======================================= HEBERGEMENT
	function survolHebergementOn(bloc,lien1,lien2,lien3)
	{
		document.getElementById(bloc).style.backgroundColor = "#00b1ff";
		document.getElementById(lien1).style.color = "#00b1ff";
		document.getElementById(lien1).style.backgroundColor = "#fff";
		document.getElementById(lien2).style.color = "#fff";
		document.getElementById(lien3).style.color = "#fff";
	}
	
	function survolHebergementOff(bloc,fond,lien1,lien2,lien3)
	{
		if(fond == "fond1")
		{
			document.getElementById(bloc).style.backgroundColor = "#f2f2f2";
		}
		else
		{
			document.getElementById(bloc).style.backgroundColor = "#fff";
		}
		document.getElementById(lien1).style.color = "#fff";
		document.getElementById(lien1).style.backgroundColor = "#00b1ff";
		document.getElementById(lien2).style.color = "#777";
		document.getElementById(lien3).style.color = "#777";
	}
	
	function survolHebergementMEAOn()
	{
		document.getElementById('mea1').style.backgroundColor = "#00b1ff";
		document.getElementById('mea2').style.backgroundColor = "#00b1ff";
		document.getElementById('mea3').style.backgroundColor = "#00b1ff";
		document.getElementById('mea4').style.backgroundColor = "#00b1ff";
		document.getElementById('mea5').style.backgroundColor = "#00b1ff";
	}
	
	function survolHebergementMEAOff()
	{
		document.getElementById('mea1').style.backgroundColor = "#000";
		document.getElementById('mea2').style.backgroundColor = "#000";
		document.getElementById('mea3').style.backgroundColor = "#000";
		document.getElementById('mea4').style.backgroundColor = "#000";
		document.getElementById('mea5').style.backgroundColor = "#000";
	}
	
	function survolBloc5clicsOn(bloc,lien1,lien2)
	{
		document.getElementById(bloc).style.backgroundColor = "#2e2e2e";
		document.getElementById(lien1).style.color = "#fff";
		document.getElementById(lien2).style.color = "#fff";
	}
	
	function survolBloc5clicsOff(bloc,lien1,lien2)
	{
		document.getElementById(bloc).style.backgroundColor = "#fffc00";
		document.getElementById(lien1).style.color = "#4c4c4c";
		document.getElementById(lien2).style.color = "#000";
	}
// ======================================= HEBERGEMENT


// ======================================= RECHERCHE
	function survolRechercheMEAOn()
	{
		document.getElementById('mea2').style.backgroundColor = "#00b1ff";
		document.getElementById('mea3').style.backgroundColor = "#00b1ff";
	}
	
	function survolRechercheMEAOff()
	{
		document.getElementById('mea2').style.backgroundColor = "#000";
		document.getElementById('mea3').style.backgroundColor = "#000";
	}
// ======================================= RECHERCHE


// ======================================= LISTE HOTELS
	function changeSaison(ongletActif,ongletInactif,tableauVisible,tableauInvisible)
	{
		document.getElementById(ongletActif).className = "accordeonLienSaisonActif";
		if(document.getElementById(ongletInactif)){
			document.getElementById(ongletInactif).className = "accordeonLienSaison";
		}
		document.getElementById(tableauVisible).className = "visible";
		if(document.getElementById(tableauInvisible)){
			document.getElementById(tableauInvisible).className = "invisible";
		}
	}
// ======================================= LISTE HOTELS

// ======================================= PAGINATION MEDIATHEQUE
	function paginationMediatheque(link)
	{
		document.getElementById('rechercheMedia').action = link;
		document.getElementById('rechercheMedia').submit();
	}

// ======================================= PAGINATION MEDIATHEQUE


// ======================================= VALIDATION RESA PARKING
	function validationResaParking(message, type)
	{
		//monform = document.resaParkingForm;@
		monform = document.getElementById("resaParkingForm");
		
		if(type == 'auto'){
			document.getElementById("resaParkingLabel0a").style.color = "#00b1ff";
			document.getElementById("resaParkingLabel0b").style.color = "#000";
			document.getElementById("resaParkingLabel0c").style.color = "#000";
			document.getElementById("nForfait1").style.border = "2px solid #3e3e3e";
			document.getElementById("nForfait2").style.border = "2px solid #3e3e3e";
			document.getElementById("nForfait3").style.border = "2px solid #3e3e3e";
			document.getElementById("nForfait4").style.border = "2px solid #3e3e3e";
			document.getElementById("nForfait5").style.border = "2px solid #3e3e3e";
			document.getElementById("nForfait6").style.border = "2px solid #3e3e3e";
			document.getElementById("resaParkingLabel1").style.color = "#00b1ff";
			document.getElementById("nForfait1Conf").style.border = "2px solid #3e3e3e";
			document.getElementById("nForfait2Conf").style.border = "2px solid #3e3e3e";
			document.getElementById("nForfait3Conf").style.border = "2px solid #3e3e3e";
			document.getElementById("nForfait4Conf").style.border = "2px solid #3e3e3e";
			document.getElementById("nForfait5Conf").style.border = "2px solid #3e3e3e";
			document.getElementById("nForfait6Conf").style.border = "2px solid #3e3e3e";
			document.getElementById("resaParkingLabel1Conf").style.color = "#00b1ff";
			document.getElementById("resaParkingNom").style.border = "2px solid #3e3e3e";
			document.getElementById("resaParkingLabel2").style.color = "#00b1ff";
			document.getElementById("resaParkingPrenom").style.border = "2px solid #3e3e3e";
			document.getElementById("resaParkingLabel3").style.color = "#00b1ff";
		}
		if(type == 'bus'){
			document.getElementById("raisonSociale").style.border = "2px solid #3e3e3e";
			document.getElementById("resaParkingLabel2").style.color = "#00b1ff";
		}
		document.getElementById("resaParkingEmail").style.border = "2px solid #3e3e3e";
		document.getElementById("resaParkingLabel4").style.color = "#00b1ff";
		document.getElementById("resaParkingConfirmEmail").style.border = "2px solid #3e3e3e";
		document.getElementById("resaParkingLabel5").style.color = "#00b1ff";
		document.getElementById("resaParkingAdresse").style.border = "2px solid #3e3e3e";
		document.getElementById("resaParkingLabel6").style.color = "#00b1ff";
		document.getElementById("resaParkingCP").style.border = "2px solid #3e3e3e";
		document.getElementById("resaParkingLabel7").style.color = "#00b1ff";
		document.getElementById("resaParkingVille").style.border = "2px solid #3e3e3e";
		document.getElementById("resaParkingLabel8").style.color = "#00b1ff";
		document.getElementById("resaParkingTel").style.border = "2px solid #3e3e3e";
		document.getElementById("resaParkingLabel9").style.color = "#00b1ff";
		document.getElementById("resaParkingDateArrivee").style.border = "2px solid #3e3e3e";
		document.getElementById("resaParkingLabel10").style.color = "#00b1ff";
		document.getElementById("resaParkingDateDepart").style.border = "2px solid #3e3e3e";
		document.getElementById("resaParkingLabel11").style.color = "#00b1ff";
		document.getElementById("resaParkingParking").style.border = "2px solid #3e3e3e";
		document.getElementById("resaParkingLabel12").style.color = "#00b1ff";
		document.getElementById("resaParkingImmatriculation").style.border = "2px solid #3e3e3e";
		document.getElementById("resaParkingLabel13").style.color = "#00b1ff";
		if(type == 'auto'){
			document.getElementById("resaParkingHauteurVehicule").style.border = "2px solid #3e3e3e";
			document.getElementById("resaParkingLabel14").style.color = "#00b1ff";
		}
		
		document.getElementById("resaParkingLabel15").style.color = "#474747";
		document.getElementById("resaParkingLabel16").style.color = "#474747";
		document.getElementById("resaParkingLabel17").style.color = "#474747";
		$("#errorFormGeneral").empty();
	  	$("#errorFormGeneral").append('');
		
		
		var erreurs;
		var nErreur = new Array();
		
		var reg_email = /^[A-Za-z0-9\.\-_]+[@][A-Za-z0-9\-\.]+[\.][A-Za-z][A-Za-z][A-Za-z]?$/;
		
		if(type == 'auto'){
			if (monform.resaParkingForfaitOuiNon.value=='')
			{
				nErreur.push(0);
				document.getElementById("resaParkingLabel0a").style.color = "#ff0000";
				document.getElementById("resaParkingLabel0b").style.color = "#ff0000";
				document.getElementById("resaParkingLabel0c").style.color = "#ff0000";
			}
			
			if (monform.resaParkingForfaitOuiNon.value=='1'){
				if (monform.nForfait1.value=='' || monform.nForfait2.value=='' || monform.nForfait3.value=='' || monform.nForfait4.value=='' || monform.nForfait5.value=='' || monform.nForfait6.value=='')
				{
					nErreur.push(1);
					document.getElementById("nForfait1").style.border = "2px solid #ff0000";
					document.getElementById("nForfait2").style.border = "2px solid #ff0000";
					document.getElementById("nForfait3").style.border = "2px solid #ff0000";
					document.getElementById("nForfait4").style.border = "2px solid #ff0000";
					document.getElementById("nForfait5").style.border = "2px solid #ff0000";
					document.getElementById("nForfait6").style.border = "2px solid #ff0000";
					document.getElementById("resaParkingLabel1").style.color = "#ff0000";
				}
				if (monform.nForfait1.value.length != 2)
				{
					nErreur.push(1);
					document.getElementById("nForfait1").style.border = "2px solid #ff0000";
					document.getElementById("resaParkingLabel1").style.color = "#ff0000";
				}
				if (monform.nForfait2.value.length != 5)
				{
					nErreur.push(1);
					document.getElementById("nForfait2").style.border = "2px solid #ff0000";
					document.getElementById("resaParkingLabel1").style.color = "#ff0000";
				}
				if (monform.nForfait3.value.length != 5)
				{
					nErreur.push(1);
					document.getElementById("nForfait3").style.border = "2px solid #ff0000";
					document.getElementById("resaParkingLabel1").style.color = "#ff0000";
				}
				if (monform.nForfait4.value.length != 5)
				{
					nErreur.push(1);
					document.getElementById("nForfait4").style.border = "2px solid #ff0000";
					document.getElementById("resaParkingLabel1").style.color = "#ff0000";
				}
				if (monform.nForfait5.value.length != 5)
				{
					nErreur.push(1);
					document.getElementById("nForfait5").style.border = "2px solid #ff0000";
					document.getElementById("resaParkingLabel1").style.color = "#ff0000";
				}
				if (monform.nForfait6.value.length != 1)
				{
					nErreur.push(1);
					document.getElementById("nForfait6").style.border = "2px solid #ff0000";
					document.getElementById("resaParkingLabel1").style.color = "#ff0000";
				}
				if (monform.nForfait1Conf.value=='' || monform.nForfait2Conf.value=='' || monform.nForfait3Conf.value=='' || monform.nForfait4Conf.value=='' || monform.nForfait5Conf.value=='' || monform.nForfait6Conf.value=='')
				{
					nErreur.push(1);
					document.getElementById("nForfait1Conf").style.border = "2px solid #ff0000";
					document.getElementById("nForfait2Conf").style.border = "2px solid #ff0000";
					document.getElementById("nForfait3Conf").style.border = "2px solid #ff0000";
					document.getElementById("nForfait4Conf").style.border = "2px solid #ff0000";
					document.getElementById("nForfait5Conf").style.border = "2px solid #ff0000";
					document.getElementById("nForfait6Conf").style.border = "2px solid #ff0000";
					document.getElementById("resaParkingLabel1Conf").style.color = "#ff0000";
				}
				if (monform.nForfait1Conf.value.length != 2)
				{
					nErreur.push(1);
					document.getElementById("nForfait1Conf").style.border = "2px solid #ff0000";
					document.getElementById("resaParkingLabel1Conf").style.color = "#ff0000";
				}
				if (monform.nForfait2Conf.value.length != 5)
				{
					nErreur.push(1);
					document.getElementById("nForfait2Conf").style.border = "2px solid #ff0000";
					document.getElementById("resaParkingLabel1Conf").style.color = "#ff0000";
				}
				if (monform.nForfait3Conf.value.length != 5)
				{
					nErreur.push(1);
					document.getElementById("nForfait3Conf").style.border = "2px solid #ff0000";
					document.getElementById("resaParkingLabel1Conf").style.color = "#ff0000";
				}
				if (monform.nForfait4Conf.value.length != 5)
				{
					nErreur.push(1);
					document.getElementById("nForfait4Conf").style.border = "2px solid #ff0000";
					document.getElementById("resaParkingLabel1Conf").style.color = "#ff0000";
				}
				if (monform.nForfait5Conf.value.length != 5)
				{
					nErreur.push(1);
					document.getElementById("nForfait5Conf").style.border = "2px solid #ff0000";
					document.getElementById("resaParkingLabel1Conf").style.color = "#ff0000";
				}
				if (monform.nForfait6Conf.value.length != 1)
				{
					nErreur.push(1);
					document.getElementById("nForfait6Conf").style.border = "2px solid #ff0000";
					document.getElementById("resaParkingLabel1Conf").style.color = "#ff0000";
				}
				if (monform.nForfait1.value!=monform.nForfait1Conf.value || monform.nForfait2.value!=monform.nForfait2Conf.value || monform.nForfait3.value!=monform.nForfait3Conf.value || monform.nForfait4.value!=monform.nForfait4Conf.value || monform.nForfait5.value!=monform.nForfait5Conf.value || monform.nForfait6.value!=monform.nForfait6.value)
				{
					nErreur.push(1);
					document.getElementById("nForfait1Conf").style.border = "2px solid #ff0000";
					document.getElementById("nForfait2Conf").style.border = "2px solid #ff0000";
					document.getElementById("nForfait3Conf").style.border = "2px solid #ff0000";
					document.getElementById("nForfait4Conf").style.border = "2px solid #ff0000";
					document.getElementById("nForfait5Conf").style.border = "2px solid #ff0000";
					document.getElementById("nForfait6Conf").style.border = "2px solid #ff0000";
					document.getElementById("resaParkingLabel1Conf").style.color = "#ff0000";
				}
			}
			
			if (monform.resaParkingNom.value=='')
			{
				nErreur.push(2);
				document.getElementById("resaParkingNom").style.border = "2px solid #ff0000";
				document.getElementById("resaParkingLabel2").style.color = "#ff0000";
			}
			
			if (monform.resaParkingPrenom.value=='')
			{
				nErreur.push(3);
				document.getElementById("resaParkingPrenom").style.border = "2px solid #ff0000";
				document.getElementById("resaParkingLabel3").style.color = "#ff0000";
			}
		}
		if(type == 'bus'){
			if (monform.raisonSociale.value=='')
			{
				nErreur.push(3);
				document.getElementById("raisonSociale").style.border = "2px solid #ff0000";
				document.getElementById("resaParkingLabel2").style.color = "#ff0000";
			}
		}
		
		if (monform.resaParkingEmail.value=='' || !reg_email.test(monform.resaParkingEmail.value))
		{
			nErreur.push(4);
			document.getElementById("resaParkingEmail").style.border = "2px solid #ff0000";
			document.getElementById("resaParkingLabel4").style.color = "#ff0000";
		}
		
		if (monform.resaParkingConfirmEmail.value=='' || !reg_email.test(monform.resaParkingConfirmEmail.value))
		{
			nErreur.push(5);
			document.getElementById("resaParkingConfirmEmail").style.border = "2px solid #ff0000";
			document.getElementById("resaParkingLabel5").style.color = "#ff0000";
		}
		
		if (monform.resaParkingEmail.value != monform.resaParkingConfirmEmail.value)
		{
			nErreur.push(6);
			document.getElementById("resaParkingEmail").style.border = "2px solid #ff0000";
			document.getElementById("resaParkingLabel4").style.color = "#ff0000";
			document.getElementById("resaParkingConfirmEmail").style.border = "2px solid #ff0000";
			document.getElementById("resaParkingLabel5").style.color = "#ff0000";
		}
		
		if (monform.resaParkingAdresse.value=='')
		{
			nErreur.push(7);
			document.getElementById("resaParkingAdresse").style.border = "2px solid #ff0000";
			document.getElementById("resaParkingLabel6").style.color = "#ff0000";
		}
		
		if (monform.resaParkingCP.value=='')
		{
			nErreur.push(8);
			document.getElementById("resaParkingCP").style.border = "2px solid #ff0000";
			document.getElementById("resaParkingLabel7").style.color = "#ff0000";
		}
		
		if (monform.resaParkingVille.value=='')
		{
			nErreur.push(9);
			document.getElementById("resaParkingVille").style.border = "2px solid #ff0000";
			document.getElementById("resaParkingLabel8").style.color = "#ff0000";
		}
		
		if (monform.resaParkingTel.value=='')
		{
			nErreur.push(10);
			document.getElementById("resaParkingTel").style.border = "2px solid #ff0000";
			document.getElementById("resaParkingLabel9").style.color = "#ff0000";
		}
		
		if (monform.resaParkingDateArrivee.value=='')
		{
			nErreur.push(11);
			document.getElementById("resaParkingDateArrivee").style.border = "2px solid #ff0000";
			document.getElementById("resaParkingLabel10").style.color = "#ff0000";
		}
		
		if (monform.resaParkingDateDepart.value=='')
		{
			nErreur.push(12);
			document.getElementById("resaParkingDateDepart").style.border = "2px solid #ff0000";
			document.getElementById("resaParkingLabel11").style.color = "#ff0000";
		}
		
		if (monform.resaParkingParking.value=='')
		{
			nErreur.push(13);
			document.getElementById("resaParkingParking").style.border = "2px solid #ff0000";
			document.getElementById("resaParkingLabel12").style.color = "#ff0000";
		}
		
		if(type == 'auto'){
			if (monform.resaParkingHauteurVehicule.value=='')
			{
				nErreur.push(15);
				document.getElementById("resaParkingHauteurVehicule").style.border = "2px solid #ff0000";
				document.getElementById("resaParkingLabel14").style.color = "#ff0000";
			}
		}
		
		if (monform.resaParkingAccepteConditions.value=='' || monform.resaParkingAccepteConditions.value=='false')
		{
			nErreur.push(16);
			document.getElementById("resaParkingLabel15").style.color = "#ff0000";
			document.getElementById("resaParkingLabel16").style.color = "#ff0000";
			document.getElementById("resaParkingLabel17").style.color = "#ff0000";
		}
		
		if(type == 'auto'){
			if(document.getElementById("hauteurParking").value != '' && document.getElementById("resaParkingHauteurVehicule").value != ''){
				if(!checkHauteur()){
					nErreur.push(17);
				}
			}
			calculerTarif();
		}
		
		erreurs = nErreur.length;
		if(erreurs>0)
		{
			$("#errorFormGeneral").empty();
			$("#errorFormGeneral").append(message);
			document.getElementById("errorFormGeneral").style.color = "#ff0000";
			alert(message);
			return false;
		}else{
			monform.submit();
		}
	}
// ======================================= VALIDATION RESA PARKING

// ======================================= CALCUL DU TARIF PARKING A CHAQUE CHANGEMENT DE VALEUR	
	function calculerTarif(){
		var tarif = '0 &euro;';
	  	$("#resaParkingMontant>span").empty();
	  	$("#resaParkingMontant>span").append(tarif);
	  	
		$("#errorPeriode").empty();
		$("#errorPeriode").append('');
		
		document.getElementById("resaParkingDateArrivee").style.border = "2px solid #3e3e3e";
		document.getElementById("resaParkingLabel10").style.color = "#00b1ff";
		document.getElementById("resaParkingDateDepart").style.border = "2px solid #3e3e3e";
		document.getElementById("resaParkingLabel11").style.color = "#00b1ff";
		
		var arrivee = document.getElementById('resaParkingDateArrivee').value;
		var depart = document.getElementById('resaParkingDateDepart').value;
		var parking = document.getElementById('resaParkingParking').value;
		var type = document.getElementById('type').value;
		
		var erreurs;
		var nErreur = new Array();
		
		var validDate = false;
		if(arrivee != '' && depart != ''){
			dateArrivee = new Date(arrivee.substring(0,4),arrivee.substring(5,7)-1,arrivee.substring(8,10));
			dateDepart = new Date(depart.substring(0,4),depart.substring(5,7)-1,depart.substring(8,10));
			today = new Date();
			today.setDate(today.getDate()+2);
			today = new Date(today.getFullYear(), today.getMonth(), today.getDate());
			if(dateArrivee && dateDepart){
				if(dateDepart > dateArrivee && dateDepart > today && dateArrivee > today){
					validDate = true;
				}else if(dateDepart <= dateArrivee){
					// affichage de l'erreur
			    	$("#errorPeriode").empty();
		    		$("#errorPeriode").append('La date de départ doit être supérieur à la date d\'arrivée');
		    		document.getElementById("errorPeriode").style.color = "#ff0000";
		    		document.getElementById("resaParkingDateArrivee").style.border = "2px solid #ff0000";
		    		document.getElementById("resaParkingLabel10").style.color = "#ff0000";
		    		document.getElementById("resaParkingDateDepart").style.border = "2px solid #ff0000";
		    		document.getElementById("resaParkingLabel11").style.color = "#ff0000";
				}else if(dateDepart < today){
					// affichage de l'erreur
			    	$("#errorPeriode").empty();
		    		$("#errorPeriode").append('La date de départ doit être supérieur à la date du jour');
		    		document.getElementById("errorPeriode").style.color = "#ff0000";
		    		document.getElementById("resaParkingDateArrivee").style.border = "2px solid #ff0000";
		    		document.getElementById("resaParkingLabel10").style.color = "#ff0000";
		    		document.getElementById("resaParkingDateDepart").style.border = "2px solid #ff0000";
		    		document.getElementById("resaParkingLabel11").style.color = "#ff0000";
				}else if(dateArrivee < today){
					// affichage de l'erreur
			    	$("#errorPeriode").empty();
		    		$("#errorPeriode").append('La date d\'arrivée doit être supérieur à la date du jour');
		    		document.getElementById("errorPeriode").style.color = "#ff0000";
		    		document.getElementById("resaParkingDateArrivee").style.border = "2px solid #ff0000";
		    		document.getElementById("resaParkingLabel10").style.color = "#ff0000";
		    		document.getElementById("resaParkingDateDepart").style.border = "2px solid #ff0000";
		    		document.getElementById("resaParkingLabel11").style.color = "#ff0000";
				}
			}
		}else{
			if (arrivee == '')
			{
				nErreur.push(11);
				document.getElementById("resaParkingDateArrivee").style.border = "2px solid #ff0000";
				document.getElementById("resaParkingLabel10").style.color = "#ff0000";
			}
			
			if (depart == '')
			{
				nErreur.push(12);
				document.getElementById("resaParkingDateDepart").style.border = "2px solid #ff0000";
				document.getElementById("resaParkingLabel11").style.color = "#ff0000";
			}
		}
			
		if(validDate && parking != ''){
			$.ajax({
				dataType: 'xml',
				type: 'POST',
				data: 'arrivee='+arrivee+'&depart='+depart+'&parking='+parking+'&type='+type,
				url: '/ajax/calculertarif/',
				success: function(reponse){
					var type = 0;
	                var errortxt = '';
				    $(reponse).find('error').each(
				    	function(){
							type = $(this).attr('type');
							errortxt = $(this).text();
						}
					);
				    appendHtml = "";
	                if(type == 0 && errortxt == ''){
	                	var tarif = $(reponse).find('tarif').text() + ' &euro;'; 				 
			    		
			    		$("#resaParkingMontant>span").empty();
			    		$("#resaParkingMontant>span").append(tarif);
				    }else{
				    	// affichage de l'erreur
				    	$("#errorPeriode").empty();
			    		$("#errorPeriode").append(errortxt);
			    		document.getElementById("errorPeriode").style.color = "#ff0000";
			    		
			    		var tarif = '0 &euro;';
					  	$("#resaParkingMontant>span").empty();
					  	$("#resaParkingMontant>span").append(tarif);
				    }
				}
			});
		}
	}
// ======================================= CALCUL DU TARIF PARKING A CHAQUE CHANGEMENT DE VALEUR

// ======================================= VERIFIE lA HAUTEUR PARKING/VEHICULE
	function isFlottant(value){
		var tmpValue = value;
		if ( ( tmpValue != "" )  && ( tmpValue != null ) ){
			tmpValue = parseFloat(tmpValue);
			tmpValue = tmpValue + "";
			if (tmpValue == value){
				return true;
			}else{
				return false;
			}
		}else{
			return false;
		}
	}
	
	function checkHauteur(){
		var retour = false;
		if(document.getElementById("resaParkingLabel14") && document.getElementById("resaParkingHauteurVehicule")){
			document.getElementById("resaParkingLabel14").style.color = "#00b1ff";
			document.getElementById("resaParkingHauteurVehicule").style.border = "2px solid #3e3e3e";
			
			var hauteurParking = document.getElementById("hauteurParking").value;
			hauteurParking = hauteurParking.replace(/,/g, '.');
			hauteurParking = hauteurParking.replace(/m/g, '.');
			if(hauteurParking.indexOf('.') == hauteurParking.length-1){
				hauteurParking = hauteurParking.substr(0, hauteurParking.indexOf('.'));
			}
			var hauteurVehicule = document.getElementById("resaParkingHauteurVehicule").value;
			hauteurVehicule = hauteurVehicule.replace(/,/g, '.');
			hauteurVehicule = hauteurVehicule.replace(/m/g, '.');
			if(hauteurVehicule.indexOf('.') == hauteurVehicule.length-1){
				hauteurVehicule = hauteurVehicule.substr(0, hauteurVehicule.indexOf('.'));
			}
			
			if(hauteurParking != '' && hauteurVehicule != ''){
				if((!isNaN(hauteurParking) || !isNaN(hauteurParking)) && (!isNaN(hauteurVehicule) || !isNaN(hauteurVehicule))){
					if(isFlottant(hauteurParking)){
						hauteurParking = parseFloat(hauteurParking);
					}
					if(isFlottant(hauteurVehicule)){
						hauteurVehicule = parseFloat(hauteurVehicule);
					}
					
					if(hauteurVehicule >= hauteurParking){
						document.getElementById("resaParkingHauteurVehicule").style.border = "2px solid #ff0000";
						document.getElementById("resaParkingLabel14").style.color = "#ff0000";
					}else{
						retour = true;
					}
				}else{
					document.getElementById("resaParkingHauteurVehicule").style.border = "2px solid #ff0000";
					document.getElementById("resaParkingLabel14").style.color = "#ff0000";
				}
			}
		}
		return retour;
	}
// ======================================= VERIFIE lA HAUTEUR PARKING/VEHICULE

// ======================================= AFFICHE / CACHE L'IMAGE SKIPASS SUR PARKING
	function showImgSkiPass(){
		$('#resaParkingNforfaitPlusInfo').show();
	}
	
	function hideImgSkiPass(){
		$('#resaParkingNforfaitPlusInfo').hide();
	}
// ======================================= AFFICHE / CACHE L'IMAGE SKIPASS SUR PARKING
	
// ======================================= VALIDATION FORM X GAMES
	function validationFormXGames(message)
	{
		monform = document.getElementById("FormMediaWinterXGames");
		
		document.getElementById("title").style.border = "2px solid #3e3e3e";
		document.getElementById("resaParkingLabel1").style.color = "#00b1ff";
		document.getElementById("resaParkingAdresse").style.border = "2px solid #3e3e3e";
		document.getElementById("resaParkingLabel2").style.color = "#00b1ff";
		document.getElementById("resaParkingCP").style.border = "2px solid #3e3e3e";
		document.getElementById("resaParkingLabel3").style.color = "#00b1ff";
		document.getElementById("resaParkingVille").style.border = "2px solid #3e3e3e";
		document.getElementById("resaParkingLabel4").style.color = "#00b1ff";
		document.getElementById("resaParkingLabel5").style.color = "#00b1ff";
		document.getElementById("resaParkingLabel6").style.color = "#00b1ff";
		document.getElementById("resaParkingLabel7").style.color = "#00b1ff";
		document.getElementById("resaParkingLabel8").style.color = "#00b1ff";
		document.getElementById("budget").style.border = "2px solid #3e3e3e";
		document.getElementById("resaParkingLabel9").style.color = "#00b1ff";
		document.getElementById("resaParkingLabel10").style.color = "#00b1ff";
		
		$("#errorFormGeneral").empty();
	  	$("#errorFormGeneral").append('');
		
		var erreurs;
		var nErreur = new Array();
		
		if (monform.title.value=='')
		{
			nErreur.push(1);
			document.getElementById("title").style.border = "2px solid #ff0000";
			document.getElementById("resaParkingLabel1").style.color = "#ff0000";
		}
		
		if (monform.hiddentypemedia.value=='')
		{
			nErreur.push(6);
			document.getElementById("resaParkingLabel10").style.color = "#ff0000";
		}
		
		if (monform.resaParkingAdresse.value=='')
		{
			nErreur.push(2);
			document.getElementById("resaParkingAdresse").style.border = "2px solid #ff0000";
			document.getElementById("resaParkingLabel2").style.color = "#ff0000";
		}
		
		if (monform.resaParkingCP.value=='')
		{
			nErreur.push(3);
			document.getElementById("resaParkingCP").style.border = "2px solid #ff0000";
			document.getElementById("resaParkingLabel3").style.color = "#ff0000";
		}
		
		if (monform.resaParkingVille.value=='')
		{
			nErreur.push(4);
			document.getElementById("resaParkingVille").style.border = "2px solid #ff0000";
			document.getElementById("resaParkingLabel4").style.color = "#ff0000";
		}
		
		if (monform.resaParkingPays.value=='')
		{
			nErreur.push(5);
			document.getElementById("resaParkingLabel5").style.color = "#ff0000";
		}
		
		if (monform.hiddennbpersonne.value=='')
		{
			nErreur.push(6);
			document.getElementById("resaParkingLabel6").style.color = "#ff0000";
		}
		
		if (monform.hiddenvehicule.value=='')
		{
			nErreur.push(7);
			document.getElementById("resaParkingLabel7").style.color = "#ff0000";
		}
		
		if (monform.hiddenhebergement.value=='')
		{
			nErreur.push(8);
			document.getElementById("resaParkingLabel8").style.color = "#ff0000";
		}
		
		if (monform.budget.value=='')
		{
			nErreur.push(9);
			document.getElementById("budget").style.border = "2px solid #ff0000";
			document.getElementById("resaParkingLabel9").style.color = "#ff0000";
		}
		
		erreurs = nErreur.length;
		if(erreurs>0)
		{
			$("#errorFormGeneral").empty();
			$("#errorFormGeneral").append(message);
			document.getElementById("errorFormGeneral").style.color = "#ff0000";
			alert(message);
			return false;
		}else{
			monform.submit();
		}
	}
// ======================================= VALIDATION FORM X GAMES
	
// ======================================= VALIDATION FORM GROUP
	function validationFormGroup(message)
	{
		monform = document.getElementById("FormGroup");
		
		document.getElementById("raisonsociale").style.border = "2px solid #3e3e3e";
		document.getElementById("resaParkingLabel1").style.color = "#00b1ff";
		document.getElementById("resaParkingNom").style.border = "2px solid #3e3e3e";
		document.getElementById("resaParkingLabel2").style.color = "#00b1ff";
		document.getElementById("resaParkingPrenom").style.border = "2px solid #3e3e3e";
		document.getElementById("resaParkingLabel3").style.color = "#00b1ff";
		document.getElementById("resaParkingEmail").style.border = "2px solid #3e3e3e";
		document.getElementById("resaParkingLabel4").style.color = "#00b1ff";
		document.getElementById("resaParkingTel").style.border = "2px solid #3e3e3e";
		document.getElementById("resaParkingLabel5").style.color = "#00b1ff";
		/*
		document.getElementById("resaParkingAdresse").style.border = "2px solid #3e3e3e";
		document.getElementById("resaParkingLabel6").style.color = "#00b1ff";
		document.getElementById("resaParkingCP").style.border = "2px solid #3e3e3e";
		document.getElementById("resaParkingLabel7").style.color = "#00b1ff";
		document.getElementById("resaParkingVille").style.border = "2px solid #3e3e3e";
		document.getElementById("resaParkingLabel8").style.color = "#00b1ff";
		*/
		document.getElementById("resaParkingLabel9").style.color = "#00b1ff";
		
		$("#errorFormGeneral").empty();
	  	$("#errorFormGeneral").append('');
		
		var erreurs;
		var nErreur = new Array();
		
		if (monform.raisonsociale.value=='')
		{
			nErreur.push(1);
			document.getElementById("raisonsociale").style.border = "2px solid #ff0000";
			document.getElementById("resaParkingLabel1").style.color = "#ff0000";
		}
		if (monform.resaParkingNom.value=='')
		{
			nErreur.push(2);
			document.getElementById("resaParkingNom").style.border = "2px solid #ff0000";
			document.getElementById("resaParkingLabel2").style.color = "#ff0000";
		}
		if (monform.resaParkingPrenom.value=='')
		{
			nErreur.push(3);
			document.getElementById("resaParkingPrenom").style.border = "2px solid #ff0000";
			document.getElementById("resaParkingLabel3").style.color = "#ff0000";
		}
		if (monform.resaParkingEmail.value=='')
		{
			nErreur.push(4);
			document.getElementById("resaParkingEmail").style.border = "2px solid #ff0000";
			document.getElementById("resaParkingLabel4").style.color = "#ff0000";
		}
		if (monform.resaParkingTel.value=='')
		{
			nErreur.push(5);
			document.getElementById("resaParkingTel").style.border = "2px solid #ff0000";
			document.getElementById("resaParkingLabel5").style.color = "#ff0000";
		}
		/*
		if (monform.resaParkingAdresse.value=='')
		{
			nErreur.push(6);
			document.getElementById("resaParkingAdresse").style.border = "2px solid #ff0000";
			document.getElementById("resaParkingLabel6").style.color = "#ff0000";
		}
		if (monform.resaParkingCP.value=='')
		{
			nErreur.push(7);
			document.getElementById("resaParkingCP").style.border = "2px solid #ff0000";
			document.getElementById("resaParkingLabel7").style.color = "#ff0000";
		}
		if (monform.resaParkingVille.value=='')
		{
			nErreur.push(8);
			document.getElementById("resaParkingVille").style.border = "2px solid #ff0000";
			document.getElementById("resaParkingLabel8").style.color = "#ff0000";
		}
		*/
		if (monform.resaParkingPays.value=='')
		{
			nErreur.push(9);
			document.getElementById("resaParkingLabel9").style.color = "#ff0000";
		}
		
		erreurs = nErreur.length;
		if(erreurs>0)
		{
			$("#errorFormGeneral").empty();
			$("#errorFormGeneral").append(message);
			document.getElementById("errorFormGeneral").style.color = "#ff0000";
			alert(message);
			return false;
		}else{
			monform.submit();
		}
	}
// ======================================= VALIDATION FORM GROUP
	
// ======================================= MONTE / DESCEND LA DIV FLASH XGAMES
	function hideDivFlash(){
		//alert('je me cache');
		document.getElementById('homeAltFlashXGames').style.visibility = 'hidden';
	}
	
	function showDivFlash(lang){
		//alert('je me montre => ' + lang);
		var so = new SWFObject("/data/homepage/xgames_"+lang+".swf", "main", "100%", "100%", "8", "#ffffff");
		so.useExpressInstall('/swf/expressInstall.swf');
		so.setAttribute('xiRedirectUrl', document.URL); 
		so.addParam("scale","noscale");
		so.addParam("wmode","transparent"); 
		so.write("homeAltFlashXGames");
		
		document.getElementById('homeAltFlashXGames').style.visibility = 'visible';
	}
// ======================================= MONTE / DESCEND LA DIV FLASH XGAMES