eval(liligo.namespace);eval(liligo.namespace);window.hpDEBUG=false;window.hp=Application(Observable,{init:function(){if(this.initialized){return }this.initialized=true;setInterval(bind(this.keepSession,this),3*60*1000);this.umInfo=new hpUMInfo();this.loadDOM()},loadDOM:function(){new AjaxRequest("/myliligo_temp/bottom.jsp?r="+hpconfig.bottomJspRelease,{method:"get",onComplete:bind(this.onDOM,this)})},onDOM:function(B,A){DOM.add("div",{innerHTML:A});hpconfig.disableCache?this.start():this.loadCache()},loadCache:function(){this.onCache=this.start;addScript("/widgets/cache/"+liligo.getLang()+".js?r="+hpconfig.widgetCacheRelease)},start:function(){this.getProfile();this._fireEvent("start")},getProfile:function(){if(this.profile){delete this.profile}new AjaxRequest("/servlet/gp",{method:"get",parameters:"rand="+Math.random()+"&widgetcontext="+hpconfig.widgetContext,onComplete:bind(this.onProfile,this)})},onProfile:function(B,A){this.profile=JSON.decode(A);this._fireEvent("profile",this.profile);hpTab.load();hpTab.home.activate();Style.removeClass(document.body,"loading");this._fireEvent("afterProfile")},updateProfile:function(A,D,C){var B;if((typeof A=="object")&&(A.constructor!=Array)){B="["+JSON.encode(A)+"]";C=D}else{if(typeof A=="string"){B='[{"'+A+'":'+JSON.encode(D)+"}]"}else{B=JSON.encode(A);C=D}}new AjaxRequest("/servlet/up",{parameters:{commands:B,widgetcontext:hpconfig.widgetContext},onComplete:C?function(F,E){C(JSON.decode(E))}:nullFunc})},keepSession:function(){(arguments.callee.img=new Image).src="/profile/session.jsp?r="+Math.random()}});var UMInfo=new Class({template:new VTemplate("/v3/um-info/templates/content.vm",function(C){var D=new liligo.__VT_StringCat(),A="function",B=0;if(C.velocityCount){B=C.velocityCount}D.push('	<div class="umi-right"></div>	<div class="umi-content">		<p>			');if(C.user.registered){D.push('				<strong>					<img src="/v3/um-info/img/lilihead.gif" />					');D.push(C.labels.homepage_user_function_welcome);D.push("					");if(C.user.nick){D.push("						");D.push(C.user.nick);D.push("					")}else{D.push("						");D.push(C.user.email);D.push("					")}D.push("				</strong><br />				");if(C.linkOut){D.push('					<a href="');D.push(C.linkOut);D.push('">My Liligo</a> |				')}D.push('				<a class="signout" href="');D.push('#">');D.push(C.labels.homepage_user_function_signout);D.push('</a> |				<a class="modify" href="/modify/">');D.push(C.labels.homepage_user_function_modify);D.push("</a>			")}else{D.push('				<strong>					<img src="/v3/um-info/img/lilihead.gif" />					<span>						My Liligo :					</span>				</strong>				<a class="signin" href="/signin/">');D.push(C.labels.homepage_user_function_signin);D.push('</a> |				<a class="register" href="/signin/">');D.push(C.labels.homepage_user_function_register);D.push("</a>				");if(C.linkOut){D.push('					<br />					» <a href="');D.push(C.linkOut);D.push('">');D.push(C.labels.homepage_user_function_trial);D.push("</a>				")}D.push("			")}D.push('		</p>	</div>	<div class="umi-left"></div>');return D.toString()}),small:false,showMyliligo:false,dontGetUser:false,constructor:function(A){if((typeof (liligo.dontGetUmUser)!="undefined")&&(liligo.dontGetUmUser)){this.dontGetUser=true}if(window.config&&window.config.lightHP){return }UMInfo.instance=this;extend(this,A||{});var B=$("um-info")||DOM.add("div",{id:"um-info"});this._div=B;__Eo(B,"click",__Eb(this.click,this));if(typeof UserManagement!="undefined"){__Eo(UserManagement,"user",bind(this.render,this));if(UserManagement.user){this.render(UserManagement.user)}else{if(!this.dontGetUser){this.getUser()}}}else{if(!this.dontGetUser){this.getUser()}}},render:function(A){if(this.showMyliligo&&config.hp_top_myliligo_enabled){this.linkOut="/myliligo.jsp"}this.user=A;Style.setClassIf(A.registered,this._div,"registered");Style.setClassIf(this.small,this._div,"small");Style.setClassIf(this.linkOut,this._div,"with-link-out");this._div.innerHTML=this.template.process(this)},click:function(B){var A=Event.element(B);if(A.nodeName!="A"){return }if(Style.hasClass(A,"signout")){Event.stop(B);return this.signout()}if(Style.hasClass(A,"signin")){Event.stop(B);return this.signin()}if(Style.hasClass(A,"register")){Event.stop(B);return this.register()}if(Style.hasClass(A,"modify")){Event.stop(B);return this.modify()}},signin:function(){if(typeof UserManagement!="undefined"){UserManagement.signin(false)}else{var A=$$("a.signin",this._div)[0];location.href=A.href+"?from="+encodeURIComponent(location.href)+"#signin"}},register:function(){if(typeof UserManagement!="undefined"){UserManagement.signin(true)}else{var A=$$("a.register",this._div)[0];location.href=A.href+"?from="+encodeURIComponent(location.href)+"#register"}},modify:function(){var A=$$("a.modify",this._div)[0];location.href=A.href+"?from="+encodeURIComponent(location.href)},signout:function(){var B=true,A=window.location;if(typeof UserManagement!="undefined"){B=!UserManagement.asLayer}if(!B){this.render({registered:false})}new AjaxRequest("/profile/logout.jsp",B?function(){A.reload()}:bind(this.getUser,this))},getUser:function(){new AjaxRequest("/servlet/gp",{parameters:{userOnly:true},onComplete:bind(this.onProfile,this)})},onProfile:function(B,A){A=JSON.decode(A).user;if(typeof UserManagement=="undefined"){this.render(A)}else{UserManagement.setUser(A)}}});window.hpUMInfo=new Class(UMInfo,{showMyliligo:false,linkOut:"/homepage/",linkOutText1:"Liligo Accueil",linkOutText2:"Essayez Liligo Accueil",dontGetUser:true,constructor:function(A){this._base_constructor(A);__Eo(hp,"profile",bind(this.render,this))},render:function(A){this._base_render(A.user)}});window.hpUserManagerPopup=Abstract(Observable,{name:null,submit:null,initialize:function(){if(this.initialized){return }this.initialized=true;Event.observe("hp-"+this.name+"-form","submit",this.bindedSubmit=Event.bindStop(this.submit,this));Event.observe("hp-"+this.name+"-close","click",Event.bindStop(this.close,this))},show:function(){this.initialize();if(!this.noFade){hpPopupTools.setPosition("hp-"+this.name);
hpPopupTools.fadeScreen(true)}Style.show("hp-"+this.name)},close:function(){Style.hide("hp-"+this.name);if(!this.noFade){hpPopupTools.fadeScreen(false)}this._fireEvent("close")},setError:function(C,A,D){var B=$(C);if(D){B=B.parentNode}if(A===null){Style.removeClass(B,"error");Style.removeClass(B,"valid")}else{(A?Style.addClass:Style.removeClass)(B,"error");(!A?Style.addClass:Style.removeClass)(B,"valid")}return A}});window.hpRecommend=Singleton(hpUserManagerPopup,{name:"recommend",emailRE:/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/,init:function(){__Eo(hp,"start",bind(this.initialize,this))},initialize:function(){if(this.initialized){return }__Eo("hp-function-recommend","click",__EbS(this.show,this));Event.observe("hp-recommend-cancel","click",bind(this.close,this));Event.observe("hp-recommend-submit","click",bind(this.submit,this));Event.observe("hp-recommend-sent-close","click",Event.bindStop(this.close,this));new hpPopupTools.tabChain("hp-recommend-mail-1","hp-recommend-mail-2","hp-recommend-mail-3","hp-recommend-mail-4","hp-recommend-name","hp-recommend-your-mail","hp-recommend-cancel","hp-recommend-submit","hp-recommend-mail-1");this._base_initialize()},submit:function(){var B={},E=[],D,I,H=false,F;for(var C=1;C<5;C++){I=$("hp-recommend-mail-"+C);this.setError(I,false);if(D=I.value){if(!this.emailRE.test(D)){if(!F){F=I}this.setError(I,H=true);$("hp-recommend-error").innerHTML="<span>"+labels.recommend_email_alert+"</span>"}else{E.push(D)}}}if(H){Style.addClass("hp-recommend-form","error");F.focus();F.select();return }if(!E.length){$("hp-recommend-error").innerHTML="<span>"+labels.recommend_email_alert_2+"</span>";this.setError("hp-recommend-mail-1",true);Style.addClass("hp-recommend-form","error");return }forEach(E,function(J,K){B["mail_"+(K+1)]=J});I=$("hp-recommend-name");var A=I.value;if(!A){$("hp-recommend-error").innerHTML="<span>"+labels.recommend_name_alert+"</span>";this.setError(I,true);Style.addClass("hp-recommend-form","error");I.focus();I.select();return }B["u-name"]=A;this.setError(I,false);I=$("hp-recommend-your-mail");D=I.value;if(!this.emailRE.test(D)){$("hp-recommend-error").innerHTML="<span>"+labels.recommend_email_alert_3+"</span>";this.setError(I,true);Style.addClass("hp-recommend-form","error");I.focus();I.select();return }B["u-email"]=D;this.setError(I,false);Style.removeClass("hp-recommend-form","error");new AjaxRequest("/air/recommendliligo_submit.jsp",{parameters:B});var G=[];forEach(E,function(J){G.push("<li>",escapeHTML(J),"</li>")});$("hp-recommend-sent-list").innerHTML=G.join("");Style.hide("hp-recommend-form");Style.show("hp-recommend-sent");urchinTracker("/HomePage/General/Events/Recommend")},show:function(){if(!this.initialized){this.initialize()}$("hp-recommend-mail-1").value=$("hp-recommend-mail-2").value=$("hp-recommend-mail-3").value=$("hp-recommend-mail-4").value=$("hp-recommend-name").value=$("hp-recommend-your-mail").value="";var A=window.hp&&hp.profile&&hp.profile.user;if(A&&A.registered){if(A.nick){$("hp-recommend-name").value=A.nick}if(A.email){$("hp-recommend-your-mail").value=A.email}}this.setError("hp-recommend-mail-1",false);this.setError("hp-recommend-mail-2",false);this.setError("hp-recommend-mail-3",false);this.setError("hp-recommend-mail-4",false);this.setError("hp-recommend-name",false);this.setError("hp-recommend-your-mail",false);Style.removeClass("hp-recommend-form","error");Style.show("hp-recommend-form");Style.hide("hp-recommend-sent");this._base_show();$("hp-recommend-mail-1").focus()}});window.hpWidgetAdder=Singleton({init:function(){Event.observe(hp,"start",bind(this.initialize,this))},initialize:function(){if(this.initialized){return }this.initialized=true;this.template=TPTemplate.parseDOM("t_hp-addwidget");this.div=$("hp-addwidget");new AjaxRequest("/widgets/availables.jsp?widgetcontext="+hpconfig.widgetContext,bind(this.onWidgets,this));Event.observe("hp-function-addwidget","click",Event.bindStop(this.show,this))},onWidgets:function(C,B){this.widgets=JSON.decode(B);this.div.innerHTML=this.template.process({widgets:this.widgets});this.byId={};for(var A=0;A<this.widgets.length;A++){if(/rss/.test(this.widgets[A].url)){this.rss=this.widgets[A]}this.byId[this.widgets[A].id]=this.widgets[A]}this.initListeners()},initListeners:function(){Event.observe("hp-aw-close","click",Event.bindStop(this.close,this));Event.observe("hp-aw-title","click",Event.bindStop(this.close,this));Event.observe("hp-awl-widgets-opener","click",Event.bindStop(this.toggleWidgetList,this));Event.observe("hp-awl-widgetlist","click",Event.bindStop(this.widgetListClick,this));Event.observe("hp-awl-addyour","click",Event.bindStop(this.addRSS,this));Event.observe("hp-awd-close","click",Event.bindStop(this.hideDetails,this));Event.observe("hp-awd-cancel","click",Event.bindStop(this.hideDetails,this));Event.observe("hp-awd-submit","click",Event.bindStop(this.addActive,this));if(IE){Event.observe("hp-awl-widgetlist",{mouseover:bindAsEventListener(this.mouseOver,this,true),mouseout:bindAsEventListener(this.mouseOver,this,false)})}},mouseOver:function(B,A){B=Event.element(B);if(B.tagName.toUpperCase()!="A"){return }(A?Style.addClass:Style.removeClass)(B.parentNode,"hover")},show:function(){var B=Geometry.position("hp-function-addwidget");this.top=B[1]-7;Style.set(this.div,{left:B[0]-14+"px",top:this.top+"px"});Style.removeClass("hp-aw","with-details");this.toggleWidgetList(true);this.div.visibility="hidden";var A=hp.profile&&hp.profile.user;((A&&(A.templateAdmin||A.admin))?Style.addClass:Style.removeClass)("hp-awl-widgets","with-admin");Style.show(this.div);this.scrolledWithDetails=false;this.scrollAndFade();this.div.visibility="visible";this.titleShadow=new hpPopupTools.Shadow("hp-aw-title");this.shadow=new hpPopupTools.Shadow("hp-aw-lists")},scrollAndFade:function(){var C=this.top+Geometry.dimension(this.div)[1];hpPopupTools.fadeScreen(false);hpPopupTools.fadeScreen(true,{minHeight:this.top+Geometry.dimension(this.div)[1]+20});var A=hpPopupTools.getViewportY();if((A[0]<this.top-20)&&(C>A[1])){var B=C+20-A[1]+A[0];
if(B>this.top){B=this.top-20}window.scrollTo(0,B)}},close:function(){this.hideDetails();this.titleShadow.remove();this.shadow.remove();Style.hide(this.div);hpPopupTools.fadeScreen(false)},toggleWidgetList:function(A){if(typeof A=="boolean"&&A){A=true}else{A=!Style.hasClass("hp-awl-widgets","cat-open")}(A?Style.addClass:Style.removeClass)("hp-awl-widgets","cat-open");if(!A){this.hideDetails()}if(!Style.hasClass("hp-aw","with-details")&&this.shadow){this.shadow.remove();this.shadow=new hpPopupTools.Shadow("hp-aw-lists")}},widgetListClick:function(A){A=Event.element(A);if(A.tagName.toUpperCase()!="A"){return }this.showDetails(this.byId[A.parentNode.id.match(/\d+/)[0]])},showDetails:function(A){if(this.activeWidget==A){return }if(this.activeWidget){Style.removeClass("hp-aw-"+this.activeWidget.id,"active")}Style.addClass("hp-aw-"+(this.activeWidget=A).id,"active");$("hp-awd-name").innerHTML=A.name;$("hp-awd-desc").innerHTML=A.desc;$("hp-awd-preview").src=A.img;$("hp-awd-rating").innerHTML=['<img src="/homepage/img/hp-stars-',A.rating,'.gif" alt="****" />'].join("");$("hp-awd-downloads").innerHTML=A.downloadCount;if(!Style.hasClass("hp-aw","with-details")){Style.addClass("hp-aw","with-details");if(!this.scrolledWithDetails){this.scrollAndFade();this.scrolledWithDetails=true}this.shadow.remove();this.shadow=new hpPopupTools.Shadow("hp-aw")}},hideDetails:function(){if(!Style.hasClass("hp-aw","with-details")){return }Style.removeClass("hp-aw-"+this.activeWidget.id,"active");this.activeWidget=null;Style.removeClass("hp-aw","with-details");this.shadow.remove();this.shadow=new hpPopupTools.Shadow("hp-aw-lists")},addActive:function(){this.add(this.activeWidget.id);this.close()},addRSS:function(){this.add(this.rss.id);this.close()},add:function(E){var C=hpTab.active.page.columns[0];var A={};for(var B=C.length-1;B>=0;B--){var D=C[B+1]=C[B];D.position[1]++;A[D.id]=D.position}delete C[0];hp.updateProfile([{movewidgets:A},{addwidget:{classId:E,tabId:hpTab.active.id,position:[0,0]}}],bind(this.onAdded,this,hpTab.active.id))},onAdded:function(A,C){var B=C[1];B.page=hpTab[A].page;B.insertAsFirst=true;B.withPersonalize=true;B=new hpWidget(B);B.load();B.highlight()}});window.hpTabAdder=Singleton({maxTitleLength:20,init:function(){Event.observe(hp,"start",bind(this.initialize,this))},initialize:function(){if(this.initialized){return }this.initialized=true;Event.observe("hp-addtab-button","click",Event.bindStop(this.show,this));Event.observe("hp-addtab-close","click",Event.bindStop(this.close,this));Event.observe("hp-addtab-cancel","click",Event.bindStop(this.close,this));Event.observe("hp-addtab-form","submit",Event.bindStop(this.submit,this));var A=bind(this.updateCount,this);this.count=$("hp-addtab-count");this.title=$("hp-addtab-title");Style.hide("hp-addtab-help-popup");Style.hide("hp-addtab-help-popup-hand");Event.observe(this.title,{keyup:A,change:A,click:A});Event.observe("hp-addtab-help-opener",{mouseover:function(){Style.show("hp-addtab-help-popup","hp-addtab-help-popup-hand")},mouseout:function(){Style.hide("hp-addtab-help-popup","hp-addtab-help-popup-hand")},click:Event.bindStop(nullFunc)});this.compLoc=new CompLoc({type:"hotel",url:"/homepage/comploc.jsp",field:"hp-addtab-city",format:"${city} (${country})",onChange:bind(this.onCityChange,this)});new hpPopupTools.tabChain("hp-addtab-city","hp-addtab-title","hp-addtab-share","hp-addtab-cancel","hp-addtab-submit","hp-addtab-city")},onCityChange:function(A,B){this.title.value=B.city.substr(0,this.maxTitleLength);this.updateCount();this.title.focus();this.title.select()},updateCount:function(){this.count.innerHTML=Math.max(this.maxTitleLength-this.title.value.length,0)},show:function(){this.title.value="";this.updateCount();Style.hide("hp-addtab-help-popup","hp-addtab-help-popup-hand");this.compLoc.clear();Style.removeClass("hp-addtab-city","error");Style.removeClass("hp-addtab-form","error");$("hp-addtab-share").checked=true;hpPopupTools.setPosition("hp-addtab");hpPopupTools.fadeScreen(true);Style.removeClass("hp-addtab","loading");Style.show("hp-addtab");try{$("hp-addtab-city").focus()}catch(A){}},close:function(){Style.hide("hp-addtab");hpPopupTools.fadeScreen(false)},tryToAdd:function(A){$("hp-addtab").style.visibility="hidden";this.show();if(A.cityCode){$("hp-addtab-city").value=A.city;$("hp-addtab-cityCode").value=A.cityCode;this.title.value=A.city.substr(0,this.maxTitleLength)}$("hp-addtab-share").checked=true;this.submit();$("hp-addtab").style.visibility="visible"},submit:function(){if(!$("hp-addtab-cityCode").value||!$("hp-addtab-city").value){$("hp-addtab-error").innerHTML="<span>"+labels.hp_addtab_error_nodestination+" </span>";Style.addClass("hp-addtab-form","error");$("hp-addtab").style.visibility="visible";$("hp-addtab-city").focus();return false}if(!$("hp-addtab-title").value){$("hp-addtab-error").innerHTML="<span>"+labels.hp_addtab_error_notitle+"</span>";Style.addClass("hp-addtab-form","error");$("hp-addtab-title").focus();$("hp-addtab").style.visibility="visible";return false}Style.removeClass("hp-addtab-form","error");$("hp-addtab-tabtitle").innerHTML=escapeHTML($("hp-addtab-title").value);Style.addClass("hp-addtab","loading");this.add({city:1*$("hp-addtab-cityCode").value,title:$("hp-addtab-title").value,shared:$("hp-addtab-share").checked});return true},add:function(A){A.position=hpTab.ordered.length;hp.updateProfile("addnewtab",A,bind(this.onAdded,this,A.position))},onAdded:function(A,C){var B=C[0];B.position=A;new hpTab(B).activate();this.close()}});window.hpTabModify=Singleton({init:function(){Event.observe(hp,"profile",bind(this.initialize,this))},initialize:function(){if(this.initialized){return }this.initialized=true;Event.observe("hp-function-modifytab","click",Event.bindStop(this.show,this));Event.observe("hp-modifytab-close","click",Event.bindStop(this.close,this));Event.observe("hp-modifytab-cancel","click",Event.bindStop(this.close,this));Event.observe("hp-modifytab-form","submit",Event.bindStop(this.submit,this));Style.hide("hp-modifytab-help-popup");
Style.hide("hp-modifytab-help-popup-hand");this.count=$("hp-modifytab-count");this.title=$("hp-modifytab-title");var A=bind(this.updateCount,this);Event.observe(this.title,{keyup:A,change:A,click:A,blur:bind(this.onBlur,this),focus:bind(this.onFocus,this)});Event.observe("hp-modifytab-help-opener",{mouseover:function(){Style.show("hp-modifytab-help-popup");Style.show("hp-modifytab-help-popup-hand");$("hp-modifytab-title").blur()},mouseout:function(){Style.hide("hp-modifytab-help-popup");Style.hide("hp-modifytab-help-popup-hand")},click:Event.bindStop(nullFunc)});new hpPopupTools.tabChain(this.title,"hp-modifytab-share","hp-modifytab-cancel","hp-modifytab-submit",this.title)},updateCount:function(){this.count.innerHTML=Math.max(hpTabAdder.maxTitleLength-this.title.value.length,0)},show:function(){$("hp-modifytab-city").innerHTML=escapeHTML(hpTab.active.city.name);this.title.value=hpTab.active.title;this.updateCount();Style.hide("hp-modifytab-help-popup");$("hp-modifytab-share").checked=hpTab.active.shared;hpPopupTools.setPosition("hp-modifytab");hpPopupTools.fadeScreen(true);Style.show("hp-modifytab");this.title.focus();this.title.select()},close:function(){Style.hide("hp-modifytab");hpPopupTools.fadeScreen(false)},onFocus:function(){this.title.select()},onBlur:function(){if(!this.title.value){this.title.value=hpTab.active.title}},submit:function(){if(!this.title.value){this.title.value=hpTab.active.title}hpTab.active.updateParams({title:this.title.value,shared:$("hp-modifytab-share").checked});this.close()}});window.hpUtils=Singleton({_replaceCache:{},replaceRegExp:function(B){var A=this._replaceCache[B];if(A){return A}return this._replaceCache[B]=new RegExp(rescape(B),"g")}});window.hpToolTip=new Class({offsetLeft:0,offsetTop:0,constructor:function(G,F,D,C,H,B,A,E){if(!hpToolTip.initialized){hpToolTip.initialize()}extend(this,{elem:$(G),content:F||"",className:D||"search",followCursor:!!C,offsetLeft:H||this.offsetLeft,offsetTop:B||this.offsetTop,maxWidth:E||380});if(typeof A=="undefined"){this.center=true}else{this.center=A}if(this.elem){Event.observe(G,{mouseover:bindAsEventListener(this.onOver,this),mouseout:bind(this.onOut,this)});if(this.followCursor){this.onMouseMove=bindAsEventListener(this.onMouseMove,this)}}},onOver:function(C){Style.hide(this._div);this._div.className="hp-tooltip-"+this.className;this._content.innerHTML=this.content;if(this.followCursor){this.onMouseMove(C);Event.observe(document,"mousemove",this.onMouseMove)}else{var B=Geometry.position(this.elem);var A=B[0];var D=B[1];if(this.center){A=A+Geometry.dimension(this.elem)[0]/2}D=D+Geometry.dimension(this.elem)[1];this.moveTo(A,D)}this._div.style.width="";this._div.style.visibility="hidden";Style.show(this._div);if(Geometry.dimension(this._div)[0]>this.maxWidth){this._div.style.width=this.maxWidth+"px"}this._div.style.visibility="visible"},onOut:function(){Style.hide(this._div);if(this.followCursor){Event.stopObserving(document,"mousemove",this.onMouseMove)}},moveTo:function(A,C){var B=this._div.style;if(this.followCursor){C-=3}B.left=1*A-13+this.offsetLeft+"px";B.top=1*C+6+this.offsetTop+"px"},onMouseMove:function(A){this.moveTo(Event.pointerX(A),Event.pointerY(A))}},{initialize:function(){this.initialized=true;var A=this.prototype._div=document.createElement("div");A.id="hp-tooltip";A.className="";A.innerHTML='<div id="hp-tooltip-cont"><div id="hp-tooltip-pointer"></div><p id="hp-tooltip-content"></p></div>';A.style.position="absolute";Style.hide(A);document.body.appendChild(A);this.prototype._content=$("hp-tooltip-content")}});if(!IE){window.hpStyle=new Class({constructor:function(A){this.create();if(A){this.set(A)}},create:function(){this.style=document.createElement("style");this.style.setAttribute("type","text/css");this.style.setAttribute("media","screen");document.getElementsByTagName("head")[0].appendChild(this.style);if(safari){this.style.appendChild(document.createTextNode("_safari {}"));this.style=document.styleSheets[document.styleSheets.length-1]}},set:function(B){var A=this.style;safari?Style.addRulesSafari(A,B):A.innerHTML=B},remove:function(){if(!this.style){return }this.set("");safari?this.style.ownerNode.parentNode.removeChild(this.style.ownerNode):this.style.parentNode.removeChild(this.style);delete this.style}})}else{window.hpStyle=new Class({_styles:[],constructor:function(A){this.create();if(A){this.set(A)}},create:function(){var C,B=this._styles,A=B._lastIndex;if(!A){A=0}for(;A<B.length;A++){C=B[A];if(C.imports.length<30){break}}B._lastIndex=A;if(!C||!C.imports||(C.imports.length>=30)){C=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(C);C=C.styleSheet;B.push(C)}this.style=C.imports[C.addImport()]},set:function(A){this.style.cssText=A},remove:function(){if(!this.style){return }this.set("");if(this._styles._lastIndex){this._styles._lastIndex--}var B=this.style.parentStyleSheet,C=this.style;for(var A=0;A<B.imports.length;A++){if(B.imports[A]==this.style){B.removeImport(A);delete this.style;return }}}})}window.hpWidget=Class({constructor:function(A){extend(this,A);this.uid="hpuid"+this.id;hpWidget.ns[this.uid]=this.namespace={};var B=this.div=document.createElement("div");B.id="hp-widget-"+this.id;B.className="hp-widget";Style.hide(B);this.page.columns[this.position[0]][this.position[1]]=hpWidget[this.id]=this},load:function(){if(this.loaded){return }this.loaded=true;this.div.innerHTML=hpWidget.template.process({id:this.id,title:labels.widgets_title_loading,type:this.type});this.maxTitle=-1;if(this.insertAsFirst){var B=$("hp-column-"+this.page.id+"-"+this.position[0]);B.insertBefore(this.div,B.firstChild);delete this.insertAsFirst}else{$("hp-column-"+this.page.id+"-"+this.position[0]).appendChild(this.div)}Style.show(this.div);this.contentDiv=$(this.div.id+"-content");var A;if(hp.widgetCache&&(A=hp.widgetCache[this.url])){this.parseWidget(A,-1)}else{if(this.url.charAt(0)=="/"){this.url=document.location.href.match(/http:\/\/[^\/]*/)[0]+this.url}new AjaxRequest("/widgets/widget2json.jsp",{method:"get",parameters:"url="+escape(this.url)+"&rand="+Math.random(),onComplete:bind(this.parseWidget,this)})
}if(IE){Event.observe(this.div,"mouseenter",bind(Style.addClass,Style,this.div,"hp-widget-hover"));Event.observe(this.div,"mouseleave",bind(Style.removeClass,Style,this.div,"hp-widget-hover"))}Event.observe("hp-person-"+this.id,"click",Event.bindStop(this.onConfig,this));Event.observe("hp-refresh-"+this.id,"click",Event.bindStop(this.onRefresh,this))},unLoad:function(){this.namespace.removed=true;delete hpWidget.ns[this.uid];delete this.page.columns[this.position[0]][this.position[1]];this.div.parentNode&&this.div.parentNode.removeChild(this.div);this.style&&this.style.remove();delete hpWidget[this.id]},API_updateParams:function(A){hp.updateProfile("setparameters",{id:this.id,parameters:A})},API_setTitle:function(A,B){if((typeof A!="undefined")&&A!==null){this.title=A}if(typeof B!="undefined"){this.maxTitle=B}A=this.title;if(this.maxTitle!=-1){if(A.length>this.maxTitle+1){A=A.substr(0,this.maxTitle)+"..."}}$("hp-title-"+this.id).innerHTML=A},API_setTitleLink:function(C,D){var B=$("hp-title-"+this.id);if(C){if(B.nodeName!="A"){var E=B.innerHTML,A=B.parentNode;A.removeChild(B);B=document.createElement("a");B.id="hp-title-"+this.id;B.innerHTML=E;A.appendChild(B)}B.href=C;B.target=D}else{if(B.nodeName!="SPAN"){var E=B.innerHTML,A=B.parentNode;A.removeChild(B);B=document.createElement("span");B.id="hp-title-"+this.id;B.innerHTML=E;A.appendChild(B)}}},API_setConfig:function(A){(A?Style.show:Style.hide)("hp-person-"+this.id);if((this.configCallback=A)&&this.withPersonalize){A();this.withPersonalize=false}},API_setRefresh:function(A){(A?Style.show:Style.hide)("hp-refresh-"+this.id);this.refreshCallback=A},API_getClassId:function(){return this.classId},API_highlight:function(A,B){this.highlight(A,B)},API_$$:function(B,A){return $$(B,A?A:this.contentDiv)},onConfig:function(){try{this.configCallback()}catch(A){}},onRefresh:function(){try{this.refreshCallback()}catch(A){}},initAPI:function(){if(this.API){return }var A=this._apiToExport;var C;this.API={city:C=this.page.tab.city,user:hp.profile.user,tab:{city:C}};for(var B=0;B<A.length;B++){this.API[A[B]]=bind(this["API_"+A[B]],this)}},parseWidget:function(xhr,text){if(!hpWidget[this.id]){return }if(text===-1){var widget=xhr}else{var widget=JSON.decode(text)}var rules="";forEach(widget.styles,function(style){if((style.b=="all")||(style.b=="IE6"&&IE6)||(style.b=="IE7"&&IE7)){rules+=style.rules+"\n"}},this);this.addStyles(rules.replace(/UID/g,this.uid));var source=widget.scripts.replace(/UID/g,this.uid).replace(/\$\{namespace\}/g,"hpWidget.ns."+this.uid);this.contentDiv.innerHTML=widget.body.replace(/UID/g,this.uid).replace(/\$\{namespace\}/g,"hpWidget.ns."+this.uid);this.initHeader();this.initAPI();if(source){var funcSource=["(function() {","var API = hpWidget['",this.id,"'].API, namespace = hpWidget.ns.",this.uid,";\n",source,"\nif (typeof namespace.setUser == 'function') {","	namespace.setUser(API.user)","}","\nif (typeof namespace.setTab == 'function') {","namespace.setTab(API.tab);","}","\nif (typeof namespace.onload == 'function') {","	namespace.onload(hpWidget['",this.id,"'].parameters)","}})();"].join("");try{eval(funcSource)}catch(e){if(hpDEBUG){throw e}}}},call:function(D,B,A,E){var C=this.namespace;if(C&&typeof C[D]=="function"){C[D](B,A,E)}},highlight:function(A,C){if(typeof A=="undefined"){A=true}if(this.highlighted=A){if(!this.highlightTimeout){var D=this.div;var B=0;Style.addClass(D,"hp-widget-highlighted");D.style.borderColor="#fff";(function(){B=Math.min(255,B+70);D.style.borderColor="rgb(255,"+(255-B)+","+(255-B)+")";if(B==255){D.style.borderColor="";return }setTimeout(arguments.callee,20)})()}else{clearTimeout(this.highlightTimeout);delete this.highlightTimeout}this.highlightTimeout=setTimeout(bind(this.highlight,this,false,false),5000)}else{clearTimeout(this.highlightTimeout);delete this.highlightTimeout;var B=0;var D=this.div;if(C){Style.removeClass(D,"hp-widget-highlighted")}else{(function(){B=Math.min(255,B+30);D.style.borderColor="rgb(255,"+B+","+B+")";if(B==255){Style.removeClass(D,"hp-widget-highlighted");D.style.borderColor="";return }setTimeout(arguments.callee,30)})()}}},initHeader:function(){Event.observe("hp-remove-"+this.id,"click",Event.bindStop(this.removeClick,this));this._titleElem=$("hp-title-"+this.id).parentNode;this._startDrag=Event.bind(this.startDrag,this);Event.observe(this._titleElem,"mousedown",this._startDrag);this.toolTips={"hp-person":"widget_myproposition_order","hp-refresh":"widget_update_content","hp-help":"widget_help","hp-remove":"widget_close"};for(var A in this.toolTips){this.toolTips[A]=new hpToolTip(A+"-"+this.id,labels[this.toolTips[A]],this.type,false,0,-6)}},startDrag:function(K){if(this._dragging){return }var C=Event.element(K);if(C&&(C.nodeName=="A")){return }Event.stop(K);if(this._hlBeforeDrag=this.highlighted){this.highlight(false,true)}var N=this.div.parentNode,F=Geometry.position(this.div),A=Geometry.dimension(this.div);hpWidget.newPosDiv.style.height=A[1]+"px";hpWidget.dragContainer.style.height=A[1]+"px";hpWidget.dragContainer.style.width=A[0]+"px";hpWidget.dragContainer.style.top=F[1]+"px";hpWidget.dragContainer.style.left=F[0]+"px";N.replaceChild(hpWidget.newPosDiv,this.div);hpWidget.dragContainer.appendChild(this.div);Style.show(hpWidget.dragContainer);this.dragOffsetX=Event.pointerX(K)-F[0];this.dragOffsetY=Event.pointerY(K)-F[1];this._possiblePos=[];var E=this.page.columns;var O=-1;for(var H=0;H<E.length;H++){var M=this._possiblePos[H]=[];var B=$(M.columnId="hp-column-"+this.page.id+"-"+H);this._possiblePos[H].right=Geometry.position(B)[0]+Geometry.dimension(B)[0];var L=0;var D=E[H];var M=false,J;for(var G=0;G<D.length;G++){var I=D[G];if(I.id==this.id){continue}M=Geometry.position(I.div);J=Geometry.dimension(I.div);L=M[1]+J[1]/2;this._possiblePos[H].push({bottom:L,beforeThis:I.div.id})}if((this.position[0]!=H)&&M){if(M[1]+J[1]>O){O=M[1]+J[1]}}this._possiblePos[H].push({bottom:L+2,beforeThis:null})}if(O<=F[1]+A[1]){this._scrollFix=document.createElement("div");this._scrollFixParent=N;
this._scrollFix.style.height=A[1]+"px"}else{this._scrollFix=false}this._newCol=this.position[0];this._newRow=this.position[1];this.dropped=false;this._drop=bind(this.drop,this);Event.observe(document,"mouseup",this._drop);this._dragging=bindAsEventListener(this.dragging,this);Event.observe(document,"mousemove",this._dragging)},dragging:function(D){if(this.dropped){Event.stopObserving(document,"mouseup",this._drop);Event.stopObserving(document,"mousemove",this._dragging);return }var F=Event.pointerX(D),E=Event.pointerY(D);hpWidget.dragContainer.style.left=F-this.dragOffsetX+"px";hpWidget.dragContainer.style.top=E-this.dragOffsetY+"px";for(i=0;i<this._possiblePos.length;i++){if(this._possiblePos[i].right>=F){break}}var C=Math.min(i,this._possiblePos.length-1);var B=this._possiblePos[C];for(i=0;i<B.length;i++){if(B[i].bottom>=E){break}}var A=Math.min(i,B.length-1);if((this._newCol!=C)||(this._newRow!=A)){if(this._scrollFix){if(C!=this.position[0]){this._scrollFixParent.insertBefore(this._scrollFix,null)}else{this._scrollFix.parentNode&&this._scrollFix.parentNode.removeChild(this._scrollFix)}}hpWidget.newPosDiv.parentNode.removeChild(hpWidget.newPosDiv);this._newCol=C;this._newRow=A;$(B.columnId).insertBefore(hpWidget.newPosDiv,$(B[A].beforeThis))}},drop:function(){Event.stopObserving(document,"mouseup",this._drop);Event.stopObserving(document,"mousemove",this._dragging);if(this.dropped){return }this.dropped=true;hpWidget.dragContainer.removeChild(this.div);hpWidget.newPosDiv.parentNode.replaceChild(this.div,hpWidget.newPosDiv);Style.hide(hpWidget.dragContainer);var A={};var C;if(this.position[0]!=this._newCol){C=this.page.columns[this.position[0]];for(var B=this.position[1];B<C.length-1;B++){var D=C[B]=C[B+1];D.position[1]--;A[D.id]=D.position}C.length--;C=this.page.columns[this._newCol];for(B=C.length;B>this._newRow;B--){var D=C[B]=C[B-1];D.position[1]++;A[D.id]=D.position}}else{C=this.page.columns[this.position[0]];if(this._newRow<this.position[1]){for(var B=this.position[1];B>this._newRow;B--){var D=C[B]=C[B-1];D.position[1]++;A[D.id]=D.position}}else{for(var B=this.position[1];B<this._newRow;B++){var D=C[B]=C[B+1];D.position[1]--;A[D.id]=D.position}}}A[this.id]=this.position=[this._newCol,this._newRow];C[this._newRow]=this;hp.updateProfile("movewidgets",A);if(this._scrollFix){this._scrollFix.parentNode&&this._scrollFix.parentNode.removeChild(this._scrollFix);delete this._scrollFixParent}delete this._scrollFix;if(this._hlBeforeDrag){this.highlight()}delete this._hlBeforeDrag;delete this._dragging;delete this._drop;delete this._possiblePos;delete this._newCol;delete this._newRow},addStyles:function(A){var C="#hp-widget-"+this.id+"-content";var B=A.replace(/\s*([^{]+)({[^}]*})/g,function(D,E,F){return C+" "+(E).split(",").join(","+C+" ")+F+"\n"});this.style=new hpStyle(B)},removeClick:function(){this.toolTips["hp-remove"].onOut();new hpPopupTools.Confirm(labels.widget_close_confirm_title,labels.widget_close_confirm,bind(this.remove,this))},remove:function(){var A={};var C=this.page.columns[this.position[0]];var E=this.position[1];var F=this.id;this.unLoad();for(var B=E;B<C.length-1;B++){var D=C[B]=C[B+1];D.position[1]--;A[D.id]=D.position}C.length--;hp.updateProfile([{removewidget:{id:F}},{movewidgets:A}])}},{ns:{},init:function(){Event.observe(hp,"profile",bind(this.initialize,this));Event.observe(hp,"userChange",bind(this.onUserChange,this))},onUserChange:function(){this.broadCast("setUser",hp.profile.user)},initialize:function(){if(this.initialized){return }this.initialized=true;this.dragContainer=document.createElement("div");this.dragContainer.style.position="absolute";this.dragContainer.style.display="none";this.dragContainer.style.zIndex=9999;document.body.appendChild(this.dragContainer);this.newPosDiv=document.createElement("div");this.newPosDiv.id="hp-newpos";this.newPosDiv.innerHTML='<div class="tl"></div><div class="tr"></div><div class="br"></div><div class="bl"></div>';this.template=TPTemplate.parseDOM("t_hp-widget");this.initCSS();this.initAPI()},initAPI:function(){var A=this.prototype._apiToExport=[];for(var B in this.prototype){if(B.substr(0,4)=="API_"){A.push(B.substr(4))}}},load:function(C){C.page.columns=[[],[],[]];for(var B=0,A=C.widgets.length;B<A;B++){var D=C.widgets[B];D.page=C.page;new this(D)}delete C.widgets;forEach(C.page.columns,function(E){forEach(E,function(F){F.load()})})},clear:function(A){forEach(A.page.columns,function(C,B){forEach(C,function(D){D.unLoad()});delete A.page.columns[B]});delete A.page.columns},broadCast:function(C,B,A,D){forEach(hpWidget.ns,function(E){if(typeof E[C]=="function"){E[C](B,A,D)}})},cssInitialized:false,initCSS:function(){if(this.cssInitialized){return }this.cssInitialized=true;var A=[{type:"search",border:"fe9648",bg:"ffddb8",position:"0 -30px"},{type:"alert",border:"ffcd00",bg:"fff3c2",position:"0 -60px"},{type:"content",border:"a6a6a6",bg:"dadada",position:"0 -90px"},{type:"community",border:"1e0fae",bg:"7489f2",position:"0 -120px"},{type:"service",border:"b0ca02",bg:"eff6be",position:"0 -150px"}];var B=".hp-widget:hover .hp-type-${type},\n.hp-widget-hover .hp-type-${type},\n.hp-widget:hover .hp-type-${type} .hp-widget-header-cont,\n.hp-widget-hover .hp-type-${type} .hp-widget-header-cont,\n.hp-widget:hover .hp-type-${type} .hp-widget-header-cont .header,\n.hp-widget-hover .hp-type-${type} .hp-widget-header-cont .header,\n.hp-widget:hover .hp-type-${type} .hp-widget-content,\n.hp-widget-hover .hp-type-${type} .hp-widget-content{border-color:#${border}}\n.hp-widget:hover .hp-type-${type} .hp-widget-header-cont .header,\n.hp-widget-hover .hp-type-${type} .hp-widget-header-cont .header{background:#${bg}}\n.hp-widget:hover .hp-type-${type} .hp-widget-header-cont .corner,\n.hp-widget-hover .hp-type-${type} .hp-widget-header-cont .corner,\n.hp-widget:hover .hp-type-${type} .hp-widget-footer span,.hp-widget-hover .hp-type-${type} .hp-widget-footer span{background-position:${position}}\n.hp-tooltip-${type}{border-color:#${border};background:#${bg}}\n";
B=new STemplate(B);var C=[];forEach(A,function(D){C.push(B.process(D))});Style.addRules(C)},Welcome:Class({constructor:function(A){Style.show(this.container);this.container=$(A.container);Event.observe(hp,"userChange",bind(this.reload,this));this.init()},init:function(){this.container.innerHTML=TPTemplate.parseDOM("t_hp-welcome").process({user:hp.profile.user});var A=hp.umInfo;Event.observe("hp-welcome-close","click",Event.bindStop(this.close,this));Event.observe("hp-welcome-options","click",Event.bindStop(hpTabAdder.show,hpTabAdder));Event.observe("hp-welcome-addtab","submit",Event.bindStop(this.submitAddTab,this));if($("hp-welcome-register")){__Eo("hp-welcome-register","click",bind(A.register,A));__Eo("hp-welcome-signin","click",bind(A.signin,A))}if($("hp-welcome-addwidget")){Event.observe("hp-welcome-addwidget","click",Event.bindStop(hpWidgetAdder.show,hpWidgetAdder))}if(safari){new BOM.helpers.safariImageButton("hp-welcome-addwidget","hp-welcome-submit")}this.compLoc=new CompLoc({type:"hotel",url:"/homepage/comploc.jsp",field:"hp-welcome-city",format:"${city} (${country})"})},reload:function(){if(this.container.innerHTML){this.container.innerHTML="";this.init()}},submitAddTab:function(){hpTabAdder.tryToAdd({city:$("hp-welcome-city").value,cityCode:$("hp-welcome-cityCode").value})},close:function(){Style.hide(this.container);this.container.innerHTML="";hp.profile.welcome=false;hp.updateProfile("welcome",false)}}),helpers:Singleton({Tabs:Class({constructor:function(D,A,C,B){this.hpuid=D.match(/^([^-]*)-/)[1];this.target=$(D);this.tabs=A;this.scope=B;this.action=C;this.locked=false;this.tabNames=[];this._buildHTML();this._addEvents();this.activate(this.getNames()[0])},getNames:function(){return this.tabNames},getTabHtmlId:function(A){return this.tabs[A]["tabHtmlId"]},getLinkHtmlId:function(A){return this.tabs[A]["linkHtmlId"]},lock:function(){Style.addClass($(this.hpuid+"-tabs"),"hp-widget-tabs-locked");this.locked=true},unlock:function(){Style.removeClass($(this.hpuid+"-tabs"),"hp-widget-tabs-locked");this.locked=false},_buildHTML:function(){var E="",A=0,D=0,C,B;for(B in this.tabs){D++;this.tabNames.push(B)}E+='<ul id="'+this.hpuid+'-tabs" class="hp-widget-tabs">';for(var B in this.tabs){this.tabs[B]["tabHtmlId"]=this.hpuid+"-tab-"+B;this.tabs[B]["linkHtmlId"]=this.hpuid+"-tablink-"+B;this.tabs[B]["pageHtmlId"]=this.hpuid+"-tabpage-"+B;if(A==0){C="first"}else{if(A==D-1){C="last"}else{C="default"}}E+='<li id="'+this.tabs[B]["tabHtmlId"]+'" class="'+C+'">';E+='<a href="#" id="'+this.tabs[B]["linkHtmlId"]+'">'+this.tabs[B]["label"]+"</a>";E+="</li>";A++}E+="</ul>";this.target.innerHTML=E},_addEvents:function(){var A;for(A in this.tabs){Event.observe(this.tabs[A]["tabHtmlId"],"click",bindAsEventListener(function(B,C){if(!this.locked){this.activate(C);if(typeof (this.action)=="function"){bind(this.action,this.scope,C)()}}Event.stop(B)},this,A))}},activate:function(C){var B,A,D;if(!C){C=this.lasttab}for(B in this.tabs){A=this.tabs[B]["tabHtmlId"];Style.removeClass(A,"first-active");Style.removeClass(A,"active");Style.removeClass(A,"last-active");D=$(this.tabs[B]["pageHtmlId"]);if(D){Style.hide(D)}}A=this.tabs[C]["tabHtmlId"];if(Style.hasClass(A,"first")){Style.addClass(A,"first-active")}else{if(Style.hasClass(A,"last")){Style.addClass(A,"last-active")}else{Style.addClass(A,"active")}}D=$(this.tabs[C]["pageHtmlId"]);if(D){Style.show(D)}this.lasttab=C}})})});window.hpTab=Class({constructor:function(A){extend(this,A);this.li=document.createElement("li");this.li.id="hp-tab-"+A.id;hpTab.ul.appendChild(this.li);this.a=document.createElement("a");this.a.href="#";this._updateTitle();this.li.appendChild(this.a);Event.observe(this.a,"click",Event.bindStop(this.activate,this));hpTab.ordered[this.position]=hpTab[this.id]=this},_updateTitle:function(){this.a.innerHTML="<span>"+escapeHTML(this.title)+"</span>"},activate:function(){if(this==hpTab.active){return false}((this==hpTab.home)?Style.hide:Style.show)($("hp-function-removetab").parentNode,$("hp-function-modifytab").parentNode);var B=hp.profile.user;if(B.templateAdmin){if(!hpTab.elem_exportAsDefault){var A=hpTab.elem_exportAsDefault=document.createElement("li");A.innerHTML='<a href="#">export as def city</a>';$("hp-functions-list").insertBefore(A,$("hp-function-removetab").parentNode);Event.observe(A.firstChild,"click",Event.bindStop(hpTab.exportActive,hpTab,false));A=hpTab.elem_exportAsCity=document.createElement("li");A.innerHTML='<a href="#">export as fix city</a>';$("hp-functions-list").insertBefore(A,hpTab.elem_exportAsDefault);Event.observe(A.firstChild,"click",Event.bindStop(hpTab.exportActive,hpTab,true))}((this==hpTab.home)?Style.hide:Style.show)(hpTab.elem_exportAsDefault,hpTab.elem_exportAsCity)}else{if(hpTab.elem_exportAsDefault){Style.hide(hpTab.elem_exportAsDefault,hpTab.elem_exportAsCity)}}this.load();if(hpTab.active){hpTab.active._hide()}this._show();hpTab.active=this},load:function(){if(this.page){return }this.page={tab:this,id:this.id,div:document.createElement("div")};if(hpTab.lastLoaded<this.position){hpTab.lastLoaded=this.position}var B=this.page.div;B.id="hp-page-"+this.id;B.className="hp-page";B.style.display="none";this.withWelcome=hp.profile.welcome&&(this==hpTab.home);var A;if(hpconfig.adZone){A='<div class="hp-widget">'+hpWidget.template.process({id:"ad"+unique(),title:"Publicité",type:"ad",fix:true,content:'<iframe name="a56f607b" style="display:block" src="http://projop.findworks.net/www/delivery/afr.php?n=a56f607b&amp;zoneid='+hpconfig.adZone+'&amp;cb={random}&amp;ct0={clickurl}" framespacing="0" frameborder="no" scrolling="no" width="300" height="250"></iframe><script type="text/javascript" src="http://projop.findworks.net/www/delivery/ag.php"><\/script>'})+"</div>"}B.innerHTML=hpTab.pageTemplate.process({id:this.id,adContent:A});$("hp-pages").appendChild(B);if(this.withWelcome){this.welcome=new hpWidget.Welcome({container:"hp-welcome-"+this.id})}else{Style.hide("hp-welcome-"+this.id)}hpWidget.load(this)},unLoad:function(){this.li.removeChild(this.a);
hpTab.ul.removeChild(this.li);if(this.welcome){delete this.welcome}if(this.page){hpWidget.clear(this);$("hp-pages").removeChild(this.page.div);delete hpTab.ordered[this.position];delete hpTab[this.id]}},_show:function(){Style.addClass(this.li,"active");Style.show(this.page.div)},_hide:function(){Style.removeClass(this.li,"active");Style.hide(this.page.div)},exportTemplate:function(A){this.broadCast("exportTemplate",A);this.remove(false);hp.updateProfile("exporttab",{id:this.id,asDefault:!A},function(){hpWidget.broadCast("reloadTemplates")})},broadCast:function(C,B,A,D){forEach(this.page.columns,function(E){forEach(E,function(F){F.call(C,B,A,D)})})},remove:function(G){if(this==hpTab.active){hpTab.active=null}var C=hpTab.ordered;var B={};var A=this.position;var F=this.id;this.unLoad();for(var D=A;D<C.length-1;D++){var E=C[D]=C[D+1];E.position--;B[E.id]=E.position}C.length--;if(G){hp.updateProfile([{removetab:{id:F}},{movetabs:B}])}(hpTab.ordered[A]||hpTab.ordered[A-1]).activate()},updateParams:function(B){var A;if(B.title&&(B.title!=this.title)){(A||(A={})).title=this.title=B.title;this._updateTitle()}if((B.shared!=undefined)&&(B.shared!=this.shared)){(A||(A={})).shared=this.shared=B.shared}if(A){A.id=this.id;hp.updateProfile("updatetab",A)}}},{active:null,lastLoaded:-1,init:function(){Event.observe(hp,"profile",bind(this.initialize,this))},initialize:function(){if(this.initialized){return }this.initialized=true;this.ul=$$("ul","hp-tabs")[0];this.ul.innerHTML="";Event.observe("hp-function-removetab","click",Event.bindStop(this.removeActive,this));this.pageTemplate=TPTemplate.parseDOM("t_hp-page")},exportActive:function(A){if(this.active!=this.home){this.active.exportTemplate((typeof A=="object")?arguments[1]:A)}},removeActive:function(){if(this.active!=this.home){new hpPopupTools.Confirm(labels.hp_tab_close_confirm_title,labels.hp_tab_close_confirm,bind(this.active.remove,this.active,true))}},load:function(){var C=hp.profile.tabs;this.tabs={};this.ordered=[];for(var B=0,A=C.length;B<A;B++){C[B].position=B;new this(C[B])}delete hp.profile.tabs;this.home=this.ordered[0];return ;this.loadNext=bind(this.loadNext,this);this._loadNextTimer=setTimeout(this.loadNext,5000)},loadNext:function(){if(++this.lastLoaded>=this.ordered.length){return }this.ordered[this.lastLoaded].load();setTimeout(this.loadNext,2000)},clear:function(){clearTimeout(this._loadNextTimer);for(var A=0;A<this.ordered.length;A++){this.ordered[A].unLoad()}this.ordered.length=0}});window.hpPopupTools=Singleton({setPosition:function(D,E,B){D=$(D);if(self.pageYOffset){offset=self.pageYOffset}else{if(document.documentElement&&document.documentElement.scrollTop){offset=document.documentElement.scrollTop}else{if(document.body){offset=document.body.scrollTop}}}if(B){var A,C=0;if(self.innerHeight){C=self.innerHeight}else{if((A=document.documentElement)&&A.clientHeight){C=A.clientHeight}else{if(document.body){C=document.body.clientHeight}}}E=Math.round((C-Geometry.dimension(D)[1])/2)}else{if(typeof E=="undefined"){E=100}}D.style.top=offset+E+"px"},getViewportY:function(){var A;if(self.innerHeight){return[window.pageYOffset,window.pageYOffset+self.innerHeight]}else{if((A=document.documentElement)&&A.clientHeight){return[A.scrollTop,A.scrollTop+A.clientHeight]}else{if(document.body){return[document.body.scrollTop,document.body.scrollTop+document.body.clientHeight]}}}},fadeScreen:function(C,D){var F={opacity:0.8,zIndex:40,color:"#abc600",minHeight:0};extend(F,D||{});if(!this.fader){this.fader=document.createElement("div");Style.set(this.fader,{position:"absolute",top:0,left:0,overflow:"hidden",display:"none"});document.body.insertBefore(this.fader,document.body.firstChild)}if(C){var E,A,B=0;if(self.innerHeight){B=self.innerHeight}else{if((A=document.documentElement)&&A.clientHeight){B=A.clientHeight}else{if(document.body){B=document.body.clientHeight}}}var G=document.body.style.height;document.body.style.height="auto";if(document.body&&(document.body.scrollWidth||document.body.scrollHeight)){E=[document.body.scrollWidth+"px",Math.max(document.body.scrollHeight,F.minHeight,B)+"px"]}else{if(document.body.offsetWidth){E=[document.body.offsetWidth+"px",Math.max(document.body.offsetHeight,F.minHeight,B)+"px"]}else{E=["100%","100%"]}}document.body.style.height=G;DatePicker&&DatePicker.actual&&DatePicker.actual.close();Style.set(this.fader,{opacity:F.opacity,zIndex:F.zIndex,backgroundColor:F.color,width:E[0],height:E[1]});if(IE){forEach($$("select"),function(H){H.style.visibility="hidden"})}Style.show(this.fader)}else{Style.hide(this.fader);if(IE){forEach($$("select"),function(H){H.style.visibility="visible"})}}},tabChain:function(){var B=arguments;for(var A=0;A<B.length-1;A++){Event.observe(B[A],"keydown",bindAsEventListener(function(D,C){if(D.keyCode==Event.KEY_TAB){try{if(D.shiftKey){if(C){$(B[C-1]).focus()}}else{$(B[C+1]).focus()}}catch(E){}Event.stop(D)}},this,A))}},Confirm:Class({constructor:function(E,D,A,C){this.onOk=A;this.onCancel=C||nullFunc;$("hp-confirm-title").innerHTML=E;$("hp-confirm-msg").innerHTML=D;this._cancel=Event.bindStop(this.cancel,this);Event.observe("hp-confirm-close","click",this._cancel);Event.observe("hp-confirm-cancel","click",this._cancel);this._ok=Event.bindStop(this.ok,this);Event.observe("hp-confirm-form","submit",this._ok);this._onkey=Event.bindStop(this.onkey,this);Event.observe(document,"keypress",this._onkey);hpPopupTools.fadeScreen(true);var B=$("hp-confirm");Style.set(B,{visibility:"hidden",top:0});Style.show(B);hpPopupTools.setPosition(B,0,true);B.style.visibility="visible";this.shadow=new hpPopupTools.Shadow("hp-confirm-popup")},onkey:function(A){if(A.keyCode==Event.KEY_RETURN){this.ok()}else{if(A.keyCode==Event.KEY_ESC){this.cancel()}}},cancel:function(){this.remove();this.onCancel()},ok:function(){this.remove();this.onOk()},remove:function(){this.shadow.remove();Style.hide("hp-confirm");hpPopupTools.fadeScreen(false);Event.stopObserving("hp-confirm-close","click",this._cancel);Event.stopObserving("hp-confirm-cancel","click",this._cancel);
Event.stopObserving("hp-confirm-form","submit",this._ok);Event.stopObserving(document,"keypress",this._onkey)}}),Shadow:Class({constructor:function(B,D){D=D||{};this.params={offsetX:4,offsetY:4,opacity:0.25,color:"#9d9d9d",zIndex:55,img:"/homepage/img/hp-shadows.png"};if((D.color=="#c9db58")&&!D.img){D.img="/homepage/img/hp-shadow-green.png"}D=extend(this.params,D);var C=Geometry.dimension(this.elem=B=$(B)),E=Geometry.position(B),A=[];Style.hide(this.div=document.createElement("div"));document.body.insertBefore(this.div,document.body.firstChild);Style.set(this.div,{opacity:D.opacity,zIndex:D.zIndex});(this.inner=document.createElement("div")).style.position="relative";this.div.appendChild(this.inner);if(C[0]>20){A.push('<div style="height:20px;width:',C[0]-20,"px;position:absolute;background:",D.color,';right:20px;bottom:0"></div>')}if(C[1]>20){A.push('<div style="width:',C[0],"px;height:",C[1]-20,"px;position:absolute;background:",D.color,';bottom:20px;right:0"></div>')}A.push('<div style="width:',Math.min(C[0],20),"px;height:",Math.min(C[0],20),"px;position:absolute;bottom:0;right:0;");if(IE){A.push("filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='",D.img,"', sizingmethod='crop')")}else{A.push("background:url(",D.img,") 100% 100%;")}A.push('"></div>');this.inner.innerHTML=A.join("");Style.set(this.inner,{height:C[1]+"px",width:C[0]+"px"});Style.set(this.div,{position:"absolute",display:"block",left:E[0]+D.offsetX+"px",top:E[1]+D.offsetY+"px"})},remove:function(){this.div.removeChild(this.inner);document.body.removeChild(this.div);delete this.inner;delete this.div;this.remove=nullFunc}})});Singleton({init:function(){if(window.hp){__Eo(hp,"start",bind(this.start,this))}else{__Eo(app,"start",bind(this.start,this))}},start:function(){this.opener=$("addthis-button");if(!this.opener){return }this.items=[{"code":"email","name":labels.addthis_email},{"code":"favorites","name":labels.addthis_favorites},{"code":"print","name":labels.addthis_print},{"code":"delicious","name":"Delicious"},{"code":"digg","name":"Digg"},{"code":"google","name":"Google"},{"code":"myspace","name":"MySpace"},{"code":"live","name":"Live"},{"code":"facebook","name":"Facebook"},{"code":"stumbleupon","name":"StumbleUpon"},{"code":"twitter","name":"Twitter"},{"code":"more","name":labels.addthis_more}];this.template=new liligo.VTemplate("/v3/addthis/addthis.vm",function(C){var F=new liligo.__VT_StringCat(),A="function",B=0;if(C.velocityCount){B=C.velocityCount}F.push('	<div id="addthis-popup" style="display:none">		<div id="addthis-head">			<span>');F.push(C.labels.addthis_title);F.push('</span>		</div>		<div id="at_hover">	');for(var E in C.items){var D=C.items[E];if(typeof D==A){continue}B=E;F.push('			<a class="at_item" id="addthis-');F.push(D.code);F.push('" href="');F.push('#">				<span class="at_item_');F.push(D.code);F.push('">');F.push(D.name);F.push("</span>			</a>	")}B=0;F.push('			<div class="cb"></div>		</div>		<div id="addthis-footer">			<a href="http://www.addthis.com/?utm_source=hm&amp;utm_medium=img&amp;utm_content=ATLogo_orig&amp;utm_campaign=AT_main" id="at-logo" target="addthis"></a>		</div>	</div>');return F.toString()});this.wrapper=document.createElement("div");this.wrapper.innerHTML=this.template.process({items:this.items,labels:labels});document.body.appendChild(this.wrapper);this.popup=$("addthis-popup");__Eo(this.popup,"mouseout",bind(this.close,this,this.popup));__Eo(this.popup,"mouseover",bind(this.open,this,this.popup));__Eo(this.opener,"click",bind(this.sendto,this));__Eo(this.opener,"mouseout",bind(this.close,this,this.popup));__Eo(this.opener,"mouseover",bind(this.open,this,this.popup));forEach($$(".at_item","at_hover"),function(A){__Eo(A,"click",bind(this.sendto,this,A.id.replace("addthis-","")))},this);this.seq=1;this.ssid=(new Date().getTime()&268435455).toString(16)+(Math.floor(Math.random()*268435455)).toString(16)},open:function(C){var D=Geometry.position(this.opener);var B=Geometry.dimension(this.popup);var A=Geometry.dimension(document.body);if(D[0]+B[0]<A[0]){this.popup.style.left=D[0]+6+"px"}else{this.popup.style.left=D[0]-103+"px"}this.popup.style.top=D[1]+17+"px";if(this.closeTimer!==null){clearTimeout(this.closeTimer)}Style.show(C)},close:function(B,A){this.closeTimer=setTimeout(bind(function(){Style.hide(B)},this),(A===true?0:700))},sendto:function(A){this.close(this.popup,true);if(A==="favorites"){try{if(BOM.detect("safari")){alert(labels.addthis_favorite_hotkey)}else{if(document.all){window.external.AddFavorite(location.href,document.title)}else{window.sidebar.addPanel(document.title,location.href,"")}}urchinTracker("/HomePage/General/Events/Bookmark/"+A);(new Image()).src=this.genurl(A);return false}catch(B){}}if(A==="print"){window.print();urchinTracker("/HomePage/General/Events/Bookmark/"+A);(new Image()).src=this.genurl(A);return false}if(A==="email"){if(window.hp){hpRecommend.show()}else{Recommend.show()}return false}if(!A||A==="more"){window.open(this.genurl(A,null),"addthis","scrollbars=no,menubar=no,width=625,height=495,resizable=no,toolbar=no,location=no,status=no");urchinTracker("/HomePage/General/Events/Bookmark/more")}else{window.open(this.genurl(A,null),"addthis");urchinTracker("/HomePage/General/Events/Bookmark/"+A)}},trim:function(A){try{A=A.replace(/^[\s\u3000]+|[\s\u3000]+$/g,"");A=encodeURIComponent(A)}catch(B){}return A},genurl:function(B){var A="AT-findworks/-/~/"+this.ssid+"/"+(this.seq++);var C="pub=findworks&s="+B+"&url="+this.trim(location.href)+"&title="+this.trim(document.title)+"&logo=&logobg=&logocolor=&ate="+A+"&adt=1&content=";return"http://www.addthis.com/bookmark.php?v=152&winname=addthis&"+C+"&CXNID=2000001.5215456080540439074NXC"}})
