var marginX=50;var marginY=38;var minWidth=800;var minHeight=580;var maxWidth=1660;var maxHeight=1119;var smallMaxWidth=1100;var mediumMaxWidth=1355;function as_favorite(){try{if(window.sidebar){window.sidebar.addPanel(document.title,location.href,"");return;}
if(document.all){window.external.AddFavorite(location.href,document.title);return;}
if(window.opera&&window.print){var elem=document.createElement("a");elem.setAttribute("href",location.href);elem.setAttribute("title",document.title);elem.setAttribute("rel","sidebar");elem.click();return;}}
catch(e){}
alert(translation.favorite);}
function goto_extlink(did,pid,addr){var uri="http://ads.eorezo.com/cgi-bin/advert/settags?x_format=redirect&x_dp_id="+did+"&x_pub_id="+pid+"&x_tag_id=clic_"+addr.replace(/\/.*$/,"")+"&x_url=http%3A%2F%2F"+addr.replace(/\//g,"%2F");window.open(uri,"_blank","resizable=yes, location=yes, width=800, height=590, status=yes, scrollbars=yes, menubar=yes, personalbar=yes, toolbar=yes");}
function goto_webmail(addr){goto_extlink(17,58,addr);}
function auto_search(text){form.getElement("searchBar").setValue(text);form.search();}
if(!Ext.util){Ext.util={};}
Ext.util.Utf8={encode:function(string){string=string.replace(/rn/g,"\n");var utftext="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){utftext+=String.fromCharCode(c);}
else if((c>127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128);}
else{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128);}}
return utftext;},decode:function(utftext){var string="";var i=0;var c=c1=c2=0;while(i<utftext.length){c=utftext.charCodeAt(i);if(c<128){string+=String.fromCharCode(c);i++;}
else if((c>191)&&(c<224)){c2=utftext.charCodeAt(i+1);string+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2;}
else{c2=utftext.charCodeAt(i+1);c3=utftext.charCodeAt(i+2);string+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}
return string;}}
var Clib=new Object();Clib.Tools=new Object();Clib.Tools.insertTag=function(tag){var url="http://ads.eorezo.com/cgi-bin/advert/settags?x_format=javascript&x_dp_id=17&x_pub_id=440&x_tag_id="+tag;Clib.Tools.addJS(url);}
Clib.Tools.urlEncode=function(str){str=escape(str);str=str.replace(/\+/gi,"%2B");str=str.replace(/\*/gi,"%2A");str=str.replace(/\//gi,"%2F");str=str.replace(/@/gi,"%40");return str;};Clib.Tools.urlDecode=function(str){str=str.replace(/\+/gi," ");str=unescape(str);return str;};Clib.Tools.trim=function(str){return str.replace(/(^\s|\s$)/gi,"");};Clib.Tools.getCookies=function(){var carray=document.cookie.split(";");var cookies={};for(var i=0;i<carray.length;i++){var cparams=carray[i].split("=");cookies[Clib.Tools.trim(cparams[0])]=unescape(cparams[1]);}
return cookies;};Clib.Tools.getCookie=function(name){return Clib.Tools.getCookies()[name];};Clib.Tools.setCookie=function(name,value,daysExpires,path,domain,secure){if(value==Clib.Tools.getCookie(name)){return;}
var d;if(daysExpires){d=new Date();d.setDate(d.getDate()+daysExpires);}
var cookie=name+"="+escape(value)+((domain)?";domain="+domain:"")+((path)?";path="+path:"")+((secure)?";secure":"")+((daysExpires)?";expires="+d.toGMTString():"");document.cookie=cookie;return Clib.Tools.getCookie(name);};Clib.Tools.delCookie=function(name,path,domain){if(Clib.Tools.getCookie(name)){document.cookie=name+"="+((path)?";path="+path:"")+((domain)?";domain="+domain:"")+";expires=Thu, 01-Jan-1970 00:00:01 GMT";}};Clib.Tools.getWindowSize=function(){var size={width:0,height:0};if(parseInt(navigator.appVersion)>3){if(navigator.appName=="Netscape"){size.width=window.innerWidth;size.height=window.innerHeight;}
if(navigator.appName.indexOf("Microsoft")!=-1){size.width=document.documentElement.clientWidth;size.height=document.documentElement.clientHeight;}}
else{size.width=document.clientWidth;size.height=document.clientHeight;}
return size;};Clib.Tools.setAsHomePage=function(url){var hompageset=false;if(!Ext.isIE){return true;}
try{document.body.style.behavior='url(#default#homepage)';document.body.sethomepage(url);hompageset=document.getElementsByTagName('body')[0].isHomePage(url);}catch(e){}
return hompageset;}
Clib.Tools.setHome=function(){if(Clib.CookieManager.get("isHomepage")!=1){var setted=Clib.Tools.setAsHomePage("http://"+window.location.hostname+"/");if(setted){Clib.CookieManager.set("isHomepage","1");}}}
Clib.Tools.addCSS=function(href){var headID=document.getElementsByTagName("head")[0];var cssNode=document.createElement('link');cssNode.type='text/css';cssNode.rel='stylesheet';cssNode.href=href;cssNode.media='screen';headID.appendChild(cssNode);}
Clib.Tools.addJS=function(src){var script=document.createElement("script");script.setAttribute("type","text/javascript");script.setAttribute("language","javascript");script.setAttribute("src",src);document.body.appendChild(script);}
Clib.CookieManager=function(){var cookieName="parameters"
var raw=Clib.Tools.getCookie(cookieName);var data={};if(raw){data=Ext.urlDecode(raw);}
return{get:function(name){return data[name];},set:function(name,value){if(value===undefined||name===undefined){return;}
data[name]=value;for(var k in data){if(!k||data[k]===null||data[k]=="undefined"){delete(data[k]);}}
if(data['undefined']){delete(data['undefined']);}
raw=Ext.urlEncode(data);Clib.Tools.setCookie(cookieName,raw,365,"/","");}}}();Clib.Swf=function(config){Clib.Swf.superclass.constructor.call(this,config);Ext.apply(this,config);this.renderTo=Ext.get(this.renderTo);this.params=new Object();this.getPlayerVersion();if(this.playerVersion.major<this.version){throw"Player too old";}};Ext.extend(Clib.Swf,Ext.util.Observable,{getPlayerVersion:function(){if(this.playerVersion){return this.playerVersion;}
this.playerVersion={major:0,minor:0}
var pluginDescription;if(navigator.plugins&&navigator.plugins.length){var plugins=navigator.plugins["Shockwave Flash"];var regexp=new RegExp("([0-9]+).([0-9])");pluginDescription=plugins.description;}else{var ax=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");if(!ax){ax=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");if(!ax)
ax=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");}
pluginDescription=ax.GetVariable("$version")}
if(!pluginDescription){return;}
var version=new RegExp("([0-9]+)\.([0-9])").exec(pluginDescription);if(!version)
return;this.playerVersion={major:parseInt(version[1]),minor:parseInt(version[2])}},setParam:function(name,value){this.params[name]=value;},getParam:function(name){return this.params[name];},getHtml:function(){var html='';if(navigator.plugins&&navigator.plugins.length){html+='<embed type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="'+this.url+'" width="'+this.width+'" height="'+this.height+'" id="'+this.id+'" name="'+this.id+'"';for(var key in this.params)
html+=' '+key+'="'+this.params[key]+'"';html+=' />';}else{html+='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+this.version+',0,0,0" ';html+=' width="'+this.width+'"';html+=' height="'+this.height+'"';html+=' align="'+this.align+'"';html+=' id="'+this.id+'"';html+='>';html+='<param name="movie" value="'+this.url+'" />';for(var key in this.params){html+='<param name="'+key+'" value="'+this.params[key]+'" />';}
html+='</object>';}
return html;},render:function(){var html=this.getHtml();if(!html){return;}
this.renderTo.update(html);}});Clib.SendToFriends=function(url){var service="image";if(form){service=form.getElement("x_service").getValue();}
var win=window.open("/cgi-bin/send_friends.cgi?x_url="+url+"&x_service="+service,"Friends","resizable=no, location=no, width=400, height=650, menubar=no, status=no, scrollbars=no, menubar=no");win.focus();};Clib.Contact=function(url){var win=window.open(url,"contactez","resizable=no, location=no, width=385, height=650, menubar=no, status=no, scrollbars=no, menubar=no");win.focus();};Clib.Faq=function(url,width,height){var win=window.open(url,"faq","resizable=yes, location=no, width="+width+", height="+height+", menubar=no, status=no, scrollbars=yes");win.focus();};Clib.FormWidjet=function(config){Ext.apply(this,config);if(this.el){this.el=Ext.get(this.el);}
if(this.addHandlers){this.addHandlers();}
this.init(config);};Ext.extend(Clib.FormWidjet,Ext.util.Observable,{init:function(config){if(config.cookie){var cookieValue=Clib.CookieManager.get(config.cookie);if(!cookieValue){if(!this.defaultValue){return;}
cookieValue=this.defaultValue;}
if(!cookieValue||cookieValue=="undefined"){return;}
if(this.selectByValue){return this.selectByValue(cookieValue);}
try{this.el.set({value:cookieValue});}catch(e){}}},validate:function(){return true;},changeSearchType:function(type){this.type=type;return;}});Clib.Activable=function(config){this.checkbox=Ext.get(config.checkboxId);this.addEvents(["enabled","disabled"]);Clib.Activable.superclass.constructor.call(this,config);};Ext.extend(Clib.Activable,Clib.FormWidjet,{addHandlers:function(){this.el.on("click",this.enable,this);this.checkbox.on("click",this.onClick,this);},onClick:function(e){if(this.checkbox.dom.checked){this.enable();}
else{this.disable();}},enable:function(){this.defaultEnabled=true;this.checkbox.dom.checked=true;this.fireEvent("enabled");},disable:function(){this.defaultEnabled=false;this.checkbox.dom.checked=false;this.fireEvent("disabled");},isActive:function(){return this.defaultEnabled;}});Clib.SearchButton=function(config){Clib.SearchButton.superclass.constructor.call(this,config);};Ext.extend(Clib.SearchButton,Clib.FormWidjet,{addHandlers:function(){this.el.on('click',this.search,this);},search:function(){this.form.search();},changeSearchType:function(type){if(this.searchTypes[type]){this.el.update(this.searchTypes[type]);}}});Clib.InputHidden=function(config){Clib.InputHidden.superclass.constructor.call(this,config);};Ext.extend(Clib.InputHidden,Clib.FormWidjet,{changeSearchType:function(type){if(this.searchTypes[type]){this.el.dom.value=this.searchTypes[type];}},getValue:function(){return this.el.getValue();}});Clib.Page=function(config){Clib.Page.superclass.constructor.call(this,config);};Ext.extend(Clib.Page,Clib.FormWidjet,{changeSearchType:function(type){this.el.dom.value=0;},goTo:function(page){this.el.dom.value=page;}});Clib.ImgSize=function(config){Clib.ImgSize.superclass.constructor.call(this,config);};Ext.extend(Clib.ImgSize,Clib.FormWidjet,{setValue:function(value){this.el.dom.value=value;this.form.submit();}});Clib.PersonalizeButton=function(config){Clib.PersonalizeButton.superclass.constructor.call(this,config);this.searchEngine=Clib.Tools.getCookie("x_search_engine");};Ext.extend(Clib.PersonalizeButton,Clib.FormWidjet,{addHandlers:function(){this.el.on("click",this.onClick,this);},onClick:function(){var pBar=this.form.getElement("personalizeBar");if(pBar.isActive()&&pBar.getValue().length>0){logoChooser.setText(pBar.getValue());}else{logoChooser.setText('');}
logoChooser.updateLogo();logoChooser.storeLogo();this.form.change(this.form.getElement("text"));var searchEngine=Clib.Tools.getCookie("x_search_engine");Clib.Tools.setHome();if(searchEngine!=this.searchEngine){location.reload();}},changeSearchType:function(type){if(this.searchTypes[type]=="on"){this.disabled=false;}
else{this.disabled=true;}}});Clib.PersonalizeBar=function(config){Clib.PersonalizeBar.superclass.constructor.call(this,config);this.on("enabled",this.onEnable,this);this.on("disabled",this.onDisable,this);this.el.on("keyup",this.onKeyUp,this);this.el.on("change",this.onKeyUp,this);var text=Clib.Tools.getCookie("glogoperso");var active=Clib.CookieManager.get("logoActive");if(active===undefined&&text){active="1";}
var t=window.location.pathname;if(t.length>1&&!t.match("/(cgi-bin|Tabs|film)")){active="1";text=t.substring(1);Clib.Tools.setCookie("logoActive","1",100,"/");Clib.Tools.setCookie("glogoperso",text,100,"/");}
if(!text){text="";}
this.el.dom.value=text;if(active=="1"){this.enable();}else{this.disable();}};Ext.extend(Clib.PersonalizeBar,Clib.Activable,{getValue:function(){return this.el.getValue();},focus:function(){if(this.defaultEnabled){this.el.focus();}},setValue:function(value){this.el.dom.value=value;this.enable();},onEnable:function(){this.el.removeClass("input_disabled");this.focus();this.changeLogo();},onDisable:function(){this.el.addClass("input_disabled");this.changeLogo();},onKeyUp:function(){this.changeLogo();},changeLogo:function(){if(this.isActive()&&this.el.dom.value.length>0){logoChooser.setText(this.el.dom.value);}else{logoChooser.setText();}}});Clib.Select=function(config){Clib.Select.superclass.constructor.call(this,config);};Ext.extend(Clib.Select,Clib.FormWidjet,{addHandlers:function(){this.el.on("change",this.onChange,this);},selectByValue:function(value){for(var i=0;i!=this.el.dom.options.length;i++){if(this.el.dom.options[i].value==value){this.el.dom.options[i].selected=true;return;}}},onChange:function(){this.form.goToPage(0,0,true);this.form.submit();}});Clib.SelectImgSize=function(config){Clib.SelectImgSize.superclass.constructor.call(this,config);};Ext.extend(Clib.SelectImgSize,Clib.FormWidjet,{addHandlers:function(){this.el.on("change",this.onChange,this);},onChange:function(){this.form.goToPage(0,0,true);this.form.getElement('x_imgsz').setValue(this.el.dom.options[this.el.dom.selectedIndex].value);this.form.submit();}});Clib.SelectImgFormat=function(config){Clib.SelectImgFormat.superclass.constructor.call(this,config);};Clib.SelectImgFormat=function(config){Clib.SelectImgFormat.superclass.constructor.call(this,config);};Ext.extend(Clib.SelectImgFormat,Clib.FormWidjet,{addHandlers:function(){this.el.on("change",this.onChange,this);},onChange:function(){this.form.goToPage(0,0,true);this.form.getElement('x_imgformat').setValue(this.el.dom.options[this.el.dom.selectedIndex].value);this.form.submit();}});Clib.SelectSkin=Ext.extend(Clib.Select,{onChange:function(evt,obj){Clib.Tools.activatePartner(obj.value);}});Clib.Radio=function(config){this.elements=new Object();for(var i=0;i<config.ids.length;i++){this.elements[config.ids[i]]=Ext.get(config.ids[i]);this.elements[config.ids[i]].dom.disabled=false;}
Clib.Radio.superclass.constructor.call(this,config);};Ext.extend(Clib.Radio,Clib.FormWidjet,{addHandlers:function(){for(var el in this.elements){this.elements[el].on("click",this.onChange,this);}},disableOnSubmit:function(){if(!this.disable){return;}
for(var el in this.elements){this.elements[el].dom.disabled=true;}},selectByValue:function(value){for(var el in this.elements){if(this.elements[el].getValue()==value)
this.elements[el].dom.checked=true;return;}},getSelectedValue:function(){for(var el in this.elements){if(this.elements[el].dom.checked==true)
return this.elements[el].dom.value;}},onChange:function(event,element){var search_language=element.value;Clib.Tools.setCookie("search_language",search_language,100,"/","");this.form.goToPage(0,0,true);this.form.submit();}});Clib.SearchEngine=function(config){Clib.SearchEngine.superclass.constructor.call(this,config);};Ext.extend(Clib.SearchEngine,Clib.Radio,{onChange:function(event,element){var searchEngine=element.value;Clib.Tools.setCookie("x_search_engine",searchEngine,100,"/","");}});Clib.SearchSite=function(config){Clib.SearchSite.superclass.constructor.call(this,config);this.on("enabled",this.onEnable,this);this.on("disabled",this.onDisable,this);};Ext.extend(Clib.SearchSite,Clib.Activable,{onEnable:function(){this.el.removeClass("input_disabled");this.el.focus();},onDisable:function(){this.el.addClass("input_disabled");},isActive:function(){return(this.defaultEnabled&&this.el.getValue()!="www.");},setValue:function(value){this.el.dom.value=value;this.enable();this.form.search();}});Clib.BgMode=function(config){Clib.BgMode.superclass.constructor.call(this,config);};Ext.extend(Clib.BgMode,Clib.Radio,{addHandlers:function(){for(var el in this.elements){this.elements[el].on("click",this.onClick,this);}},onClick:function(e){var value=this.getSelectedValue();switch(value){case"list":var bgimage=Ext.get("x_background").dom.options[Ext.get("x_background").dom.selectedIndex].value;Clib.Tools.setBgImage(bgimage);Clib.CookieManager.set("bglist",bgimage);Clib.CookieManager.set("bgmode","list");break;case"path":var bgimage=Ext.get("x_bgpath").dom.value;if(bgimage){Clib.Tools.setBgImage(bgimage);Clib.CookieManager.set("bgpath",bgimage);Clib.CookieManager.set("bgmode","path");}
break;case"url":var bgimage=Ext.get("x_bgurl").dom.value;if(bgimage){Clib.Tools.setBgImage(bgimage);Clib.CookieManager.set("bgurl",bgimage);Clib.CookieManager.set("bgmode","url");}
break;}}});Clib.SelectBg=function(config){Clib.SelectBg.superclass.constructor.call(this,config);};Ext.extend(Clib.SelectBg,Clib.Select,{addHandlers:function(){this.el.on("change",this.onChange,this);this.el.on("click",this.onClick,this);},onChange:function(e){var bgimage=this.el.dom.options[this.el.dom.selectedIndex].value;Clib.Tools.setBgImage(bgimage);Clib.CookieManager.set("bglist",bgimage);Clib.CookieManager.set("bgmode","list");},onClick:function(e){Ext.get("perso_fond_list").dom.checked=true;}});Clib.BgUrl=function(config){Clib.BgUrl.superclass.constructor.call(this,config);};Ext.extend(Clib.BgUrl,Clib.FormWidjet,{addHandlers:function(){this.el.on("change",this.onChange,this);this.el.on("click",this.onClick,this);},onChange:function(e){var bgimage=this.el.dom.value;if(bgimage){var d=new Date();d.setDate(d.getDate()+99);Clib.Tools.setBgImage(bgimage);Clib.CookieManager.set("bgurl",bgimage);Clib.CookieManager.set("bgmode","url");}},onClick:function(e){Ext.get("perso_fond_url").dom.checked=true;var bgimage=this.el.dom.value;if(bgimage){Clib.Tools.setBgImage(bgimage);Clib.CookieManager.set("bgmode","url");}}});Clib.BgPath=function(config){Clib.BgPath.superclass.constructor.call(this,config);};Ext.extend(Clib.BgPath,Clib.FormWidjet,{addHandlers:function(){this.el.on("change",this.onChange,this);this.el.on("click",this.onClick,this);},onChange:function(e){var bgimage=this.el.dom.value;if(bgimage){Clib.Tools.setBgImage(bgimage);Clib.CookieManager.set("bgpath",bgimage);Clib.CookieManager.set("bgmode","path");}},onClick:function(e){Ext.get("perso_fond_path").dom.checked=true;var bgimage=this.el.dom.value;if(bgimage){Clib.Tools.setBgImage(bgimage);Clib.CookieManager.set("bgmode","path");}}});Clib.SearchBar=function(config){Clib.SearchBar.superclass.constructor.call(this,config);};Ext.extend(Clib.SearchBar,Clib.FormWidjet,{setValue:function(value){this.el.dom.value=value;},focus:function(){if(!this.form.autoSubmit){this.el.focus();}},getValue:function(){return this.el.dom.value;},getSearchType:function(type){return this.searchTypes[type];},validate:function(){if(this.searchTypes[this.type]=="on"){if(!this.el.getValue()){var site=this.form.getElement("searchSite");if(!site.isActive()){return false;}}}
return true;}});Clib.UpButton=function(config){Clib.UpButton.superclass.constructor.call(this,config);};Ext.extend(Clib.UpButton,Clib.FormWidjet,{addHandlers:function(){this.el.on("click",this.onClick,this);},getType:function(){return this.type;},hasToSubmit:function(){return this.submit;},onClick:function(){service=this.type;this.form.change(this,this.hasToSubmit(),this.bar);},select:function(){this.el.addClass("selected");},unselect:function(){this.el.removeClass("selected");},changeSearchType:function(type){if(this.type==type){this.form.getElement(this.bar).focus();}}});Clib.FlightButton=function(config){Clib.UpButton.superclass.constructor.call(this,config);}
Ext.extend(Clib.FlightButton,Clib.UpButton,{changeSearchType:function(type){if(this.type==type){if(this.loaded){return;}
this.loaded=true;var self=this;window.onFlightLoaded=function(){self.onLoad();}
Clib.Tools.addJS(cdnServer+"/javascript/ext-flight.js");}},onClick:function(){Clib.Tools.insertTag('FlightForm');this.form.change(this,this.hasToSubmit(),this.bar);},emptyInput:function(){},onLoad:function(){if(this.jsloaded){return;}
this.jsloaded=true;var elements={townBarFrom:new Clib.TownBar({el:"depart",form:form}),townBarTo:new Clib.TownBar({el:"destination",form:form}),inputDateDepart:new Clib.InputDate({el:"departureDate",calendar:"calendarDeparture",divToHide:'num_adults',connectInput:"returnDate",searchTypes:{"flight":"on","hotel":"on"},form:form}),inputDateRetour:new Clib.InputDate({el:"returnDate",calendar:"calendarReturn",divToHide:'num_babies',searchTypes:{"flight":"on","hotel":"on"},form:form}),typeVolButton1:new Clib.TypeVolButton({el:"type_vol1",inputToChange:["returnDate","horaire_retour"],classInput:"returnDate_OFF",valueOfInput:"",classAction:'add',desable:true,form:form}),typeVolButton0:new Clib.TypeVolButton({el:"type_vol0",inputToChange:["returnDate","horaire_retour"],classInput:"returnDate_OFF",classAction:'remove',valueOfInput:Ext.get("departureDate").dom.value,desable:false,form:form})}
for(var i in elements){this.form.add(i,elements[i]);}
if(service=='flight'){window.scrollTo(0,0);if(homePage!=1){serviceClass=new Clib.FlightService();kelkoo=new Clib.Kelkoo(serviceClass);kelkoo.statusSearch('searching');kelkoo.search();}}}});Clib.PersoButton=function(config){Clib.PersoButton.superclass.constructor.call(this,config);};Ext.extend(Clib.PersoButton,Clib.UpButton,{addHandlers:function(){this.el.on("click",this.onClick,this);},onClick:function(){this.form.change(this,this.hasToSubmit());}});Clib.Form=function(form,config){this.form=Ext.get(form);this.elements={};this.searchType=config.defaultSearchType;this.rootElement=Ext.get(config.rootElement);this.autoSubmit=config.autoSubmit;this.addHandlers();};Clib.Form.prototype.getElement=function(name){return this.elements[name];};Clib.Form.prototype.add=function(name,value){this.elements[name]=value;};Clib.Form.prototype.addHandlers=function(){};Clib.Form.prototype.change=function(type,submit,bar){if(!this.type){this.type=this.getElement(this.rootElement.dom.className);}
if(!Clib.Tools.getCookie("glogoperso")&&type.getType()=="logo"){var logo=translation.personalize;logoChooser.setText(logo);logoChooser.updateLogo();}
this.type.unselect();type.select();this.rootElement.dom.className=type.getType();for(var el in this.elements){this.elements[el].changeSearchType(type.getType());}
if(type.getType()==this.type.getType())
return;this.type=type;this.goToPage(0,0,true);if(bar=="searchBar"&&!form.elements['searchBar'].getValue()&&form.elements['searchBar'].getSearchType(service)=="on")
return;if(submit){this.submit();}};Clib.Form.prototype.submit=function(){for(var el in this.elements){if(this.elements[el].validate&&!this.elements[el].validate(service)){return false;}}
if(!this.autoSubmit){return true;}
for(var el in this.elements){if(this.elements[el].disableOnSubmit){this.elements[el].disableOnSubmit();}}
this.form.dom.submit();};Clib.Form.prototype.search=function(value){if(value){Ext.get('x_query').dom.value=value;return this.goToPage(0,0);}
var autoSubmit=this.autoSubmit;this.autoSubmit=true;var ret=this.submit();this.autoSubmit=autoSubmit;return ret;};Clib.Form.prototype.onSubmit=function(){if(this.type.type=="logo"){this.getElement("personalizeButton").onClick();return false;}
return this.search();};Clib.Form.prototype.goToPage=function(start,number,noSearch){this.getElement("start").goTo(start);if(!noSearch){this.search();}};Clib.Form.prototype.searchOnDomain=function(domain){this.getElement("searchSite").setValue(domain);};Clib.Logo=function(config){config.type=Clib.CookieManager.get("logoType");config.text=Clib.Tools.getCookie("glogoperso");if(config.text=="undefined"){delete(config.text);}
if(config.text&&config.text.substr(0,7)=="favicon"){delete(config.text);}
var active=Clib.CookieManager.get("logoActive");if(active!="1"){delete(config.text);}
Ext.apply(this,config);try{if(noSwfLogo){throw"";}
this.logo=new Clib.SwfLogoChooser(config);}catch(e){this.logo=new Clib.ImgLogo(config);}}
Clib.Logo.prototype.setText=function(text){this.text=text;var perso=Ext.get('perso');if(!this.text){perso.removeClass("perso");}else{perso.addClass("perso");}
this.logo.setText(text);}
Clib.Logo.prototype.setType=function(type){Clib.CookieManager.set("logoType",type);this.logo.setType(type);}
Clib.Logo.prototype.storeLogo=function(){if(this.text){Clib.Tools.setCookie("glogoperso",this.text,100,"/","");Clib.CookieManager.set("logoActive","1");}
else{Clib.CookieManager.set("logoActive","0");Clib.Tools.delCookie("glogoperso");}}
Clib.Logo.prototype.updateLogo=function(){try{this.logo.updateLogo();}catch(e){}}
Clib.SwfLogo=function(config){Clib.SwfLogo.superclass.constructor.call(this,config);var self=this;window.onLogoReady=function(logoId){self.object=document.getElementById(logoId);self.fireEvent("ready");}
this.addEvents({ready:true});this.on('ready',this.onReady,this);}
Ext.extend(Clib.SwfLogo,Clib.Swf,{setText:function(text){if(!this.rendered&&text){this.rendered=true;this.render();}
if(text===undefined){text="";}
this.text=text;text="_"+text;if(this.object){try{this.object.setUrl(logoUrl);}catch(e){}
this.object.setLogoText(text);}},remove:function(){var el=Ext.fly(this.object);if(el){el.remove();}},onReady:function(){this.setText(this.text);}});Clib.SwfLogoChooser=function(config){Ext.apply(this,config);this.init();}
Clib.SwfLogoChooser.prototype.init=function(){var renderTo=Ext.get("pos_bloc_logo_swf");var height=renderTo.getHeight();this.logo=new Clib.SwfLogo({url:cdnServer+"/swf/"+this.getSwfName()+"?logoId=swfLogo",id:"swfLogo",width:2000,height:height,version:8,align:"middle",renderTo:renderTo});this.logo.setParam("wmode",'transparent');this.logo.setParam("allowScriptAccess",'always');if(this.text){this.logo.setText(this.text);}}
Clib.SwfLogoChooser.prototype.getSwfName=function(){return(this.type=="g")?"catull.swf":"trajan.swf";}
Clib.SwfLogoChooser.prototype.setType=function(type){if(this.type==type){return;}
this.type=type;this.logo.remove();this.init();}
Clib.SwfLogoChooser.prototype.setText=function(text){this.text=text;this.logo.setText(text);}
Clib.SwfLogoChooser.prototype.updateLogo=function(){return;}
Clib.ImgLogo=function(config){Ext.apply(this,config);if(this.server.charAt(this.server.length-1)!='/'){this.server+='/';}
this.name=config.text;this.div=Ext.get(config.imgDiv);this.update();};Clib.ImgLogo.prototype.getName=function(){if(!this.name){return;}
var name=this.name;name=name.replace(/\//gi,"_slash_");name=name.replace(/&/gi,"_and_");name=name.replace(/\+/gi,"_plus_");name=Clib.Tools.urlEncode(name);return name;};Clib.ImgLogo.prototype.updateLogo=function(){this.update();};Clib.ImgLogo.prototype.getLogo=function(){return this.server+this.getType()+"logo/"+this.getName()+".png";};Clib.ImgLogo.prototype.getThumb=function(){return this.server+this.getType()+"thumb/"+this.getName()+".png";};Clib.ImgLogo.prototype.setType=function(type){this.type=(type=="g")?"g":"";};Clib.ImgLogo.prototype.getType=function(){return this.type?this.type:"";};Clib.ImgLogo.prototype.getSrc=function(){if(this.defaultType=="logo"){return this.getLogo();}
return this.getThumb();}
Clib.ImgLogo.prototype.setText=function(text){this.name=text;}
Clib.ImgLogo.prototype.update=function(){var name=this.getName();var type=this.getType();if(name==this.currentName&&type==this.currentType)
return;if(this.img){this.img.remove();delete(this.img);}
this.currentName=name;this.currentType=type;if(!name){return;}
this.img=new Clib.Image({parent:this.div,src:this.getSrc()});};Clib.Flag=function(config){Ext.apply(this,config);this.el=Ext.get(this.el);if(!this.el){return;}
this.el.on("click",this.onClick,this);};Clib.Flag.prototype.onClick=function(){Clib.Tools.setCookie("language",this.lang,100,"/");location.reload();};Clib.Color=function(config){Ext.apply(this,config);for(var i=0;i<this.id.length;i++){var el=Ext.get(this.id[i]);if(el){el.on("click",this.onClick,this);}}};Clib.Color.prototype={getKey:function(){return this.key;},onClick:function(){this.colorChooser.change(this);},getColor:function(){return this.color;},getType:function(){if(!this.type){return"";}
return this.type;}}
Clib.ColorChooser=function(config){this.elements=new Object();for(var i in config.elements){config.elements[i].colorChooser=this;config.elements[i].key=i;this.elements[i]=new Clib.Color(config.elements[i]);}
var def=Clib.CookieManager.get("colkey");if(!def){return;}
this.change(this.elements[def]);};Clib.ColorChooser.prototype.get=function(name){return this.elements[name];};Clib.ColorChooser.prototype.getCurrent=function(){return this.currentColor;};Clib.ColorChooser.prototype.changeNotStore=function(color){if(!color){return;}
if(logoChooser){logoChooser.setType(color.getType());logoChooser.storeLogo();logoChooser.updateLogo();}
var colorName=color.getColor();var el=Ext.get(defaultColor);this.currentColor=colorName;if(el.dom.id==colorName)
return;el.dom.id=colorName;defaultColor=colorName;var pngs=Ext.DomQuery.select('.png');for(var i=0;i<pngs.length;i++){Ext.fly(pngs[i]).repaint();}};Clib.ColorChooser.prototype.change=function(color){if(!color||!color.getKey()){return;}
this.changeNotStore(color);Clib.CookieManager.set("colkey",color.getKey());Clib.Tools.setCookie("color",color.getColor(),100,"/","");}
Clib.ModalDialogsCache=new Array();Clib.Dialog=function(config){var element=Ext.get(config.element);this.bgClass=config.bgClass;if(Clib.ModalDialogsCache[element.id]){return Clib.ModalDialogsCache[element.id];}
Clib.ModalDialogsCache[element.id]=this;this.dialog=element;this.dialog.appendTo(document.body);if(config.bgOpacity>0)
this.bgOpacity=config.bgOpacity;else
this.bgOpacity=0.90;this.noBgClose=config.noBgClose;this.hide();};Clib.Dialog.prototype.resizeBg=function(){this.bg.setWidth(parseInt(document.documentElement.scrollWidth));this.bg.setHeight(parseInt(document.documentElement.scrollHeight));};Clib.Dialog.prototype.onResize=function(){if(this.hidden){return;}
this.resizeBg();this.centerWindow();};Clib.Dialog.prototype.hide=function(){this.hidden=true;if(this.bg){this.bg.remove();}
this.dialog.hide();this.dialog.dom.style.display='none';};Clib.Dialog.prototype.centerWindow=function(){if(this.hidden){return;}
this.dialog.center();};Clib.Dialog.prototype.show=function(){Ext.EventManager.on(window,"scroll",this.centerWindow,this);Ext.EventManager.on(window,"resize",this.onResize,this);this.hidden=false;this.bg=this.dialog.createProxy(this.bgClass);if(!this.noBgClose){this.addCloseButton(this.bg.dom);}
this.dialog.dom.style.display='';this.dialog.dom.style.visibility='visible';this.dialog.dom.style.position='absolute';this.resizeBg();this.centerWindow();var bg=this.bg;this.bg.setOpacity(this.bgOpacity);this.dialog.show({duration:2});};Clib.Dialog.prototype.setCloseCallback=function(callback){this.closeBtCallBack=callback;};Clib.Dialog.prototype.addCloseButton=function(element,callback){if(callback){this.setCloseCallback(callback);}
var el=Ext.get(element);el.on("click",this.onClose,this);};Clib.Dialog.prototype.onClose=function(){this.hide();if(this.closeBtCallBack){this.closeBtCallBack(this);}};Clib.Preview=function(config){if(service=="flight")
return;config.iframeProperties.tag="iframe";this.iframeProperties=config.iframeProperties;this.window=new Clib.Dialog(config);this.container=Ext.get(config.container);this.window.addCloseButton(Ext.get(config.closedialog).dom);var self=this;this.window.setCloseCallback(function(){self.hide();});};Clib.Preview.prototype.show=function(el){this.iframe=this.container.createChild(this.iframeProperties);this.iframe.dom.src=el.href;this.window.show();};Clib.Preview.prototype.showUrl=function(url){this.iframe=this.container.createChild(this.iframeProperties);this.iframe.dom.src=url;this.window.show();};Clib.Preview.prototype.hide=function(){if(this.iframe&&this.iframe.dom){this.container.dom.removeChild(this.iframe.dom);this.iframe=null;}
this.opened=false;};Clib.JsIt=function(){return{templateCache:new Object(),getTemplate:function(id){if(!this.templateCache[id]){this.templateCache[id]=new Clib.Template(id);}
return this.templateCache[id];}};}();Clib.Template=function(id){this.init(id);};Clib.Template.prototype.init=function(id){var root=Ext.get(id);if(!root){return;}
var html=root.dom.innerHTML;html=html.replace(/<!--/g,"_BEGIN_<!--");html=html.replace(/-->/g,"-->_END_");var lines=html.split(/(_BEGIN_|_END_)/);var template="var html = \"\";";for(var i=0;i!=lines.length;i++){var result=lines[i].match(/<!--\s*js:\s*(.*?)\s*-->/);if(result!=null&&result[0]){template+=result[1];}
else{var line=Clib.Tools.urlDecode(lines[i]);line=line.replace(/III(.*?)III/g,"_TODEQUOTE_ (\" + $1 + \")");line=line.replace(/\r/g,"\\r");line=line.replace(/\n/g,"\\n");line=line.replace(/\'/g,"\\'");line=line.replace(/\"/g,"\\\"");var motif=line.match(/_TODEQUOTE_ \((.*?)\)/);while(motif){for(var c=1;c<motif.length;c++){var mot=motif[c].replace(/\\/g,"");line=line.replace(motif[c],mot);}
line=line.replace(/_TODEQUOTE_ \((.*?)\)/,"$1");motif=line.match(/_TODEQUOTE_ \((.*?)\)/);}
template+="html +=\""+line+"\";\n";}}
template=template.replace(/_BEGIN_/g,"");template=template.replace(/_END_/g,"");this.template=template;};Clib.Template.prototype.render=function(params){if(!this.template){return;}
for(var i in params){var toEval="var "+i+" = params[i];";eval(toEval);}
eval(this.template);return html;};Clib.Image=function(conf){this.config=conf;var childOptions={tag:"img",border:0};if(conf.className){childOptions.cls=conf.className;}
this.parent=Ext.get(conf.parent)
this.img=this.parent.createChild(childOptions);this.img.hide();this.img.on("load",this.onLoad,this);this.img.on("error",this.onError,this);this.img.dom.src=conf.src;this.fade=conf.fade;};Clib.Image.prototype.onError=function(){if(this.config.defaultImage){this.img.dom.src=this.config.defaultImage;}};Clib.Image.prototype.onLoad=function(){if(this.fade){this.img.show({duration:1,callback:this.loaded,scope:this});}
else{this.img.show();}
this.origWidth=this.img.getWidth();this.origHeight=this.img.getHeight();this.parentNode=this.img.dom.parentNode;this.patchIePng(this.img.dom);};Clib.Image.prototype.loaded=function(){this.img.clearOpacity();}
Clib.Image.prototype.scale=function(factor){this.img.setWidth(this.img.getWidth()*factor);this.img.setHeight(this.img.getHeight()*factor);};Clib.Image.prototype.reset=function(){this.img.setWidth(this.origWidth);this.img.setHeight(this.origHeight);};Clib.Image.prototype.addListener=function(eventName,fn,scope,options){this.img.on(eventName,fn,scope,options);};Clib.Image.prototype.remove=function(){this.img.remove();}
Clib.Image.prototype.patchIePng=function(){if(!Ext.isIE6||Ext.isIE8){return;}
var img=this.img.dom;var imgName=img.src.toUpperCase();if(imgName.substring(imgName.length-3,imgName.length)!="PNG"){return;}
var imgID=(img.id)?"id='"+img.id+"' ":"";var imgClass=(img.className)?"class='"+img.className+"' ":"";var imgTitle=(img.title)?"title='"+img.title+"' ":"title='"+img.alt+"' ";var imgStyle="display:inline-block;"+img.style.cssText;if(img.align=="right"){imgStyle="float:right;"+imgStyle;}
if(img.align=="left"){imgStyle="float:left;"+imgStyle;}
if(img.align=="right"){imgStyle="float:right;"+imgStyle;}
if(img.vspace){imgStyle="margin-top:"+img.vspace+"px;margin-bottom:"+img.vspace+"px;"+imgStyle;}
if(img.hspace){imgStyle="margin-left:"+img.hspace+"px;margin-right:"+img.hspace+"px;"+imgStyle;}
if(img.parentElement&&img.parentElement.href){imgStyle="cursor:hand;"+imgStyle;}
var strNewHTML="<span "+imgID+imgClass+imgTitle+" style=\"";strNewHTML+="width:"+Ext.fly(img).getWidth()+"px;";strNewHTML+="height:"+Ext.fly(img).getHeight()+"px;";strNewHTML+=imgStyle+";"+"filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"+"(src='"+img.src+"',sizingMethod='crop');\">&nbsp;</span>";this.img.remove();var newImg=this.parent.createChild({tag:'div'});newImg.update(strNewHTML);this.img=newImg;}
var form;var logoChooser;var colorChooser;var defaultSearchType="text";var autoSubmit=false;var imgServer="";var searchXML="";var defaultType="logo";var xiti;var x_imgsz;var x_imgformat;var siteDefaultEnabled=false;var startPreview=false;var preview;var colors={gris_2:{id:["color_gris_2","color_gris_2_p"],color:"gris_2"},vert_2:{id:["color_vert_2","color_vert_2_p"],color:"vert_2"},rose_2:{id:["color_rose_2","color_rose_2_p"],color:"rose_2"},bleu_2:{id:["color_bleu_2","color_bleu_2_p"],color:"bleu_2"},violet:{id:["color_violet","color_violet_p"],color:"violet"},blanc:{id:["color_blanc","color_blanc_p"],color:"blanc",type:"g"},gris:{id:["color_gris","color_gris_p"],color:"gris"},vert:{id:["color_vert","color_vert_p"],color:"vert"},rose:{id:["color_rose","color_rose_p"],color:"rose"},marron:{id:["color_marron","color_marron_p"],color:"marron"},bleu:{id:["color_bleu","color_bleu_p"],color:"bleu"}}
var flags={en:{el:"flag_en",lang:"en"},fr:{el:"flag_fr",lang:"fr"},it:{el:"flag_it",lang:"it"},es:{el:"flag_es",lang:"es"}};Clib.Yt={adaptStruct:function(code,entry){var rating="00";if(entry['gd$rating']){rating=entry['gd$rating'].average;rating=Math.round(rating*2)*5;rating=String.leftPad(rating,2,"0");}
var runtime;if(entry["media$group"]){var duration=entry["media$group"]["yt$duration"].seconds;var mins=String(Math.floor(duration/60));mins=String.leftPad(mins,2,"0");var seconds=String(duration%60);seconds=String.leftPad(seconds,2,"0");var runtime=mins+":"+seconds;}
return{code:code,image:'http://i2.ytimg.com/vi/'+code+'/default.jpg',short_title:entry.title['$t'],evaluation:rating,runtime:runtime,style:""};}};Clib.Player=function(element){this.video="";this.rootNode=Ext.get(element);this.loaded=false;this.playerPanel=new Ext.ux.YoutubePlayer({developerKey:DEVELOPER_KEY,playerId:'myytplayer',playerUrl:'/swf/yt.swf',additionalParams:'',bgColor:"#666666",border:false,ratioMode:'stretch',hideMode:'visibility',renderTo:element});this.playerPanel.on('ready',this.onReady,this);element=Ext.get(element);var size=element.getBox();var p=new Ext.Panel({items:[this.playerPanel],layout:'fit',cls:'msgBox',hideBorders:true,baseCls:"none",hideMode:'visibility',width:size.width,height:size.height,renderTo:element});this.playerPanel.on('error',this.onPlayerError,this);this.playerPanel.on('stateChange',this.onStateChange,this);this.playerPanel.on('play',this.onPlayVideo,this);this.playerPanel.on('pause',this.onPauseVideo,this);this.playerPanel.on('shuffle',this.onShuffle,this);this.playerPanel.on('repeat',this.onRepeat,this);this.playerPanel.on('hd',this.test,this);this.playerPanel.on('previous',this.onPrevious,this);this.playerPanel.on('next',this.onNext,this);this.playerPanel.on('fullscreen',this.onFullScreen,this);this.playerPanel.on('volume',this.onVolumeChange,this);this.playerPanel.on('mute',this.onMuteChange,this);};Clib.Player.prototype.onReady=function(panel,pl){this.loaded=true;this.panel=panel;this.hd=Clib.CookieManager.get("hd")||"hdon";this.setHd(this.hd);this.repeat=Clib.CookieManager.get("repeat")||"off";this.setRepeat(this.repeat);this.shuffle=Clib.CookieManager.get("shuffle")||"off";this.setShuffle(this.shuffle);this.volume=Clib.CookieManager.get("volume")||100;this.setVolume(this.volume);this.mute=Clib.CookieManager.get("mute")||"off";this.setMute(this.mute);this.panel.setLoaded();if(this.playing){this.loadVideo(this.playing,this.lastCallback,this.lastVideoManager);}}
Clib.Player.prototype.onPlayerError=function(code){}
Clib.Player.prototype.onFullScreen=function(panel,pl){}
Clib.Player.prototype.onPlayVideo=function(){this.panel.playVideo();}
Clib.Player.prototype.onPauseVideo=function(){this.panel.pauseVideo();}
Clib.Player.prototype.onShuffle=function(){this.swapShuffle();}
Clib.Player.prototype.onStateChange=function(newState){if(newState=="ended"&&this.stopEnd===false){currentVideoList.nextVideo();}}
Clib.Player.prototype.onRepeat=function(){this.swapRepeat();}
Clib.Player.prototype.onNext=function(){currentVideoList.nextVideo();}
Clib.Player.prototype.onPrevious=function(){currentVideoList.previousVideo();}
Clib.Player.prototype.onVolumeChange=function(newValue){this.setVolume(newValue);}
Clib.Player.prototype.onMuteChange=function(){this.swapMute();}
Clib.Player.prototype.swapHd=function(){if(this.hd=="on"){return this.setHd("off");}
this.setHd("on");}
Clib.Player.prototype.getHd=function(){return this.hd=="on";}
Clib.Player.prototype.setHd=function(value){this.hd=value;Clib.CookieManager.set("hd",value);this.panel.setHd(this.getHd());}
Clib.Player.prototype.swapRepeat=function(){if(this.repeat=="on"){return this.setRepeat("off");}
this.setRepeat("on");}
Clib.Player.prototype.getRepeat=function(){return this.repeat=="on";}
Clib.Player.prototype.setRepeat=function(value){this.repeat=value;Clib.CookieManager.set("repeat",value);this.panel.setRepeat(this.getRepeat());}
Clib.Player.prototype.swapShuffle=function(){if(this.shuffle=="on"){return this.setShuffle("off");}
this.setShuffle("on");}
Clib.Player.prototype.getShuffle=function(){return this.shuffle=="on";}
Clib.Player.prototype.setShuffle=function(value){this.shuffle=value;Clib.CookieManager.set("shuffle",value);this.panel.setShuffle(this.getShuffle());}
Clib.Player.prototype.getVolume=function(){return this.volume;}
Clib.Player.prototype.setVolume=function(value){value=Math.max(value,0);value=Math.round(Math.min(value,100));this.volume=value;if(value>0&&this.getMute()){this.setMute('off');}
Clib.CookieManager.set("volume",value);this.panel.setVolume(this.getVolume());}
Clib.Player.prototype.swapMute=function(){if(this.mute=="on"){return this.setMute("off");}
this.setMute("on");}
Clib.Player.prototype.getMute=function(){return this.mute=="on";}
Clib.Player.prototype.setMute=function(value){this.mute=value;Clib.CookieManager.set("mute",value);this.panel.mute(this.getMute());}
Clib.Player.prototype.loadVideo=function(code,callback,videoManager){this.playing=code;if(callback){this.lastCallback=callback;}
if(videoManager){this.lastVideoManager=videoManager;}
if(!this.loaded){return;}
this.stopEnd=true;this.panel.cueVideoById(code,0);var self=this;setInterval(function(){self.stopEnd=false;},1000);if(callback){setTimeout(function(){self.panel.pauseVideo();},50);setTimeout(function(){self.call(callback);},100);}}
Clib.Player.prototype.call=function(method,arguments,qText){if(this.loaded===false||!this.panel){return;}
arguments||(arguments=new Array());this.panel[method](arguments[0],arguments[1]);}
Clib.VideoManager=function(template,rootElement,qText){this.template=Clib.JsIt.getTemplate(template);this.title=Ext.get("videoTitle");this.qText=qText;this.root=Ext.get(rootElement);this.titles={};this.videos={};this.thumbs={};this.anchors={};this.qtips={};}
Clib.VideoManager.prototype.disableQtips=function(){for(var i in this.qtips){this.qtips[i].disable();}};Clib.VideoManager.prototype.enableQtips=function(){for(var i in this.qtips){this.qtips[i].enable();}};var lastVideoManager;Clib.VideoManager.prototype.loadVideo=function(code,callback){this.title.update(this.titles[code]);if(lastVideoManager){lastVideoManager.endPlaying();}
this.lastVideo=code;player.loadVideo(code,callback,this);this.startPlaying();lastVideoManager=this;};Clib.VideoManager.prototype.startPlaying=function(){if(this.lastVideo){this.anchors[this.lastVideo].addClass("playing");}}
Clib.VideoManager.prototype.endPlaying=function(){if(this.lastVideo&&this.anchors[this.lastVideo]){this.anchors[this.lastVideo].removeClass("playing");}};Clib.VideoManager.prototype.createAnchor=function(id,code){this.anchors[code]=this.root.createChild({tag:"div",id:id,cls:"anchor"});this.anchors[code].setVisibilityMode(Ext.Element.DISPLAY);this.anchors[code].hide();};Clib.VideoManager.prototype.addVideo=function(video,fade){var longTitle=video.short_title;video.short_title=video.short_title.substr(0,55);this.videos[video.code]=this.anchors[video.code].createChild(this.template.render(video));video.short_title=longTitle;this.anchors[video.code].show();this.thumbs[video.code]=new Clib.Image({parent:video.type+"_thumb_"+video.code,src:video.image,fade:fade});this.qtips[video.code]=new Ext.ToolTip({target:video.operation+"_"+video.code,html:this.qText,title:'Aide'});this.titles[video.code]=video.short_title;}
Clib.VideoManager.prototype.removeVideo=function(code){var el=this.anchors[code];delete(this.titles[code]);this.qtips[code]=null;el.code=code;el.hide({callback:this.removeFirstStep,scope:this});}
Clib.VideoManager.prototype.removeFirstStep=function(element){this.thumbs[element.code].remove();this.thumbs[element.code]=null;element.setWidth(0,{duration:1,callback:this.afterRemove,scope:this})}
Clib.VideoManager.prototype.afterRemove=function(element){this.videos[element.code].remove();this.videos[element.code]=null;this.anchors[element.code].remove();this.anchors[element.code]=null;}
Clib.TabManager=function(config){Ext.apply(this,config);this.current=Ext.get(this.current);this.styleId=Ext.get(this.styleId);this.tabList={};for(var i in this.tabs){this.tabList[i]=Ext.get(i);}}
Clib.TabManager.prototype.show=function(tab){this.current.removeClass("tabOpen");this.styleId.removeClass(this.tabs[this.current.id]);this.current=this.tabList[tab];this.current.addClass("tabOpen");this.styleId.addClass(this.tabs[this.current.id]);}
Clib.VideoOrder=function(){}
Clib.VideoOrder.prototype.shuffle=function(number){return Math.floor(Math.random()*number);}
Clib.VideoOrder.prototype.chooseNext=function(videoNum,videoPlaying){var shuffle=player.getShuffle();if(shuffle){return this.shuffle(videoNum);}
var repeat=player.getRepeat();if(videoPlaying===undefined){videoPlaying=0;}
videoPlaying++;if(videoNum==videoPlaying){if(repeat){videoPlaying=0;}else{return undefined;}}
return videoPlaying;}
Clib.VideoOrder.prototype.choosePrevious=function(videoNum,videoPlaying){var shuffle=player.getShuffle();if(shuffle){return this.shuffle(videoNum);}
var repeat=player.getRepeat();if(videoPlaying===undefined){videoPlaying=videoNum;}
videoPlaying--;if(videoPlaying<0){if(repeat){return videoNum-1;}else{return undefined;}}
return videoPlaying;}
Clib.SearchList=function(videos){this.videoManager=new Clib.VideoManager("videoTemplate","videoElements",translation.quicklistAdd);this.videoOrder=new Clib.VideoOrder();this.init(videos);}
Clib.SearchList.prototype.init=function(videos){this.videos={};this.ordered={};var regexp=/video:(.*)/i;this.videoCount=0;var firstVideo;if(!videos.feed.entry){var el=Ext.get("no_results");el.dom.style.display="block";return;}
for(var i=0;i<videos.feed.entry.length;i++){var video=videos.feed.entry[i];var code=video.id["$t"].match(regexp)[1];;if(!code){continue;}
if(!firstVideo){firstVideo=code;}
this.ordered[this.videoCount]=code;this.videoCount++;var video=Clib.Yt.adaptStruct(code,video);this.videoManager.createAnchor("video_anchor_"+code,code);video.type="video";video.operation="add";video.id=i;video.code=code;if(quickList.has(code)){video.style="hidden";}
this.videos[code]=video;this.videoManager.addVideo(this.videos[code],true);}
var playback;if(startPlay){playback="playVideo";}
if(firstVideo){this.videoManager.loadVideo(firstVideo,playback);}}
Clib.SearchList.prototype.getVideo=function(code){return this.videos[code];}
Clib.SearchList.prototype.nextVideo=function(){var choosen=this.videoOrder.chooseNext(this.videoCount,this.currentPlaying);if(choosen===undefined){return;}
if(!this.ordered[choosen]){return;}
this.play(this.ordered[choosen]);}
Clib.SearchList.prototype.previousVideo=function(){var choosen=this.videoOrder.choosePrevious(this.videoCount,this.currentPlaying);if(choosen===undefined){return;}
if(!this.ordered[choosen]){return;}
this.play(this.ordered[choosen]);}
Clib.SearchList.prototype.play=function(code){currentVideoList=this;this.playing=code;this.currentPlaying=0;for(var i in this.ordered){if(this.ordered[i]==code){this.currentPlaying=i;break;}}
this.videoManager.loadVideo(code,'playVideo');}
Clib.SearchList.prototype.getVideoManager=function(){return this.videoManager;}
Clib.SearchList.prototype.pause=function(code){currentVideoList=this;player.call("pauseVideo");}
Clib.SearchList.prototype.removeVideo=function(code){this.videoManager.removeVideo(code);}
Clib.QuickList=function(title){this.title=Ext.get(title);this.text=this.title.dom.innerHTML;this.videoOrder=new Clib.VideoOrder();this.quickListManager=new Clib.VideoManager("videoTemplate","quickListElements",translation.quicklistDelete);this.quickList={};var quick=Clib.Tools.getCookie("quicklist");if(quick&&quick!=="undefined"){this.quickList=Ext.urlDecode(quick);}
var self=this;window.videoInformation=function(response){self.gotResponse(response);};this.reorderList();}
Clib.QuickList.prototype.gotResponse=function(response){var regexp=/video:(.*)/i;var code=response.entry.id['$t'].match(regexp)[1];var struct=Clib.Yt.adaptStruct(code,response.entry);struct.type="quick";struct.operation="remove";struct.id=code;this.quickListManager.addVideo(struct,"anchor_"+code,false);}
Clib.QuickList.prototype.getVideoManager=function(){return this.quickListManager;}
Clib.QuickList.prototype.reorderList=function(){this.last=0;var ordered={};this.ordered={};var elements=[];for(var i in this.quickList){ordered[this.quickList[i]]=i;this.last++;}
for(i in ordered){elements.push(ordered[i]);}
for(var i=0;i<this.last;i++){this.quickList[elements[i]]=i;this.ordered[i]=elements[i];}
this.updateTitle();}
Clib.QuickList.prototype.has=function(code){return this.quickList[code]!==undefined;}
Clib.QuickList.prototype.updateTitle=function(){this.title.update(this.last);};Clib.QuickList.prototype.init=function(){for(var i in this.ordered){var code=this.ordered[i];if(code===undefined){continue;}
this.quickListManager.createAnchor("anchor_"+code,code)
var url='http://gdata.youtube.com/feeds/api/videos/'+code+'?alt=json-in-script&callback=videoInformation&v=2';Clib.Tools.addJS(url);}};Clib.QuickList.prototype.add=function(code){if(this.quickList[code]){return;}
var element=videoList.getVideo(code);element.type="quick";element.operation="remove";element.style="";this.quickList[element.code]=this.last;this.ordered[this.last]=element.code;this.last++;this.updateTitle();this.store();this.quickListManager.createAnchor("anchor_"+element.code,element.code)
this.quickListManager.addVideo(element,"anchor_"+element.code,false);var position=Ext.fly("quicklist_button").getBox();var to={x:position.x+position.width/2,y:position.y+position.height/2};to.x-=150;var plusButton=Ext.get("add_"+element.code);var pos=plusButton.getBox();plusButton.position("absolute",undefined,pos.x,pos.y);var distance=Math.sqrt(Math.pow(to.x-pos.x,2)+Math.pow(to.y-pos.y,2));var speed=500;var duration=distance/speed;plusButton.addClass("clicked");plusButton.moveTo(to.x,to.y,{callback:function(){plusButton.hide();},duration:duration});}
Clib.QuickList.prototype.store=function(){var data=Ext.urlEncode(this.quickList);Clib.Tools.setCookie("quicklist",data,100,"/","");}
Clib.QuickList.prototype.remove=function(code,goNext){if(!code){code=this.playing;}
if(code==this.playing&&goNext!==true){this.nextVideo();}
delete(this.ordered[this.quickList[code]]);delete(this.quickList[code]);this.reorderList();this.store();this.quickListManager.removeVideo(code);var plusButton=Ext.get("add_"+code);if(plusButton){plusButton.clearPositioning();plusButton.removeClass("clicked");plusButton.show();}}
Clib.QuickList.prototype.removeAll=function(){Ext.Msg.show({buttons:Ext.Msg.YESNO,closeable:false,fn:this.removeAllOk,scope:this,cls:"msgBox",buttons:{yes:'Oui',no:'Non'},modal:true,msg:translation.removeQuicklist,proxyDrag:true,width:220,title:translation.removeQuicklistTitle});}
Clib.QuickList.prototype.removeAllOk=function(response){if(response=="no"){return;}
for(var i in this.quickList){try{this.remove(i);}catch(e){}}}
Clib.QuickList.prototype.nextVideo=function(){if(this.last<=0){return;}
var choosen=this.videoOrder.chooseNext(this.last,this.quickList[this.playing]);if(choosen===undefined){return;}
if(!this.ordered[choosen]){return;}
this.play(this.ordered[choosen]);}
Clib.QuickList.prototype.previousVideo=function(){if(this.last<=0){return;}
var choosen=this.videoOrder.choosePrevious(this.last,this.quickList[this.playing]);if(choosen===undefined){return;}
if(!this.ordered[choosen]){return;}
this.play(this.ordered[choosen]);}
Clib.QuickList.prototype.play=function(code){if(!this.ordered[0]){return;}
if(!code){if(this.playing){player.call('playVideo');return;}
code=this.ordered[0];}
this.playing=code;currentVideoList=this;this.quickListManager.loadVideo(code,'playVideo');}
Clib.QuickList.prototype.pause=function(code){player.call('pauseVideo');}
var images;var ads;var cyberUrl="http://js.cybermonitor.com/lost.js";var tabs;var quickList;var videoList;var currentVideoList;var player;var loadDone=false;var DEVELOPER_KEY='AI39si4rPzPgq46MHrIh3IXuXcBH_hl_mzE_4gRBkYlKzOQPdUDjs1vlU0GhWy_eLQLGvma__VCHzEtVwrKXULG6RH1IBQrlrg';var pages;var start;var end;var progressBar;var service;var kelkoo;var calendarDeparture;var calendarReturn;var calendarHotel;var serviceClass;var ajax_query;var company;var startPlay=false;var logoUrl="http://"+window.location.hostname;Clib.Tools.setBgImage=function(bgImage)
{bgImage=bgImage||Clib.CookieManager.get("bg_image");Clib.CookieManager.set("bg_image",bgImage);if(!bgImage||bgImage=="none"){Ext.fly("persoType").removeClass("homePerso");Clib.Tools.setCookie("persotype","classic",100,"/","");return;}
Clib.Tools.setCookie("persotype","homePerso",100,"/","");var bgHome=Ext.get("bgHome");if(!bgImage||!bgHome)return;Ext.fly("persoType").addClass("homePerso");Ext.fly("partner").removeClass("part_on");bgHome.dom.style.backgroundImage="url("+bgImage+")";};Clib.Tools.partnerOn=function(){var color=colorChooser.getCurrent();Clib.CookieManager.set("oldColor",color);Clib.Tools.activatePartner(window.lastPartner);}
var currCss=null;Clib.Tools.activatePartner=function(name){if(!name){name=window.lastPartner;}
if(name=="off"){Clib.Tools.desactivatePartner();}
var part;if(!window.partners){return;}
for(var i=0;i<window.partners.length;i++){if(window.partners[i].value==name){part=partners[i];}}
if(!part){return;}
myform.getElement('x_skin').selectByValue(name);Clib.Tools.addCSS(cdnServer+part.css);Ext.fly("perso").addClass("perso");if(Ext.fly("persoType"))
Ext.fly("persoType").addClass("homePerso");Clib.CookieManager.set("partner",name);colorChooser.change(colorChooser.get(part.color));if(window.section&&window.section=="index"){Ext.fly("partner").addClass("part_on");Ext.fly("partner").removeClass("last_part");if(name==window.lastPartner){Ext.fly("partner").addClass("last_part");}}else{Ext.fly("perso").addClass("part_on");}
var bgHome=Ext.get("bgHome");if(bgHome){bgHome.dom.style.cssText="";Clib.Tools.resizeBg();}}
Clib.Tools.desactivatePartner=function(){Ext.fly("partner").removeClass("part_on");Ext.fly("partner").removeClass("last_part");Clib.CookieManager.set("partner","off");var color=Clib.CookieManager.get("oldColor");if(color){colorChooser.change(colorChooser.get(color));}
Clib.Tools.setBgImage();}
Clib.Tools.getBgMediumAndBgSmall=function(){var result={medium:{width:0,height:0},small:{width:0,height:0}};for(var s=0;s!=document.styleSheets.length;s++){var css=document.styleSheets[s];try{if(css.rules)
css.cssRules=css.rules;var len=css.cssRules.length;for(var c=0;c!=len;c++){var style=css.cssRules[c].style;if(css.cssRules[c].selectorText&&css.cssRules[c].selectorText.match(".part_on")&&css.cssRules[c].selectorText.match(".bg-medium")){var style=css.cssRules[c].style;if(style.maxWidth){result.medium.width=parseInt(style.maxWidth);}
if(style.maxHeight){result.medium.height=parseInt(style.maxHeight);}}
else if(css.cssRules[c].selectorText&&css.cssRules[c].selectorText.match(".part_on")&&css.cssRules[c].selectorText.match(".bg-small")){var style=css.cssRules[c].style;if(style.maxWidth){result.small.width=parseInt(style.maxWidth);}
if(style.maxHeight){result.small.height=parseInt(style.maxHeight);}}}}
catch(e){}}
return result;}
Clib.Tools.resizeBg=function(){var bgHome=Ext.get('bgHome');if(!bgHome){return;}
var size=Ext.getBody().getViewSize();var sizes=Clib.Tools.getBgMediumAndBgSmall();size.width=Math.max(size.width,minWidth);size.width=Math.min(size.width,maxWidth);size.height=Math.max(size.height,minHeight);size.height=Math.min(size.height,maxHeight);var smallW=smallMaxWidth;if(sizes.small.width)
smallW=sizes.small.width;var mediumW=mediumMaxWidth;if(sizes.medium.width)
mediumW=sizes.medium.width;bgHome.removeClass("bg-small");bgHome.removeClass("bg-medium");if(size.width<mediumW){bgHome.addClass("bg-medium");}
if(size.width<smallW){bgHome.addClass("bg-small");}
bgHome.setWidth(size.width-marginX);bgHome.setHeight(size.height-marginY);var cadreExterne=Ext.get("partOnOff");cadreExterne.setWidth(size.width-marginX);cadreExterne.setHeight(size.height-marginY);var partnerOn=Ext.get('partnerOn');if(partnerOn){if(document.documentElement.scrollHeight<=document.documentElement.clientHeight){var orig=Ext.getBody().getViewSize();if(bgHome.getHeight()){partnerOn.setBottom(orig.height-bgHome.getHeight());}
else{var tmf=function(){Clib.Tools.resizeBg();};}}}};Clib.AddPartner=function(config){this.el=Ext.get('partnerOn');if(!this.el){return;}
this.close=Ext.get('closePartner');Clib.AddPartner.superclass.constructor.call(this,config);this.el.on("click",this.onClick,this);this.el.hover(this.onOverIn,this.onOverOut,this);this.clap=Ext.get("clapOn");this.clap.on('click',this.onClapClick,this);this.clap.hide();this.el.hide();if(Clib.CookieManager.get('disablePartner')=="true"){this.clap.show(true);}else{if(Ext.isIE){this.el.show();this.close.hide({duration:1.5});}else{this.el.show({callback:function(){this.close.hide({duration:1.5});},scope:this});}}}
Ext.extend(Clib.AddPartner,Ext.util.Observable,{onClapClick:function(){Clib.CookieManager.set('disablePartner','false');this.el.show(!Ext.isIE);this.clap.hide();},onClick:function(evt,target,options){if(target.id=="closePartnerImg"||target.id=="closePartner"){Clib.CookieManager.set('disablePartner','true');this.el.hide(!Ext.isIE);this.close.hide(true);this.clap.show(true);}else{Clib.Tools.partnerOn();}},onOverIn:function(){this.close.show();},onOverOut:function(){this.close.hide();}});function load(){if(loadDone)
return;loadDone=true;try{logoChooser=new Clib.Logo({server:imgServer,imgDiv:"pos_bloc_logo_img",defaultType:defaultType});colorChooser=new Clib.ColorChooser({elements:colors});form=new Clib.Form("x_form",{autoSubmit:autoSubmit,rootElement:"searchType"});var elements={x_filetype:new Clib.Select({el:"x_filetype",searchTypes:{"text":"on"},form:form}),x_imgtype:new Clib.Select({el:"x_imgtype",searchTypes:{"image":"on"},form:form}),x_color:new Clib.Select({el:"x_color",searchTypes:{"image":"on"},form:form}),x_video_lr:new Clib.Select({el:"x_video_lr",searchTypes:{"video":"on"},form:form}),x_sort:new Clib.Select({el:"x_sort",searchTypes:{"video":"on"},form:form}),searchButton:new Clib.SearchButton({el:"hh",searchTypes:translation.searchButton,form:form}),searchButtonVoyage:new Clib.SearchButton({el:"hhVoyage",searchTypes:{"flight":translation.searchButton.flight},form:form}),personalizeButton:new Clib.PersonalizeButton({el:"hhh",searchTypes:{"logo":"on"},form:form}),personalizeBar:new Clib.PersonalizeBar({el:"logo_perso",checkboxId:"logo_active",searchTypes:{"logo":"on"},form:form}),x_bgurl:new Clib.BgUrl({el:"x_bgurl",searchTypes:{"logo":"on"},form:form,cookie:"bgurl"}),x_bgpath:new Clib.BgPath({el:"x_bgpath",defaultEnabled:false,searchTypes:{"logo":"on"},form:form,cookie:"bgpath"}),x_background:new Clib.SelectBg({el:"x_background",searchTypes:{"logo":"on"},form:form,defaultValue:'none',cookie:"bglist"}),x_skin:new Clib.SelectSkin({el:"x_skin",searchTypes:{"logo":"on"},form:form,cookie:"partner"}),searchEngine:new Clib.SearchEngine({ids:["g_search_engine","y_search_engine","m_search_engine"],form:form,disable:true}),x_lr:new Clib.Radio({ids:["all","il"],searchTypes:{"text":"on","wiki":"on"},form:form}),x_bgmode:new Clib.BgMode({ids:["perso_fond_list","perso_fond_path","perso_fond_url"],searchTypes:{"logo":"on"},disable:true,form:form,defaultValue:'list',cookie:"bgmode"}),text:new Clib.UpButton({el:"text",type:"text",form:form,submit:true,bar:'searchBar'}),image:new Clib.UpButton({el:"image",type:"image",form:form,submit:true,bar:'searchBar'}),wiki:new Clib.UpButton({el:"wiki",type:"wiki",form:form,submit:true,bar:'searchBar'}),logo:new Clib.PersoButton({el:"logo_change",type:"logo",form:form,submit:false,bar:'personalizeBar'}),video:new Clib.UpButton({el:"video",type:"video",form:form,submit:true,bar:'searchBar'}),music:new Clib.UpButton({el:"music",type:"music",form:form,submit:true,bar:'searchBar'}),flight:new Clib.FlightButton({el:"flight",type:"flight",form:form,submit:true,bar:'searchBar'}),x_service:new Clib.InputHidden({el:"x_service",searchTypes:{"text":"text","image":"image","wiki":"wiki","video":"video","music":"music","flight":"flight"},form:form}),start:new Clib.Page({el:"x_start",form:form}),number:new Clib.Page({el:"x_nr",form:form}),searchBar:new Clib.SearchBar({el:"x_query",searchTypes:{"text":"on","image":"on","wiki":"on","video":"on","music":"on","flight":"off"},form:form}),searchSite:new Clib.SearchSite({el:"x_site",defaultEnabled:siteDefaultEnabled,checkboxId:"x_search_site",searchTypes:{"text":"on","image":"on"},form:form})};if(x_imgsz){elements["x_imgsz"]=new Clib.ImgSize({el:"x_imgsz",form:form});elements["x_select_imgsz"]=new Clib.SelectImgSize({el:"x_select_imgsz",form:form});}
if(x_imgformat){elements["x_imgformat"]=new Clib.ImgSize({el:"x_imgformat",form:form});elements["x_select_imgformat"]=new Clib.SelectImgFormat({el:"x_select_imgformat",form:form});}
for(var i in elements){form.add(i,elements[i]);}
if(service)
form.change(elements[service],false);else
form.change(elements[defaultSearchType],false);for(var id in images){images[id]=new Clib.Image({parent:id,src:images[id],className:"Thumb",fade:true});}
var bgHome=Ext.get('bgHome');if(bgHome){window.onresize=Clib.Tools.resizeBg;Clib.Tools.resizeBg();}
var addPartner=new Clib.AddPartner();var videoPlayer=Ext.get("player");if(videoPlayer){player=new Clib.Player(videoPlayer);quickList=new Clib.QuickList("quicklist_button");videoList=new Clib.SearchList(videos);currentVideoList=videoList;tabs=new Clib.TabManager({current:"videoList",styleId:"section",tabs:{"videoList":"search","quickListDetails":"quickList"}});quickList.init();}
Clib.Tools.showAds();var topLinks=Ext.get("topLinks");if(topLinks){var to=topLinks.getBox();topLinks.position("absolute",undefined,to.x,to.y);topLinks.moveTo(to.x,0,{duration:1});}
if(startPreview){preview=new Clib.Preview({element:"dialog",bgClass:"modal",container:"content",closedialog:"close_dialog",iframeProperties:{width:"792px",height:"592px",frameBorder:"0",allowtransparency:false}});var efastdialog=new Clib.Preview({element:"efast",bgClass:"modal",container:"efastcontent",closedialog:"efastclose_dialog",noBgClose:true,bgOpacity:0.70,iframeProperties:{width:"692px",height:"422px",frameBorder:"0",allowtransparency:false,scrolling:'no'}});if(efast=='show')
efastdialog.showUrl("http://scache.eorezo.com/html/partners/lost/pub_lost.htm");}
window.myform=form;if(Ext.get("persoType")){Clib.Tools.setBgImage();}
var part=Clib.CookieManager.get("partner");if(part&&part!="off"){Clib.Tools.activatePartner(part);}
if(window.location.href.match(/#./)||window.location.href.match(/\?tab/)||window.location.href.match(/x_from=searchbar$/)){if(window.location.href.indexOf('#logo')>0){elements.logo.onClick();}else{Clib.Tools.setCookie("p","1",100,"/","");}
if(window.location.href.indexOf('#vols')>0){elements.flight.onClick();}}
var preload=Ext.get("preload");if(preload){preload.setVisibilityMode(Ext.Element.DISPLAY);preload.show();}}catch(e){throw(e);}finally{var loadedDiv=Ext.fly("loaded");if(loadedDiv){loadedDiv.removeClass("not_loaded").addClass("loaded");}
var res=Ext.get('resultat');if(res){res.show();}
Clib.Tools.addJS(cyberUrl);}
for(var i in flags){new Clib.Flag(flags[i]);}}
var adsReqNum=1;Clib.Tools.showAds=function(){if(!ads){return;}
var narrow=Clib.JsIt.getTemplate("narrowAdsTemplate");var wide=Clib.JsIt.getTemplate("wideAdsTemplate");var wideHTML="";var narrowHTML="";var wideAdsNum=0;var narrowAdsNum=0;for(var i=0;i<ads.length;i++){if(ads[i].type=="text/narrow"){narrowHTML+=narrow.render(ads[i]);narrowAdsNum++;}else{wideHTML+=wide.render(ads[i]);wideAdsNum++;}}
if(wideHTML!=""){Ext.fly("wideAds").update(wideHTML);Ext.get("googleWideAds").show();}
if(narrowHTML!=""){Ext.fly("narrowAds"+adsReqNum).update(narrowHTML);Ext.get("googleNarrowAds").show();}
if(ads.length>0){if(wideHTML!=""&&narrowHTML=="")
Clib.Tools.addJS("http://ads.eorezo.com/cgi-bin/advert/settags.cgi?x_dp_id=228&x_pub_id=0&x_tag_id=ads_wide&x_format=javascript&x_mode=args");if(wideHTML!=""&&narrowHTML!="")
Clib.Tools.addJS("http://ads.eorezo.com/cgi-bin/advert/settags.cgi?x_dp_id=228&x_pub_id=0&x_tag_id=ads_wide_narrow&x_format=javascript&x_mode=args");}}
Clib.TypeVolButton=function(config){this.config=config;if(Ext.get("type_vol1").dom.checked){this.addClass();this.setValue("");this.changeState();}
Clib.TypeVolButton.superclass.constructor.call(this,config);};Ext.extend(Clib.TypeVolButton,Clib.FormWidjet,{addHandlers:function(){this.el.on("click",this.onClick,this);},onClick:function(){this.setClass();this.setValue(this.valueOfInput);this.changeState();},getValue:function(){return this.el.dom.value;},setClass:function(){if(this.config.classAction=="remove")
this.removeClass();else
this.addClass();},addClass:function(){Ext.get("returnDateBlock").addClass(this.config.classInput);Ext.get("returnDate").addClass("input_disabled_color");},removeClass:function(){Ext.get("returnDateBlock").removeClass(this.config.classInput);Ext.get("returnDate").removeClass("input_disabled_color");},changeState:function(){Ext.get(this.config.inputToChange[0]).dom.disabled=this.desable;Ext.get(this.config.inputToChange[1]).dom.disabled=this.desable;},setValue:function(value){if(value)
Ext.get(this.config.inputToChange[0]).dom.value=value;else
Ext.get(this.config.inputToChange[0]).dom.value="";}});Clib.InputDate=function(config){Clib.InputDate.superclass.constructor.call(this,config);this.calendar=new Clib.Calendar({input:config.el,connectInput:config.connectInput,rendererTo:config.rendererTo,calendar:config.calendar,divToHide:config.divToHide,minDate:config.minDate});Ext.EventManager.on(this.el,'focus',this.onFocus,this);};Ext.extend(Clib.InputDate,Clib.FormWidjet,{setValue:function(value){this.el.dom.value=value;},getValue:function(){return this.el.dom.value;},getId:function(){return this.el.id;},onFocus:function(){this.normalBackground();},normalBackground:function(){this.el.addClass("font10v");this.el.addClass("input_closeto_select");Ext.get("returnDateBlock").addClass("returnDate_ON");this.el.removeClass("input_date_error");},errorBackground:function(){this.el.removeClass("font10v");this.el.removeClass("input_closeto_select");Ext.get("returnDateBlock").removeClass("returnDate_ON");this.el.addClass("input_date_error");},validate:function(type){if(type!="flight"){return true;}
else{if(this.getValue()||(this.el.id=="returnDate"&&Ext.get("type_vol1").dom.checked==true)){return true;}
this.errorBackground();return false;}}});var minDate;Clib.Calendar=function(config){Ext.apply(this,config);this.parent=Ext.get(this.calendar);this.config=config;this.dp=new Ext.DatePicker({renderTo:this.parent,hidden:true,monthNames:translation.monthNames,dayNames:translation.dayNames,showToday:true,todayText:translation.todayText,startDay:1});var d=new Date();var month=d.getMonth()+1
var day=d.getDate()
var year=d.getFullYear()
var currentTime=new Date(month+"/"+day+"/"+year);this.dp.setMinDate(currentTime);this.dp.on("select",this.onSelect,this);Ext.get(this.input).on("click",this.onClick,this);this.dp.on("show",this.onShow,this);this.dp.on("hide",this.onHide,this);this.parent.setWidth(this.dp.getEl().getWidth());this.layer=new Ext.Layer();this.layer.hide();this.layer.on("click",this.hide,this);}
Clib.Calendar.prototype.hide=function(){this.dp.hide();Ext.get(this.config.divToHide).show();}
Clib.Calendar.prototype.onShow=function(){this.layer.show();this.layer.addClass("mask");this.layer.setLeftTop(0,0);this.layer.setSize(Ext.lib.Dom.getViewWidth(true)-10,Ext.lib.Dom.getViewHeight(true)-10);Ext.get(this.config.divToHide).hide();}
Clib.Calendar.prototype.onHide=function(){this.layer.hide();this.layer.removeClass("mask");}
Clib.Calendar.prototype.onClick=function(){this.parent.alignTo(this.input);if(minDate&&!this.connectInput){this.dp.setMinDate(minDate);}
this.dp.show();}
Clib.Calendar.prototype.onSelect=function(obj,date){this.hide();Ext.get(this.input).dom.value=date.format('d/m/Y');minDate=date;if(this.connectInput){this.updateReturnDate(date,this.connectInput);}}
Clib.Calendar.prototype.getAmericanDate=function(d){var day=d.substr(0,2);var month=d.substr(3,2);var year=d.substr(6,4);var date=month+"/"+day+"/"+year;return date;}
Clib.Calendar.prototype.isBefore=function(d1,d2){var dt=new Date('1/10/2007');var millisec1=d1.getElapsed(dt);var millisec2=d2.getElapsed(dt);if(millisec1>millisec2)
return false
return true}
Clib.Calendar.prototype.updateReturnDate=function(d,input){var dateReturn=this.getAmericanDate(Ext.get(input).dom.value);dateReturn=new Date(dateReturn);if(!this.isBefore(d,dateReturn)){Ext.get(input).dom.value=d.format('d/m/Y');}}
Clib.FlightService=function(){this.config={sort:"flightsort",sortInput:"fs_sort",resultTemplate:"ResultsTemplate",query:ajax_query,noResults:translation.noFlightAvailables};}
Clib.FlightService.prototype.getDestination=function(){destination=Ext.get('destination').dom.value
var index2=destination.indexOf(',');if(index2!=-1)
destination=destination.substring(0,index2);return destination;}
Clib.FlightService.prototype.getDepart=function(){var depart=Ext.get('depart').dom.value;var index1=depart.indexOf(',');if(index1!=-1)
depart=depart.substring(0,index1);return depart;}
Clib.FlightService.prototype.updateResume=function(){Ext.get('flightDestination').update(this.getDestination());Ext.get('flightDepartureDate').update(Ext.get('departureDate').getValue());}
Clib.HotelService=function(){this.config={sort:"hotelsort",sortInput:"hs_sort",resultTemplate:"ResultsTemplate",query:ajax_query,noResults:""};}
Clib.HotelService.prototype.updateResume=function(){}
Clib.Kelkoo=function(service){this.service=service;this.config=service.config;this.results=new Array();this.images=new Array();this.resultTemplate=this.config.resultTemplate;this.url=this.config.query;this.sort=Ext.get(this.config.sort);this.progress=Ext.get('progressbar');this.preload=Ext.get('preload_kelkoo');this.searching=Ext.get('searching');this.resume=Ext.get('resume');this.errorDiv=Ext.get('error');this.bottomBar=Ext.get('bottom_bandeau');}
Clib.Kelkoo.prototype.search=function(){var url=this.url+"&callback=kelkoocb";Clib.Tools.addJS(url);var self=this;window.kelkoocb=function(response){self.onSuccess(response);}}
Clib.Kelkoo.prototype.onFailure=function(resultats){this.search();}
Clib.Kelkoo.prototype.onSuccess=function(response,options){kelkoo.results=response;if(!this.results[0]){Ext.fly("resume").addClass("no_results");this.statusSearch('error');this.error(this.config.noResults);return;}
if(kelkoo.results){Ext.fly("resume").addClass("results");if(kelkoo.results[0].error){this.error(kelkoo.results[0].error);return;}
this.priceMax=kelkoo.results[kelkoo.results.length-1].prix;this.priceMin=kelkoo.results[0].prix;this.priceIndicator=new Clib.PriceIndicator(kelkoo.results);this.showResultsKelkoo(0);pages=new Clib.Pages(kelkoo.results.length);this.service.updateResume();}}
Clib.Kelkoo.prototype.error=function(serverError){this.errorDiv.update(serverError);this.statusSearch('error');this.resume.addClass('no_results');}
Clib.Kelkoo.prototype.setImages=function(src,id,clazz){this.images[id]=new Clib.Image({parent:id,src:cdnServer+src,className:clazz,fade:true,defaultImage:cdnServer+"/images/widgets/logos_Comp_Aeriennes/compagnies-multiples.gif"});}
Clib.Kelkoo.prototype.statusSearch=function(state){if(state=='searching'){Clib.Tools.insertTag('SearchingFlight');this.errorDiv.hide();this.preload.hide();this.bottomBar.hide();this.searching.show();this.progress.show();}
else if(state=='error'){Clib.Tools.insertTag('FlightError');this.errorDiv.show();this.progress.hide();this.searching.hide();this.preload.hide();this.bottomBar.show();}
else if(state=='resultsOk'){Clib.Tools.insertTag('FlightResults');this.searching.dom.style.display="none";this.sort.show();this.progress.dom.style.display="none";this.preload.hide();this.bottomBar.show();}
else if(state=='sorting'){this.preload.show();}}
Clib.Kelkoo.prototype.showResultsKelkoo=function(start){this.statusSearch('resultsOk');var end=start+19;var resultHtml="";if(this.results!=""){var resultTemplate=Clib.JsIt.getTemplate(this.resultTemplate);var parent=Ext.get("resultsDiv");for(var i=start;i<end;i++){if(this.results[i]){this.results[i].id=i;this.results[i].priceMax=this.priceMax;this.results[i].priceMin=this.priceMin;this.results[i].cursorPrice=Math.round(this.priceIndicator.getCursorCoord(this.results[i].prix));resultHtml+=resultTemplate.render(this.results[i]);}}
if(resultHtml!=""){Ext.fly("resultsDiv").update(resultHtml);}}
for(var i=start;i<end;i++){if(this.results[i]){if(Ext.get("pi_img_"+i))
Ext.get("pi_img_"+i).setLeft(this.results[i].cursorPrice);this.setImages(this.results[i].image,'logo_'+i,this.results[i].logo_class)}}
window.scrollTo(0,0);}
Clib.Kelkoo.prototype.onSort=function(){var self=this;this.statusSearch('sorting');setTimeout(function(){self.sortResults();},1);}
Clib.Kelkoo.prototype.sortResults=function(){var field=Ext.get(this.config.sortInput).dom.value;for(var i=0;i!=this.results.length;i++){for(var j=0;j!=this.results.length-1;j++){var v1=this.results[j][field];var v2=this.results[j+1][field];if(field=='prix'||field=='rating'){v1/=1;v2/=1;}
if(v2<v1){this.exchange(j,j+1);}}}
pages=new Clib.Pages(this.results.length);this.showResultsKelkoo(0);}
Clib.Kelkoo.prototype.exchange=function(el1,el2){var old=this.results[el1];this.results[el1]=this.results[el2];this.results[el2]=old;}
Clib.Suggestions=function(){window.townList=[];var self=this;setInterval(function(){self.onUpdate()},100);}
Clib.Suggestions.prototype.onUpdate=function(){if(window.townList&&window.townList!=window.oldTownList){window.oldTownList=window.townList;var finalTownList=new Array();for(var i=0;i<window.townList.length;i++){finalTownList[i]=new Array(window.townList[i]);}
if(finalTownList.length){store.loadData(finalTownList);}}}
Clib.Suggestions.prototype.update=function(word){this.word=word;if(this.word.length>2){this.url='http://voyages.kelkoo.fr/ctl/do/asyncCall/getSuggestionList?catId=172201&search='+this.word;Clib.Tools.addJS(this.url);}}
Clib.TownBar=function(config){if(!window.suggestion){window.suggestion=new Clib.Suggestions();}
if(!window.store){window.store=new Ext.data.SimpleStore({fields:['state'],data:window.townList});}
Clib.TownBar.superclass.constructor.call(this,config);this.combo=new Ext.form.ComboBox({store:store,displayField:'state',typeAhead:true,mode:'local',triggerAction:'all',selectOnFocus:true,hideTrigger:true,applyTo:this.el,listAlign:"tl-bl"});this.combo.addClass("black-text");Ext.get(this.el.id).dom.style.top='0px';Ext.EventManager.on(this.el,'keyup',this.onKeyUp,this);Ext.EventManager.on(this.el,'focus',this.onFocus,this);Ext.EventManager.on(this.el,'click',this.onClick,this);};Ext.extend(Clib.TownBar,Clib.FormWidjet,{setValue:function(value){this.el.dom.value=value;},getValue:function(){return this.el.dom.value;},onClick:function(){window.townList=[];window.suggestion=new Clib.Suggestions()},onFocus:function(){this.combo.setWidth(155);this.el.dom.style.width='151px';this.normalBackground();},normalBackground:function(){this.el.removeClass("font9bError");this.el.removeClass("x-form-text");this.el.removeClass("x-form-fieldError");this.el.addClass("font9b");this.el.addClass("x-form-text");this.el.addClass("x-form-field");},errorBackground:function(){this.el.removeClass("font9b");this.el.removeClass("x-form-field");this.el.removeClass("x-form-text");this.el.addClass("font9bError");this.el.addClass("x-form-text");this.el.addClass("x-form-fieldError");},validate:function(type){if(type!="flight"||this.getValue())
return true;else{this.errorBackground();return false;}},onKeyUp:function(e){var value=this.getValue();var ch=e.getCharCode();if((ch<38||ch>40)&&value.length>2){suggestion.update(value);}}});Clib.PriceIndicator=function(results){this.ValMax=0;this.ValMin=-90;this.priceMax=results[results.length-1].prix;this.priceMin=results[0].prix;this.priceRange=this.priceMax-this.priceMin;this.valRange=this.ValMax-this.ValMin;}
Clib.PriceIndicator.prototype.getCursorCoord=function(price){var index=price/this.priceRange;var cursorCoord=((price-this.priceMin)/(this.priceMax-this.priceMin))*this.valRange+this.ValMin+5;if(cursorCoord>=this.ValMax)
cursorCoord=this.ValMax-5;if(cursorCoord<=this.ValMin)
cursorCoord=this.ValMin+5;return cursorCoord;}
Clib.Pages=function(nr_total_results){this.pages=Ext.get('pages');this.total=nr_total_results;this.resForPage=20;this.allPages=new Array();this.setCurrentPage(1);this.setFirstPage();this.setLastPage();this.setAllPages();this.showPages();this.setResume();this.preload=Ext.get('preload_kelkoo');}
Clib.Pages.prototype.setResultForPage=function(num){this.resForPage=num;}
Clib.Pages.prototype.setAllPages=function(){for(var i=this.first;i<=this.last;i++)
this.allPages[i]={num:i};}
Clib.Pages.prototype.setCurrentPage=function(start){this.firstResult=start;var num=(start/this.resForPage)+1;this.current=Math.floor(num);}
Clib.Pages.prototype.setLastPage=function(){var num=this.total/this.resForPage;this.last=Math.ceil(num);if((this.last>(this.first+9))&&((this.current+9)<this.last))
this.last=this.current+9;}
Clib.Pages.prototype.NextON=function(action){}
Clib.Pages.prototype.BackON=function(action){}
Clib.Pages.prototype.setFirstPage=function(){this.first=this.current-9;if(this.first<=0){this.first=1;}}
Clib.Pages.prototype.onGoToPage=function(page){var self=this;window.scrollTo(0,0);Ext.get('preload_kelkoo').show();setTimeout(function(){self.goToPage(page);},1);}
Clib.Pages.prototype.goToPage=function(page){this.startResults=(page-1)*this.resForPage;this.setCurrentPage(this.startResults);this.setFirstPage();this.setLastPage();this.setAllPages();this.showPages();this.setResume();kelkoo.showResultsKelkoo(this.startResults);}
Clib.Pages.prototype.showPages=function(){var resultHtml="";var pagesTemplate=Clib.JsIt.getTemplate("pagesTemplate");for(var i=this.first;i<=this.last;i++){if(this.allPages[i]){resultHtml+=pagesTemplate.render(this.allPages[i]);}}
var back=this.current*1-1;var next=this.current*1+1;if(this.current!=this.last){this.pages.addClass('nextON');resultHtml=resultHtml+'<a href="javascript:pages.onGoToPage(\''+next+'\')" class="next" id="next">Suivant</a>';}
if(this.first!=this.current){this.pages.addClass('backON');resultHtml='<a href="javascript:pages.onGoToPage(\''+back+'\')" class="back" id="back">Pr&eacute;c&eacute;dent</a>'+resultHtml;}
if(resultHtml!=""){Ext.get("pagesDiv").dom.innerHTML=resultHtml;}
var divNum=Ext.get('page_'+this.current);divNum.dom.innerHTML='<strong>'+this.current+'</strong>';}
Clib.Pages.prototype.setResume=function(){var end=this.firstResult+this.resForPage;var start=this.firstResult+1;if(start==2){start--;end--;}
Ext.get("resultStartEnd").update(start+" - "+end);Ext.get("totalResults").update(kelkoo.results.length);}
function load_only_colors(){if(loadDone)
return;loadDone=true;var loadedDiv=Ext.fly("loaded");if(loadedDiv){loadedDiv.removeClass("not_loaded").addClass("loaded");}
colorChooser=new Clib.ColorChooser({elements:colors});Clib.Tools.addJS(cyberUrl);var part=Clib.CookieManager.get("partner");if(part&&part!="off"){Clib.Tools.activatePartner(part);}}
var imgDetails;var imgUrl;function load_img_details(){imgDetails=new Clib.Image({parent:"image",src:imgUrl,fade:true});var imgArea=Ext.get("imgArea");imgArea.hide();imgDetails.addListener("load",function(){var preload=Ext.get("preload");if(preload.setVisibilityMode)
preload.setVisibilityMode(Ext.Element.DISPLAY);preload.hide();Ext.get("loupe").show(true);Ext.get("imgArea").show();});load_only_colors();}
function unload(){if(preview&&preview.opened){preview.hide();}}
if(window.function_to_load){Ext.EventManager.on(window,"unload",unload);eval("var func = "+function_to_load+";");Ext.onReady(func);}
function isdefined(variable)
{return(typeof(window[variable])=="undefined")?false:true;}
