//Initialisation des variables
if(!NOV) {var NOV = {};}
var newWin = null;
//Initialisation des variables
if(!nov_initCalendar){
	var nov_initCalendar = null;
}
if(!nov_initLang){
	var nov_initLang = null;
}
var IS_IE = document.all && window.print && !window.opera && ( !document.compatMode || /MSIE/.test(navigator.userAgent) || (document.compatMode && document.compatMode=="BackCompat"));
var IS_IE6 = document.all && window.print && !window.opera && ( !document.compatMode || /MSIE 6/.test(navigator.userAgent) || (document.compatMode && document.compatMode=="BackCompat"));
var heightPropertyToUse = IS_IE6 ? "height" : "minHeight"; //variable utilisee pour l'alignement en hauteur des elements.
var IS_quirks = IS_IE6 && document.compatMode && document.compatMode=="BackCompat"; // variable qui declare le quirksmode seulement utile pour IE
var IS_Webkit = /Konqueror|Safari|KHTML/.test(navigator.userAgent);

//Debut NOV.display.js
//Initialisation des variables
var CSSBottomCorners			= []; //array pouvant contenir les coins absolu positionnes en bottom
var currentBlockToFixCorners	= null; //variable gloable utilisee lorsqu'on veux fixer les coins sur un seul bloc
var currentBlockToFixCorners	= null;
var linesOfBlocks				= [];

NOV.display = {
	//retournement des listes d'items sur trois colonnes
	returnLists : function() {
		if (document.getElementsByClassName('list3cols').length == 0) return;
		//correction pour FF3
		//document.getElementsByClassName('list3cols').each(function(el,i){
		if($('main')){
			$('main').select('ul.list3cols').each(function(el,i){
				var lis = el.getElementsBySelector("li");
				var li = new Array(); 
				var li_result = new Array();
				var li_inner= new Array();
				var length1, length2, length3;
				var length = Math.floor(lis.length / 3);
				var modulo = lis.length % 3;
				length1 = length;
				length2 = length;
				if (modulo == 1) {
					length1++;
				}
				if (modulo == 2) {
					length1++;
					length2++;
				}
				li[0] = lis.slice(0, length1);
				li[1] = lis.slice(length1, length1 + length2);
				li[2] = lis.slice(length1 + length2);
				
				for (var ind = 0; ind < lis.length; ind++) {
					li_result[ind] = li[(ind%3)][Math.floor(ind/3)];
					li_inner[ind] = li_result[ind].innerHTML; // buffer
				}
				for (var ind = 0; ind < lis.length; ind++) {
					lis[ind].innerHTML = li_inner[ind];
					if ((ind%3) == 0) {
						$(lis[ind]).addClassName("clear");
					}
				}
			});
		}
	},
	
	// getStyle : retourne la valeur d'une propriete CSS appliquee a un element
	getStyle : function(oElm, strCssRule){
		var strValue = "";
		if(document.defaultView && document.defaultView.getComputedStyle) {
			try{ 
				strValue = document.defaultView.getComputedStyle(oElm, null).getPropertyValue(strCssRule); 
			}
			catch(e) { strValue = ""; }
		}
		else if(oElm.currentStyle) {
			try{
				strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
					return p1.toUpperCase();
				});
				strValue = oElm.currentStyle[strCssRule];
			} catch(e) {
				strValue = "";
			}
		}
		return strValue;
	},
	
	// retourne la valeur entiere d'un style
	intStyle : function(oElm, strCSSRule) {
		var val = parseInt(this.getStyle(oElm, strCSSRule));
		if (isNaN(val)) val=0;
		return val;
	},

	// retourne la somme de tous les styles verticaux appliques (border-width+padding)
	getVStyles : function(elm) {
		return IS_quirks ? 0 : this.intStyle(elm, "border-top-width")+this.intStyle(elm, "border-bottom-width")+this.intStyle(elm, "padding-top")+this.intStyle(elm, "padding-bottom");
	},
	
	cssRight : function(elm) {
		if (!IS_IE6) {
			elm.style.right = elm.currentStyle.right || "auto";
			return;
		}
		if (elm.currentStyle.right!="auto") {
			elm.style.right = (parseInt(elm.currentStyle.right)-(elm.parentNode.offsetWidth%2))+"px";
		} else {
			elm.style.right = "auto";
		}
	},
	
	cssBottom : function(elm, pushElement) {
		if (!IS_IE6) {
			elm.style.bottom = elm.currentStyle.bottom || "auto";
			return;
		}
		if (pushElement && !elm.CSSBottomAlreadyCSS) {
			CSSBottomCorners.push(elm);
			elm.CSSBottomAlreadyCSS=true;
		}
		if (elm.currentStyle.bottom!="auto") {
			elm.style.bottom = (parseInt(elm.currentStyle.bottom)-(elm.parentNode.offsetHeight%2))+"px";
		} else {
			elm.style.bottom = "auto";
		}
	},
	
	fixCorners : function(block) {
		if (window.event) { // correction coins arrondis hack culte
			setTimeout(function() {
				$$('b[class*=content]').each(function(corner){
					corner.style.zoom = 1;
					setTimeout(function() {corner.style.zoom = 0;}, 10);
				});
			},10);
		}
		if (IS_IE6) {
			for (var i=CSSBottomCorners.length-1; i>-1; --i) {
				CSSBottomCorners[i].style.bottom="";
			}
		} else {
			if (IS_Webkit || /Gecko\/200[56]|Opera 8.5/i.test(navigator.userAgent)) this.fixCornersOnBlocks(block);
		}
	},
	
	fixCornersOnBlocks : function(block) {
		currentBlockToFixCorners = block || document.body;
		currentBlockToFixCorners.className+=" hidecorners";
		setTimeout(this.fixCornersOnBlocksShowCorners,5);
	},
	
	fixCornersOnBlocksShowCorners : function() {
		if (currentBlockToFixCorners) currentBlockToFixCorners.className=currentBlockToFixCorners.className.replace(/\bhidecorners\b/g,"");
		currentBlockToFixCorners=null;
	},
	
	//initOtherBlocks(block) : fonction rajoute d'autres fonctionnalites sur differents blocks  (toggle, onglets),
	//Cette fonction est forcement lancee depuis generateStyleElements, et cela evite de faire une deuxieme passe sur les divs de la page
	initBlocksFunctionnalities : function(x) {
		if (x.className.match(/\bline\b/)) //si ligne de block, on la stocke dans un tableau
			linesOfBlocks.push(x);
		if (x.className.indexOf("block-toggle")!=-1)
			NOV.tools.toggleBlock.init(x);
		if (x.className.match(/\bblockTabs/)) 
			NOV.tools.manageTabs.init(x);
	},
	
	// addHover :
	// Cette fonction ajoute le fonctionnement de la pseudo classe hover en CSS, et seulement pour IE
	// Elle se base sur les evenement propres a IE qui sont les evenements qui ont le comportement le plus proche du :hover en CSS.
	// Pour utiliser cette fonction il faut le faire en CSS, on peut en plus ajouter en parametre la classe CSS qui sera ajoutee en CSS
	// ex :
	//   #menu ul li {behavior:expression(addHover(this))}
	//   #menu ul li {behavior:expression(addHover(this, "maclassehover"))}
	//   Afin de ne pas prendre en compte IE7 en mode strict il suffit de placer la classe .IS_IE avant, cette classe est ajoutee pendant le chargement de la page.
	//   .IS_IE #menu ul li {behavior:expression(addHover(this))}
		   
	addHover :function(elm, className, iframeTag) {
		className = className || "hover";
		elm.style.behavior = "   "; //reecriture du style behavior
		if (!IS_IE6) return;
		elm.hoverClassName = className;
		if (iframeTag) {
			elm.iframeElm = getNode(elm, iframeTag);
			
		}
		elm.onmouseenter = function() {
		   this.className+= ' ' + this.hoverClassName;
		   if (this.iframeElm) NOV.ifrlayer.make(this.iframeElm);
		}
		elm.onmouseleave = function() {
		   this.className = this.className.replace(new RegExp("\\b" + this.hoverClassName + "\\b", "g"),"");
		   if (this.iframeElm) NOV.ifrlayer.hide(this.iframeElm);
		}
	},
	
	centerPage : function() {
		//if (!$('conteneur_page') || IS_IE || document.location.hostname.match(/accorthalassa/)) return;
		if (!$('conteneur_page') || document.location.hostname.match(/accorthalassa/)) return;
		var ctnGlobal = document.createElement('DIV');
		ctnGlobal.id = 'ctn_global';
		$('conteneur_page').wrap(ctnGlobal);
	},
	
	fix :function() {
		var colonnes = ['side-menu','side','popsit-left','popsit-middle','popsit-right'],
			colonnesInside = ["", ""];
		var hMax=0, vStyle, i, b, minMax=0, sum=0; var hToU = heightPropertyToUse;
		
		colonnes.each(function(id){
			id = $(id);
			if(id) {
				hMax = id.offsetHeight + NOV.display.getVStyles(id);
				if (hMax > minMax) {
					minMax = hMax;
					vStyle = NOV.display.getVStyles(id);
				}
			}
		});
		colonnes.each(function(id){
			id = $(id);
			if (id) id.setStyle({minHeight:minMax+vStyle-NOV.display.getVStyles(id)+'px',_height:minMax+vStyle-NOV.display.getVStyles(id)+'px'});
		});
		NOV.display.fixCorners();
	},
	
	fixColumns :function() {
		setTimeout(this.fix,1);
	},
	
	//recupere un node avec la class block_insideParDefaut
	getIsd : function(node, className) { 
		return getNode(node, {className: (className || "block_inside")});
	},
	
	// fonction de creation d'un coin (b avec className) 
	nc : function(clN) {
		var b = document.createElement("b");
		b.className=clN;return b;
	},
	
	//ajoute un element ou une liste d'elements (c) sur l'element x
	add : function(x, c) {
		var i=0; if (!x) return; 
		if (c.length) for (i=0; i<c.length; i++) x.appendChild(c[i].cloneNode(true));
		else x.appendChild(c.cloneNode(true));
	},
	
	// initialisation des divs dans la page 
	// + ajout fonctionnalite et ?ments de d?ration 
	generateStyleElements : function(parent, stringClasses) {
		var i, x;
		parent = (typeof parent == "string") ? $(parent) : parent;
		var content = parent || document.body;
		var nodes = content.getElementsByTagName("div");
		nodes = $A(nodes).concat($A(document.getElementsByTagName("ul")));
		
		//-- creation des elements qui seronts clones --
		var corners = [this.nc("tl"), this.nc("tr"), this.nc("bl"), this.nc("br")]; //corners 
		var cornersLeft = [this.nc("tl"), this.nc("bl")]; //corners 
		var cornersRight = [this.nc("tr"), this.nc("br")]; //corners 
		var overtl = this.nc("overtl"); // overtl : coin arrodis supplementaire pour les blocks avec des bordures speciales
		var slTopLeft = this.nc("tLeft"); this.add(slTopLeft, this.nc("tRight"));
		var slBottomLeft = this.nc("bLeft"); this.add(slBottomLeft, this.nc("bRight"));
		
		// -- creation des coins ou autres elements -- 
		// parcours des divs pour leur rajouter les corners
		for (i=nodes.length-1; i>=0; i--) {
			x=nodes[i];
			if (!x.alreadyProcessed) {
				if (x.className.match(/\bblock-(simple|filled)\b/)) this.add(x, corners);
				if (x.className.match(/\bblock-complex\b/)) {
					first = x.firstChild;
					while(first.nodeType==3){
						first = first.nextSibling;
					};
					x.insertBefore(slTopLeft.cloneNode(true),first);
					this.add(x, slBottomLeft);
				}
				if (x.className.match(/\bblockTabs\b/)) this.add(this.getIsd(x, 'blockInside'), corners);
				if (x.id=="content") this.add(x, [this.nc("content-tl"), this.nc("content-tr"), this.nc("content-bl"), this.nc("content-br")]);
				if (x.id=="main-inside") this.add(x, [this.nc("main-tl"), this.nc("main-tr"), this.nc("main-bl"), this.nc("main-br")]);
				if (x.id=="main-site") this.add(x, [this.nc("std-block-bl"), this.nc("std-block-br")]);
				x.alreadyProcessed = true;	
				this.initBlocksFunctionnalities(x); // fonction d'initialisation d'autres blocks
			}
		}
		var li = document.getElementsByTagName('li');
		for (var i=0; i<li.length; i++) {
			var x = li[i];
			if (x.id=="std-block-left") {this.add(x, [this.nc("std-block-tl"),  this.nc("std-block-bl")]);}
			if (x.id=="std-block-right") {this.add(x, [this.nc("std-block-tr"), this.nc("std-block-br")]);}
			if (x.className.match(/\b(menu-current)\b/)) {this.add(x, [this.nc("menu-current-tr"), this.nc("menu-current-br")]);}
		}
		var ul = document.getElementsByTagName('ul');
		for (var i=0; i<ul.length; i++) {
			this.initBlocksFunctionnalities(ul[i]);
		}
	},
	
	size : function(block, size){
		if (block){
			var body = block; //block.className.match(/\bblock\b/) ? getNode(block, {nodeName:"div", className:"body"}) : block; //si on a une line ou bien un block
			if (body) body.style[heightPropertyToUse] = body.offsetHeight + size - this.getVStyles(body) + "px";
		}
	},
	
	sizeBlocks : function(parentBlock) {
		linesOfBlocks.eachInv(function (line) { //les lignes fournies sont
			var units = getChildNodes(line, {className:"unit"});
			units.each(function(unit) {
				var blocks = getChildNodes(unit, {className:"(block|line)"}, {className:"noresize"});
				var sizeToApply = line.offsetHeight-unit.offsetHeight;
				var sizePerBlock = parseInt(sizeToApply/blocks.length);
				blocks.each(function(block) {
					NOV.display.size(block, sizePerBlock);
				});
				//sur une division on tombe parfois sur un calcul pas precis, on resize le dernier element d'un unit, afin que le calcul soit correct
				//if (blocks.length>1) size(blocks.getLast(), line.offsetHeight-unit.offsetHeight);
				// Si ca ne fonctionne pas, appeller arnaud gueras, le nain malin
			});
		});
	}

}

/*  ifrlayer : 
	Cette fonction corrige un probleme sous IE6 lorsqu'un layer passe par dessus un select, le select sera toujours au dessus. Pour corriger ce probl&egrave;me.
	ex : 	
		- afficher un bloc : 
			myBlock.style.display='block';
			NOV.ifrlayer.make(myBlock); //genere ou affiche l'iframe
		- cacher un bloc :
			myBlock.style.display='none';
			NOV.ifrlayer.hide(myBlock); //cache l'iframe associee au bloc
		-deplacer un bloc : 
			myBlock.style.left = "100px";
			NOV.ifrlayer.move(myBlock); // deplace l'iframe associee au bloc
*/
NOV.ifrlayer = {
	ie : document.all && window.print && !window.opera && $,
	$ : function(obj) { 
		if (!obj) return null;
		return (typeof(obj)=="string") ? $(obj) : obj; 
	},
	
    make:function(obj) {
		obj = this.$(obj); if(!obj) return;
		if(this.ie) {
			if (!obj.iframelayer) {
				var ifr = document.createElement('iframe')
	            ifr.src = "javascript:false";
				obj.parentNode.insertBefore(ifr, obj);
				obj.iframelayer = ifr;
				ifr.style.filter = "mask()";
                ifr.style.position = "absolute";
				if(obj.currentStyle.zIndex != "" && parseInt(obj.currentStyle.zIndex)>1 ) {
					ifr.style.zIndex = parseInt(obj.currentStyle.zIndex)-1;
				}
			}
			var ifr = obj.iframelayer;
			obj.iframelayer.style.visibility = "visible";
            NOV.ifrlayer.move(obj,true);
        }
    },
	
    hide:function(obj){
		obj = this.$(obj); if(!obj) return;
         if(obj.iframelayer) {
            obj.iframelayer.style.visibility="hidden";
        }
    },
	
    kill:function(obj){
        obj = this.$(obj); if(!obj) return;
        if(obj.iframelayer) {
            obj.iframelayer.parentNode.removeChild(obj.iframelayer);
			obj.iframelayer = null;
        }
    },
	
    move:function(obj, size) {
		obj = this.$(obj);
        if(obj && obj.iframelayer) {
            with(obj.iframelayer.style) {
                top = obj.offsetTop+"px";
                left = obj.offsetLeft+"px";
                if (size) {
                    width  =  obj.offsetWidth+"px";
                    height =  obj.offsetHeight+"px";
                }
            }
        }
    }
}
// Fin nov_display.js

//Debut nov_flash.js
//Initialisation des variables

NOV.flash = {

	correspondingArray : {HO:0,RO:1,BA:2,RS:2,SL:3,FA:4,IN:5,SP:5,SO:6,SM:6,WD:0,DE:9,AC:10},
	
	init : function() {
		initier = this;
		RID = NOV.tools.getMeta("X-Accor-rid");
		MEDIATYPE = NOV.tools.getMeta("X-Accor-mediatype");
		if (MEDIATYPE=="") MEDIATYPE="HO"; // valeur par d?ut
		LNG  = NOV.flash.getLang(); // (fr,  en , de ...) correspond ?a norme ISO
		window.lng = IMG_PATH = ("en"==LNG)?"gb":LNG; // (fr, gb ,de ...) correspond ?'arborescence ACCOR       
		if($("flash-container-fh")) NOV.flash.startFH();
		if($("flash-container-h")) NOV.flash.startH();	
		if($("flash-container-dn")) NOV.flash.startDN();
		if($("flash-container-family")) NOV.flash.startFamily();
		if($("flash-container-specialoffer")) NOV.flash.startSpecialoffer();
		if($("flash-container-weekend")) NOV.flash.startWE();
		if($("flash-container-geo")) NOV.flash.startGeo();
		if($("flash-container-map_uk")) NOV.flash.startMapUk();
	},
	
	getLang : function() {
		var html = document.documentElement;
		var ln = '';
		if (html.getAttribute("xml:lang")) {
			 ln =  html.getAttribute("xml:lang");
		}
		else {
			if (html.getAttribute("lang")) {	ln =  html.getAttribute("lang") }
			else { ln =  "en"; }
		}
		return ln;
	},
	
	startH : function() {
		var so = new SWFObject("/flash/home/split25.swf", "flashMovie","100%", "100%", "8", "#ffffff");
		so.addParam("wmode", "transparent");
		so.addParam("quality", "high");
		so.addVariable("LANG", IMG_PATH);
		so.addVariable("LNG", IMG_PATH);
		so.addVariable("XMLfile", "/geoloc/geoloc.cgi?file=/"+IMG_PATH+"/home/banner/banner.xml");
		so.write("flash-container-h"); // OK
	},	
	
	startFH : function() {
		var so = new SWFObject("/flash/fh/ficheHotel.swf", "split25", "100%", "100%", "8", "#FFFFFF");
		so.addParam('wmode','transparent');
		so.addVariable("URL_XMLhotel", "/fichehotel/xml/"+RID+"_"+LNG+".xml"); // addresse du fichier xml de l'hotel g?r?ar le moteur
		so.addVariable("URL_XMLfile","/flash/fh/xml/texte_"+IMG_PATH+".xml"); // addresse du fichier 	xml de trad	
		so.addVariable("URL_PIC", "/photos/"); // addresse du fichier xml
		so.addVariable("Default", MEDIATYPE); // vignette affich par d?ut
		so.addVariable("LANG", IMG_PATH);
		var blueHeader = 	document.documentElement.className.match('external') ? "false" : "true";
		so.addVariable("blueHeader", blueHeader); // visibilit?u	bandeau bleu : true or false
		so.write("flash-container-fh");  // OK
	},

	startDN : function() {
		var so = new SWFObject("/flash/discover/landing.swf", "myMovie", "100%", "100%", "9", "#ffffff");
		so.addParam("wmode", "transparent");
		so.addParam("quality", "high");
		so.addVariable("XMLfile", "/"+IMG_PATH+"/xml/discover/pathVideoLandingPage.xml");
		so.write("flash-container-dn"); // OK mais flash a localiser donc dans /lang/
		
	},

	startWE : function() {
		var so = new SWFObject("/flash/weekend/carteV1.swf", "myweekend", "100%", "100%", "9", "#ffffff");
		so.addParam("wmode", "transparent");
		so.addParam("quality", "high");
		so.addVariable("XMLfile", "/"+IMG_PATH+"/xml/weekend/listHotel.xml");
		so.write("flash-container-weekend"); // OK
	},

	startFamily : function() {
		var so = new SWFObject("/flash/family/family.swf", "family", "100%", "100%", "9", "#ffffff");
		so.addParam("wmode", "transparent");
		so.addParam("quality", "high");
		so.addVariable("XMLfile", "/"+IMG_PATH+"/xml/family/family.xml");
		so.addVariable("LANG", IMG_PATH);
		so.write("flash-container-family");  // attente SWF
	},
  
	startSpecialoffer : function() {
		var so = new SWFObject("/"+IMG_PATH+"/flash/family/bolt.swf", "special", "229", "350", "9", "#ffffff");
		so.addParam("quality", "high");
        so.addParam("scale", "noscale");
        so.addParam("wmode", "transparent");
		so.addVariable("LANG", IMG_PATH);
		so.write("flash-container-specialoffer");  // attente SWF
	},
	
     startGeo : function() {
        var so = new SWFObject("/flash/rechgeo/rechlabel_nov.swf", "cartoLabel", "716", "308", "6", "#6E1940");
        so.addVariable("marque_var", "NOV");
        so.addVariable("langue", LNG);
        so.addVariable("label", "ALL");
        so.addVariable("webApp", "novotel");
        so.addParam("allowScriptAccess", "always");
        so.addParam("quality", "high");
        so.addParam("scale", "noscale");
        so.addParam("wmode", "transparent");
        so.write("flash-container-geo");
    },
	
	startMapUk : function() {
		var so = new SWFObject("/flash/hotel-deals/special-offers/uk.swf", "uk", "227", "450", "8", "");
		so.addParam("quality", "high");
		so.addParam("wmode", "transparent"); 
		so.addParam("menu", "false");  
		so.write("flash-container-map_uk"); 
	},
	
	popup: function (){
		//window.open("./galerie_flash.shtml","gallery","menubar=no, status=no, scrollbars=no, resizable=yes, top=200, left=250, width=619,height=530");
		NOV.flashLayer.init();
		NOV.flashLayer.open();
	},
	
	//initialise l'observe sur les inputs du formulaire de recherche par carte
	initUpdate : function(){
        if (!$("formGeo")) {return;}
        var elements = $("formGeo").down('input');
        for(var i=0; i<elements.length; i++){
            if(elements[i].type == "radio")
                if(elements[i].id == 'all') elements[i].checked = true;
                $(elements[i]).observe('click', this.rewriteSwfObject);
        }
    },
    
	// gestion de la recherche par carte pour recharger la carte selon les params passes.
    rewriteSwfObject : function(event){
        var input = event.element();
		var so = new SWFObject("/flash/rechgeo/rechlabel_nov.swf", "cartoLabel", "716", "308", "6", "#6E1940");
        so.addVariable("marque_var", "NOV");
        so.addVariable("langue", LNG);
        so.addVariable("label", input.id.toUpperCase());
        so.addVariable("webApp", "novotel");
        so.addParam("allowScriptAccess", "always");
        so.addParam("quality", "high");
        so.addParam("scale", "noscale");
        so.addParam("wmode", "transparent");
        so.write("flash-container-geo");
    }
}

//fonction lie aux Flashs
function openpopup (){
	NOV.flash.popup();
}
//Fin nov_flash.js

//Debut nov_moteur.js
var formControl = {
	cityInput : null,
	cityInputValue : null,
	bEngine : null,
	dest : null,
    
	init : function() {
		formControl.bEngine = $('bookingEngine');
		
 		if ($('hotel_ou_ville') || $('hotel_ville')) formControl.initMotorHome(); 
        if ($('destination')) formControl.controlResaRadios($('destination'));
		if ($('zone-recherche')) {
			var zr = $('zone-recherche');
		}
	},

	initMotorHome : function() {
		formControl.cityInput = $('hotel_ou_ville');
		if($('hotel_ou_ville').readAttribute('type') == 'hidden'){
			formControl.cityInputValue = '';
		}
		else{
			formControl.cityInputValue = $('hotel_ou_ville').value;
		}
		
		formControl.inputValue(formControl.cityInput);
		Event.observe(document, "keypress",  function(event) { 
		if    (event.keyCode==13) {	formControl.checkMotors();};
    });
		Event.observe($('submitter'), 'click', function(){formControl.checkMotors();});
	}, 
	
	checkMotorsCallback : function(){return true;},
	checkMotors : function() {
	
		var isValid = false;
		var errBox = $('errorMessage');
		if (!formControl.cityInput && !$('hotel_ville')) return;
		if (formControl.cityInput){
			formControl.dest = $F(formControl.cityInput.id);
			switch(formControl.dest) {
				case "":
				case null:
				case formControl.cityInputValue:
					
					formControl.cityInput.value = "";
					errBox.style.display = "block";
					errBox.style.left = formControl.cityInput.offsetLeft+"px";
					errBox.style.top = formControl.cityInput.offsetTop+"px";
					NOV.ifrlayer.make(errBox);
					errBox.onclick = function() {
					    this.style.display = "none";
					    NOV.ifrlayer.kill(this);
					};
					break;
				default:
					isValid = this.checkMotorsCallback();
					break;
			}
		}
		else if ($('hotel_ville')){
			if ((codeHotel = formControl.getPos('rid')) != ""){
				formControl.dest = $('hotel_ville').value;
				$('hotel_ville').value=codeHotel;
				isValid = true;
			}
		}
		if (isValid){formControl.moteurSubmit();}
	},

	inputValue : function(elm) {
		elm.oldValue=elm.value;
		elm.onfocus=function() {
			if (!this.isChecking && this.value==this.oldValue) this.value='';			
		}
		elm.onblur=function() {
			if(this.value=='') this.value=this.oldValue;
		}
	},
	
	moteurSubmit : function (elm){
		if ($('checkboxContrat') && $('checkboxContrat').checked){
			window.location="http://www.accorhotels.com/lien_externe.svlt?goto=societe"
			+ "&hotelOuVille="+ formControl.dest
			+ "&jour_arrivee="+ $('jour_arrivee').value
			+ "&mois_arrivee="+ $('mois_arrivee').value
			+ "&annee_arrivee="+ $('annee_arrivee').value
			+ "&nb_nuit="+ $('nb_nuit').value
			+ "&code_chaine=NOV";
		}
		else formControl.bEngine.submit();
	},
	
	getPos : function(p) {                                    
		var params = location.hash.substring(1).split("&");                               
		for (var i=0;i<params.length;i++) {                      
			var pos = params[i].indexOf("=");                      
			if (pos != -1 && p==params[i].substring(0,pos))        
				return params[i].substring(pos+1);                
		}                                                        
		return '';
	},
	
	controlResaRadios: function(elm) {
		var inputs = elm.getElementsByTagName('input');
		var prev = null;
		for (var i=0;i<inputs.length;i++) {
			if (inputs[i].name == "destination") {
				inputs[i].onclick = function() {
					if (this.getAttribute('saveCheck')=='check' && this == prev) {
						this.checked = false;
						formControl.cityInput.value = "";
						this.setAttribute('saveCheck','');
					} else if (this.getAttribute('saveCheck')!='check' && this == prev) {
						this.checked = true;
						formControl.cityInput.value = this.value;
						this.setAttribute('saveCheck','check');
					} else if (this.getAttribute('saveCheck')=='check' && this != prev) {
						this.checked = false;
						formControl.cityInput.value = "";
						this.setAttribute('saveCheck','');
						prev = this;
					} else if (this.getAttribute('saveCheck')!='check' && this != prev) {
						this.checked = true;
						formControl.cityInput.value = this.value;
						this.setAttribute('saveCheck','check');
						if (prev) prev.setAttribute('saveCheck','');
						prev = this;
					}
				}
			}
		}
	}
}

//Debut NOV.tooltip.js
// Tooltip Object
var Tooltip = Class.create({
	initialize: function(el, options) {
		this.el = $(el);
		this.initialized = false;
		this.setOptions(options);
		
		// Event handlers
		this.showEvent = this.show.bindAsEventListener(this);
		this.hideEvent = this.hide.bindAsEventListener(this);
		this.updateEvent = this.update.bindAsEventListener(this);
		Event.observe(this.el, "mouseover", this.showEvent );
		Event.observe(this.el, "mouseout", this.hideEvent );
		
		// Removing title from DOM element to avoid showing it
		this.content = this.el.title;
		this.el.title = "";

		// If descendant elements has 'alt' attribute defined, clear it
		this.el.descendants().each(function(el){
			if(Element.readAttribute(el, 'alt'))
				el.alt = "";
		});
	},
	setOptions: function(options) {
		this.options = {
			backgroundColor: '', // Default background color (use CSS value)
			borderColor: '', // Default border color (use CSS value)
			textColor: '', // Default text color (use CSS value)
			textShadowColor: '', // Default text shadow color (use CSS value)
			maxWidth: 250,	// Default tooltip width
			align: "left", // Default align
			delay: 250, // Default delay before tooltip appears in ms
			mouseFollow: true, // Tooltips follows the mouse moving
			opacity: .75, // Default tooltips opacity
			appearDuration: .10, // Default appear duration in sec
			hideDuration: .10 // Default disappear duration in sec
		};
		Object.extend(this.options, options || {});
	},
	show: function(e) {
		/*this.xCord = Event.pointerX(e);
		this.yCord = Event.pointerY(e);*/
		this.xCord = Position.cumulativeOffset(this.el)[0];
		this.yCord = Position.cumulativeOffset(this.el)[1];
		if(!this.initialized) {
			var that = this;
			//this.timeout = window.setTimeout(function(){that.appear(that)}, that.options.delay); // c est cette ligne qui cr la loop infinie
			that.appear(that);
		}
	},
	hide: function(e) {
		if(this.initialized) {
			document.body.removeChild(document.body.childNodes[0]);

		}
		this._clearTimeout(this.timeout);
		
		this.initialized = false;
	},
	update: function(e){
		this.xCord = Event.pointerX(e);
		this.yCord = Event.pointerY(e);
		this.setup();
	},
	appear: function(that) {
		// Building tooltip container
		/* that.tooltip = Builder.node("div", {className: "tooltip", style: "display: none;" }, [
			Builder.node("div", {className: "xboxcontent"}, this.content),
		]); */
		divTooltip = document.createElement('div');
		divTooltip.className = 'tooltip';
		//divTooltip.setStyle({display:'none'});
		divXBox = document.createElement('div');
		divXBox.className = 'xboxcontent';
		divXBox.innerHTML = that.content;
		divTooltip.appendChild(divXBox);
		document.body.insertBefore(divTooltip, document.body.childNodes[0]);
		
		Element.extend(divTooltip); // IE needs element to be manually extended
		that.options.width = divTooltip.getWidth();
		divTooltip.style.width = that.options.width + 'px'; // IE7 needs width to be defined
		that.tooltip = divTooltip;
		divTooltip.style.left = that.xCord - divTooltip.getWidth() + 8 + "px";
		divTooltip.style.top = that.yCord - that.el.getHeight() +"px";
		
		if(that.options.mouseFollow)
			Event.observe(that.el, "mousemove", that.updateEvent);
			
		that.initialized = true;
		//that.appearingFX = new Effect.Appear(divTooltip, {duration: that.options.appearDuration, to: that.options.opacity });
	},
	setup: function(){	
		this.tooltip.style.left = this.xCord - this.tooltip.getWidth() + 8 + "px";
		this.tooltip.style.top = this.yCord - this.el.getHeight() + 4 + "px";
	},
	_clearTimeout: function(timer) {
		clearTimeout(timer);
		clearInterval(timer);
		return null;
	}
});

function addToolTips() {
	$$('a.tip').each(function(element){
		new Tooltip(element, {opacity:1, delay:50, mouseFollow: false});
		
	});	
}
//Fin NOV.tooltip.js

//Ecriture des classes
var hotelsHistory = Class.create();
hotelsHistory.prototype = {
	initialize : function(key,value) {
		this.maxDays = 21;
		this.maxListSize = 5;
		this.cookieString = this.readCookie("hotelsHistory") || "";
		this.data = this.unserialize(this.cookieString).findAll(this.isNotEmpty);
		this.list = this.constrain(this.data,this.maxListSize);
	},
	
	
	//@name : saveCurrentPage
	//@description : Add the entry to the list if it's not already in it.
	//@param : <key> The name of the page
	//@param : <value> The url of the page
	saveCurrentPage : function(title,url) {
		if(this.isACurrentEntry(url) == false) {
			this.list.append({'key':title,'value':url});
			this.writeCookie("hotelsHistory",this.serialize(this.list),this.maxDays);
		}
	},
	
	//@name : isNotEmpty
	//@description : Verify that the entry is not undefined, this might occur when the cookie is empty. Used as filter.
	//@param : <entry> Entry bound by the filter method.
	//@return : Boolean
	isNotEmpty : function(entry) {
		return entry.value != undefined;
	},
	
	//@name : isACurrentEntry
	//@description : Verify that the entry in not in the list already.
	//@param : <entry> The search is done using the url of the page.
	//@return : Boolean		
	isACurrentEntry : function(entry) {
		return this.list
		.map(function(item) {
			return item.value;
		})
		.include(entry);
	},
	

	//@name : constrain
	//@description : Contrains a list at a maximum size, if that is hitted
	//the last item is pushed out and the new entry is add at the beginning of the list.
	//@param : <list The list to constrain
	//@param : <limit> The maximum size of the list
	//@return : Array	
	constrain : function(list, limit) {		
		list.append = function(item) {
			if(this.length < limit) {
				this.push(item);
			} else {
				this.pop();
				this.unshift(item);
			}
		}
		return list;
	},
	
	//@name : serialize
	//@description : Serialize a list where each item is an hash. The serializing is done
	//using a pipe to seperate keys and values and a comma to seperate items.
	//@return : String	
	serialize : function(items) {
		return items.map(function(item) {
			return [item.key,item.value].join('|');
		}).join(',');
	},

	//@name : unserialize
	//@description : Unserialize a list using the same rules as serialize.
	//@return : Array		
	unserialize : function(chain) {
		var items = chain.split(',');
			
		return items.map(function(item) {
			var obj = item.split('|');
			return {key:obj[0],value:obj[1]};
		});
	},
	
	//@name : writeCookie
	//@description : Write a cookie. Writing is desctructive	
	writeCookie : function(name,value,days) {
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	},

	//@name : readCookie
	//@description : Return the value of the cookie with the name passed
	//@return : String || Null	
	readCookie : function(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
		}
		return null;
	},
	
	//@name : render
	//@description : Render the list using a Prototype template
	//@params : <tmp> A prototype template, see http://www.prototypejs.org/api/template
	//@return : String	
	render : function(tmp) {
		var template = new Template(tmp);
		
		return this.list.map(function(item) {
			return template.evaluate(item);
		}).join("\n");
	}
};

// Framework : 
// Fonctions necessaires au fonctionnement general. Elles apportent une aide supplementaire pour le developpement d'autres fonctions.
// Ces fonction sont utilisees par toutes les autres
Array.prototype.eachInv = function(f) {
	var i;
	for(i=this.length-1;i>=0;i--) {
		f(this[i], i);
	}
}

function addEvent(elm, eventName, fn) {
	Event.observe(elm, eventName, fn);
}

function removeEvent(elm, event, fn) {
	Event.stopObserving(elm,event, fn);
}

NOV.tools = {
	closeWin : function(){
		if (newWin != null){
			if(!newWin.closed)
				newWin.close();
		}
	},
	
	//supprime la propagation du click sur un element
	//(le click n'est pas repercute sur les autres elements en dessous du block en question)
	cancelClick : function(e){
		if (window.event){
			window.event.cancelBubble = true;
			return;
		}
		if (e){
			if (e.stopPropagation) {
				e.stopPropagation();
			}
		}
	},
	
	popUp : function(strURL,strType,strHeight,strWidth) {
		NOV.tools.closeWin();
		var strOptions="";
		switch(strType) {
			case "console":
				strOptions="resizable,height="+strHeight+",width="+strWidth;
				break;
			case "fixed":
				strOptions="status,height="+strHeight+",width="+strWidth;
				break;
			case "elastic":
				strOptions="toolbar,menubar,scrollbars,resizable,location,height="+strHeight+",width="+strWidth;
				break;
			case "elastic2":
				strOptions = 'width=580,height=600,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=yes,status=yes';
				break;
			case "elastic3":
				strOptions = "height="+strHeight+",width="+strWidth+',toolbar=no,menubar=no,location=no,resizable=no,scrollbars=yes,status=yes';
				break;
			case "pwnov":
				strOptions = "height="+strHeight+",width="+strWidth+',toolbar=no,menubar=no,location=no,resizable=no,scrollbars=no,status=no';
				break;
			default:
			break;	
		}
		
		newWin = window.open(strURL, 'newWin', strOptions);
		newWin.focus();
	},

	toggleClass : function(element, className) {
		if (element.className.match(className)) {
			$(element).removeClassName(className)
		} else {
			$(element).addClassName(className)
		}
	},
	
	getMeta : function(nameValue){
		var metas = document.getElementsByTagName("meta");
		for (i = 0;i<metas.length;i++) {
			if (metas[i].name == nameValue) {
		return metas[i].content;
			}
		}
		return "";
	},
	
	toggleQA : function(elm) {
		var links = getNodes(elm,{nodeName:'a',className:'switchLink'});
		var divs = getNodes(elm,{nodeName:'div',className:'switchDiv'});
		var prevLink = false;
		for (var i=0;i<links.length;i++){
			links[i].onclick = function() {
				var next = getNextSibling(this,{nodeName:'div',className:'switchDiv'});
				if (prevLink) $(prevLink).addClassName('hidden');
				$(next).removeClassName('hidden');
				prevLink = next;
			}
		}
	}
}

// _n : objet de parcours du DOM, facile. Les fonctions ne font que les nodes HTML
NOV.tools._n = {
	
	// hasAttributes : retourne true si l'element passe en parametre correspond a tous les attributs passes, 
	// on peut aussi donner des attributs que l'on ne veut pas, afin de filtrer tous les &eacute;lements
	// ex : if (hasAttributes(div, {nodeName:"div", className:"foobar"), {className:"idontwant"} ) doStuff();
	// ici on recherche tous les DIV qui on la classe "foobar", mais on ne prend pas ceux qui ont la classe "idontwant"
	// ex : <div class="foobar idontwant"> ne sera pas recupere.
	hasAttr : function(n, a, not) {
		var re, at;
		if (n.nodeType!=1) return false;
		function check(attr) {
			for (var i in attr) {
				at = (typeof n[i]) !="undefined" ? n[i] : n.getAttribute(i);
				re = attr[i] instanceof RegExp ? re : new RegExp("\\b" + attr[i] + "\\b","i");
				if (!at || !re.test(at)) 
					return false;
			}
			return true;
		};
		if (not && check(not))	return false;
		if (check(a)) return true;
		return false;
	},
	
	// getByTagName : equivalent a element.getElementsByTagName, mais compatible avec IE5 et IE5.5 pour l'histoire du "*"
	getByTagName : function(n, tag) {
		return  (tag=="*") ? (n.all ? n.all : n.getElementsByTagName("*")) : n.getElementsByTagName(tag);
	},
	
	// fonction qui retourne le premier element correspondant aux attributs donnes
	node : function(n, a, not) {
		return NOV.tools._n.nodes(n, a, not, true);
	},
	
	// fonction qui retourne tous les elements correspondant selon "a"
	nodes : function(n, a, not, oneNode, arrElms) {
		var aRetElms=[];
		if (!a) a = {};
		//si une chaine de caract&egrave;res pass&eacute;e en param&egrave;tre, cela signifie qu'on ne veut que r&eacute;cup&eacute;rer des tags
		if (typeof a == "string") a = {nodeName:a}; 
		if (a.nodeName && a.nodeName=="*") delete a.nodeName;
		var elms = arrElms || NOV.tools._n.getByTagName(n, (a.nodeName || "*"));
		for (var i=0; i<elms.length; i++) {
			var x = elms[i];
			if (NOV.tools._n.hasAttr(x, a, not)) {
				if (oneNode) return x;
				else aRetElms.push(x);
			}
		}
		if (oneNode) return null;
		return aRetElms;
	},
	
	// childs : retourne tous les noeuds enfants de l'element
	childs : function(n, a, not) {
		return NOV.tools._n.nodes(n, a, not, false, n.childNodes);
	},
	
	firstChild : function(n, a, not) {
		return NOV.tools._n.nodes(n, a, not, true, n.childNodes);
	},
	
	lastChild : function(n, a, not) {
		var node = NOV.tools._n.nodes(n, a, not, false, n.childNodes);
		return node[node.length-1];
	},
	
	move : function(n, a, not, action) {
		while (n) {
			if (NOV.tools._n.hasAttr(n, a, not)) return n;
			n = n[action];
		}
		return null;
	},
	
	after : function(n, a, not) { 
		return NOV.tools._n.move(n, a, not, "nextSibling");
	},
	
	parent : function(n, a, not) {
		return NOV.tools._n.move(n, a, not, "parentNode");
	}
}

NOV.tools.toggleBlock = {
	init : function(elm) {
		var head = getNode(elm, {className:"head"});
		if (head) 
			var a = getNode(head, {nodeName:"a"});
			if (a)
			a.onclick = function() {
				if($(a).getAttribute('href').endsWith('#') || $(a).getAttribute('href') == ''){
					NOV.tools.toggleBlock.toggle(this);
					return false;
				}
			}
	},
	// ajout les fonctionnalites du open/close (toggle);
	toggle : function(elm) {
		elm.blur();
		var scrollTop = document.body.scrollTop;
		var block = getParent(elm, {nodeName:"div", className:"block-toggle"});
		NOV.tools.toggleClass(block, 'toggle-closed')
		NOV.display.fixColumns();
		document.body.scrollTop = scrollTop;
		document.body.style.zoom = 1;
		setTimeout(function() {document.body.style.zoom=0}, 1);
		setTimeout(NOV.display.fixCorners,2);
	}
}

NOV.tools.manageTabs = {
	init : function(elm) {
		var ul = getNode(elm, {nodeName:"ul"});
		if (!ul) return;
		var a = ul.getElementsByTagName("a");
		for (var i=0; i<a.length; i++) {
			if (!hasAttributes(a[i], {className:"nochange"}))  {
				a[i].onclick = function() {
					NOV.tools.manageTabs.change(this);
					return false;
				}
			}
			NOV.tools.manageTabs.size(a[i], ul);
		}
	},
	
	size : function(a, ul) {
		var newSize =  a.offsetHeight + (ul.offsetHeight-a.offsetHeight) - NOV.display.getVStyles(a);
		//IE doesn't compute size under 0
		a.style[heightPropertyToUse] = (newSize<0) ? 0 : newSize + "px";
	},
	
	change : function(elm) {
		var i, n, tabs, ul, li, body, tabCtns, current=0, block;
		ul = getParent(elm, {nodeName:"ul", className:"tabs(Big|Sub)?"});
		li = getParent(elm, {nodeName:"li"});
		tabs = ul.getElementsByTagName("li");
		block = getParent(ul, {nodeName:"div", className:"blockTabs(Sub)?"});
		// get What is the index of the new Tab and remove otherClass "current"
		for (i=0; i<tabs.length; i++) {
			if (tabs[i]==li) {
				current = i;
				$(li).addClassName("current");
			} else 
				$(tabs[i]).removeClassName("current");
		}
		//get the tabCtn blocks, and show the contentTab that is match with clicked tab
		body = getNode(block, {nodeName:"div", className:"body"});
		tabCtns = getChildNodes(body, {nodeName:"div", className:"tabCtn"});
		for (i=0; i<tabs.length; i++) {
			n = tabCtns[i];
			$(n).removeClassName("tabCurrent");
			if (i==current) {
				$(n).addClassName("tabCurrent");
			}
		}
	}
}

/* fonctions raccourcis */
var getNode 			 = NOV.tools._n.node,
	getNodes			 = NOV.tools._n.nodes,
	getChildNodes 		 = NOV.tools._n.childs,
	getNextSibling 		 = NOV.tools._n.after,
	getParent			 = NOV.tools._n.parent,
	hasAttributes 		 = NOV.tools._n.hasAttr,
	getElementsByTagName = NOV.tools._n.getByTagName;

NOV.deploy = {
	checkLinks : function() {
		if ($('bloc_ident')) {
			if($('favoris')) getNode($('favoris'),{nodeName:'a'}).onclick = function() {NOV.tools.popUp(this.href,'elastic2');return false;}
			if($('fideliteid')) getNode($('fideliteid'),{nodeName:'a'}).onclick = function() {NOV.tools.popUp(this.href,'elastic2');return false;}
		}
		
		var links = getNodes(document.documentElement,{nodeName:'a',className:'(clickPop|clickPop2|closePop|popFH|popBan)'});
		for (var i=0;i<links.length;i++) {
			if (links[i].className.match('clickPop'))
				links[i].onclick = function(){NOV.tools.popUp(this.href,'elastic2'); return false;};
			if (links[i].className.match('clickPop2'))
				links[i].onclick = function(){NOV.tools.popUp(this.href,'elastic',300,480); return false;};
			if (links[i].className.match('clickZoom'))
				links[i].onclick = function(){NOV.tools.popUp(this.href,'elastic',580,830); return false;};
			if (links[i].className.match('closePop'))
				links[i].onclick = function(){window.close();};
			if (links[i].className.match('popFH')){
				links[i].onclick = function(){NOV.tools.popUp(this.href,'elastic3',550,700); return false;};
			}
			if (links[i].className.match('popBan')){
				links[i].onclick = function(){NOV.tools.popUp(this.href,'pwnov',300,480); return false;};
			}
		}
	},
	
	createSheets : function() {
		var NovotelHistory = new hotelsHistory;
		if($$('body.fichehotel')[0] != undefined) {
			var title = $$('#header h1')[0].innerHTML;
			var rid = NOV.tools.getMeta("X-Accor-rid");
			if(NovotelHistory.readCookie('hotelsHistory'))	
				if (NovotelHistory.readCookie('hotelsHistory').indexOf(title) != -1) 
					return;
			NovotelHistory.saveCurrentPage(title,rid);
			
		}
		
		if($$('ul.histo-recherche')[0] != undefined) {
			var base = $$('ul.histo-recherche')[0];
			var template = [
				'<li>',
					'<p class="text"><strong><a href="/#{value}">#{key}</a></strong></p>',
				'</li>'
			].join('');
			
			if(NovotelHistory.list.length > 0) {
				base.innerHTML = NovotelHistory.render(template);
				base.getElementsBySelector('li').each(function(item,index) {
					if(index % 2 == 0) item.addClassName('even');
				});
			}
				
		}
	},
	
	pu_OpenScroll : function(){
		window.open("/fr/aide/credit_photos.html',","credits_photo","menubar=no, status=no, scrollbars=no, resizable=yes, top=200, left=250, width=650,height=480");
	},
	
	contextualize : function() {
		if (!document.location.hostname.match(/novotel/)) {
			$(document.documentElement).addClassName(" external");
			//var logo = $("logo");
			//if (logo) logo.innerHTML = '<div class="txt-c tMarginSm bMarginLg"><img src="/imagerie/thalassa.png" alt="logo"/></div>';
		}
	},
	
	mailingwrite : function() {
		if (!window.location.hostname.match(/novotel/)) {
			if (window.location.hostname.match(/accorhotels/)) {
				if(document.getElementById('newsId')){
				var linkmail=document.getElementById('newsId').getElementsByTagName('a') ;
				linkmail[0].href='http://www.accorhotels.com/mailing_list.svlt?action=CREATEACCOUNT&site=NOV,AEC|PMO';
				};
				if(document.getElementById('newsId2')){
				var linkmailid=document.getElementById('newsId2').getElementsByTagName('a');
				linkmailid[0].href='http://www.accorhotels.com/mailing_list.svlt?action=CREATEACCOUNT&site=NOV,AEC|PMO';
				} 
			};
			if (window.location.hostname.match(/thalassa/)) {
				if(document.getElementById('newsId')){
				var linkmail=document.getElementById('newsId').getElementsByTagName('a');
				linkmail[0].href='http://www.accorthalassa.com/mailing_list.svlt?action=CREATEACCOUNT&site=NOV,AEC|PMO';
				};
				if(document.getElementById('newsId2')){
				var linkmailid=document.getElementById('newsId2').getElementsByTagName('a');
				linkmailid[0].href='http://www.accorthalassa.com/mailing_list.svlt?action=CREATEACCOUNT&site=NOV,AEC|PMO';
				}
			}
		}
	}
}

/** 
* functions lie aux frames dernieres minutes GreatDeals
**/



NOV.framePlayer = {
	init: function (){
		var that = this;
		if(!$('tri')) return ;
		// vars
		this.actualZone = "pays";
		this.actualFiltre = "dest";
		this.baseURL = "http://www.novotel.com/hotel-cms/"+window.lng+"/promo/hotel-";
		// btns affichez-masquez
		this.btn1 = $('toggleBtn');
		this.btn1.onclick = this.toggleFiltre;
		this.btn2 = $('toggleBtn2');
		this.btn2.onclick = this.toggleFiltre;
		// onglets ==> modifie actualZone + select option
		this.idTab = ['pays', 'europe', 'monde'];
		this.idTab.each(function (elm){
			$(elm).onclick = function (e){
				this.actualFiltre = "dest";
				that.actualZone = this.id;
				that.toggleTab(this);
				that.generateOptions(this.id); 
				that.changeFrame();
			};
		}.bind(this));	

		// radios btn
		this.inputs = $("tri").getElementsByTagName("input");
		for(var i=0;i<this.inputs.length;i++){
			this.inputs[i].onclick = function (){
				that.changeFrameFiltre(this.value)
			}
		}
		//
	},
	
	toggleFiltre : function (id) {
		if (id== "tri" && $('tri').style.display != "none") return
		var tri = $('tri');
		var filtre = $('filtre');
		var affine = $('affine');
		var mask_affine = $('mask_affine');
		var tab = [tri, filtre, affine, mask_affine];
		for(var i=0; i<tab.length;i++){
			tab[i].style.display = (tab[i].style.display != 'none') ? "none" : "block" ;
		}
	},
	
	toggleTab: function (elm) {
		this.idTab.each(function (el){
			el = $(el);
			if(elm == el) {
				$(el.parentNode).addClassName("current");
			} else {
				$(el.parentNode).removeClassName('current');
			}
		}.bind(this));		
	},
	
	changeFrameFiltre: function(arg) {
		this.actualFiltre = arg;
		this.changeFrame();
	},

	changeFrame: function (){
		$("iframeHotdeals").src = this.baseURL+this.actualZone+"-"+this.actualFiltre+".html";
	}, 
	
	generateOptions : function (id){
		var monde = $('Gmonde');
		var europe = $('Geurope');
		var comparo = $("G"+id);
		if (id=="pays") {
			this.btn1.style.visibility = "hidden";
			this.toggleFiltre("tri");
			this.actualZone = "pays";			
		}
		if(comparo == monde) {
			this.btn1.style.visibility = "visible";
			monde.style.display = "inline";
			europe.style.display = "none";
			this.actualZone = "monde";			
			$('Gmonde').value = "dest";
			
		}
		if(comparo == europe) {
			this.btn1.style.visibility = "visible";
			monde.style.display = "none";
			europe.style.display = "inline";
			this.actualZone = "europe";				
			$('Geurope').value = "dest";
		}		
	} 
};

//Family / Goodies
NOV.popup = {
	toggled: true,
	items : [
	{id:'jeux1', height:500, width:600},
	{id:'jeux2', height:500, width:600},
	{id:'jeux1_1', height:500, width:600},
	{id:'jeux2_2', height:500, width:600},
	{id:'family_extra_room', height:650, width:600}
	],
	load : function(){
		this.items.each(function(item){
			if($(item.id)){
				var href = $(item.id).getAttribute('href');
				$(item.id).setAttribute('href','javascript:;');
				
				Event.observe($(item.id), 'click', function(event){
					var popup = window.open(href, this.getAttribute('title'), 'top=50px, left=50px, height='+item.height+'px, width='+item.width+'px, toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, directories=no, status=no');
					Event.stop(event);
					if(item.callback)
						item.callback(popup);
					return false;
				});
			}
		});
	}
}

NOV.rewrite = {
	init : function(){
		if (!document.location.hostname.match(/accorhotels/)) {
            NOV.display.centerPage();
        }
		NOV.deploy.createSheets();
		NOV.deploy.contextualize();
		NOV.display.generateStyleElements();
		addToolTips(); //bug proto verifier show puis appear
		NOV.display.returnLists();
		NOV.deploy.checkLinks();
		formControl.init();
		NOV.deploy.mailingwrite(); 
		NOV.flash.init();
		NOV.flash.initUpdate();
		if ($('aide_contact')) NOV.tools.toggleQA($('aide_contact'));
		NOV.popup.load();
		
		NOV.display.sizeBlocks();
		NOV.display.fixColumns();
		NOV.display.fixCorners();
		NOV.framePlayer.init(); // a laissez apres flashInit
		
		//new PeriodicalExecuter(function(){NOV.offers.init(); arguments[0].stop();}, .1);
		
		if(typeof nov_initCalendar == "function" && typeof nov_initLang == "function"){
			nov_initLang();
			nov_initCalendar();
		}
		
		// pour la page Bons Plans Famille http://www.novotel.com/LANGUE/family/family-guides/index.shtml
		if(typeof redirectEngine == "object" && typeof redirectEngine.init == "function"){
			redirectEngine.init();
		}
		
	}
}

Event.observe(window, "load", function() {
    if(IS_IE6) {
        var theBody = document.getElementsByTagName('BODY')[0];
        $(theBody).addClassName('IS_IE');
    }
    NOV.rewrite.init();
});
