﻿/*<![CDATA[ */
/* jQuery Carousel 0.9.1
Copyright 2008-2009 Thomas Lanciaux and Pierre Bertet.
This software is licensed under the CC-GNU LGPL <http://creativecommons.org/licenses/LGPL/2.1/>
*/
;(function($){
	
	$.fn.carousel = function(params){
		
		var params = $.extend({
			direction: "horizontal",
			loop: false,
			dispItems: 1,
			pagination: false,
			paginationPosition: "inside",
			nextBtn: '<span role="button">Next</span>',
			prevBtn: '<span role="button">Previous</span>',
			btnsPosition: "inside",
			nextBtnInsert: "appendTo",
			prevBtnInsert: "prependTo",
			nextBtnInsertFn: false,
			prevBtnInsertFn: false,
			autoSlide: false,
			autoSlideInterval: 3000,
			delayAutoSlide: false,
			combinedClasses: false,
			effect: "slide",
			slideEasing: "swing",
			animSpeed: "fast",
			equalWidths: "true",
			callback: function(){},
			useAddress: false,
			adressIdentifier: "carousel"
		}, params);
		
		// Buttons position
		if (params.btnsPosition == "outside"){
			params.prevBtnInsert = "insertBefore";
			params.nextBtnInsert = "insertAfter";
		}
		
		// Slide delay
		params.delayAutoSlide = params.delayAutoSlide || params.autoSlideInterval;
		
		return this.each(function(){
			
			// Env object
			var env = {
				$elts: {},
				params: params,
				launchOnLoad: []
			};
			
			// Carousel main container
			env.$elts.carousel = $(this).addClass("js");
			
			// Carousel content
			env.$elts.content = $(this).children().css({position: "absolute", "top": 0});
			
			// Content wrapper
			env.$elts.wrap = env.$elts.content.wrap('<div class="carousel-wrap"></div>').parent().css({overflow: "hidden", position: "relative"});
			
			// env.steps object
			env.steps = {
				first: 0, // First step
				count: env.$elts.content.children().length // Items count
			};
			
			// Last visible step
			env.steps.last = env.steps.count - 1;
			
			// Prev Button
			if ($.isFunction(env.params.prevBtnInsertFn)) {
				env.$elts.prevBtn = env.params.prevBtnInsertFn(env.$elts);
				
			} else { 
				env.$elts.prevBtn = $(params.prevBtn)[params.prevBtnInsert](env.$elts.carousel);
			}
			
			// Next Button
			if ($.isFunction(env.params.nextBtnInsertFn)) {
				env.$elts.nextBtn = env.params.nextBtnInsertFn(env.$elts);
				
			} else {
				env.$elts.nextBtn = $(params.nextBtn)[params.nextBtnInsert](env.$elts.carousel);
			}
			
			// Add buttons classes / data
			env.$elts.nextBtn.addClass("carousel-control next carousel-next");
			env.$elts.prevBtn.addClass("carousel-control previous carousel-previous");
			
			// Bind events on next / prev buttons
			initButtonsEvents(env);
			
			// Pagination
			if (env.params.pagination) {
				initPagination(env);
			}
			
			// Address plugin
			initAddress(env);
			
			// On document load...
			$(function(){
				
				// First item
				var $firstItem = env.$elts.content.children(":first");
				
				// Width 1/3 : Get default item width
				env.itemWidth = $firstItem.outerWidth();
				
				// Width 2/3 : Define content width
				if (params.direction == "vertical"){
					env.contentWidth = env.itemWidth;
					
				} else {
					
					if (params.equalWidths) {
						env.contentWidth = env.itemWidth * env.steps.count;
						
					} else {
						env.contentWidth = (function(){
								var totalWidth = 0;
								
								env.$elts.content.children().each(function(){
									totalWidth += $(this).outerWidth();
								});
								
								return totalWidth;
							})();
					}
				}
				
				// Width 3/3 : Set content width to container
				env.$elts.content.width( env.contentWidth );
				
				// Height 1/2 : Get default item height
				env.itemHeight = $firstItem.outerHeight();
				
				// Height 2/2 : Set content height to container
				if (params.direction == "vertical"){
					env.$elts.content.css({height:env.itemHeight * env.steps.count + "px"});
					env.$elts.content.parent().css({height:env.itemHeight * env.params.dispItems + "px"});
					
				} else {
					env.$elts.content.parent().css({height:env.itemHeight + "px"});
				}
				
				// Update Next / Prev buttons state
				updateButtonsState(env);
				
				// Launch function added to "document ready" event
				$.each(env.launchOnLoad, function(i,fn){
					fn();
				});
				
				// Launch autoslide
				if (env.params.autoSlide){
					window.setTimeout(function(){
						env.autoSlideInterval = window.setInterval(function(){
							goToStep( env, getRelativeStep(env, "next") );
						}, env.params.autoSlideInterval);
					}, env.params.delayAutoSlide);
				}
				
			});
			
		});
		
	};
	
	// Next / Prev buttons events only
	function initButtonsEvents(env){
		
		env.$elts.nextBtn.add(env.$elts.prevBtn)
			
			.bind("enable", function(){
				
				var $this = $(this)
					.unbind("click")
					.bind("click", function(){
						goToStep( env, getRelativeStep(env, ($this.is(".next")? "next" : "prev" )) );
						stopAutoSlide(env);
					})
					.removeClass("disabled");
				
				// Combined classes (IE6 compatibility)
				if (env.params.combinedClasses) {
					$this.removeClass("next-disabled previous-disabled");
				}
			})
			.bind("disable", function(){
				
				var $this = $(this).unbind("click").addClass("disabled");
				
				// Combined classes (IE6 compatibility)
				if (env.params.combinedClasses) {
					
					if ($this.is(".next")) {
						$this.addClass("next-disabled");
						
					} else if ($this.is(".previous")) {
						$this.addClass("previous-disabled");
						
					}
				}
			})
			.hover(function(){
				$(this).toggleClass("hover");
			});
	};
	
	// Pagination
	function initPagination(env){
		env.$elts.pagination = $('<div class="center-wrap"><div class="carousel-pagination"><p></p></div></div>')[((env.params.paginationPosition == "outside")? "insertAfter" : "appendTo")](env.$elts.carousel).find("p");
		
		env.$elts.paginationBtns = $([]);
		
		env.$elts.content.find("li").each(function(i){
			if (i % env.params.dispItems == 0) {
				env.$elts.paginationBtns = env.$elts.paginationBtns.add( $('<a role="button"><span>'+( env.$elts.paginationBtns.length + 1 )+'</span></a>').data("firstStep", i) );
			}
		});
		
		env.$elts.paginationBtns.appendTo(env.$elts.pagination);
		
		env.$elts.paginationBtns.slice(0,1).addClass("active");
		
		// Events
		env.launchOnLoad.push(function(){
			env.$elts.paginationBtns.click(function(e){
				goToStep( env, $(this).data("firstStep") );
				stopAutoSlide(env);
			});
		});
	};
	
	// Address plugin
	function initAddress(env) {
		
		if (env.params.useAddress && $.isFunction($.fn.address)) {
			
			$.address
				.init(function(e) {
					var pathNames = $.address.pathNames();
					if (pathNames[0] === env.params.adressIdentifier && !!pathNames[1]) {
						goToStep(env, pathNames[1]-1);
					} else {
						$.address.value('/'+ env.params.adressIdentifier +'/1');
					}
				})
				.change(function(e) {
					var pathNames = $.address.pathNames();
					if (pathNames[0] === env.params.adressIdentifier && !!pathNames[1]) {
						goToStep(env, pathNames[1]-1);
					}
				});
		} else {
			env.params.useAddress = false;
		}
	};
	
	function goToStep(env, step) {
	    // This should be done only when the action is performed in the big carousel
	    // Currently it is also done with a click on the best deals carousel :(
	    if(true)
	    {
    	    // Get the list of the full pictures and the corresponding img tag
            var imagesTag = $("#carousel").find("img");
		    // Change the image if it isn't the first (because it is already loaded, otherwise it reloads it a second time)
		    if(step != 0) $(imagesTag[step]).attr("src", $(imagesTag[step]).attr("longdesc"));
		}
		
		// TODO : distinguer le clic des deux carousels
		// Best deals part
		if(env.contentWidth == 792 && false)
		{
            var imagesTag = $("#bestdeals").find("img");
		    // Change the image if it wasn't already changed
		    if($(imagesTag[step]).attr("src") == "") $(imagesTag[step]).attr("src", $(imagesTag[step]).attr("longdesc"));
		}
		
		// Callback
		env.params.callback(step);
		
		// Launch animation
		transition(env, step);
		
		// Update first step
		env.steps.first = step;
		
		// Update buttons status
		updateButtonsState(env);
		
		// Update address (jQuery Address plugin)
		if ( env.params.useAddress ) {
			$.address.value('/'+ env.params.adressIdentifier +'/' + (step + 1));
		}
		
	};
	
	// Get next/prev step, useful for autoSlide
	function getRelativeStep(env, position) {
		if (position == "prev") {
			if ( (env.steps.first - env.params.dispItems) >= 0 ) {
				return env.steps.first - env.params.dispItems;
				
			} else {
				return ( (env.params.loop)? (env.steps.count - env.params.dispItems) : false );
			}
			
		} else if (position == "next") {
			
			if ( (env.steps.first + env.params.dispItems) < env.steps.count ) {
				return env.steps.first + env.params.dispItems;
				
			} else {
				return ( (env.params.loop)? 0 : false );
			}
		}
	};
	
	// Animation
	function transition(env, step) {
		
		// Effect
		switch (env.params.effect){
			
			// No effect
			case "no":
				if (env.params.direction == "vertical"){
					env.$elts.content.css("top", -(env.itemHeight * step) + "px");
				} else {
					env.$elts.content.css("left", -(env.itemWidth * step) + "px");
				}
				break;
			
			// Fade effect
			case "fade":
				if (env.params.direction == "vertical"){
					env.$elts.content.hide().css("top", -(env.itemHeight * step) + "px").fadeIn(env.params.animSpeed);
				} else {
					env.$elts.content.hide().css("left", -(env.itemWidth * step) + "px").fadeIn(env.params.animSpeed);
				}
				break;
			
			// Slide effect
			default:
				if (env.params.direction == "vertical"){
					env.$elts.content.stop().animate({
						top : -(env.itemHeight * step) + "px"
					}, env.params.animSpeed, env.params.slideEasing);
				} else {
					env.$elts.content.stop().animate({
						left : -(env.itemWidth * step) + "px"
					}, env.params.animSpeed, env.params.slideEasing);
				}
				break;
		}
		
	};
	
	// Update all buttons state : disabled or not
	function updateButtonsState(env){
		
		if (getRelativeStep(env, "prev") !== false) {
			env.$elts.prevBtn.trigger("enable");
			
		} else {
			env.$elts.prevBtn.trigger("disable");
		}
		
		if (getRelativeStep(env, "next") !== false) {
			env.$elts.nextBtn.trigger("enable");
			
		} else {
			env.$elts.nextBtn.trigger("disable");
		}
		
		if (env.params.pagination){
			env.$elts.paginationBtns.removeClass("active")
			.filter(function(){ return ($(this).data("firstStep") == env.steps.first) }).addClass("active");
		}
	};
	
	// Stop autoslide
	function stopAutoSlide(env) {
		if (!!env.autoSlideInterval){
			window.clearInterval(env.autoSlideInterval);
		}
	};

})(jQuery);
/*]]>*/
/*<![CDATA[ */
/* jQuery Produits */

$(document).ready(function() {
    s = new slider("#products", "#contener");
});

var slider = function(id, id2) {
    var self = this;
    this.NBul = 0;
    this.Largeur = 0;

    this.div = $(id);
    this.contener = this.div.find(id2);
    this.LargeurProduits = this.div.width();
    this.table = this.div.find(".table");
    this.td = this.div.find(".td");

    this.div.find('ul').each(function() {
        if ($(this).hasClass("group")) {
            self.Largeur += $(this).width();
            self.Largeur += parseInt($(this).css("padding-left"));
            self.Largeur += parseInt($(this).css("padding-right"));
            self.Largeur += parseInt($(this).css("margin-left"));
            self.Largeur += parseInt($(this).css("margin-right"));
            self.NBul++;
        }
    });

    /* Fix du width de la table pour IE*/
    $(this.table).css({ width: (this.Largeur) + "px" });

    //alert(this.table.width());

    /* Fin Fix */

    //this.NBul = 7;
    this.saut = this.Largeur / this.NBul;
    this.nav = this.div.find(".navigation");
    this.courant = 0;
    this.deb = this.nav.find(".first");
    this.prec = this.nav.find(".back");
    this.suiv = this.nav.find(".next");
    this.fin = this.nav.find(".last");
    this.numPage = this.nav.find(".step");


    $(this.numPage).empty();
    $(this.numPage).text((this.courant + 1) + "/" + this.NBul);
    $(this.deb).addClass("firstOff");
    $(this.prec).addClass("backOff");

    this.prec.click(function() {
        if (self.courant > 0) {
            self.courant--;
            $(self.suiv).removeClass("nextOff");
            $(self.fin).removeClass("lastOff");
            $(self.numPage).empty();
            setTimeout(function() { $(self.numPage).text((self.courant + 1) + "/" + self.NBul); }, 20);
            self.contener.animate({
                left: -self.courant * self.saut
            }, 1000);

            if (self.courant == 0) {
                $(this).addClass("backOff");
                $(self.deb).addClass("firstOff");
            }
        }
    })

    this.suiv.click(function() {
        if (self.courant < self.NBul - 1) {
            self.courant++;
            //$(this).css({color: "#000000"});
            //$(self.fin).css({color: "#000000"});
            $(self.deb).removeClass("firstOff");
            $(self.deb).addClass("first");
            $(self.prec).removeClass("backOff");
            $(self.prec).addClass("back");
            $(self.numPage).empty();
            setTimeout(function() { $(self.numPage).text((self.courant + 1) + "/" + self.NBul); }, 20);
            self.contener.animate({
                left: -self.courant * self.saut
            }, 1000);

            if (self.courant == self.NBul - 1) {
                $(self.suiv).addClass("nextOff");
                $(self.fin).addClass("lastOff");
            }
        }
    })

    this.fin.click(function() {
        if (self.courant < self.NBul - 1) {
            self.courant = self.NBul - 1;
            $(self.deb).removeClass("firstOff");
            $(self.prec).removeClass("backOff");
            $(this).addClass("lastOff");
            $(self.suiv).addClass("nextOff");
            $(self.numPage).empty();
            setTimeout(function() { $(self.numPage).text((self.courant + 1) + "/" + self.NBul); }, 20);
            self.contener.animate({
                left: -self.courant * self.saut
            }, 1000);
        }
    })

    this.deb.click(function() {
        if (self.courant >= 1) {
            self.courant = 0;
            $(self.suiv).removeClass("nextOff");
            $(self.fin).removeClass("lastOff");
            $(this).addClass("firstOff");
            $(self.prec).addClass("backOff");
            $(self.numPage).empty();
            setTimeout(function() { $(self.numPage).text((self.courant + 1) + "/" + self.NBul); }, 20);
            self.contener.animate({
                left: -self.courant * self.saut
            }, 1000);
        }
    })

}
/*]]>*/
/*<![CDATA[ */
// Function used to retrieve the value of a cookie, and return null if the cookie doesn't exist
function get_cookie(name)
{
    if ( document.cookie) // Is the cookie valid ?
    {
        index = document.cookie.indexOf( name);
        if ( index != -1)
        {
            nDeb = (document.cookie.indexOf( "=", index) + 1);
            nFin = document.cookie.indexOf( ";", index);
            if (nFin == -1) {nFin = document.cookie.length;}
            return unescape(document.cookie.substring(nDeb, nFin));
        } 
    }
    return null;
}

// Function used to retrieve the value of a cookie, and return a default value if the cookie doesn't exist
function get_cookie_or_default(name, defaultValue)
{
    if ( document.cookie) // Is the cookie valid ?
    {
        index = document.cookie.indexOf( name);
        if ( index != -1)
        {
            nDeb = (document.cookie.indexOf( "=", index) + 1);
            nFin = document.cookie.indexOf( ";", index);
            if (nFin == -1) {nFin = document.cookie.length;}
            return unescape(document.cookie.substring(nDeb, nFin));
        }
        index = document.cookie.indexOf( name.toUpperCase());
        if ( index != -1)
        {
            nDeb = (document.cookie.indexOf( "=", index) + 1);
            nFin = document.cookie.indexOf( ";", index);
            if (nFin == -1) {nFin = document.cookie.length;}
            return unescape(document.cookie.substring(nDeb, nFin));
        }
    }
    return defaultValue;
}

// Returns the date parameter using the following format : YYYY-MM-DD HH:MM:SS
// If there is no parameter, returns the current time
function get_date(date)
{
	if(date == null) date = new Date();
	var dateYear = date.getFullYear();
	var dateMonth = date.getMonth().valueOf() + 1;
	if (dateMonth.valueOf() < 10) dateMonth = "0" + dateMonth;
	var dateDay = date.getDate();
	if (dateDay.valueOf() < 10) dateDay = "0" + dateDay;
	var dateHour = new Date().getHours();
	if (dateHour.valueOf() < 10) dateHour = "0" + dateHour;
	var dateMinute = new Date().getMinutes();
	if (dateMinute.valueOf() < 10) dateMinute = "0" + dateMinute;
	var dateSecond = new Date().getSeconds();
	if (dateSecond.valueOf() < 10) dateSecond = "0" + dateSecond;
	return dateYear + '-' + dateMonth + '-' + dateDay + ' ' + dateHour + ':' + dateMinute + ':' + dateSecond;
}
/*]]>*/
/*<![CDATA[ */
// Used to validate the CDV form with Enter key
function addClickFunction(id)
{
    var b = document.getElementById(id);
    if (b && typeof(b.click) == 'undefined') b.click = function()
    {
        var result = true; if (b.onclick) result = b.onclick();
        if (typeof(result) == 'undefined' || result) 
        {
            eval(b.getAttribute('href'));
        }
    }
}

// Function used to clear the login TextBox
function clear_login(loginTextBox)
{
    if (loginTextBox.value == 'email')
        loginTextBox.value = '';
}

// Function used to clear the password TextBox
function clear_password(passwordTextBox)
{
    passwordTextBox.value = '';
}
/*]]>*/
/*<![CDATA[ */
var url = document.location.href;
var comparatorURL;
if (url.indexOf	("/TravelHorizon.WebFrontOffice/", 0) != -1)
	comparatorURL = "/TravelHorizon.WebFrontOffice/Comparator.aspx";
else
	comparatorURL = "/Comparator.aspx";

function RedirectionComparateur(strUrl)
{
	if(strUrl!='#')
		window.location.href=strUrl;
	else
	{
        var lang = get_cookie_or_default('LANG', 'gb').toUpperCase();
	    switch(lang)
		{
		    case 'DE' :
			alert('Sie müssen mindestens ein Produkt auswählen');
		    break;
		    case 'FR' :
			alert('Vous devez choisir au moins un produit');
		    break;
		    case 'GB' :
			alert('You must choose at least one accommodation');
		    break;
		    case 'IT' :
			alert('Dovete sceliere almeno un\'allogiamento');
		    break;
		    case 'DU' :
			alert('U dient minstens één accommodatie te selecteren');
		    break;
		    case 'SE' :
			alert('Du måste välja minst en boendeform');
		    break;
		    default :
			alert('You must choose at least one accommodation');
		    break;
		}
	}
}

function comparateur(sId, lang)
{
	if (document.getElementById("hid_nb_offres") != null)
	{
		// Si on click et qu'on a déjà 3 offres, on n'autorise pas l'ajout
		if (document.getElementById('cb_comparateur_' + sId).checked == true)
		{
			if (parseInt(document.getElementById("hid_nb_offres").value) < 3 )
				sendToWS(sId, lang);
			else
			{
				document.getElementById('cb_comparateur_' + sId).checked = false;
				switch(lang)
				{
				    case 'de-DE' :
    				alert('Es ist nicht möglich, mehr als 3 Unterkünfte miteinander zu vergleichen !');
				    break;
				    case 'fr-FR' :
    				alert('Vous ne pouvez pas comparer plus de 3 produits !');
				    break;
				    case 'en-GB' :
    				alert('You can only compare up to 3 offers !');
				    break;
				    case 'it-IT' :
    				alert('Non potete paragonare piu di 3 prodotti !');
				    break;
				    case 'nl-NL' :
    				alert('U kan maximum 3 producten vergelijken !');
				    break;
				    case 'sv-SE' :
    				alert('Du kan inte jämföra mer än 3 boenden !');
				    break;
				    default :
    				alert('You can only compare up to 3 offers !');
				    break;
				}
			}
		}
		else
			sendToWS(sId, lang);
	}
	else
		sendToWS(sId, lang);
}

// Same function as above, but this one is called when you click on the text instead of the checkbox
function comparateur2(sId, lang)
{
	document.getElementById('cb_comparateur_' + sId).checked = !document.getElementById('cb_comparateur_' + sId).checked;
	if (document.getElementById("hid_nb_offres") != null)
	{
		// Si on click et qu'on a déjà 3 offres, on n'autorise pas l'ajout
		if (document.getElementById('cb_comparateur_' + sId).checked == true)
		{
			if (parseInt(document.getElementById("hid_nb_offres").value) < 3 )
				sendToWS(sId, lang);
			else
			{
				document.getElementById('cb_comparateur_' + sId).checked = false;
				switch(lang)
				{
				    case 'de-DE' :
    				alert('Es ist nicht möglich, mehr als 3 Unterkünfte miteinander zu vergleichen !');
				    break;
				    case 'fr-FR' :
    				alert('Vous ne pouvez pas comparer plus de 3 produits !');
				    break;
				    case 'en-GB' :
    				alert('You can only compare up to 3 offers !');
				    break;
				    case 'it-IT' :
    				alert('Non potete paragonare piu di 3 prodotti !');
				    break;
				    case 'nl-NL' :
    				alert('U kan maximum 3 producten vergelijken !');
				    break;
				    case 'sv-SE' :
    				alert('Du kan inte jämföra mer än 3 boenden !');
				    break;
				    default :
    				alert('You can only compare up to 3 offers !');
				    break;
				}
			}
		}
		else
			sendToWS(sId, lang);
	}
	else
		sendToWS(sId, lang);
}

function sendToWS(sId_offre, lang)
{
	var params = document.getElementById('params_' + sId_offre).value + "&culture=" + lang;
	//var params = document.getElementById(sId_offre).value;

	var jquery = new jQuery.ajax({
		type: "GET",
		url: comparatorURL,
		cache: false,
		success : function(response) {
				onSendSuccess(response);
				return;
			},
		data: params,
		dataType: "html"
		});
}

function refreshComparator(culture)
{
    var lang = get_cookie_or_default('lang', 'fr');
    var version = get_cookie_or_default('version', '1');
    var partenaire = get_cookie_or_default('partenaire', '0');
    var partenaireAffichage = get_cookie_or_default('partenaireaffichage', '0');
    var comparatorCookie = 'comparator-' + lang + '-' + version + '-' + partenaire + '-' + partenaireAffichage;
    // The ajax query is done only if there is a comparator cookie
    if( get_cookie(comparatorCookie) != null )
    {
	    var jquery = new jQuery.ajax({
		    type: "GET",
		    url: comparatorURL,
		    cache: false,
		    success : function(response) {
				    onSendSuccess(response);
				    return;
			    },
			data: "culture=" + culture,
		    dataType: "html"
		    });
    }
}

function onSendSuccess(originalRequest)
{
//	alert('Ajax: Form has been transmit\n') ;
	
    var lang = get_cookie_or_default('LANG', 'fr');
	var btn_comparateur_h = document.getElementById('btn_comparateur_h');
	var btn_comparateur_b = document.getElementById('btn_comparateur_b');
	var a_comparer; 
	//var div_panier = $('div_panier')
	var div_panier = document.getElementById('div_panier');
	var href="#";
	
	if( div_panier )
	{
		var newDiv = document.createElement("div");
		newDiv.innerHTML = originalRequest;
		// Remove previous elements
		while( div_panier.hasChildNodes() )
			div_panier.removeChild(div_panier.lastChild);
		div_panier.appendChild(newDiv);
	}
	
	//permet de récupérer le lien du comparateur
	var regEx = new RegExp( "<a href=\"(.*)\" id=\"a_comparer\">", "g" ) ;
	var resultat = regEx.exec(originalRequest) ;
	if (resultat)
	{
		if(resultat.length>=2)
			href = resultat[1];
	}	
	
	href = "javascript:void(RedirectionComparateur('" + href + "'))";
	
	if(btn_comparateur_h != null)
		btn_comparateur_h.href = href;
	if(btn_comparateur_b != null)
		btn_comparateur_b.href = href;
}
/*]]>*/
/*<![CDATA[ */
var url = document.location.href;
var domain = url.substring(7, url.indexOf("/",7));
var subdomain = domain.substring(domain.indexOf(".", 0));
var sld = domain.substring(domain.indexOf(".", 0) + 1, domain.indexOf(".", domain.indexOf(".", 0) + 1)).toUpperCase();
var travelPathString = "/travel";
if (sld == "TRAVELHORIZON") {
    travelPathString = "";
}

function ajouter_favoris(intHEB_ID, intLIEU_ID, datDATE_DEBUT, intDUREE, intFORMULE_ID, intACTITYPE)
{
	var favourite_cookie = get_cookie_or_default('favoris', '0');
	var favouriteId = intHEB_ID + "_" +	intLIEU_ID + "_" +	datDATE_DEBUT + "_" + intDUREE + "_" + intFORMULE_ID;
	if( favourite_cookie.match(favouriteId) == null)
	{
		// It's a new favourite
		var expDate = new Date();
		expDate.setTime(expDate.getTime() + (30 * 24 * 3600 * 1000));
		document.cookie = "mesfavoris=" + favourite_cookie + "," + favouriteId + "_" + intACTITYPE + "_1_" + get_date() + ";expires=" + expDate.toGMTString() + ";path=/;domain=" + subdomain;
	}
	else
	{
		// The favourite already exists, the cookie is rewritten with the updated action and time
		var arr_favourites = favourite_cookie.split(',');
		var new_favourite_cookie = '0';
		for(var i = 1; i<arr_favourites.length; i++)
		{
			var arr_favourite = arr_favourites[i].split('_');
			if (arr_favourite[0] == intHEB_ID && arr_favourite[1] == intLIEU_ID && arr_favourite[2] == datDATE_DEBUT &&
				arr_favourite[3] == intDUREE && arr_favourite[4] == intFORMULE_ID)
				new_favourite_cookie = new_favourite_cookie + "," + favouriteId + "_" + intACTITYPE + "_1_" + get_date();
			else
				new_favourite_cookie = new_favourite_cookie + "," + arr_favourites[i];
		}
		var expDate = new Date();
		expDate.setTime(expDate.getTime() + (30 * 24 * 3600 * 1000));
		document.cookie = "mesfavoris=" + new_favourite_cookie + ";expires=" + expDate.toGMTString() + ";path=/;domain=" + subdomain;
	}
	
	var lang = get_cookie_or_default('lang', '').toLowerCase();
	if (lang == '') lang = get_cookie_or_default('LANG', 'gb').toLowerCase();
	switch (lang)
	{
		case 'de' :
		document.getElementById("entete_favoris").innerHTML = '<a href="' + travelPathString + '/de/recherche2/AffichageOffre.asp?favoris=1">Meine Favoriten (' + get_nb_favourites() + ')</a>';
		document.getElementById("addfav_" + favouriteId).innerHTML = '<a class="favourites" href="javascript:supprimer_favoris(' + intHEB_ID + "," + intLIEU_ID + ",'" + datDATE_DEBUT + "'," + intDUREE + "," + intFORMULE_ID + "," + intACTITYPE + ')" rel="nofollow">Aus meinen Favoriten löschen</a>';
		break;
		case 'du' :
		document.getElementById("entete_favoris").innerHTML = '<a href="' + travelPathString + '/du/recherche2/AffichageOffre.asp?favoris=1">Mijn favorieten (' + get_nb_favourites() + ')</a>';
		document.getElementById("addfav_" + favouriteId).innerHTML = '<a class="favourites" href="javascript:supprimer_favoris(' + intHEB_ID + "," + intLIEU_ID + ",'" + datDATE_DEBUT + "'," + intDUREE + "," + intFORMULE_ID + "," + intACTITYPE + ')" rel="nofollow">Verwijder mijn favorieten</a>';
		break;
		case 'fr' :
		    document.getElementById("entete_favoris").innerHTML = '<a href="' + travelPathString + '/fr/recherche2/AffichageOffre.asp?favoris=1">Mes favoris (' + get_nb_favourites() + ')</a>';
		    document.getElementById("addfav_" + favouriteId).innerHTML = '<a class="favourites" href="javascript:supprimer_favoris(' + intHEB_ID + "," + intLIEU_ID + ",'" + datDATE_DEBUT + "'," + intDUREE + "," + intFORMULE_ID + "," + intACTITYPE + ')" rel="nofollow">Retirer de mes favoris</a>';
		break;
		case 'gb' :
		    document.getElementById("entete_favoris").innerHTML = '<a href="' + travelPathString + '/gb/recherche2/AffichageOffre.asp?favoris=1">My favourites (' + get_nb_favourites() + ')</a>';
		    document.getElementById("addfav_" + favouriteId).innerHTML = '<a class="favourites" href="javascript:supprimer_favoris(' + intHEB_ID + "," + intLIEU_ID + ",'" + datDATE_DEBUT + "'," + intDUREE + "," + intFORMULE_ID + "," + intACTITYPE + ')" rel="nofollow">Remove from favourites</a>';
		break;
		case 'it' :
		    document.getElementById("entete_favoris").innerHTML = '<a href="' + travelPathString + '/autre/recherche2/AffichageOffre.asp?favoris=1">Favoriti (' + get_nb_favourites() + ')</a>';
		    document.getElementById("addfav_" + favouriteId).innerHTML = '<a class="favourites" href="javascript:supprimer_favoris(' + intHEB_ID + "," + intLIEU_ID + ",'" + datDATE_DEBUT + "'," + intDUREE + "," + intFORMULE_ID + "," + intACTITYPE + ')" rel="nofollow">Rimuovi dai favoriti</a>';
		break;
		case 'se' :
		    document.getElementById("entete_favoris").innerHTML = '<a href="' + travelPathString + '/se/recherche2/AffichageOffre.asp?favoris=1">Mina Favoriter (' + get_nb_favourites() + ')</a>';
		    document.getElementById("addfav_" + favouriteId).innerHTML = '<a class="favourites" href="javascript:supprimer_favoris(' + intHEB_ID + "," + intLIEU_ID + ",'" + datDATE_DEBUT + "'," + intDUREE + "," + intFORMULE_ID + "," + intACTITYPE + ')" rel="nofollow">Ta bort från mina favoriter</a>';
		break;
		default :
		    document.getElementById("entete_favoris").innerHTML = '<a href="' + travelPathString + '/gb/recherche2/AffichageOffre.asp?favoris=1">My favourites (' + get_nb_favourites() + ')</a>';
		    document.getElementById("addfav_" + favouriteId).innerHTML = '<a class="favourites" href="javascript:supprimer_favoris(' + intHEB_ID + "," + intLIEU_ID + ",'" + datDATE_DEBUT + "'," + intDUREE + "," + intFORMULE_ID + "," + intACTITYPE + ')" rel="nofollow">Remove from favourites</a>';
		break;
	}
	document.getElementById("entete_favoris").style.display = '';
	document.getElementById("picto_" + favouriteId).className = 'FavoritesRemove';
	// TODO : Gérer pageTracker
// response[7] = pays		// response[8] = nom station // response[9] = nom hebergement
//	pageTracker._trackPageview("/favoris/" + lang + "/" + response[7] + "/" + response[8] + "/" + response[9] + "/in");
//	pageTracker._trackEvent("favoris", "in", "/" + lang + "/" + response[7] + "/" + response[8] + "/" + response[9], response[1])
}

function supprimer_favoris(intHEB_ID, intLIEU_ID, datDATE_DEBUT, intDUREE, intFORMULE_ID, intACTITYPE)
{
	var favourite_cookie = get_cookie_or_default('favoris', '0');
	var favouriteId = intHEB_ID + "_" +	intLIEU_ID + "_" +	datDATE_DEBUT + "_" + intDUREE + "_" + intFORMULE_ID;
	var arr_favourites = favourite_cookie.split(',');
	var new_favourite_cookie = '0';
	for(var i = 1; i<arr_favourites.length; i++)
	{
		var arr_favourite = arr_favourites[i].split('_');
		if (arr_favourite[0] == intHEB_ID && arr_favourite[1] == intLIEU_ID && arr_favourite[2] == datDATE_DEBUT &&
			arr_favourite[3] == intDUREE && arr_favourite[4] == intFORMULE_ID)
			new_favourite_cookie = new_favourite_cookie + "," + favouriteId + "_" + intACTITYPE + "_0_" + get_date();
		else
			new_favourite_cookie = new_favourite_cookie + "," + arr_favourites[i];
	}
	var expDate = new Date();
	expDate.setTime(expDate.getTime() + (30 * 24 * 3600 * 1000));
	document.cookie = "mesfavoris=" + new_favourite_cookie + ";expires=" + expDate.toGMTString() + ";path=/;domain=" + subdomain;
	
	var lang = get_cookie_or_default('lang', '').toLowerCase();
	if (lang == '') lang = get_cookie_or_default('LANG', 'gb').toLowerCase();
	switch (lang)
	{
		case 'de' :
		    document.getElementById("entete_favoris").innerHTML = '<a href="' + travelPathString + '/de/recherche2/AffichageOffre.asp?favoris=1">Meine Favoriten (' + get_nb_favourites() + ')</a>';
		    document.getElementById("addfav_" + favouriteId).innerHTML = '<a class="favourites" href="javascript:ajouter_favoris(' + intHEB_ID + "," + intLIEU_ID + ",'" + datDATE_DEBUT + "'," + intDUREE + "," + intFORMULE_ID + "," + intACTITYPE + ')" class="red">Zu meinen Favoriten hinzufügen</a>';
		break;
		case 'du' :
		    document.getElementById("entete_favoris").innerHTML = '<a href="' + travelPathString + '/du/recherche2/AffichageOffre.asp?favoris=1">Mijn favorieten (' + get_nb_favourites() + ')</a>';
		    document.getElementById("addfav_" + favouriteId).innerHTML = '<a class="favourites" href="javascript:ajouter_favoris(' + intHEB_ID + "," + intLIEU_ID + ",'" + datDATE_DEBUT + "'," + intDUREE + "," + intFORMULE_ID + "," + intACTITYPE + ')" rel="nofollow">Toevoegen aan mijn favorieten</a>';
		break;
		case 'fr' :
		    document.getElementById("entete_favoris").innerHTML = '<a href="' + travelPathString + '/fr/recherche2/AffichageOffre.asp?favoris=1">Mes favoris (' + get_nb_favourites() + ')</a>';
		    document.getElementById("addfav_" + favouriteId).innerHTML = '<a class="favourites" href="javascript:ajouter_favoris(' + intHEB_ID + "," + intLIEU_ID + ",'" + datDATE_DEBUT + "'," + intDUREE + "," + intFORMULE_ID + "," + intACTITYPE + ')" rel="nofollow">Ajouter à mes favoris</a>';
		break;
		case 'gb' :
		    document.getElementById("entete_favoris").innerHTML = '<a href="' + travelPathString + '/gb/recherche2/AffichageOffre.asp?favoris=1">My favourites (' + get_nb_favourites() + ')</a>';
		    document.getElementById("addfav_" + favouriteId).innerHTML = '<a class="favourites" href="javascript:ajouter_favoris(' + intHEB_ID + "," + intLIEU_ID + ",'" + datDATE_DEBUT + "'," + intDUREE + "," + intFORMULE_ID + "," + intACTITYPE + ')" rel="nofollow">Add to my favourites</a>';
		break;
		case 'it' :
		    document.getElementById("entete_favoris").innerHTML = '<a href="' + travelPathString + '/autre/recherche2/AffichageOffre.asp?favoris=1">Favoriti (' + get_nb_favourites() + ')</a>';
		    document.getElementById("addfav_" + favouriteId).innerHTML = '<a class="favourites" href="javascript:ajouter_favoris(' + intHEB_ID + "," + intLIEU_ID + ",'" + datDATE_DEBUT + "'," + intDUREE + "," + intFORMULE_ID + "," + intACTITYPE + ')" rel="nofollow">Aggiungi ai favoriti</a>';
		break;
		case 'se' :
		    document.getElementById("entete_favoris").innerHTML = '<a href="' + travelPathString + '/se/recherche2/AffichageOffre.asp?favoris=1">Mina Favoriter (' + get_nb_favourites() + ')</a>';
		    document.getElementById("addfav_" + favouriteId).innerHTML = '<a class="favourites" href="javascript:ajouter_favoris(' + intHEB_ID + "," + intLIEU_ID + ",'" + datDATE_DEBUT + "'," + intDUREE + "," + intFORMULE_ID + "," + intACTITYPE + ')" rel="nofollow">Lägg till mina favoriter</a>';
		break;
		default :
		    document.getElementById("entete_favoris").innerHTML = '<a href="' + travelPathString + '/gb/recherche2/AffichageOffre.asp?favoris=1">My favourites (' + get_nb_favourites() + ')</a>';
		    document.getElementById("addfav_" + favouriteId).innerHTML = '<a class="favourites" href="javascript:ajouter_favoris(' + intHEB_ID + "," + intLIEU_ID + ",'" + datDATE_DEBUT + "'," + intDUREE + "," + intFORMULE_ID + "," + intACTITYPE + ')" rel="nofollow">Add to my favourites</a>';
		break;
	}
	document.getElementById("entete_favoris").style.display = '';
	document.getElementById("picto_" + favouriteId).className = 'FavoritesAdd';
	// TODO : Gérer pageTracker
// response[7] = pays		// response[8] = nom station // response[9] = nom hebergement
//	pageTracker._trackPageview("/favoris/" + lang + "/" + response[7] + "/" + response[8] + "/" + response[9] + "/out");
//	pageTracker._trackEvent("favoris", "out", "/" + lang + "/" + response[7] + "/" + response[8] + "/" + response[9], response[1]);
	if(get_nb_favourites() == 0)
		document.getElementById("entete_favoris").style.display = 'none';
}

function changeLinks()
{
	var favouriteCookie = get_cookie('mesfavoris');
	// Do the following only if there is the mesfavoris cookie
	if (favouriteCookie != null)
	{
		var favouritesArray = favouriteCookie.split(',');
		// For each favourite in the cookie
		for( var i = 1; i<favouritesArray.length; i++)
		{
			var favourite = favouritesArray[i].split('_');
			var favouriteId = favourite[0] + "_" + favourite[1] + "_" + favourite[2] + "_" + favourite[3] + "_" + favourite[4];
			// If the favourite product has been added to the favourites (could be removed, where we do nothing)
			if( favourite[6] == "1")
			{
				// If the product is displayed on the page
				if( document.getElementById('addfav_' + favouriteId) )
				{
					// Replace the add to favourites by removes from favourites
					var lang = get_cookie_or_default('lang', '').toLowerCase();
					if (lang == '') lang = get_cookie_or_default('LANG', 'gb').toLowerCase();
					switch (lang)
					{
						case 'de' :
						    document.getElementById("addfav_" + favouriteId).innerHTML = '<a class="favourites" href="javascript:supprimer_favoris(' + favourite[0] + "," + favourite[1] + ",'" + favourite[2] + "'," + favourite[3] + "," + favourite[4] + "," + favourite[5] + ')" rel="nofollow">Aus meinen Favoriten löschen</a>';
						break;
						case 'du' :
						    document.getElementById("addfav_" + favouriteId).innerHTML = '<a class="favourites" href="javascript:supprimer_favoris(' + favourite[0] + "," + favourite[1] + ",'" + favourite[2] + "'," + favourite[3] + "," + favourite[4] + "," + favourite[5] + ')" rel="nofollow">Verwijder mijn favorieten</a>';
						break;
						case 'fr' :
						    document.getElementById("addfav_" + favouriteId).innerHTML = '<a hclass="favourites" ref="javascript:supprimer_favoris(' + favourite[0] + "," + favourite[1] + ",'" + favourite[2] + "'," + favourite[3] + "," + favourite[4] + "," + favourite[5] + ')" rel="nofollow">Retirer de mes favoris</a>';
						break;
						case 'gb' :
						    document.getElementById("addfav_" + favouriteId).innerHTML = '<a class="favourites" href="javascript:supprimer_favoris(' + favourite[0] + "," + favourite[1] + ",'" + favourite[2] + "'," + favourite[3] + "," + favourite[4] + "," + favourite[5] + ')" rel="nofollow">Remove from favourites</a>';
						break;
						case 'it' :
						    document.getElementById("addfav_" + favouriteId).innerHTML = '<a class="favourites" href="javascript:supprimer_favoris(' + favourite[0] + "," + favourite[1] + ",'" + favourite[2] + "'," + favourite[3] + "," + favourite[4] + "," + favourite[5] + ')" rel="nofollow">Rimuovi dai favoriti</a>';
						break;
						case 'se' :
						    document.getElementById("addfav_" + favouriteId).innerHTML = '<a class="favourites" href="javascript:supprimer_favoris(' + favourite[0] + "," + favourite[1] + ",'" + favourite[2] + "'," + favourite[3] + "," + favourite[4] + "," + favourite[5] + ')" rel="nofollow">Ta bort från mina favoriter</a>';
						break;
						default :
						    document.getElementById("addfav_" + favouriteId).innerHTML = '<a class="favourites" href="javascript:supprimer_favoris(' + favourite[0] + "," + favourite[1] + ",'" + favourite[2] + "'," + favourite[3] + "," + favourite[4] + "," + favourite[5] + ')" rel="nofollow">Remove from favourites</a>';
						break;
					}
					document.getElementById("picto_" + favouriteId).className = 'FavoritesRemove';
				}
			}
		}
	}
}

function refresh_favourites_header()
{
	var favouriteCookie = get_cookie('mesfavoris');
	var nb_favourites = get_nb_favourites();
	if ( favouriteCookie != null && nb_favourites > 0 )
	{
		var favouritesArray = favouriteCookie.split(',');
		// For each favourite in the cookie
		var lang = get_cookie_or_default('lang', '').toLowerCase();
		if (lang == '') lang = get_cookie_or_default('LANG', 'gb').toLowerCase();
		switch (lang)
		{
			case 'de' :
			    document.getElementById("entete_favoris").innerHTML = '<a href="' + travelPathString + '/de/recherche2/AffichageOffre.asp?favoris=1">Meine Favoriten (' + nb_favourites + ')</a>';
			break;
			case 'du' :
			    document.getElementById("entete_favoris").innerHTML = '<a href="' + travelPathString + '/du/recherche2/AffichageOffre.asp?favoris=1">Mijn favorieten (' + nb_favourites + ')</a>';
			break;
			case 'fr' :
			    document.getElementById("entete_favoris").innerHTML = '<a href="' + travelPathString + '/fr/recherche2/AffichageOffre.asp?favoris=1">Mes favoris (' + nb_favourites + ')</a>';
			break;
			case 'gb' :
			    document.getElementById("entete_favoris").innerHTML = '<a href="' + travelPathString + '/gb/recherche2/AffichageOffre.asp?favoris=1">My favourites (' + nb_favourites + ')</a>';
			break;
			case 'it' :
			    document.getElementById("entete_favoris").innerHTML = '<a href="' + travelPathString + '/autre/recherche2/AffichageOffre.asp?favoris=1">Favoriti (' + nb_favourites + ')</a>';
			break;
			case 'se' :
			    document.getElementById("entete_favoris").innerHTML = '<a href="' + travelPathString + '/se/recherche2/AffichageOffre.asp?favoris=1">Mina Favoriter (' + nb_favourites + ')</a>';
			break;
			default :
			    document.getElementById("entete_favoris").innerHTML = '<a href="' + travelPathString + '/gb/recherche2/AffichageOffre.asp?favoris=1">My favourites (' + nb_favourites + ')</a>';
			break;
		}
	}
}

function get_nb_favourites()
{
	var favouriteCookie = get_cookie('mesfavoris');
	var nb_favourites = 0;
	// Do the following only if there is the mesfavoris cookie
	if (favouriteCookie != null)
	{
		var favouritesArray = favouriteCookie.split(',');
		// For each favourite in the cookie
		for( var i = 1; i<favouritesArray.length; i++)
		{
			var favourite = favouritesArray[i].split('_');
			if( favourite[6] == "1")
				nb_favourites++;
		}
	}
	return nb_favourites;
}
/*]]>*/
/*<![CDATA[ */
$(document).ready(function () {
    var toggletitles = $("a[id^='toggletitle']");
    if (toggletitles != null) {

        toggletitles.click(function () {
            collapsedElementClick(this);
        });

        $("div[id^='togglebutton']").click(function () {
            collapsedElementClick(this);
        });

        /*Get the cookie navdeploystatecookie to know the uncollapsed dimensions on the navigation bar */
        var cookieContent = getNavDeployCookie();
        if (cookieContent != null && cookieContent != "") {
            uncollapseElements(cookieContent);
        }
        else // create the cookie
        {
            setNavDeployCookie();
            cookieContent = getNavDeployCookie();
            uncollapseElements(cookieContent);
        }
    }

    function toggleElement(id, bforcetoggleclass) {
        $("div[id='togglecontent_" + id + "']").slideToggle();
        $("div[id='togglebutton_" + id + "']").toggleClass("toggle-button");
        if (bforcetoggleclass != null) {
            $("a[id='toggletitle_" + id + "']").toggleClass("uncollapsed", bforcetoggleclass);
        }
        else {
            $("a[id='toggletitle_" + id + "']").toggleClass("uncollapsed");
        }
    }

    function getNavDeployCookie() {
        return $.cookie('navdeploystatecookie');
    }

    function setNavDeployCookie() {
        var contentCookieValue = "";

        $(".toggle-title.uncollapsed").each(function () {
            var id = GetId(this);
            contentCookieValue += id + '|';
        });

        contentCookieValue = contentCookieValue.substring(0, contentCookieValue.length - 1);
        $.cookie('navdeploystatecookie', contentCookieValue);
    }

    function collapsedElementClick(element) {
        var id = GetId(element);
        toggleElement(id, null);
        setNavDeployCookie();
    }

    function GetId(element) {
        var obj = element.id.split('_');
        var id = obj[1];

        return id;
    }

    function uncollapseElements(ids) {
        $(".toggle-title.uncollapsed").each(function () {
            var id = GetId(this);
            $("a[id='toggletitle_" + id + "']").toggleClass("uncollapsed", false);
        });
        if (ids != null) {
            var dimensionsIdList = ids.split('|');
            for (var i = 0; i < dimensionsIdList.length; i++) {
                var id = dimensionsIdList[i];
                toggleElement(id, true);
            }
        }
    }
});
/*]]>*/ 

/*<![CDATA[ */
/**
* Cookie plugin
*
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/

/**
* Create a cookie with the given name and value and other optional parameters.
*
* @example $.cookie('the_cookie', 'the_value');
* @desc Set the value of a cookie.
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
* @desc Create a cookie with all available options.
* @example $.cookie('the_cookie', 'the_value');
* @desc Create a session cookie.
* @example $.cookie('the_cookie', null);
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
*       used when the cookie was set.
*
* @param String name The name of the cookie.
* @param String value The value of the cookie.
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
*                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
*                             If set to null or omitted, the cookie will be a session cookie and will not be retained
*                             when the the browser exits.
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
*                        require a secure protocol (like HTTPS).
* @type undefined
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/

/**
* Get the value of a cookie with the given name.
*
* @example $.cookie('the_cookie');
* @desc Get the value of a cookie.
*
* @param String name The name of the cookie.
* @return The value of the cookie.
* @type String
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};
/*]]>*/
/*<![CDATA[ */
/*	
Watermark plugin for jQuery
Version: 3.0.3
http://jquery-watermark.googlecode.com/

Copyright (c) 2009 Todd Northrop
http://www.speednet.biz/
	
November 30, 2009

Requires:  jQuery 1.2.3+
	
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version, subject to the following conditions:
	
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
	
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
------------------------------------------------------*/

(function ($) {

var
	// Will speed up references to undefined
	undefined,

	// String constants for data names
	dataFlag = "watermark",
	dataClass = "watermarkClass",
	dataFocus = "watermarkFocus",
	dataFormSubmit = "watermarkSubmit",
	dataMaxLen = "watermarkMaxLength",
	dataPassword = "watermarkPassword",
	dataText = "watermarkText",
	
	// Includes only elements with watermark defined
	selWatermarkDefined = ":data(" + dataFlag + ")",

	// Includes only elements capable of having watermark
	selWatermarkAble = ":text,:password,:search,textarea",
	
	// triggerFns:
	// Array of function names to look for in the global namespace.
	// Any such functions found will be hijacked to trigger a call to
	// hideAll() any time they are called.  The default value is the
	// ASP.NET function that validates the controls on the page
	// prior to a postback.
	// 
	// Am I missing other important trigger function(s) to look for?
	// Please leave me feedback:
	// http://code.google.com/p/jquery-watermark/issues/list
	triggerFns = [
		"Page_ClientValidate"
	],
	
	// Holds a value of true if a watermark was displayed since the last
	// hideAll() was executed. Avoids repeatedly calling hideAll().
	pageDirty = false;

// Extends jQuery with a custom selector - ":data(...)"
// :data(<name>)  Includes elements that have a specific name defined in the jQuery data collection. (Only the existence of the name is checked; the value is ignored.)
// :data(<name>=<value>)  Includes elements that have a specific jQuery data name defined, with a specific value associated with it.
// :data(<name>!=<value>)  Includes elements that have a specific jQuery data name defined, with a value that is not equal to the value specified.
// :data(<name>^=<value>)  Includes elements that have a specific jQuery data name defined, with a value that starts with the value specified.
// :data(<name>$=<value>)  Includes elements that have a specific jQuery data name defined, with a value that ends with the value specified.
// :data(<name>*=<value>)  Includes elements that have a specific jQuery data name defined, with a value that contains the value specified.
$.extend($.expr[":"], {
	"data": function (element, index, matches, set) {
		var data, parts = /^((?:[^=!^$*]|[!^$*](?!=))+)(?:([!^$*]?=)(.*))?$/.exec(matches[3]);
		if (parts) {
			data = $(element).data(parts[1]);
			
			if (data !== undefined) {

				if (parts[2]) {
					data = "" + data;
				
					switch (parts[2]) {
						case "=":
							return (data == parts[3]);
						case "!=":
							return (data != parts[3]);
						case "^=":
							return (data.slice(0, parts[3].length) == parts[3]);
						case "$=":
							return (data.slice(-parts[3].length) == parts[3]);
						case "*=":
							return (data.indexOf(parts[3]) !== -1);
					}
				}

				return true;
			}
		}
		
		return false;
	}
});

$.watermark = {

	// Current version number of the plugin
	version: "3.0.3",
		
	// Default options used when watermarks are instantiated.
	// Can be changed to affect the default behavior for all
	// new or updated watermarks.
	// BREAKING CHANGE:  The $.watermark.className
	// property that was present prior to version 3.0.2 must
	// be changed to $.watermark.options.className
	options: {
		
		// Default class name for all watermarks
		className: "watermark",
		
		// If true, plugin will detect and use native browser support for
		// watermarks, if available. (e.g., WebKit's placeholder attribute.)
		useNative: true
	},
	
	// Hide one or more watermarks by specifying any selector type
	// i.e., DOM element, string selector, jQuery matched set, etc.
	hide: function (selector) {
		$(selector).filter(selWatermarkDefined).each(
			function () {
				$.watermark._hide($(this));
			}
		);
	},
	
	// Internal use only.
	_hide: function ($input, focus) {
	
		if ($input.val() == $input.data(dataText)) {
			$input.val("");
			
			// Password type?
			if ($input.data(dataPassword)) {
				
				if ($input.attr("type") === "text") {
					var $pwd = $input.data(dataPassword), 
						$wrap = $input.parent();
						
					$wrap[0].removeChild($input[0]); // Can't use jQuery methods, because they destroy data
					$wrap[0].appendChild($pwd[0]);
					$input = $pwd;
				}
			}
			
			if ($input.data(dataMaxLen)) {
				$input.attr("maxLength", $input.data(dataMaxLen));
				$input.removeData(dataMaxLen);
			}
		
			if (focus) {
				$input.attr("autocomplete", "off");  // Avoid NS_ERROR_XPC_JS_THREW_STRING error in Firefox
				window.setTimeout(
					function () {
						$input.select();  // Fix missing cursor in IE
					}
				, 0);
			}
		}
		
		$input.removeClass($input.data(dataClass));
	},
	
	// Display one or more watermarks by specifying any selector type
	// i.e., DOM element, string selector, jQuery matched set, etc.
	// If conditions are not right for displaying a watermark, ensures that watermark is not shown.
	show: function (selector) {
		$(selector).filter(selWatermarkDefined).each(
			function () {
				$.watermark._show($(this));
			}
		);
	},
	
	// Internal use only.
	_show: function ($input) {
		var val = $input.val(),
			text = $input.data(dataText),
			type = $input.attr("type");

		if (((val.length == 0) || (val == text)) && (!$input.data(dataFocus))) {
			pageDirty = true;
		
			// Password type?
			if ($input.data(dataPassword)) {
				
				if (type === "password") {
					var $wm = $input.data(dataPassword),
						$wrap = $input.parent();
						
					$wrap[0].removeChild($input[0]); // Can't use jQuery methods, because they destroy data
					$wrap[0].appendChild($wm[0]);
					$input = $wm;
					$input.attr("maxLength", text.length);
				}
			}
		
			// Ensure maxLength big enough to hold watermark (input of type="text" or type="search" only)
			if ((type === "text") || (type === "search")) {
				var maxLen = $input.attr("maxLength");
				
				if ((maxLen > 0) && (text.length > maxLen)) {
					$input.data(dataMaxLen, maxLen);
					$input.attr("maxLength", text.length);
				}
			}
            
			$input.addClass($input.data(dataClass));
			$input.val(text);
		}
		else {
			$.watermark._hide($input);
		}
	},
	
	// Hides all watermarks on the current page.
	hideAll: function () {
		if (pageDirty) {
			$.watermark.hide(selWatermarkAble);
			pageDirty = false;
		}
	},
	
	// Displays all watermarks on the current page.
	showAll: function () {
		$.watermark.show(selWatermarkAble);
	}
};

$.fn.watermark = function (text, options) {
	///	<summary>
	///		Set watermark text and class name on all input elements of type="text/password/search" and
	/// 	textareas within the matched set. If className is not specified in options, the default is
	/// 	"watermark". Within the matched set, only input elements with type="text/password/search"
	/// 	and textareas are affected; all other elements are ignored.
	///	</summary>
	///	<returns type="jQuery">
	///		Returns the original jQuery matched set (not just the input and texarea elements).
	/// </returns>
	///	<param name="text" type="String">
	///		Text to display as a watermark when the input or textarea element has an empty value and does not
	/// 	have focus. The first time watermark() is called on an element, if this argument is empty (or not
	/// 	a String type), then the watermark will have the net effect of only changing the class name when
	/// 	the input or textarea element's value is empty and it does not have focus.
	///	</param>
	///	<param name="options" type="Object" optional="true">
	///		Provides the ability to override the default watermark options ($.watermark.options). For backward
	/// 	compatibility, if a string value is supplied, it is used as the class name that overrides the class
	/// 	name in $.watermark.options.className. Properties include:
	/// 		className: When the watermark is visible, the element will be styled using this class name.
	/// 		useNative (Boolean or Function): Specifies if native browser support for watermarks will supersede
	/// 			plugin functionality. If useNative is a function, the return value from the function will
	/// 			determine if native support is used. The function is passed one argument -- a jQuery object
	/// 			containing the element being tested as the only element in its matched set -- and the DOM
	/// 			element being tested is the object on which the function is invoked (the value of "this").
	///	</param>
	/// <remarks>
	///		The effect of changing the text and class name on an input element is called a watermark because
	///		typically light gray text is used to provide a hint as to what type of input is required. However,
	///		the appearance of the watermark can be something completely different: simply change the CSS style
	///		pertaining to the supplied class name.
	///		
	///		The first time watermark() is called on an element, the watermark text and class name are initialized,
	///		and the focus and blur events are hooked in order to control the display of the watermark.  Also, as
	/// 	of version 3.0, drag and drop events are hooked to guard against dropped text being appended to the
	/// 	watermark.  If native watermark support is provided by the browser, it is detected and used, unless
	/// 	the useNative option is set to false.
	///		
	///		Subsequently, watermark() can be called again on an element in order to change the watermark text
	///		and/or class name, and it can also be called without any arguments in order to refresh the display.
	///		
	///		For example, after changing the value of the input or textarea element programmatically, watermark()
	/// 	should be called without any arguments to refresh the display, because the change event is only
	/// 	triggered by user actions, not by programmatic changes to an input or textarea element's value.
	/// 	
	/// 	The one exception to programmatic updates is for password input elements:  you are strongly cautioned
	/// 	against changing the value of a password input element programmatically (after the page loads).
	/// 	The reason is that some fairly hairy code is required behind the scenes to make the watermarks bypass
	/// 	IE security and switch back and forth between clear text (for watermarks) and obscured text (for
	/// 	passwords).  It is *possible* to make programmatic changes, but it must be done in a certain way, and
	/// 	overall it is not recommended.
	/// </remarks>
	
	var hasText = (typeof(text) === "string"), hasClass;
	
	if (typeof(options) === "object") {
		hasClass = (typeof(options.className) === "string");
		options = $.extend({}, $.watermark.options, options);
	}
	else if (typeof(options) === "string") {
		hasClass = true;
		options = $.extend({}, $.watermark.options, {className: options});
	}
	else {
		options = $.watermark.options;
	}
	
	if (typeof(options.useNative) !== "function") {
		options.useNative = options.useNative? function () { return true; } : function () { return false; };
	}
	
	return this.each(
		function () {
			var $input = $(this);
			
			if (!$input.is(selWatermarkAble)) {
				return;
			}
			
			// Watermark already initialized?
			if ($input.data(dataFlag)) {
			
				// If re-defining text or class, first remove existing watermark, then make changes
				if (hasText || hasClass) {
					$.watermark._hide($input);
			
					if (hasText) {
						$input.data(dataText, text);
					}
					
					if (hasClass) {
						$input.data(dataClass, options.className);
					}
				}
			}
			else {
			
				// Detect and use native browser support, if enabled in options
				if (options.useNative.call(this, $input)) {
					
					// Placeholder attribute (WebKit)
					// Big thanks to Opera for the wacky test required
					if ((("" + $input.css("-webkit-appearance")).replace("undefined", "") !== "") && ($input.attr("tagName") !== "TEXTAREA")) {
						
						// className is not set because WebKit doesn't appear to have
						// a separate class name property for placeholders (watermarks).
						if (hasText) {
							$input.attr("placeholder", text);
						}
						
						// Only set data flag for non-native watermarks (purposely commented-out)
						// $input.data(dataFlag, 1);
						return;
					}
				}
				
				$input.data(dataText, hasText? text : "");
				$input.data(dataClass, options.className);
				$input.data(dataFlag, 1); // Flag indicates watermark was initialized
				
				// Special processing for password type
				if ($input.attr("type") === "password") {
					var $wrap = $input.wrap("<span>").parent();
					var $wm = $($wrap.html().replace(/type=["']?password["']?/i, 'type="text"'));
					
					$wm.data(dataText, $input.data(dataText));
					$wm.data(dataClass, $input.data(dataClass));
					$wm.data(dataFlag, 1);
					$wm.attr("maxLength", text.length);
					
					$wm.focus(
						function () {
							$.watermark._hide($wm, true);
						}
					).bind("dragenter",
						function () {
							$.watermark._hide($wm);
						}
					).bind("dragend",
						function () {
							window.setTimeout(function () { $wm.blur(); }, 1);
						}
					);
					$input.blur(
						function () {
							$.watermark._show($input);
						}
					).bind("dragleave",
						function () {
							$.watermark._show($input);
						}
					);
					
					$wm.data(dataPassword, $input);
					$input.data(dataPassword, $wm);
				}
				else {
					
					$input.focus(
						function () {
							$input.data(dataFocus, 1);
							$.watermark._hide($input, true);
						}
					).blur(
						function () {
							$input.data(dataFocus, 0);
							$.watermark._show($input);
						}
					).bind("dragenter",
						function () {
							$.watermark._hide($input);
						}
					).bind("dragleave",
						function () {
							$.watermark._show($input);
						}
					).bind("dragend",
						function () {
							window.setTimeout(function () { $.watermark._show($input); }, 1);
						}
					).bind("drop",
						// Firefox makes this lovely function necessary because the dropped text
						// is merged with the watermark before the drop event is called.
						function (evt) {
							var dropText = evt.originalEvent.dataTransfer.getData("Text");
							
							if ($input.val().replace(dropText, "") === $input.data(dataText)) {
								$input.val(dropText);
							}
							
							$input.focus();
						}
					);
				}
				
				// In order to reliably clear all watermarks before form submission,
				// we need to replace the form's submit function with our own
				// function.  Otherwise watermarks won't be cleared when the form
				// is submitted programmatically.
				if (this.form) {
					var form = this.form,
						$form = $(form);
					
					if (!$form.data(dataFormSubmit)) {
						$form.submit($.watermark.hideAll);
						
						// form.submit exists for all browsers except Google Chrome
						// (see "else" below for explanation)
						if (form.submit) {
							$form.data(dataFormSubmit, form.submit);
							
							form.submit = (function (f, $f) {
								return function () {
									var nativeSubmit = $f.data(dataFormSubmit);
									
									$.watermark.hideAll();
									
									if (nativeSubmit.apply) {
										nativeSubmit.apply(f, Array.prototype.slice.call(arguments));
									}
									else {
										nativeSubmit();
									}
								};
							})(form, $form);
						}
						else {
							$form.data(dataFormSubmit, 1);
							
							// This strangeness is due to the fact that Google Chrome's
							// form.submit function is not visible to JavaScript (identifies
							// as "undefined").  I had to invent a solution here because hours
							// of Googling (ironically) for an answer did not turn up anything
							// useful.  Within my own form.submit function I delete the form's
							// submit function, and then call the non-existent function --
							// which, in the world of Google Chrome, still exists.
							form.submit = (function (f) {
								return function () {
									$.watermark.hideAll();
									delete f.submit;
									f.submit();
								};
							})(form);
						}
					}
				}
			}
			
			$.watermark._show($input);
		}
	).end();
};

// Hijack any functions found in the triggerFns list
if (triggerFns.length) {

	// Wait until DOM is ready before searching
	$(function () {
		var i, name, fn;
	
		for (i=triggerFns.length-1; i>=0; i--) {
			name = triggerFns[i];
			fn = window[name];
			
			if (typeof(fn) === "function") {
				window[name] = (function (origFn) {
					return function () {
						$.watermark.hideAll();
						origFn.apply(null, Array.prototype.slice.call(arguments));
					};
				})(fn);
			}
		}
	});
}

})(jQuery);
/*]]>*/
// <![CDATA[

// Functions to switch the display to a specific engine
function hide(strId) {
    var objCalque = document.getElementById(strId);
    if (objCalque != null)
        objCalque.style.display = "none";
}

function display(strId) {
    var objCalque = document.getElementById(strId);
    if (objCalque != null)
        objCalque.style.display = "block";
}

function display_engine(n) {
    var list = new Array("sea_engine", "spa_engine", "ski_engine", "kvl_engine");
    for (var i = 0; i < list.length; i++)
    {
        if (i == n)
            display(list[i]);
        else
            hide(list[i]);
    }
}

//-----------------------------------------------------------------------
//  Affichage Critère DATE 
//  possibilité d'afficher la date complète JJ/MMAA (cas s==1 + s==2) 
//  ou juste MMAA (cas s==2)
function init_datefrm(dateForm) {
	var objformJJ = document.getElementById("JJ");
	var objformMMAAAA = document.getElementById("MMAAAA");

	// récupération du champs date à afficher dans le formulaire
	var s = dateForm;
	// Initialisation de la date par défaut à aujourd'hui + 15 jours
	DEFAUT_DATE_AVANCE = 15;
	// init jour-mois-année
	today = new Date();
	mois_courant = today.getMonth() + 1; // mois calendaire
	annee_courante = today.getFullYear(); yyyy_courante = new String(annee_courante); yy_courante = yyyy_courante.substr(2, 4);
	today.setDate(today.getDate() + DEFAUT_DATE_AVANCE);
	jour = today.getDay();
	mois = today.getMonth() + 1; // mois par défaut correspondant à date_avance
	annee = today.getFullYear();
	yyyy = new String(annee); yy = yyyy.substr(2, 4); //pour affichage annee format yy

	if (s == 1) { //  mettre jour menu déroulant
		for (var i = 1; i <= 31; i++) {
			objformJJ[i - 1] = new Option(i, i);
			if (i == jour) { objformJJ[i - 1].selected = true; }
		}
	}
	//	
	if (s == 2) { //mettre mois + année menu déroulant

		var moisCodes = new Array("", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12");
		var moisLib = new Array("", "Janv.", "Fév.", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Sept.", "Oct.", "Nov.", "Déc.");

		objformMMAAAA[0] = new Option("Indiff&eacute;rent", "");
		for (var i = mois_courant; i <= 12; i++) // à partir du mois courant, affiche tous les mois de l'année courante
		{      //alert(mois_courant+' <- courant /  + date_avance -> '+mois);
			objformMMAAAA[i - mois_courant] = new Option(moisLib[i] + ' ' + yy_courante, annee_courante + i);
			if (i == mois) { objformMMAAAA[i - mois_courant].selected = true; }
		}
		if ((mois_courant) || (mois) > 9) // à partir du mois d'octobre, affiche les m mois de l'année suivante
		{
			var SelLength = objformMMAAAA.options.length;
			if (annee_courante == annee) { annee += 1; }
			for (var i = 1; i < mois_courant; i++) {
				yyyy = new String(annee); yy = yyyy.substr(2, 4); //pour affichage annee format yy
				objformMMAAAA[i + SelLength - 1] = new Option(moisLib[i] + ' ' + yy, annee + i);
				if (i == mois) { objformMMAAAA[i + SelLength - 1].selected = true; }
			}
		}
	}
}

function init_date(dateForm) {
	// récupération du champs date à afficher dans le formulaire
	var s = dateForm;
	// Initialisation de la date par défaut à aujourd'hui + 15 jours
	DEFAUT_DATE_AVANCE = 15;
	// init jour-mois-année
	today = new Date();
	mois_courant = today.getMonth() + 1; // mois calendaire
	annee_courante = today.getFullYear(); yyyy_courante = new String(annee_courante); yy_courante = yyyy_courante.substr(2, 4);
	today.setDate(today.getDate() + DEFAUT_DATE_AVANCE);
	jour = today.getDate();
	mois = today.getMonth() + 1; // mois par défaut correspondant à date_avance
	annee = today.getFullYear();
	yyyy = new String(annee); yy = yyyy.substr(2, 4); //pour affichage annee format yy

	if (s == 1) { //  mettre jour menu déroulant
		for (var i = 1; i <= 31; i++) {
			document.write('<option value="' + i + '" ');
			if (i == jour) { document.write(' selected="selected"'); }
			document.write('>' + i + '</option>');
		}
	}
	//	
	if (s == 2) { //mettre mois + année menu déroulant

		var moisCodes = new Array("", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12");
		var moisLib = new Array("", "Janv.", "F&eacute;v.", "Mars", "Avril", "Mai", "Juin", "Juillet", "Ao&ucirc;t", "Sept.", "Oct.", "Nov.", "Déc.");

		document.write('<option value="">Indiff&eacute;rent</option>');
		for (var i = mois_courant; i <= 12; i++) // à partir du mois courant, affiche tous les mois de l'année courante
		{      //alert(mois_courant+' <- courant /  + date_avance -> '+mois);
			document.write('<option value="' + annee_courante + i + '"');
			if (i == mois) { document.write(' selected '); }
			document.write('>' + moisLib[i] + '&nbsp;' + yy_courante + '</option>');
		}
		if ((mois_courant) || (mois) > 9) // à partir du mois d'octobre, affiche les m mois de l'année suivante
		{
			if (annee_courante == annee) { annee += 1; }
			for (var i = 1; i < mois_courant; i++) {
				document.write('<option value="' + annee + i + '"');
				if (i == mois) { document.write(' selected="selected"'); }
				yyyy = new String(annee); yy = yyyy.substr(2, 4); //pour affichage annee format yy
				document.write('>' + moisLib[i] + '&nbsp;' + yy + '</option>');
			}
		}
	}
}

//-----------------------------------------------------------------------
//  Submit Button 
function rechercher(objform) {
	// Traitement de la recherche en fonction de la provenance 
	objform = document.forms[objform];
	urlPart = objform.urlpart.value;
	//--- url de redirection à Paramètrer ici
	urlForm = "http://" + urlPart + "";
	//   
	today = new Date();
	mois_courant = today.getMonth() + 1;
	// date saisie
	yyyy = objform.MMAAAA.value;
	JOUR = objform.JJ.value;
	MOIS = yyyy.substr(4, 2);
	ANNEE = yyyy.substr(0, 4);
	//   
	VILLEDEPART = objform.VILLEDEPART.value;
	DEST = objform.PAYS.value;
	THEME = objform.THEME.value;
	//   
	var bool = checkDate(JOUR, MOIS, ANNEE); /* Contrôler la date demandée */

	if (bool == 1) {
		/*--- Debut: ajout ---*/
		if (objform.nom_page) {
			nom_page = objform.nom_page.value;
		} else {
			nom_page = 'recherche.htm';
		}

		if (JOUR == "31" && MOIS * 1 != mois_courant) {
			JOUR = "30";
		}

		if (objform.site) {
			site = objform.site.value;
		} else {
			site = "";
		}
		if (objform.BUDMAX) {
			budget = objform.BUDMAX.value;
			arrbudget = budget.split(" - ");
			BUDMAX = arrbudget[0];
			BUDMIN = arrbudget[1];
		} else {
			BUDMAX = "9999999";
			BUDMIN = "0";
		}

		if (objform.DELTA) {
			DELTA = objform.DELTA.value;
		} else {
			DELTA = 4;
		}
		urlForm = urlForm + "/" + nom_page + "?pays=" + escape(DEST) + "&budmax=" + BUDMAX + "&budmin=" + BUDMIN + "&theme=" + THEME + "&mois=" + MOIS + "&site=" + site + "&jj=" + JOUR + "&mm=" + (MOIS < 10 ? "0" + MOIS : MOIS) + "&aaaa=" + ANNEE + "&delta=" + DELTA + "&villedepart=" + escape(VILLEDEPART);
		if (self.parent != null) {
			if (self.parent.location != null) {
				self.parent.location.href = urlForm + "&PMV_RECH_MOTEURpg=1";
			}
		} else if (top.location != null) {
			top.location = urlForm + "&PMV_RECH_MOTEURpg=1";
		} else {
			document.location = urlForm + "&PMV_RECH_MOTEURpg=1";
		}
		/*--- Fin: ajout ---*/

	} else {
		alert("Attention, la date demandée est antérieure à la date du jour !");
	}

}

function checkDate(J, M, A) {
	// Contrôle de la date choisie
	bool = 1;
	// init jour-mois-année
	today = new Date();
	mois_courant = today.getMonth() + 1; // mois calendaire
	annee_courante = today.getFullYear();
	jour = today.getDate();

	//alert(A+"-"+M+"-"+J); alert(annee_courante+"-"+mois_courant+"-"+jour);

	if (annee_courante == A) {
		if (M <= mois_courant) {
			if (J < jour) { bool = 0; }
		}
	}

	return bool;
}

function valide_form() {
	var form = document.form1;

	if (form.VILLEDEPART.value == "") {
		alert("Vous n\'avez pas précisé la ville de départ");
		return false;
	}
	if (form.PAYS.value == "0") {
		alert("Vous n\'avez pas précisé la destination");
		return false;
	}
	if (form.THEME.value == "0") {
		alert("Vous n\'avez pas précisé la durée du séjour");
		return false;
	}
	if (form.BUDMAX.value == "") {
		alert("Vous n\'avez pas précisé le budget");
		return false;
	}
	return true;
}

// ]]>

/*<![CDATA[ */
var _gaq = _gaq || [];

_gaq.push(['_setAccount', 'UA-6576364-1']);
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_setAllowHash', false]);
_gaq.push(['_trackPageview']);
_gaq.push(['_link()']);
_gaq.push(['_linkByPost()']);

(function()
{
	var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
	ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
	(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
})();
/*]]>*/

if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();