/* generated Fri Jan 27 15:36:08 EST 2012 */

var R9=R9||{};var _isIE=navigator.appName.indexOf("Microsoft")>-1;var _isSafari=navigator.userAgent.indexOf("Safari")>-1;var _updatingResultsMessage=null;var _currentPageNum=1;var _numrows;var cancelAfterclick=false;var usePopoverPagingTooltip=false;if(typeof window.Streaming=="undefined"){window.Streaming={done:true}}function showPagingTooltip(){if(!window.R9Skin&&jq.cookie("pgmsgshown")!="y"&&!window.FILTER_CLICKED&&!(window.currentview=="map")){if(usePopoverPagingTooltip===true){jq('<div><div class="pagingToolTip popover"><span>Si seleccionas el filtro de la izquierda, los resultados se reducir\u00E1n a unos pocos.</span></div></div>').r9popover({position:"#topOfFilter",title:"Encontrar resultados más rápido...",width:350});jq(".ui-dialog-titlebar").before("<div class='pagingToolTipIcon'></div>")}else{var a={x:-6,y:70};showTT(document.getElementById("topOfFilter"),"<div class='pagingToolTip'><span class=\"hideTTX\" onclick=\"hideTTType('CT')\"></span><div><b>Encontrar resultados m\u00E1s r\u00E1pido</b></div><div>Si seleccionas el filtro de la izquierda, los resultados se reducir\u00E1n a unos pocos.</div></div>","CL",a);jq("body").one("click",function(){hideAllTT()})}jq.cookie("pgmsgshown","y");addAdt("showpgtooltip")}}function setPage(d){var b=d;function c(){scrollTo(0,0);if(b==2){showPagingTooltip()}addAdt("page/"+b);updateDisplayA_ds(b);try{FB.XFBML.parse()}catch(f){}}if(window.ssUserAction){return ssUserAction("PG"+b,c,{pn:b-1})}function a(){if(!isNaN(b)&&b>=1&&b!=_currentPageNum){_currentPageNum=b;updateTable("paging");pgNums();c();hidemessage()}}waitForResults(a)}function getFilteredCount(){if(!_filtered){return R9FltrdCount}if(window._ALLRESULTSLOADED||!window.R9FltrdCount){return _filtered.length}return R9FltrdCount>0?R9FltrdCount:_filtered.length}function clearPages(){_currentPageNum=1}function getUpdateMessage(b){var a="";if(_updatingResultsMessage!=null&&_updatingResultsMessage.length>0){a+=_updatingResultsMessage}else{if(b!=null&&b.length>0){a+=b}else{a+="Actualizando resultados..."}}return a}function jumpToTopOfFilters(){try{document.getElementById("topOfFilter").scrollIntoView()}catch(a){}}function noop(){}function refilter(b,d,g){showmessage(getUpdateMessage("Aplicando tus opciones de filtro..."));hideAllTT();var h=new Date();function c(){_updatingResultsMessage=null;updateDisplayA_ds("filter");addAdt("filtertime&"+(new Date().getTime()-h.getTime()))}if(window.ssUserAction){return ssUserAction("FLT",c)}var f=b||jq.noop;function a(){h=new Date();clearPages();var j=parseInt(document.resultsPaging.rowsper.value);if(d==null||d){setTop(0)}f();computeFiltered();if(j>_numrows){fNumRows(j)}if(_lastsort==null){updateTable(g)}else{if(_lastdirection!=null){_lastdirection=!_lastdirection}sortresults(_lastsort,true)}setTimeout(hidemessage,250);setTimeout(function(){try{FB.XFBML.parse()}catch(k){}},1000);c();if(typeof resetResultCount=="function"){resetResultCount()}}waitForResults(a)}function sortresults(a){var f=new Date();showmessage(getUpdateMessage("Ordenando resultados..."));if(window.ssUserAction){var b=a.match(/(\w+)_([ab])$/);if(b){a=b[1];_lastdirection=b[2]=="a"}else{if(_currentsortid==a){_lastdirection=!_lastdirection}else{_lastdirection=true}}_currentsortid=a;return ssUserAction("SRT"+a,function(){updateDisplayA_ds("sort")})}var c=a;function d(){var m=new Date();clearPages();setTop(0);c();var k=new Date();var l=1000-(k.getTime()-f.getTime());setTimeout(hidemessage,((l>0)?l:1));_updatingResultsMessage=null;var j=new Date();addAdt("sorttime&"+(j.getTime()-m.getTime()));updateTable("sorting");updateDisplayA_ds("sort");var g=new Date();var h=new Date()}waitForResults(d)}function humanizeBookit(d,a){var c=null;if(d&&typeof(d)!="string"){c=jq(d);d=c.attr(a||"href")}if(!d||d.match(/&sc=/)){return d}var b=d.match(/code=(.*)&/);if(b){b=b[1].split(".")}if(!b||b.length<=6){return d}var f=(Math.abs(parseInt(b[0]))+Math.abs(parseInt(b[5])))%13242+1;d=d+"&sc="+f;if(c){c.attr(a||"href",d)}return d}var lastclickid=null;var lastclickmsg="";function itemClicked(b,m,h,g,l,f,k){humanizeBookit(f,k);g=g||"popup/resultclick";l=jq.extend({},l);if(b&&getResultID){l.resultid=getResultID(b)}if(h){l.pcode=h}if(typeof toggleShowAfterClickSection=="function"){toggleShowAfterClickSection(true,b,h)}if(window.hidePriceSelections&&!cancelAfterclick){hidePriceSelections()}if(window.ViewState){ViewState.update("clicked",b)}else{_r[b]._vs=1;if(lastclickid!=null){_r[lastclickid]._vs=2}}var j=(document.getElementById("popupAfterBooking")!=null);if(!j){var c=document.getElementById("msg"+b);var a=document.getElementById("resultmessage"+b);if(c){c.style.display=_isIE?"block":"table-row"}if(a){a.innerHTML=m}try{showprices(b,true)}catch(d){}}else{if(!cancelAfterclick){openbooking(null,m,h,b)}}if(lastclickid!=null){if(document.getElementById("msg"+lastclickid)!=null){document.getElementById("msg"+lastclickid).style.display="none"}if(document.getElementById("tbd"+lastclickid)!=null){document.getElementById("tbd"+lastclickid).style.backgroundColor="#eeeeee"}}jq("#tbd"+b).css("background-color","#eee");lastclickmsg=m;lastclickid=b;addAdt(g,l);return true}function openbooking(j,f,h,a){var b=(j!=null)?j:"popupAfterBooking";var d=window.getResultID?getResultID(a):_r[a]._id;var c=document.getElementById(b);if(c!=null&&"FR"!=h){function g(){closebooking(b)}toggleFaderPane(true,g);jq("#"+b).show().css({top:jq(window).scrollTop()+150,left:(jq(window).width()-jq("#"+b).width())/2});if(f!=null){jq("#popupbookmessage").html(f);f="<span class='closearea'><a class='actionlink' href='javascript: closebooking()'>cerrar</a> <img onclick='closebooking()' src='/images/v42526/close-x-white.gif' border='0' width='11' height='11' /></span>"+f;jq("#popupAfterBooking > tbody > tr > td.title").html(f).children("span.fnf").css("display","none")}jq("#fnflink > a").attr("href","javascript: flightnotfound("+a+", '"+h+"')");if(typeof searchid!="undefined"){jq("#addtotripslink").attr("href","javascript: addAdt('afterclick/addtotrips');addResultToTrip('"+searchid+"', '"+d+"', 'addFlightToTrip"+a+"')");jq("#fbsharelink").attr("href","javascript:shareResultOnFacebook(searchid, rid, pcode);")}}}function closebooking(c){toggleFaderPane(false);var a=(c!=null)?c:"popupAfterBooking";var b=document.getElementById(a);if(b!=null){b.style.display="none"}}function hideSearchBox(){toggleFaderPane(false);jq("#doc3Outer").unbind("click",hideSearchBox);jq("#popupSearch").hide()}var _lastEmailAttemptID=null;function emailResult(a,b){return emailresult(window.getResultID&&getResultID(a)||_r[a],SearchID,a,b)}function emailresult(d,h,g,a){var j=585;var b=550;var f=0;var c="?resultid="+d+"&searchid="+h;if(a){c+="&bookingid="+a}var k=window.open("/s/emailresult"+c,"emailresult","scrollbars,height="+(j+f)+",width="+b+",menubar=no,toolbar=no,resizable");if(k!=null){if(g>0){_lastEmailAttemptID=g}k.focus()}}function emailsuccess(){if(_lastEmailAttemptID!=null){try{itemClicked(_lastEmailAttemptID,"Los detalles de los resultados se han enviado por email y se han guardado en el historial de b\u00FAsquedas.");_lastEmailAttemptID=null}catch(a){}}}var pinnedResultList=new Array();var displayPinnedItems=true;var justPinned=-1;function getPinnedIDList(){var b=new Array();for(var a=0;a<pinnedResultList.length;a++){b.push(_r[pinnedResultList[a].id]._pid);if(_r[pinnedResultList[a].id]._pid!=_r[pinnedResultList[a].id]._id){b.push(_r[pinnedResultList[a].id]._id)}}return b.join(",")}function storePinned(a){jq.post("/s/sparkle",a)}function addPinned(b){if(window.hideAllTT){hideAllTT()}if(window.ssUserAction){ssUserAction("PIN: "+b,{pin:b+1});return}PinnedItems[_r[b]._id]=1;pinnedResultList.push({id:b});justPinned=b;updateTable("pin_"+_r[b]._id);justPinned=-1;try{document.getElementById("startsearchover").scrollIntoView(true)}catch(c){}var a=getPinSaveFields(b);a+="&add=Y&action=pinneditem";storePinned(a)}function removePinned(b){if(window.hideAllTT){hideAllTT()}if(window.ssUserAction){var d=b==null?"-all":-b-1;ssUserAction("UNPIN: "+d,{pin:d});return}for(var c=0;c<pinnedResultList.length;c++){if(pinnedResultList[c].id==b){pinnedResultList.splice(c,1)}}delete PinnedItems[_r[b]._id];if(window.onlyShowFavorites&&pinnedResultList.length==0){onlyShowFavorites(false)}else{updateTable("unpin_"+_r[b]._id)}var a=getPinSaveFields(b);a+="&add=N&action=pinneditem";storePinned(a)}function getLeftOfResultsCell(a,b){if(typeof a=="undefined"){a="ccc"}if(typeof b=="undefined"){b="fff"}return"<td class='repeaty' style='background-image:url(/images/corners/"+a+"-l.gif)'></td>"}function getRightOfResultsCell(a,b){if(typeof a=="undefined"){a="ccc"}if(typeof b=="undefined"){b="fff"}return"<td class='repeaty' style='background-image:url(/images/corners/"+a+"-r.gif); background-position: right'></td>"}function localTTHidden(){toggleFaderPane(false,null)}function showFareChartTip(b){var c=document.getElementById("no_chart_data_helptext");var a=document.getElementById(b);if(c!=null&&a!=null){jq(a).html(c.innerHTML)}}function mkCurrency(a){return _LEFT_CURSYMBOL+a+_RIGHT_CURSYMBOL}function chkCompareToGroups(d){var a=[],l={};for(var c=0;c<d.length;c++){if(d[c].group==null||d[c].group.length==0){d[c].groupOK=true}else{var g=d[c].group.substr(0,d[c].group.indexOf("-")),h=parseInt(d[c].group.slice(d[c].group.indexOf("-")+1)),f=c;if(l[g]==null){for(var b=c+1;b<d.length;b++){var m=d[b].group.substr(0,d[b].group.indexOf("-"));if(m==g){var k=parseInt(d[b].group.slice(d[b].group.indexOf("-")+1));if(k<h){d[f].groupOK=false;if(d[f].input!=null){d[f].input.checked=false}f=b;h=k}else{d[b].groupOK=false;if(d[b].input!=null){d[b].input.checked=false}}}}}}}for(var c=0;c<d.length;c++){if(d[c].groupOK=true){a.push(d[c])}}return a}function compareToKayak(){var f=document.comparesites;var g=true;var a=new Array();if(typeof f.comparetosite!="undefined"){if(typeof f.comparetosite.length=="undefined"){if(f.comparetosite.checked){a.push({code:f.comparetosite.value,url:f[f.comparetosite.value+"_url"].value})}}else{var h=f.comparetosite;for(var d=0;d<h.length;d++){if(h[d].checked){a.push({code:h[d].value,url:f[h[d].value+"_url"].value,group:h[d].className})}}}var c=new R9.utils.windowopener({searchType:R9.globals.vertical,tileWindows:true});a=chkCompareToGroups(a);for(var b=0;b<a.length;b++){g=(g&&c.open(b,a[b].code,a[b].url,a.length))}}if(!g){document.getElementById("innerTableTTTL").style.width="800px";popupBlockerMsg(null);window.focus()}}function popupBlockerMsg(){toggleFaderPane(true,null);loadDialog("popupWarning","popupblockertooltipdiv",function(){showTT(document.getElementById("popupTTIPPos"),document.getElementById("popupWarning").innerHTML,"TL");jq("#tooltipdivimageholder").empty().append("<img align='left' style='margin-right: 8px' src='/images/a-pop-up-ani.gif'>");window.focus()})}function popupContinue(){toggleFaderPane(false,null);hideAllTT()}function isNumeric(c){var b=""+c;if(b.length==0){return false}else{if(b.length==1&&(b.charAt(0)=="."||b.charAt(0)==","||(b.charAt(0)=="-"))){return false}}for(var a=0;a<b.length;a++){if((b.charAt(a)>="0"&&b.charAt(a)<="9")||b.charAt(a)=="."||b.charAt(a)==","||(b.charAt(a)=="-"&&a==0)){}else{return false}}return true}function getLeaveBehindFilterCell(b,c,a){return["<a href='javascript:"+c+';addAdt("leavebehind/'+(a||b.replace("'","\\'"))+"\");'>","<span>"+b+"</span>","</a>"].join("")}function getLeaveBehindFilterLink(b,a){return['<a id="freset_',a||sectionName.replace("'","\\'"),'" ',"onclick='javascript:",b,';addAdt("leavebehind/',a||sectionName.replace("'","\\'"),"\");cancelPropagation(event);'>","restablecer","</a>"].join("")}function updateLeaveBehindFilterReasons(){var a=getLeaveBehindFilterReasons();if(a){jq("#leaveBehindFilters").html(a);jq("#checklets").show()}var b=getFilteredOutReasons().reasons;jq("#filterdiv .sectionSubHeader").each(function(){var f=false;if(b){for(var c=0;c<b.length&&!f;c++){var g=b[c];if(!g.heading||!g.sectionname){continue}if(this.id=="fs_outer_"+g.sectionname||this.id=="fs_outersub_"+g.sectionname){var d=jq(this).find(".freset");if(d&&d.html().length==0){d.html(getLeaveBehindFilterLink(g.action,g.name))}jq(this).addClass("filtered");f=true}}}if(!f&&jq(this).hasClass("filtered")){jq(this).removeClass("filtered").find(".freset").html("")}})}function getLeaveBehindFilterReasons(){var f=[];var a={};var b=false;var d=getFilteredOutReasons().reasons;for(var c=0;c<d.length;c++){var g=d[c];if(g.heading==null||g.heading==""){continue}if(a[g.heading]==null){if(!b){f[f.length]="<span class='title'>Filtros:</span>";b=true}f[f.length]=getLeaveBehindFilterCell(g.heading,g.action,g.name)+" ";a[g.heading]=true}}if(b){return f.join("")}return null}function get_slider_range(b){var a=jq(b);return a.length&&[a.slider("option","min"),a.slider("option","max")]||null}function inrange(b,a){return b>=a[0]&&b<=a[1]}function ui_select(a){return a&&document.resultUI&&document.resultUI[a]||null}function ui_check(b,a){jq(ui_select(b)).prop("checked",a?true:false)}function ui_checked(a,c){var b=jq(ui_select(a));var d=0;b.each(function(g,f){if(f.checked){c[f.value]=f.value;d++}});return d==b.length}function monthDayYear(a){if(!a){a=new Date()}return(a.getMonth()-0+1)+"/"+a.getDate()+"/"+a.getFullYear()}function populateAdSpace(a,b){jq.get("/h/ads/results?searchid="+a+"&pagenum="+_currentPageNum,function(c){var k=jq("<div/>").html(c);var m=k.find("#sideads");var q=k.find("#topads");var g=k.find("#bottomads");var j=k.find("#bottomads_opt_header_tr1");var h=k.find("#bottomads_opt_header_tr2");var o=k.find("#bottomads_text_ads_td");var n=k.find("#bottomads_separator_td");var p=k.find("#topbannerads");if(b){jq("#topBannerAdContainer").html(p)}if(q.children().length>0){jq("#topAdContainer").html(q).show();validateResultTopAdHeight()}else{jq("#topAdContainer").hide()}if(b){jq("#nrAds").html(m)}else{jq("#nrAdsAjax").html(m)}if(b){jq("#bottomAdContainer").html(g)}else{if(j.length>0){jq("#bottomads_ads_tr").before(j);jq("#bottomads_opt_header_tr1").after(h)}if(o.length>0){jq("#bottomads_display_ad_td").before(o);jq("#bottomads_text_ads_td").after(n)}}if(b&&typeof(document.bannerUrls)!="undefined"){for(id in document.bannerUrls){if(navigator.appVersion.indexOf("MSIE")!=-1){var d=id.slice(id.length-1);var f=document.getElementById("displayAdSpanFrame"+d).innerHTML;var l=f.replace(/src="[^"]*"/,'src="'+document.bannerUrls[id]+'"');document.getElementById("displayAdSpanFrame"+d).innerHTML=l}else{jq("#"+id).attr("src",document.bannerUrls[id])}}}loadDisplayAds()});if(window.CMP2RESULTSPAGE){pollinlinecmp2(a)}if(window.CROSSSALEDISPLAYAD&&window.crossSaleSetContent){populateCrossSaleAds(a)}}function validateResultTopAdHeight(){if(window.R9Admin&&window.R9TopAdsHeight){var a=jq("#topAdContainer").height();if(a>window.R9TopAdsHeight){alert("Hey, Admin!\nThis is not good: Top ads container '#topAdContainer' is pushing result content after loading. Check it's height!\nCurrent height difference from expected: "+(a-window.R9TopAdsHeight)+"px!")}}}function pollinlinecmp2(a){if(!Streaming.done){window.setTimeout("pollinlinecmp2('"+a+"')",1000)}else{cmp2setcontentinline()}}function cmp2setcontentinline(){var a=jq("#cmp2contentinline").html();if(a){jq(".cmp2inlinecontainer").html(a).show();jq(".cmp2inline").show();cmp2bottombarsetup(a);jq(".cmp2providerbutton").hover(function(){jq(this).addClass("hovering")},function(){jq(this).removeClass("hovering")})}}function cmp2bottombarsetup(b){jq("#cmp2BottomContent").html(b);a();jq("#cmp2BottomBar").show();function a(){var c=jq("#listbody").offset().left-8;jq("#cmp2BottomBar").css("left",c+"px")}jq(window).resize(function(){a()})}function cmp2setcontent(a){jq.ajax({type:"POST",url:"/h/ads/getcmp2",data:{searchid:a,alternatetemplate:"cmp2resultspage.vtl"},dataType:"html",success:function(c){jq("#cmp2container").html(c);var f=jq("#cmp2contentrightrail").html();if(f){jq("#cmp2rightrailcontainer").html(f).show();jq("#cmp2contentrightrail").remove()}jq("#cmp2topright").show();var b=jq("#cmp2contentbottom").html();if(b){jq("#cmp2bottomcontainer").html(b).show();jq("#cmp2contentbottom").remove();jq("#cmp2bottom").show()}var d=jq("#cmp2contentsearchcompleted").html();if(d){jq("#searchcompletedcontainer").html(d)}pollinlinecmp2(a)},error:function(b,d,c){if(window.R9Admin){alert("There was an error fetching the list of sites to compare prices to. Please refresh and try again.")}}})}function populateCrossSaleAds(a){crossSaleSetContent(a);if(!populateCrossSaleAds.handler){populateCrossSaleAds.handler=function(){crossSaleSetContent(a)};jq(window).bind("updateDisplayDone.crosssale",populateCrossSaleAds.handler);jq("form[name='inlinesearchagain']").submit(function(){jq(window).unbind("updateDisplayDone.crosssale",populateCrossSaleAds.handler);window.IS_CROSSSALE_REQUESTED=window.IS_CROSSSALE_IMPRESSED=false;populateCrossSaleAds.handler=null})}}function flippyDone(){jq("#flippyiframecontainer").hide(750);if(window.R9PBar){R9PBar._stopTimer()}}function shareResultOnFacebook(b,c,a){FB.login(function(f){if(f.session&&f.perms&&f.perms.indexOf("publish_stream")>-1){var d=d||"";jq.post("/h/socmed/facebookShareResult",{searchid:b,resultid:c,pc:a,prod:d},"json")}},{perms:"publish_stream"})}var R9PBar=null;function setupPBar(a){var b=window.R9_PBartimer&&jq("#progressDiv")||[];if(!b.length){return}R9PBar=new R9_PBartimer(b,(a?(a-0):60000)+5000)}var adt=new Array();function initAdt(d,b){if(!window.LogUserEvents){return false}try{adt.push(d);adt.push(SearchID);adt.push("load="+new Date().getTime());adt.push("rc="+_r.length);adt.push("fc="+_filtered.length);if(extraArgs){for(var c in extraArgs){adt.push(extraArgs[c])}}adt.push("resultmessage="+RANDOM_UPSELL_CODE)}catch(a){}}function addAdt(c,b){if(window.LogVSEvents&&c.indexOf("filtertime")<0&&c.indexOf("sorttime")<0){b=jq.extend({},b,{action:"vs"});if(window.SearchID){b.searchid=SearchID}jq.get("/vs/"+window.SearchType+"/"+c,b)}if(!window.LogUserEvents){return}try{adt.push('f="'+c+":"+new Date().getTime()+'"');if(adt.length>=20){sendAdt();initAdt()}}catch(a){}}function sendAdt(){if(!window.LogUserEvents){return}jq.post("/s/sparkle?action=filterstats&ts="+new Date().getTime()+(typeof SearchID!="undefined"?"&searchid="+SearchID:""),"log="+escape(adt.join(" ")));adt=new Array()}function allresultsloaded(){_ALLRESULTSLOADED=true;var a=document.getElementById("filtered_count");if(a){a.innerHTML=_filtered.length}Streaming.dbg("ALR=true")}function uistatsunload(){adt.push("unload="+new Date().getTime());sendAdt()}function flippyLoaded(){jq("#flippyblocker").hide()}function updateDisplayA_ds(a){if(window.NoAds||R9_DisplayEds_JustHidden||!window.SearchID||window.local_displayEdOKToUpdate&&!local_displayEdOKToUpdate()){return}addAdt("bannerreload");reloadBannerAds()}function waitForResults(d){var a=d;var b=0;function c(){if(_ALLRESULTSLOADED){d();jq(".slidedown").slideDown("slow");return}else{if(window.SearchType=="hotel"&&b==0){addAdt("impatienthoteluser")}}b++;if(b>=40){alert("Lo sentimos, ha ocurrido un error al intentar actualizar tus resultados. Escr\u00EDbenos si persiste este problema.")}else{if(b<=10){window.setTimeout(c,250)}else{window.setTimeout(c,1000)}}}window.setTimeout(c,1)}function research(){addAdt("startsearchover");var a="/"+SearchType+"s?uselast=true&"+(window.extraSearchParam&&extraSearchParam()||"");window.location.replace(a)}function doHide(){if(typeof hidePriceSelections=="function"){hidePriceSelections()}}function initSmartbox(k,c,d,a){var b=0;if(typeof d=="function"){var g=d;d=a;a=g}var h={callbackWithNull:true,minWidth:180,searchType:window.SearchType,timeout:window.smartyTypedelay};if(d){jq.extend(h,d)}var j=h.callback;jq.each(c,function(f,m){var l=jq(jq.isArray(m)&&m[0]||m);if(l.length){h.callback=function(n){if(jq.isArray(m)){jq(m[1]).val(n?n.id:"")}if(j){j.apply(this,n)}if(a){a.call(this,n,m)}};jq(l).smartbox(h).blur(function(){compare2chk(gradientDialogCleanup)});b++}});jq(window).unbind("lazyLoad."+k);if(c.length>b){jq(window).bind("lazyLoad."+k,function(){initSmartbox(k,c,d,a)})}return b}function modifySearch(a,b){if(typeof hidePriceSelections=="function"){hidePriceSelections()}compare2origin="rslt";if(!a){return research()}loadPopupSearch(function(){if(b){b()}initCalendar();if(typeof compare2chk=="function"){compare2initializing=false;compare2chk(gradientDialogCleanup);jq("#compareToRow").show().css("visibility","visible")}if(typeof useSearch=="function"){useSearch()}var f=document.searchagain;if(f){jq("div.inlineStartSearchOver :input").each(function(h){var g=jq(this);if(g.val()!=g.attr("defaultValue")||g.attr("type")=="hidden"){if(g.attr("type")=="checkbox"&&jq(f[this.name]).attr("type")=="checkbox"){jq(f[this.name]).prop("checked",g.prop("checked"))}else{jq(f[this.name]).val(g.val())}}})}var d=jq(this),c=jq("#modifysearchtd");if(c.is(":visible")){d.r9popover({position:c})}else{d.r9dialog({draggable:false})}})}function secondPhaseShow(){Streaming.showAllResults()}function clearTwoPhaseMessage(){Streaming.stopTwoPhase()}function expiredSearchAgain(a,c){jq(document.body).css("cursor","wait");if(window.Filters){Filters.saveState("expired")}var b;if(a){b=document.location.href;if(c){b+="&nocache=1";document.location.replace(b)}else{document.location.reload()}}else{var b=SearchURL;if(c){b+="&nocache=1"}document.location.replace(b)}}function getResultID(a){return _r[a]._id}function setsortorder(b,a){_currentsortid=b;_lastsortid=b;_lastdirection=a}var sharectl=null;function showShareSavedSection(g,a,b,f,c,d){showShareSection(g,a,b,f,c,d,"sharesaved")}function showShareSection(resultID,hid,name,price,triptype,likeurl,action){var data="action="+(action||"share")+"&searchid="+SearchID+"&resultid="+getResultID(resultID)+"&hid="+hid;hotelalertresid=resultID;hotelalerthid=hid;hotelalertname=name;if(resultID>-1){jq.ajax({type:"POST",url:"/s/toolbox",data:data+"&includecode=true",dataType:"xml",success:function(xmlobj){var xml=jq(xmlobj),code=xml.find("code").text();if(code&&code.length){eval(code);sharectl=new shareController()}jq("body").append(xml.find("html").text());sharectl.newShare(document.getElementById("sharelink"+resultID),hid,name,resultID,price,triptype,likeurl)},error:function(request,textStatus,error){alert(textStatus+" "+error.toString())},cache:false})}}function setLookbackCookie(c,b){var a="/s/lookback/"+c+"&resolve=true&resultid="+b;jq.ajax({type:"POST",url:a,dataType:"html",success:function(f){try{var k=jq("iframe.lookbackUrl").attr("contentWindow");var j=jq(k).attr("document");var h=jq(j).attr("body");jq(h).html(f);var g=j.forms.book;jq(g).submit()}catch(d){}},cache:false})}function bookLinksExpired(b){if(window.getXsellImpressionParams){var a=getXsellImpressionParams();b=b+a}jq.ajax({type:"POST",url:"/s/toolbox",data:b,dataType:"html",success:function(d){try{toggleFaderPane(true);var f=jq("#bookLinksExpiredDiv");if(!f.length){f=jq("<div id='bookLinksExpiredDiv'></div>").appendTo("body")}if(jq.browser.msie){f.css("position","absolute")}f.html(d);jq("td.tellmemore").append(jq("#expiredXSell").html());f.show();addAdt("booklinkexpired/shown")}catch(c){}},error:function(d,f,c){alert(f)},cache:false})}function showPriceAlertSaved(alertid,error){var mydata={action:"farealertsaved",searchid:SearchID,alertid:alertid};var savedalert;jq.ajax({type:"POST",url:"/s/toolbox",data:mydata,dataType:"xml",success:function(xmlobj){try{jq("#alertUpsellContent").r9popover("destroy").remove();var xml=jq(xmlobj);var code=xml.find("code").text();var html=xml.find("html").text();if(code!=null&&code.length>0){eval(code)}jq("#showalertlinkrow").hide();jq("#showalertsavedlinkrow").show();showTT(jq("#showalertsavedlinkrow"),"","DL",{x:35,y:-15});if(typeof(savedalert)!="undefined"&&typeof(savedalert.savedalertid)!="undefined"){jq("#editalertlink").attr("href","/alerts?action=prepop&alertid="+savedalert.savedalertid)}else{jq("#editalertlink").attr("href","/alerts")}jq("#ttipDL").html(html);jq("#bootypopcontent").html(html);if(alertid=="-2"&&(typeof(error)!="undefined")){AjaxAlert.showEmailAlertError(error)}else{jq("#alerterrorrow").hide();jq("#alertsuccessrow").show()}}catch(ignored){}},error:function(request,textStatus,error){alert(textStatus)},cache:false})}function displayPrice(b,a){var c=(b*1)+0.5;return(a?_LEFT_CURSYMBOL:"")+parseInt(c)+(a?_RIGHT_CURSYMBOL:"")}function showLowest(a){Filters.undoAll(a,"show_lowestprice");addAdt("leavebehind/all")}function validateJS(d){if(!d){d=jq(document)}var c=d.find("#scripts");var b=[];var a=[];if(!c.length){throw"#scripts div not found."}d.find("script").each(function(){var f=this.id&&"#"+this.id||this.src||this.text&&("'"+this.text.substr(1,35).replace("\n"," ")+"...'")||this;if(this.parentNode!=c[0]){throw"All scripts must be in #scripts div, but\n"+f+" is in "+identify(this.parentNode)}if(this.src){b.push(this.src)}else{if(!this.id){throw"All inline script tags must have ids, but\n "+f+" does not"}else{a.push(this.id)}}});if(a.length>1){throw (a.length-1)+" extraneous inline tags found: "+a.join(", ")}if(b.length>(SearchType=="car"&&10||6)){throw"Too many ("+b.length+") included scripts. Should be merged: "+b.join("\n")}}function completeInitialLoad(a){if(window.productstartup){window.productstartup()}Streaming.dbg("I="+R9RsltCount+"; T="+Streaming.lastPoll);if(window.R9Admin&&!window.R9Skin&&(!window.samepageresults||a)){Streaming.dbg("CHKS<");validateScripts();Streaming.dbg("CHKS>")}jq(window).trigger("initialLoad")}function attachMatrixHover(){var a=jq("#filterviewmatrix");if(!a.length){return}jq("#filterviewmatrix").delegate("td.pricecell","hover",function(){if(jq(this).html().match("\\d")){jq(this).toggleClass("hoverCell")}}).delegate("td.airlinecell","hover",function(){jq("#filterviewmatrix td."+jq(this).attr("id")).toggleClass("hoverCol")}).delegate("td.stopslabel","hover",function(){jq("#filterviewmatrix td."+jq(this).attr("id")).toggleClass("hoverRow")})}function identify(b){var c="";b=jq(b);while(1){if(!b[0]||b[0].tagName=="HTML"){break}if(b[0].id){c="#"+b[0].id+" "+c;break}var a=b[0].className.replace("s+",".");c=b[0].tagName+(a?"."+a:"");b=b.parent()}return c}R9.ajaxHistory={lastHash:"",callback:null,initialize:function(a){this.lastHash=window.location.hash;this.callback=a;setTimeout(R9.ajaxHistory.checkHash,300)},ignoredChange:function(a){var b=this.callback;this.callback=false;try{a.call();this.lastHash=window.location.hash}finally{this.callback=b}},checkHash:function(){var a=window.location.hash;var b=this.lastHash;if(a!=b&&b!=undefined){this.lastHash=a;if(this.callback){this.callback.call(this)}}setTimeout(R9.ajaxHistory.checkHash,300)}};function destroyPopupSearch(){var a=jq("#popupSearch"),b=a.data();if(b.r9popover){a.r9popover("destroy")}else{if(b.r9dialog){a.r9dialog("destroy")}}return a}function loadPopupSearch(a){loadSection(jq("#popupSearchLazy"),function(){a.apply(destroyPopupSearch())},{action:"searchpopup"})}function loadDialog(c,b,a){if(jq("#"+c).length){a()}else{ssAJAX("/s/toolbox",{action:"tpl",t:b},a)}}function loadSection(b,a,d){if(typeof a=="string"){var c=d;d={action:a};a=c}if(b.is(".lazy")){ssUserAction("LZLD",function(){if(a){a.apply(b,arguments)}b.removeClass("lazy");jq(window).trigger("lazyLoad",[b,d]);jq(b).trigger("lazyLoad",d)},d)}else{if(typeof a=="function"){a.apply(b)}}}function toggleMatrix(b){var a=jq("#filterviewmatrix");if(!b){b=a.is(":visible")&&"list"||"matrix"}var c=b!="matrix";window.currentview=b;if(!c){loadSection(a,"matrix")}hideAllTT();jq(".selectedtab").addClass("unselectedtab");jq(".selectedtab").removeClass("selectedtab");jq("#content_div").show();jq("#pagingTableBottom").show();a[c?"hide":"show"]();jq("#toolboxitemshowmatrix")[c?"show":"hide"]();jq("#toolboxitemhidematrix")[c?"hide":"show"]();addAdt("chgview/"+b)}function showMoreReasons(a){jq(".reviewreasons").hide();var c=jq("#firstreview_"+a).html();var d="hotel.freetextreview.show."+c;if(c!=null&&c!=""){var b=jq("#revdetail_"+c).html();if(b!=null&&b.length<10){detailReviewClicked(a,c,d)}}jq("#reviewreasons_"+a).r9dialog({width:780,position:["center",100]}).show()}function cancelPropagation(a){if(!a){a=window.event}a.cancelBubble=true;if(a.stopPropagation){a.stopPropagation()}}function bindSelectTextOnFocus(){jq("input.selectTextOnFocus").one("focus",function(){this.select()})}function closeFilterInfo(){jq("#popupFilterInfo").hide()}function showAndHideFilterPopup(){var a=jq("#filterdiv"),b=a.offset();b.left+=a.width()+30;b.top=b.top-(jq("#popupFilterInfo").height()/2)+(a.height()/2+10);jq("#popupFilterInfo").offset(b);jq("#popupFilterInfo").delay(2000).show().delay(10000).fadeOut("slow")}function attachInlineMultibook(){jq("#listbody").delegate(".resultInlineMulti .allInlineItems","click",function(event){event.stopPropagation();jq(this).parents(".resultInlineMulti").toggleClass("opened")});jq("#listbody").delegate(".resultInlineMulti .item, .deals .flowness","click",function(event){event.stopPropagation();jq(this).find("a.dealsinresult").each(function(i){if(this.rel.indexOf("javascript")==0){eval(this.rel)}else{window.open(this.rel,this.target.replace(":",""))}jq(this).addClass("visited");addAdt("results/inline/click")})})}function popupsearchsubmit(){addAdt("toolbox/changesearch/searchagain");Profiler.markSearchStart();comparewindows(document.searchagain);jq("#getratesbutton").prop("disabled",true);var a=generateSearchUrl(document.searchagain);if(a!=null){window.clearTimeout(window.R9.bookLinksExpiredTimeout);loadResults(a,undefined,destroyPopupSearch);return false}return true}function setAllCmp2(a){jq("#compareToCheckboxes input:checkbox:visible").prop("checked",a);setCmp2Count();jq.get("/vs/cmpallclk."+_getStartTab()+"?action=vs"+(typeof SearchID!="undefined"?"&searchid="+SearchID:""))}function _getStartTab(){if(window.SearchType&&!window.StartTab){StartTab=SearchType+"s"}return StartTab}function _getSearchForm(){return document[_getStartTab()]||document.searchagain}function startsWith(b,a){return b.match("^"+a)==a}function isEnoughInfoForCmp2(){if(!window.CMP2REQUIREDEST){return true}var a=_getSearchForm();return window.StartTab=="cruises"||a&&jq(a.origin).attr("value")&&!startsWith(jq(a.origincode).attr("value"),"C-")&&jq(a.destination).attr("value")&&!startsWith(jq(a.destcode).attr("value"),"C-")||a&&jq(a.othercity).attr("value")||a&&jq(a.location).attr("value")}function getCmp2Args(){if(window.flynow){return""}var b=_getStartTab();var c=_getSearchForm();var a="ptype="+b;if(b=="flights"||b=="vacations"){a+="&depart_date="+c.depart_date.value;a+="&return_date="+c.return_date.value;a+="&origin="+c.origin.value;a+="&origincode="+c.origincode.value;a+="&destination="+c.destination.value;a+="&destcode="+c.destcode.value;if(b=="flights"){a+="&cabin="+c.cabin.value;a+="&oneway="+((c.oneway[1].checked)?"true":"false");if(c.student){a+="&student="+c.student.value}}}else{if(b=="hotels"){var a="ptype=hotels";a+="&checkin_date="+c.checkin_date.value;a+="&checkout_date="+c.checkout_date.value;a+="&location="+c.othercity.value;a+="&citycode="+c.citycode.value;a+="&lmid="+c.lmid.value}else{if(b=="cars"){var a="ptype=cars";a+="&pickup_date="+c.pickup_date.value;a+="&dropoff_date="+c.dropoff_date.value;a+="&location1="+c.location.value;a+="&citycode1="+c.citycode1.value;a+="&location2="+c.location2.value;a+="&citycode2="+c.citycode2.value;a+="&oneway="+((c.oneway[1].checked)?"true":"false")}else{if(b=="cruises"){var a="ptype=cruises";a+="&destination="+c.destination.value}else{return""}}}}if(compare2origin!=null){a+="&qryorigin="+compare2origin}return a}var skipCompare=false;var compare2initializing=true;var compare2origin=null;function compare2chk(c){if(compare2initializing){return}if(skipCompare){return}if(!isEnoughInfoForCmp2()){jq("#compareToSpacer").hide();jq("table.compareToWrapper").hide();gradientDialogCleanup();return}if(window.flynow){return}var b=_getSearchForm();if(!b){return}var a=null;if(typeof c=="function"){a=c}if(typeof b.comparetosite!=="undefined"){jq("#compareToSpacer").show();jq("table.compareToWrapper").show();jq.getScript("/s/cmp2chk?"+getCmp2Args(),a)}else{if(typeof a=="function"){a()}}}function allcmp2set(a){try{var c=document.getElementById("compareToRow");if(a){if(c.style.display=="none"){c.style.display=""}}else{c.style.display="none"}}catch(b){}}function cmp2set(a,d){if(d!=null&&d.indexOf("KAYAK")==0){return}try{var c=document.getElementById("site"+d);var f=document.getElementById("cb"+d);if(a){jq("#compareToRow").show();if(c.style.display=="none"){c.style.display="";f.checked=f.defaultChecked;f.value=d;initCmp2CTR();cmp2CTR.recordCheck(d,f.defaultChecked);cmp2CTR.recordVisible(d,true)}}else{f.checked=false;c.style.display="none";initCmp2CTR();cmp2CTR.recordCheck(d,false);cmp2CTR.recordVisible(d,false)}}catch(b){}}function cmp2swap(d,c){cmp2set(true,d);try{var b=document.getElementById("cb"+d);b.value=c}catch(a){}}function cmp2precheck(d,b){try{var c=document.getElementById("cb"+b);c.checked=d}catch(a){}}function setCmp2Count(){var a=_getStartTab();if(jq("#compareToCheckboxes").children("span:visible").size()==0){jq("#compareToRow").css("visibility","hidden")}else{jq("#compareToRow").css("visibility","visible")}}function checkStudentCabin(a){if(a.value=="e"){toggleStudent(true)}else{toggleStudent(false)}}function toggleStudent(a){if(a){student("0")}else{document.getElementById("student").value="0";jq("#student_link").hide();jq("#non_student_link").hide()}}function student(a){document.getElementById("student").value=a;if(a=="1"){jq("#student_link").hide();jq("#non_student_link").show();jq("#compareALL").hide()}else{jq("#non_student_link").hide();jq("#student_link").show();jq("#compareALL").show()}compare2chk()}function addCheckedCompareTos(c,a){var d=0;if(typeof c.comparetokayak!="undefined"){var f=c.comparetokayak;for(var b=0;b<f.length;b++){if(f[b].checked){if(CMP2_HIDDEN){f[b].checked=false}else{if(f[b].value!=null&&f[b].value!=""){a.push({code:f[b].value,group:f[b].className,input:f[b]})}}}}}if(typeof c.comparetosite!="undefined"){if(typeof c.comparetosite.length=="undefined"){if(c.comparetosite.checked){if(CMP2_HIDDEN){c.comparetosite.checked=false}else{a.push({code:c.comparetosite.value,group:c.comparetosite.className,input:c.comparetosite})}}}else{var f=c.comparetosite;for(var b=0;b<f.length;b++){if(f[b].checked){if(CMP2_HIDDEN||!jq(f[b]).is(":visible")){f[b].checked=false}else{if(f[b].value!=null&&f[b].value!=""){a.push({code:f[b].value,group:f[b].className,input:f[b]})}}}}}}}function comparewindows(d){var a=new Array();if(typeof d.comparetosite=="undefined"){return true}addCheckedCompareTos(d,a);var c=new R9.utils.windowopener({searchType:R9.globals.vertical,tileWindows:true});for(var b=0;b<a.length;b++){if(a[b].code!=null&&a[b].code!=""){if(!c.open(b,a[b].code,a.length)){return false}}}return true}function uncheckcomparetos(c){if(c.comparetosite==null){return}if(typeof c.comparetosite.length=="undefined"){c.comparetosite.checked=false;return}initCmp2CTR();cmp2CTR.startUpdate();var d=c.comparetosite;for(var a=0;a<d.length;a++){d[a].checked=false;var b=d[a].value;cmp2CTR.recordCheck(b,false);cmp2CTR.recordVisible(b,false)}cmp2CTR.endUpdate()}function compareExpediaDom(a){jq.ajax({type:"POST",url:"/k/cookie",data:{action:"setmeta",metacookie:"EXPEDIA_DFDCMP2",metavalue:a},success:function(b){compareExpediaInt(a)}})}function compareExpediaInt(a){jq.ajax({type:"POST",url:"/k/cookie",data:{action:"setmeta",metacookie:"EXPEDIA_IFDCMP2",metavalue:a}})}function compareChecked(c){var b="false";if(c.checked){b="true"}var a=c.value;initCmp2CTR();cmp2CTR.recordCheck(a,c.checked);if(a.indexOf("EXPEDIA_DFDCMP2")>=0||a.indexOf("EXPEDIA_IFDCMP2")>=0){window.setTimeout("compareExpediaDom('"+b+"')",500);a="EXPEDIA_FDCMP2"}jq.ajax({type:"POST",url:"/k/cookie",data:{action:"setmeta",metacookie:a,metavalue:b}});setCmp2Count()}var CMP2_HIDDEN=false;function compareToClosed(){CMP2_HIDDEN=true;jq("#compareToRow").hide();jq.ajax({type:"POST",url:"/k/cookie",data:{action:"setmeta",metacookie:"hidefdcmp",metavalue:"true"}})}function compareCheckedKayak(a){var b=document.getElementById("cbKAYAK_FDHCMP2");if(b){saveMeta(b,compareCheckedKayak3)}}function compareCheckedKayak3(){var a=document.getElementById("cbKAYAK2_FDCCMP2");if(a){saveMeta(a,null)}}function saveMeta(b,c){var a="false";if(b.checked){a="true"}if(c==null){jq.ajax({type:"POST",url:"/k/cookie",data:{action:"setmeta",metacookie:b.value,metavalue:a}})}else{jq.ajax({type:"POST",url:"/k/cookie",data:{action:"setmeta",metacookie:b.value,metavalue:a},success:c})}}function showMoreCMP2(){var b=jq("#moresiteslink").offset();var a=jq("#addmorecmp2").detach();a.appendTo("body").css({top:b.top-0+15,left:b.left}).show();window.setTimeout(bindhideCMP2,100)}function bindhideCMP2(){jq(document).bind("click",hideMoreCMP2)}function hideMoreCMP2(){jq("#addmorecmp2").hide();jq(document).unbind("click",hideMoreCMP2)}function cmp2am(a,c){if(c!=null&&c.indexOf("KAYAK")==0){return}try{var d=document.getElementById("am"+c);if(a){if(d.style.display=="none"){d.style.display=""}}else{d.style.display="none"}}catch(b){}}function addcomparetolist(a){cmp2set(true,a);jq("#cb"+a).prop("checked",true);savedisplay(a,true);compareChecked(document.getElementById("cb"+a));jq("#am"+a).hide();checkmoresites()}function checkmoresites(){var a=true;jq("#addmorecmp2 span").each(function(){a=jq(this).css("display")=="none";if(!a){return false}});if(a){jq("#moresites").hide()}else{jq("#moresites").show()}}function cmp2ForceSingleLine(){var b=9999;jq("#compareToCheckboxes").children("span.cmp2item:visible").each(function(d){var c=Math.round(jq(this).offset().top);if(c<b){b=c}});var a=0;jq("#compareToCheckboxes").children("span.cmp2item:visible").each(function(d){var c=Math.round(jq(this).offset().top);if(Math.round(c)-b>5){jq(this).hide();a++}})}function savedisplay(b,a){jq.ajax({type:"POST",url:"/k/cookie",data:{action:"setmeta",metacookie:b+"_disp",metavalue:a}})}function Cmp2CTR(d){this.recordVisible=function(k,j){b(k,4,(j)?"1":"0")};this.recordCheck=function(k,j){b(k,5,(j)?"1":"0")};this.recordTerm=function(j,k){b(j,3,k)};this.startUpdate=function(){g=false};this.endUpdate=function(){f();g=true};var h=d;var c=null;var a=6;var g=true;function b(o,m,p){try{if(c==null){if(h==null){return}c=new Object();var l=h.value.split(";");for(var k in l){var j=l[k].split("|");c[j[0]]=j}}if(3<=m&&m<a){var n=c[o];if(n!=null&&n.length==a&&n[m]!=p){n[m]=p;if(g){f()}}}}catch(q){}}function f(){try{if(c==null){return}if(h==null){return}var k="";for(var j in c){if(k.length>0){k+=";"}k+=c[j].join("|")}h.value=k}catch(l){}}}var cmp2CTR;function initCmp2CTR(){if(typeof(cmp2CTR)=="undefined"){try{cmp2CTR=new Cmp2CTR(document.forms[0].c2s)}catch(a){cmp2CTR=null}}}function inlineSearchResubmit(a){try{addAdt("inlinesearch/searchagain");showmessage("Iniciando nueva b\u00FAsqueda...");jq("body").css("cursor","wait");Profiler.markSearchStart();var c=generateSearchUrl(a,true);if(c!=null){window.clearTimeout(window.R9.bookLinksExpiredTimeout);loadResults(c);return false}}catch(b){if(window.R9Admin){alert("Exception "+b+" in inlineSearchResubmit(). Abort");return false}}return true}function setDisplayTabs(c){for(var a=0;a<c.length;a++){var b=jq("#cmp2TabFD"+a);if(b.length==0){break}b.text(c[a])}if(c.length==0){jq("#compareToRow").hide()}else{if(jq("#tabbedCmpFDContent:visible").length==0){jq("#compareToRow").show();jq("#tabbedCmpFDContent").slideDown(800)}}}R9.extend("utils",{windowopener:function(b){if(top!=self){try{if(top.document.location.toString()){this._top=top}}catch(a){}}jq.extend(this.options,b)}});R9.extend("utils.windowopener.prototype",{_top:self,options:{searchType:"",popUnder:true,tileWindows:false,heightRule:false,minWidth:0,minHeight:0,screenWidth:1024,screenHeight:768},open:function(c,f,d,b){var b=this._getUrl(b,f);if(!b){return true}var a=this._getWindow(b,this._getWindowName(f),c,d);if(!a){return false}this._handleInitialWindowFocus(a);this._preparePopUpWindow(a);a.init(a);return true},_getWindow:function(c,f,b,d){try{return this._top.window.open(c,f,"toolbar=0,scrollbars=1,location=1,statusbar=1,menubar=0,resizable=1,top="+this._getWindowTop()+",left="+this._getWindowLeft(b,d)+",width="+this._getWindowWidth(b,d)+",height="+this._getWindowHeight())}catch(a){return false}},_getWindowWidth:function(a,c){if(this.options.tileWindows){return Math.min(this.options.screenWidth,Math.floor(this._getScreenWidth()/c-10))}var b=0;if(typeof(this._top.window.innerWidth)=="number"){b=this._top.window.innerWidth}if(this._top.document.documentElement&&this._top.document.documentElement.clientWidth){b=this._top.document.documentElement.clientWidth}if(this.options.minWidth){return this.options.minWidth>b?this.options.minWidth:b}return b},_getWindowHeight:function(){if(this.options.heightRule){return Math.round(this._getScreenHeight()*0.6)}if(this.options.tileWindows){return this._getScreenHeight()}var a=0;if(typeof(this._top.window.innerHeight)=="number"){a=this._top.window.innerHeight}if(this._top.document.documentElement&&this._top.document.documentElement.clientHeight){a=this._top.document.documentElement.clientHeight}if(this.options.minHeight){return this.options.minHeight>a?this.options.minHeight:a}return a},_getWindowTop:function(){if(this.options.heightRule){return Math.round(this._getScreenHeight()*0.4)}if(this.options.tileWindows){return 0}if(this._top.window.screenTop!=undefined){return this._top.window.screenTop}return this._top.window.screenY},_getWindowLeft:function(a,b){if(this.options.tileWindows){return Math.floor(this._getWindowWidth(a,b)*a+10*a)}if(this._top.window.screenLeft!=undefined){return this._top.window.screenLeft}return this._top.window.screenX},_getWindowName:function(a){if(a.indexOf("_")>0){return a.substring(0,a.indexOf("_"))}return a},_getUrl:function(a,b){if(a!=null){return a}if(this.options.searchType){return"/s/compareresults/startingsearch?type="+this.options.searchType+"&p="+b}return""},_handleInitialWindowFocus:function(a){if(!this.options.popUnder){return}a.blur();if(navigator.userAgent.toLowerCase().indexOf("applewebkit")>-1){this._top.window.blur();this._top.window.focus()}},_preparePopUpWindow:function(a){jq.extend(a,{init:function(b){this._doMozillaMagic();try{b.opener.window.focus()}catch(c){}},_doMozillaMagic:function(){if(typeof window.mozPaintCount=="undefined"){return}var b=this.window.open("about:blank");b.close()}})},_getScreenWidth:function(){if(window.screen.availWidth){return window.screen.availWidth}return window.screen.availWidth},_getScreenHeight:function(){if(window.screen.availHeight){return window.screen.availHeight}return this.options.screenHeight}});function toggleCheckbox(b){var a=jq("#"+b).prop("checked");jq("#"+b).prop("checked",!a)}function makeFrameHtml(a){return'<iframe src="'+a+'" width="470" height="430" style="border: 1px solid #bbbbbb;"></iframe>'}function fbReturnFromAuth(){location.href=location.href}function shareAfterLogin(a){if(a.authResponse){fbSend()}}function fbSend(){jq.ajax({type:"POST",url:"/s/run/toolbox/sendtofb",data:jq("#facebook_msg").serialize(),success:function(a){closefb()}})}function fbShare(){FB.login(shareAfterLogin,{scope:"publish_stream"});return false}function afterCheckPerms(b){if(!b){FB.login(afterLogin,{scope:"publish_stream"})}else{try{if(b.publish_stream==1){fbSend()}else{FB.login(afterLogin,{scope:"publish_stream"})}}catch(a){FB.login(afterLogin,{scope:"publish_stream"})}}}function fbConnect(){FB.login(afterLogin,{scope:"publish_stream"});return false}var lastanchor="";var lastorientation="";function fbOptions(b,a){lastanchor=b;lastorientation=a;setToAnchor("popupFacebookOptions",b,a,-37,0);jq("#popupFacebookOptions").show();hideOnOutsideClick("popupFacebookOptions")}function closefb(){jq("#facebook_msg").hide();jq("#facebook_posted").show();if(window.gradientDialogCleanup){gradientDialogCleanup()}}function showWallPost(){jq("#fb-wallpost-button").css("background-position","0 0");jq("#fb-send-button").css("background-position","-109px -26px");jq(".fb-to-field").css("display","none");jq(".message-label").css("display","none");jq("#fbShareSendButton").css("display","none");jq("#fbSharePostButton").css("display","");jq(".fb-faux-post-msg").css("display","block");jq(".send-message").css("display","none");jq("#fb-state").attr("state","post")}function showSend(){jq("#fb-wallpost-button").css("background-position","0 -26px");jq("#fb-send-button").css("background-position","-109px 0");jq(".fb-to-field").css("display","block");jq(".message-label").css("display","block");jq("#fbShareSendButton").css("display","");jq("#fbSharePostButton").css("display","none");jq(".fb-faux-post-msg").css("display","none");jq(".send-message").css("display","block");jq("#fb-state").attr("state","send")}function fbSendMessage(){FB.ui({method:"send",display:"popup",name:jq(".sharename").text(),show_error:true,link:window.location.href},function(a){if(a&&a.request_ids){closefb()}})}function fbSendMessageLater(){FB.ui({method:"send",display:"popup",name:jq(".sharename").text(),picture:jq(".fb-faux-post-pic > img").attr("src"),description:jq(".fb-faux-post-desc").text(),show_error:true,link:jq("#sharing_fb_link").val()},function(a){if(a&&a.request_ids){closefb()}})}jq(document).bind("r9.social.linkedinshare.success",function(){jq("#linkedin_msg").hide();jq("#linkedin_posted").show()});function liConnect(){R9.social.shareToLinkedin(jq("#limessage").val(),R9.utils.formToObject("#linkedin_msg form"))}function twitterShare(){var d="https://twitter.com/share";var f=jq("#tweet").val();f=escape(f);var c=window.location.pathname;c=escape(c);d+="?text="+f;d+="&url=null"+c;var a="Tweet!";var b="width=600,height=400";window.open(d,a,b)}function limitTwitterChars(){var a=jq("#tweet").val().length;if(a>140){jq("#tweet").val(jq("#tweet").val().substring(0,140))}}function submitforemail(d){var c=d?document.getElementById(d):document.emailform;if(!validateEmail(c.from.value)){try{c.from.focus()}catch(b){}alert("Introduce una direcci\u00F3n de email v\u00E1lida en el campo \u201CDe\u201D.");return false}var a=c.tolist.value.split(",");if(c.tolist.value.length==0||a.length==0||!validateEmail(a[0])){try{c.tolist.focus()}catch(b){}alert("Introduce una direcci\u00F3n de email v\u00E1lida en el campo \u201CPara\u201D.");return false}if(c.subject.value.length==0){try{c.subject.focus()}catch(b){}alert("Please enter a subject for the email");return false}return true}function shareemail(k,a){var a=a||"";if(submitforemail((a?"shareemailform"+a:null))){var b=a?jq("#shareemailform"+a):jq("form[name=emailform]");var d=true;var h=b[0].tolist.value;var l=h.split(",").length;var c=R9.globals.tripsaliases;var g=c.split(",");var j=false;var f=0;for(f=0;f<g.length;f++){if(h.indexOf(g[f])!=-1){j=true;break}}if(j){if(l<=1){l=0}if(typeof k!="undefined"&&k==true){d=false;showTripsAjaxReg("#sendemail")}else{addResultToTrip(b[0].searchid.value,b[0].resultid.value,"tripadded"+a);jq("#tripadded"+a).show()}}if(d&&l>0){sharetheemail(b,a)}else{if(d){jq("#emailform"+a).hide();jq("#emailsent"+a).show()}}}}function sharetheemail(c,d){var b=c.serialize();var a="/s/emailresult";jq.ajax({type:"POST",url:a,data:b,success:function(f){jq("#emailform"+d).hide();jq("#emailsent"+d).show();jq("#emailsentmessage"+d).show();if(window.gradientDialogCleanup){gradientDialogCleanup()}},error:function(g,h,f){alert(h)},cache:false})}function closeAllDialogs(){jq(".ui-dialog-content").r9dialog("close");jq(".ui-dialog-content").r9popover("close")}function showTripsAjaxRegAfterClick(a){jq("body").unbind("click.hidepricesel");if(!AjaxReg.alreadyRegistered){showTripsAjaxReg(a)}else{openSaveToMyTripsDialogAfterClick(searchId,resultId,showPrice,providerCode)}}function showTripsAjaxReg(f,d,a,b,c){if(!AjaxReg.alreadyRegistered){AjaxReg.regtype="trips";AjaxReg.searchid="";AjaxReg.ui.register(function(){openSaveToMyTripsDialog(d,a,b,c)})}else{openSaveToMyTripsDialog(d,a,b,c)}}function openSaveToMyTripsDialogAfterClick(d,a,b,c){jq("body").unbind("click.hidepricesel").bind("click.hidepricesel",hidePriceSelections);openSaveToMyTripsDialog(d,a,b,c)}function openSaveToMyTripsDialog(d,a,b,c){if(!checkTripsTos()){showTripsTosBubble(d,a,b,c);return}jq.ajax({type:"POST",url:"/s/run/saveToMyTrips/chooseTrip",data:{searchId:d},dataType:"json",success:function(g){if(g.success){var f=jq(g.html);f.r9dialog({width:510}).find("#saveToMyTripsTabs").tabs();f.r9dialog("option","close",function(){f.r9dialog("destroy");f.remove()});jq("a").blur();jq("#saveToMyTripsResultId").val(a);jq("#saveToMyTripsShowPrice").val(b);jq("#saveToMyTripsProviderCode").val(c)}else{alert(g.error)}},error:function(){alert("Se ha producido un error inesperado. Int\u00E9ntalo de nuevo.")},cache:false})}function showSaveToMyTripsControls(b,a){hideSaveToMyTripsControls();jq("#"+b).addClass("selectedTrip");jq("#saveToMyTripsTripId").val(b);jq("#saveToMyTripsTripName").html(a);jq("#saveToMyTripsControls").show()}function hideSaveToMyTripsControls(){jq(".saveToMyTripsTrip").removeClass("selectedTrip");jq("#saveToMyTripsTripId").val("");jq("#saveToMyTripsTripName").html("");jq("#saveToMyTripsControls").hide();jq("#saveToMyTripsDuplicate").hide()}function saveToMyTrips(){jq.ajax({type:"POST",url:"/s/run/saveToMyTrips/save",data:{searchId:jq("#saveToMyTripsSearchId").val(),resultId:jq("#saveToMyTripsResultId").val(),showPrice:jq("#saveToMyTripsShowPrice").val(),providerCode:jq("#saveToMyTripsProviderCode").val(),encodedTripId:jq("#saveToMyTripsTripId").val()},dataType:"json",success:function(a){if(a.success){jq("#saveToMyTrips").html(a.html)}else{if(a.duplicate){hideSaveToMyTripsControls();jq("#saveToMyTripsDuplicate").html(a.error).show()}else{alert(a.error)}}},error:function(){alert("Se ha producido un error inesperado. Int\u00E9ntalo de nuevo.")},cache:false})}function saveToNewTrip(){jq("#saveToMyTripsTripId").val("");saveToMyTrips()}function checkTripsTos(){var a=false;jq.ajax({type:"POST",url:"/k/run/tripsTos/check",async:false,dataType:"json",success:function(b){if(b.success){a=b.ok}else{alert(b.error)}},error:function(){alert("Se ha producido un error inesperado. Int\u00E9ntalo de nuevo.")},cache:false});return a}function showTripsTosBubble(d,a,b,c){jq.ajax({type:"POST",url:"/k/run/tripsTos/showTosBubble",data:{searchId:d,resultId:a,showPrice:b,providerCode:c},dataType:"html",success:function(g){var f=jq(g);f.r9dialog({width:440});f.r9dialog("option","close",function(){f.r9dialog("destroy");f.remove()});jq("a").blur()},error:function(g,h,f){alert(g.statusText)},cache:false})}function sendTripsTosResponse(f,d,a,b,c){if(f){jq.ajax({type:"POST",url:"/k/run/tripsTos/accept",dataType:"json",success:function(g){if(g.success){closeAllDialogs();openSaveToMyTripsDialog(d,a,b,c)}else{alert(g.error)}},error:function(){alert("Se ha producido un error inesperado. Int\u00E9ntalo de nuevo.")},cache:false})}else{jq.ajax({type:"POST",url:"/k/run/tripsTos/showTosRejected",dataType:"html",success:function(g){jq("#tosBubble").html(g)},error:function(h,j,g){alert(h.statusText)},cache:false})}}function inlinelearnmore(a,b){var c="provider="+b;jq.ajax({type:"POST",url:"/s/run/toolbox/learnmoreinline",data:c,dataType:"html",success:function(f){try{showTT(document.getElementById(a),f,"BL")}catch(d){}},error:function(f,g,d){alert(g)},cache:false})}function stopPropagation(a){if(!a){var a=window.event}if(a.stopPropagation){a.stopPropagation()}else{a.cancelBubble=true}}function stopPropagationAndDefault(a){if(a.preventDefault){a.preventDefault()}else{a.returnValue=false}stopPropagation(a)}var BubbleIsOpen=false;var R9LastSelectionShown=-1;var checkSelectBoxX=false;R9.extend("dialog.bubble",{defaultParams:{rowSelector:".detailtop",containerSelector:"#bubbleholder",linkSelector:"a.booklink",delegationFlagParamName:"delegationFlags",splitBookingWarningSelector:"#splitBookingWarning",mapBubbleOffset:{left:-30,top:-50}},bindPriceEvents:function(c,f,b){if(!c){var c=this.defaultParams.rowSelector}if(!b){var b=this.defaultParams.containerSelector}if(!f){var f=this.defaultParams.linkSelector}bindKykButton();var a=jq(b);if(!a.data("stopPropagationFlagged")){a.click(function(g){stopPropagation(g)});a.data("stopPropagationFlagged",true)}if(!this._isDelegationFlagged(b,c,f)){var d=this;a.delegate(c,"click",function(g){d._bookingRowClickEvent(this,f)});this._flagDelegation(b,c,f)}},acceptSplitBookingWarning:function(a){if(!a){var a=this.defaultParams.containerSelector}jq("#splitBookingWarning").hide();jq("#splitBookingInfo").show();jq(a+" .truncate").ellipsisTooltip();addAdt("splitbooking/okbutton")},attachDisclaimerTipTip:function(a,b){var c=jq(a||"#bubbleholder .totalpricelbl");if(!c.length){return}that=this;c.each(function(){var f=that._getDisclaimerTipType(this);var d=this;loadTT("#ttip"+f,function(){jq(d).tipTip(jq.extend({delay:0,defaultPosition:"top",maxWidth:"300px",content:jq("#ttip"+f).text()},b||{}))})})},showPriceSelections:function(a,g,c){if(isNonAvail){getrates(a,"tbd"+a);return}if(!g){var g="bubble"}var f=this;var b=jq("#buttonReference");var d=!b.length||b.hasClass("lazy");ssUserAction("BUBL",function(){if(g=="splitbook"){addAdt("splitbooking/openbubble")}f._postProcessResponse();jq(f.defaultParams.containerSelector).r9popover("destroy").r9popover(jq.extend({autoFocus:false,modal:false,position:"#priceAnchor"+a,title:jq.trim(jq(f.defaultParams.containerSelector+" .dialogTitle").text())},c||{}))},{action:g,index:a,lazy:d})},showPriceSelectionsOnMap:function(a,d,g,b){if(!g){return}var f="left";if(g.left.x-Math.round(jq("div.fixedWidthOuter").offset().left)>450){var f="right"}var c=this;this.showPriceSelections(a,d,jq.extend({position:document,at:f,open:function(h,j){jq(h.target).parent().parent().css(c.getBubblePositionOnMap(g))}},b))},getBubblePositionOnMap:function(b){var a=Math.round(b.right.x+this.defaultParams.mapBubbleOffset.left);if(b.left.x-Math.round(jq("div.fixedWidthOuter").offset().left)>450){a=Math.round(b.left.x+this.defaultParams.mapBubbleOffset.left-this.getBubbleWidth())}return{left:a,top:Math.round(this.defaultParams.mapBubbleOffset.top+b.left.y)}},getBubbleWidth:function(){return jq(this.defaultParams.containerSelector).width()+jq(this.defaultParams.containerSelector).parent().find(".ui-popover-arrow").width()},hideBookingBubble:function(){jq(this.defaultParams.containerSelector).r9popover("close")},_getDisclaimerTipType:function(b){var d=jq(b).parent().attr("class").split(" ");for(var a in d){var c=jq.trim(d[a]).match(/^splitPriceTaxes_([A-Z]{2,3}$)/);if(!c){continue}return c[1]}return"DT"},_bookingRowClickEvent:function(node,linkSelector){if(jq(node).is("span.disclaim")){e.stopPropagation();return}jq(node).addClass("visited");jq(node).find(linkSelector).each(function(){if(typeof this.onclick=="function"){this.onclick()}if(this.rel.indexOf("javascript")==0){eval(this.rel)}else{window.open(this.rel,this.target.replace(":",""))}})},_isDelegationFlagged:function(a,c,d){var b=jq(a).data(this.defaultParams.delegationFlagParamName);if(!b||typeof b[c]=="undefined"||typeof b[c][d]=="undefined"){return false}return true},_flagDelegation:function(a,c,d){var b=jq(a).data(this.defaultParams.delegationFlagParamName)||{};if(typeof b[c]=="undefined"){b[c]={}}b[c][d]=true;jq(a).data(this.defaultParams.delegationFlagParamName,b)},_postProcessResponse:function(){var b=jq("#bubbleholder");b.find(".gobuttoncell").html(jq("#buttonReference").html());if(window.canBuyOnKAYAK&&!b.find(".splitBubbleIntro").length){b.find(".gobuttoncell.buy").html(jq("#buttonReferenceBuy").html());b.find("button").css("width",window.canBuyOnKAYAKWidth)}var a=".bottomlinks a.actionlink, #selectBoxHotelDetails a";b.find(a).each(function(){if(jq(this).attr("href").indexOf("detailClicked")>-1){jq(this).click(function(){b.r9popover("close")})}})}});if(!window.OldStyleBubble){OldStyleBubble=false}function getBubbleWidth(){return(SearchType=="hotel"||SearchType=="vacation")&&!window.HIDE_TOTAL?412:325}function showSelectionBox(){if(checkSelectBoxX){var b=jq("#bubbleholder"),c=b.outerWidth(),a=getBubbleWidth();if(c!=a){b.css("left",b.offset().left-(c-a))}}}function showPriceSelections(a,g,h){if(!g){R9.dialog.bubble.showPriceSelections(a,h)}else{var f=null;var c;var d;if(g!=null&&jq(g).size()==1){f=g}else{var b="priceAnchor"+a;f=document.getElementById(b)}if(f!=null){var j=jq(f).offset();c={x:j.left,y:j.top};d={x:c.x+f.offsetWidth,y:c.y+f.offsetHeight}}else{c={x:0,y:0};d={x:0,y:0}}showPriceSelectionsXY(a,c,d,h)}}function showPriceSelectionsXY(a,c,f,g){if(!g||g.length==0){g="bubble"}if(jq("#selectBoxContainer").css("display")!="none"){hidePriceSelections();if(a==R9LastSelectionShown){return}}BubbleIsOpen=true;R9LastSelectionShown=a;if(navigator.appVersion.indexOf("MSIE 6.")!=-1){jq("iframe:not(.donothide)").css("visibility","hidden")}var b=jq("#buttonReference");var d=!b.length||b.hasClass("lazy");ssUserAction("BUBL",function(){aftershowPriceSelectionsXY(getResultID(a),c,f)},{action:g,index:a,lazy:d});if(!OldStyleBubble){hideAllTT()}}function aftershowPriceSelectionsXY(g,a,b){var c={x:15,y:-50},f=Math.round(c.y+a.y),d=0;if(a.x-Math.round(jq("div.fixedWidthOuter").offset().left)>450){setPointDirection(false);d=Math.round(a.x-getBubbleWidth());checkSelectBoxX=true}else{setPointDirection(true);d=Math.round(c.x+b.x);checkSelectBoxX=false}var h=jq("#selectBoxContainer").css({top:f,left:d});h.find(".gobuttoncell").html(jq("#buttonReference").html());if(window.canBuyOnKAYAK&&!h.find(".splitBubbleIntro").length){h.find(".gobuttoncell.buy").html(jq("#buttonReferenceBuy").html());h.show();h.find("button").css("width",window.canBuyOnKAYAKWidth);if(msie(7)){jq("#selectBoxContainer").width(500)}}else{h.show()}}function hidePriceSelections(){R9.dialog.bubble.hideBookingBubble();BubbleIsOpen=false;jq("#cmp2Popup").children("tr.dynamic").remove();jq("#cmp2Popup").children("tr.popupCmp2").show()}function bindPriceEvents(){jq("tbody.detailitem").hover(function(){jq(this).toggleClass("hovering")});R9.dialog.bubble.bindPriceEvents("tr.detailtop")}function setPointDirection(b){var a=jq("#selectBoxContainer");if(b){a.removeClass("dialog_translucent_rightptr");a.addClass("dialog_translucent_leftptr")}else{a.removeClass("dialog_translucent_leftptr");a.addClass("dialog_translucent_rightptr")}}function toggleShowAfterClickSection(j,k,c){var f=jq("#selectBoxContainer");if(!SHOW_AFTERCLICK_SECTION_IN_POPUP){return}if(j){var d=getResultID(k);var b={searchid:searchid,resultid:d,localidx:k,pcode:c};var h=250;var g;var a=getAfterClickRequest(b,h,g);if(typeof a=="object"){jq.ajax(a)}}else{jq("#afterclickcontent").remove();jq("#selectBoxContainer").removeClass("afterclick");if((SearchType=="flight"||SearchType=="hotel")){jq("#selectBoxalert").html("")}}}var showAfterClickXsell=false;var showAfterclickSimilars=false;function getAfterClickRequest(mydata,alertboxwidth,existingalertobj){var reqobj=null;if(showAfterClickXsell){reqobj={type:"POST",url:"/h/ads/toprightsmtad?searchid="+searchid+"&adpvd="+smartAdProvider+"&layout=grid2x2",dataType:"html",success:function(html){var cleanHtml=html.replace(/^\s+|\s+$/g,"");if(cleanHtml.length>0){jq("#selectBoxXSellBubble").html(cleanHtml)}if(window.gradientDialogCleanup){window.setTimeout(gradientDialogCleanup,200)}},error:function(request,textStatus,error){alert(textStatus)},cache:false}}else{if(showAfterclickSimilars){reqobj={type:"POST",url:"/s/run/toolbox/simafterclick",dataType:"html",data:mydata,success:function(html){var cleanHtml=html.replace(/^\s+|\s+$/g,"");if(cleanHtml.length>0){jq("#selectBoxXSellBubble").html(cleanHtml)}if(window.gradientDialogCleanup){window.setTimeout(gradientDialogCleanup,200)}addAdt("impression/afterclick/similarhotels")},error:function(request,textStatus,error){alert(textStatus)},cache:false}}else{jq.ajax({type:"GET",url:"/s/flightdetails/afterclick",data:mydata,dataType:"xml",success:function(xmlobj){var xml=jq(xmlobj),code=xml.find("code").text(),html=xml.find("html").text();if(code!=null&&code.length>0){eval(code)}jq("#afterclickcontent").remove();if((typeof(existingalertobj)!="undefined"&&existingalertobj.existingalert=="false")&&(SearchType=="flight"||SearchType=="hotel")){jq("#selectBoxalert").html(html);var sbc=jq("#selectBoxContainer").addClass("afterclick")}else{jq("#selectBox").append(html)}if(msie(7)){var w=jq("#selectBoxalert").width()+490;jq("#selectBoxContainer div.dialog_content").css({width:w+"px"});jq("#selectBoxContainer div.dialog_bottom").css({width:(w+12)+"px"});jq("#selectBoxContainer").css({width:(w+12)+"px"})}if(window.gradientDialogCleanup){window.setTimeout(gradientDialogCleanup,200)}},error:function(request,textStatus,error){alert(textStatus)},cache:false})}}return reqobj}function hideSplitBooking(){hidePriceSelections();Filters.splitbooking.setVal(false);refilter()}ViewState={_state:{},update:function(c,a,b){if(b==null&&{clicked:1,removed:1}[c]){b=true}if(a==null){if(b){this.clear(c)}delete this._state[c];delete this._state["last"+c];return}this._state[c]=jq.merge(this._state[c]||[],[a]);if(b){this.clear("last"+c)}this._state["last"+c]=[a];if(b){c=="removed"?ssUserAction("RM",{pn:_currentPageNum-1}):this.set(c)}},applyClass:function(a,b){jq.each(this._state[a]||[],function(){jq("#tbd"+this)[b?"removeClass":"addClass"](a)})},clear:function(a){this.set(a,true);if(a){this._state[a]=this._state["last"+a]=null}else{this._state={}}},set:function(a,b){this.apply(a,b);this.apply("last"+a,b)},apply:function(a,c){if(a){this.applyClass(a,c);return}var b=this;jq.each(this._state,function(d){b.applyClass(d,c)})}};function ssUserAction(b,a,c){if(a&&!c&&typeof a!="function"){c=a;a=null}if(typeof affiliatePageUpdate=="function"){affiliatePageUpdate(b,c)}if(!Streaming.done&&Streaming.delay<2000){Streaming.delay*=1.5}if(c&&c.pin){ViewState.update("pinned",c.pin>0?c.pin-1:null)}ViewState.interacted=true;ssRefreshResults(null,null,null,a,b,c,function(){cmp2setcontentinline();hidemessage()})}function ssRefreshResults(l,f,n,j,d,c,a){var m=(l==null)?"":"&poll="+l+"&final="+f+"&updateStamp="+n;var g=window._currentsortid||"";if(Streaming.pollTimer){Streaming.dbg("CNCL: "+Streaming.pollTimer);window.clearInterval(Streaming.pollTimer);Streaming.pollTimer=null}if(g&&!window._lastdirection){g="-"+g}var b=document.resultUI&&jq(ui_select("landmark"))||jq("lmlist");var h=jq.extend(c,{lm:b.attr("value"),lmname:b.find(":selected").text(),c:document.resultsPaging&&document.resultsPaging.rowsper.value||15,s:g,searchid:SearchID,itd:ViewState.interacted&&"1"||"",poll:l||-1});var k;if(window.Filters){if(Filters.size){h.fs=Filters.stateString()}if(Filters.matchprice){h=jq.extend(h,Filters.matchprice)}Filters.matchprice=null}if(window.ssUserActionParams){k=ssUserActionParams(h)}if(k){h=jq.extend(h,k)}return ssAJAX("/s/jsresults?ss=1"+m,h,j,d,a)}function ssAJAX(d,g,c,f,a){var b=new Date().getTime()-Streaming.startTime;window.POLLID=b;if(!f&&g){f=g.action}jq.ajax({url:d,dataType:"html",data:g,complete:function(h){ssCompleteRq(b,a,f,h)},success:function(h){ssApplyResults(h,b,c,f)},error:function(k,h,j){Streaming.err(j)}});if(!g||g.poll==null||g.poll<0){Streaming.dbg((f||"PICK")+": "+b+" >");if(!jq.browser.msie){jq(document.body).addClass("wait")}}return false}function ssCompleteRq(a,c,d,b){if(a==window.POLLID){if(c){c(a,d,b)}window.POLLID=null}if(!jq.browser.msie){jq(document.body).removeClass("wait")}}function ssApplyResults(f,b,c,d){if(f.match("<html>")){bookLinksExpired(window.R9.bookLinksExpired);return}try{var h=(d||"Poll #"+Streaming.pollCount)+" ["+b+"]";Streaming.dbg(h+"<:-");if(window.POLLID!=b){Streaming.dbg("LCKD "+b+";"+window.POLLID);return}if(!ViewState._initialized){Streaming.dbg("AWA");jq(window).bind("updateDisplayDone.initial",function(){window.POLLID=b;ssApplyResults(f,b,c,d)});return}jq(window).unbind("updateDisplayDone.initial");var j=document.createElement("div");j.innerHTML=f;f=jq(j);f.children(".exec.first").each(evalExec);f.children(":not(.exec)").each(function(k,m){var l=m.id?document.getElementById(m.id):null;if(l){l.innerHTML=m.innerHTML}else{document.body.appendChild(m)}});f.children(".exec:not(.first)").each(evalExec);if(c){c(d,f,b)}}catch(g){if(window.R9Admin&&(!Streaming.alertedPollError||Streaming.done)){if(typeof console!="undefined"){console.log("Error in update: ",g)}var a=Streaming.stack(g,"Error in update:");alert("Admin message - Error in update: "+a);Streaming.alertedPollError=true}}Streaming.nextPoll()}function evalExec(c){if(typeof c=="number"){c=this}var a=(c.innerText||c.textContent).replace(/([^\r])\n/,"$1\r\n");try{jq.globalEval(a)}catch(b){Streaming.err(b,false,a)}}function updateDisplay(d,b,c,f,a){_r=_filtered=null;_ALLRESULTSLOADED=true;ViewState.apply();R9RsltCount=window.R9TotalResultCount=d;R9FltrdCount=b;R9ResultsRendered=new Date();if(c){_currentsortid=c;_lastdirection=typeof f=="string"?f=="true":f}updateLeaveBehindFilterReasons();if(a){_currentPageNum=a}if(Streaming.done){finalUpdateDisplay()}else{updateDOMInfo()}if(!ViewState._initialized){Streaming.dbg("INI ("+d+")")}ViewState._initialized=true;jq(window).trigger("updateDisplayDone")}function finalUpdateDisplay(){if(typeof YAPTA!=="undefined"){setTimeout(generateYaptaButtons,1)}if(window.postProcessResultsList){postProcessResultsList()}setTimeout(updateDOMInfo,3000)}function updateDOMInfo(){var a=new Date().getTime();jq("#dominfo .count").html([jq("*").length," (",new Date().getTime()-a," ms)."].join(""))}function getResultID(a){return jq("#tbd"+a).data("resultid")||jq("#resultid"+a).html()}function removeDisplay(a){ViewState.update("removed",a)}function FilterBase(){}FilterBase.prototype={_noop:function(){},_identity:function(a){return a||this},_if:function(b,a){return this[b]&&this[b]()&&(a||this)||null},_attr:function(a){return this[a]},extend:function(a){return jq.extend(this,a)}};function FilterSet(b){this._fs={};this.size=0;var a=this;if(b){this.each(function(c){a.add(c)},b)}}FilterSet.prototype=new FilterBase().extend({reinit:function(){this._fs={};this.size=0},add:function(b){if(jq.isArray(b)){for(var a=0;a<b.length;a++){this.add(b[a])}}else{if(b.name){if(!this._fs[b.name]){this.size++}this._fs[b.name]=this[b.name]=b;if(this.fullname){b._fullpath=this.fullname()+"."+b.name}}}return this},remove:function(a){if(this._fs[a]){this.size--}delete this[a];delete this._fs[a]},each:function(c,b){if(!b){b=this._fs}if(!c){c=this._identity}var a=[];jq.each(b,function(h,g){var d=g==null?null:c(g,h);if(d!=null){a.push(d)}});return a},interacted:function(){var a=this.f(null,"_if","interacted");return a.length&&a||null},f:function(name,fu){var args=Array.prototype.slice.call(arguments,2);var fs=this._fs;if(typeof name=="string"){name=name.split(/,/)}if(jq.isArray(name)){fs=jq.map(name,function(n){return typeof n=="string"?fs[n]:n})}else{if(name){fs=(typeof name=="string")?[eval("fs."+name)]:name}}if(!fu){fu="_identity"}var func=null;if(typeof fu=="function"){func=fu}var res=this.each(function(f){if(func){return func.apply(f,args)}return f[fu]&&f[fu].apply(f,args)},fs);return(!name||jq.isArray(name))&&res||res.length&&res[0]||null},state:function(b){var a=this;if(b){jq.each(b,function(d,c){a.f(d,"state",c)})}else{b={};a.each(function(d){var c=d.state();if(c!=null){b[d.name]=c}})}return b},userState:function(){var a={};this.each(function(c){var b=c.interacted()&&c.userState();if(b!=null){a[c.name]=b}});return a},stateString:function(b,a){return this.f(a,function(){var c=this.touched()?this.stateString():null;return c==null?null:(this.name+"="+c)}).join(b||";")+(b||";")},restore:function(h,a){var c=h.split(a||";");for(var b=0;b<c.length;b++){var g=c[b].match(/^(.+?)=(.*)$/);if(!g||g.length<2){continue}var d=this[g[1]];if(d){d.restore(g[2])}}}});function makeFilters(a){return new FilterSet().extend({Generator:a,generate:function(j){var h=j||this.Generator;if(!h){return false}var d=this;if(!j){jq.each(this._fs,function(f){d.remove(f)})}for(var g in h){if((typeof h[g]!="function")||(g=="augment")){continue}var b=h[g]();if(!b){continue}if(!jq.isArray(b)){b=[b]}for(var c=0;c<b.length;c++){if(typeof this.Generator.augment=="function"){b[c]=this.Generator.augment(b[c])}if(!b[c]){continue}this.add(b[c]);if(b[c].attachCB){b[c].attachCB()}b[c].generator={};b[c].generator[g]=h[g]}}jq.each([new ProviderFilter(),new TrueProviderFilter()],function(){this.attachCB();d.add(this)})},set_distancesort:function(){if(_currentsortid!=null&&_currentsortid.indexOf("distance")>-1){return}_lastdirection=true;_currentsortid="distancesort"},set_pricesort:function(c,b){if(b<0||b>=9999999){return}_lastdirection=true;_currentsortid="pricesort";if(!b){return}this.matchprice={bp:b,fuc:c.join?c.join(","):c}},reset:function(b,d){var c=this.f(b,"state");this.undoAll(false,false);this.f(b,"state",c);if(d!=null&&d!==false){refilter(null,true,d||null)}},undoAll:function(b,c){return this.undo(null,b,c)},undo:function(b,c,g){var d;if(window.ViewState){ViewState.clear("removed")}else{jq.each(_r,function(){this._vs=0})}this.f(b,function(){if(this.touched()){this.undo()}});if(g==null||g){if(c){this.set_pricesort()}refilter(null,false,g||null)}return true},apply:function(c,f){var d=this.touched(f);if(!d){return}if(!jq.isArray(d)){d=[d]}jq.each(d,function(){this.prefilter()});var b=this.each(function(g,j){if(g._vs<0){return null}for(var h=0;h<d.length;h++){if(!d[h].filter(g)){return null}}return j},c);jq.each(d,function(){this.postfilter()});return b},touched:function(b){return this.f(b,"_if","touched")},restore:function(b){this.undoAll(false,false);FilterSet.prototype.restore.call(this,b)},saveState:function(f){var g=this.stateString();var b="sf-"+(f?SearchType:SearchID);var d=null;var c=null;if(f=="expired"){d=new Date();d.setTime(d.getTime()+180000);b="sfx-"+SearchType}var h=this.stateString();jq.cookie(b,h,d&&{expires:d});return h},restoreState:function(c){var h=c&&["sf-"+SearchType]||["sf-"+SearchID,"sfx-"+SearchType];var f=null;for(var j=0;j<h.length;j++){if(f=jq.cookie(h[j])){if(!c){jq.cookie(h[j],null)}Streaming.dbg("RFS: "+h[j]+": "+f);break}}if(!f){return false}try{var b=this.stateString();this.restore(f);if(c){refilter()}return b!=f}catch(g){var d=(g.name||"ERROR")+":"+g.message;Streaming.dbg("FRF: "+d);if(window.R9Admin||c){alert("Failed to restore filter state: "+d);throw g}}return false},stateString:function(){var b=FilterSet.prototype.stateString.call(this);if(window.ViewState&&ViewState._state.removed){b=(b&&b+";"||b)+"rmvd={"+ViewState._state.removed.join(",")+"}"}return b},ensureLoaded:function(d,c,b){var f=b;if(msie(7)&&d.is(".lazy")){jq(window).one("lazyLoad",function(){window.setTimeout(function(){d.children(".filterSectionContent").css({"background-image":"none"})},1)})}loadSection(d,b,{action:"filtersection",fsec:c})}})}function FilterUI(){}FilterUI.prototype={attachCB:function(){var a=this.control&&this.control();if(!a||!this._clickCB){return false}this.bindCB(a)},handledEvent:function(b){b=b.length&&jq(b[0])||b;var a=b.is("select,input[type=text]")?"change":"click";if(b.is("div")){a="slidestop"}return a+".filter_"+this.name},bindCB:function(a,b){a=jq(a);var c=this.handledEvent&&this.handledEvent(a);if(!c){return false}a.unbind(c).bind(c,{filter:this},b||FilterUI.prototype._clickCB);return true},adtString:function(a){return(this.adtName||this.name)+"&"+(isNaN(parseFloat(a.value))?R9.utils.slugify(a.value):a.value)},filterReason:function(a){var b=this.adtString(a);return b&&"filter_"+b||null},_clickCB:function(a){if(typeof a.originalEvent=="undefined"){return}window.FILTER_CLICKED=true;var b=a.data.filter;if(b&&b._doClickCB){b._doClickCB(a)}},_doClickCB:function(a){if(this.onchange){this.onchange(a)}if(this.clickCB){this.clickCB(a.target)}},updatingMessage:function(){return this.updateMsg&&this.updateMsg||window.FilterMsgs&&FilterMsgs[this.name]||null},clickCB:function(c,a,b){_updatingResultsMessage=this.updatingMessage();c=c||this.control();a=a||this.adtString&&this.adtString(c);if(a){addAdt("filter/"+a)}refilter(null,false,b||this.filterReason&&this.filterReason(c))}};function Filter(a,d,b,c){jq.extend(this,{name:a,heading:d,sectionname:c||a,action:'Filters.undo("'+a+'")',ctrl:a&&(this.ctrl||jq(b||ui_select(a)))});if(a&&this.defVal==null){this.defVal=this.initialVal()}if(this.initialize){this.initialize()}}Filter.prototype=new FilterBase().extend(new FilterUI()).extend({getVal:function(){},setVal:function(a){this.updated(a)},initialVal:function(a){return this.getVal()},interacted:function(){return this.live()&&this._clicked||null},val:function(a){return a==null?this.getVal():this.setVal(a)},updated:function(a,b){this._curstate=a;if(!b){this._clicked=1}},state:function(a){return a==null&&this._curstate||(this._curstate=this.val(a))},userState:function(){return this.state()},stateString:function(){var a=this.state();return a==null?null:a.toString()},restore:function(a){return this.setVal(a)},control:function(){return this.ctrl},live:function(){return this.control().length},untouched:function(){return this.state()==this.defVal},touched:function(){return this.live()&&!this.untouched()&&this||null},undo:function(){return this.clear()},clear:function(){if(this.touched()){this.val(this.defVal)}},accept:function(){return true},prefilter:function(){return this._curstate==undefined?this._curstate=this.val():this._curstate},filter:function(a){return this.accept(a,this._curstate)},postfilter:function(){},fullname:function(){return this._fullpath||this.name},onchange:function(a){this.updated(this.getVal())},generate:function(){if(!this.generator||!window.Filters){return false}Filters.generate(this.generator)}});function CombinationFilter(a,d,c,f,b){FilterSet.call(this,b);Filter.call(this,a,d,null,c);this._oper=f||"and";this._separ="|";if(b){this.saveDef()}}CombinationFilter.prototype=jq.extend(new Filter(),new FilterSet()).extend({getVal:FilterSet.prototype.state,state:FilterSet.prototype.state,setVal:FilterSet.prototype.state,stateString:function(){return FilterSet.prototype.stateString.call(this,this._separ)},restore:function(a){FilterSet.prototype.restore.call(this,a,this._separ);return this.getVal()},live:function(){return this.f(null,"_if","live").length},untouched:function(){return this.f(null,"_if","untouched").length==this.size},touched:function(){return this.f(null,"_if","touched").length&&this||null},attachCB:function(){this.f(null,"attachCB")},saveDef:function(){var a={};this.each(function(b){a[b.name]=b.defVal});return(this.defVal=a)},prefilter:function(){var a=[];var b={};this.each(function(c){if(c.touched()){c.prefilter();a.push(c)}b[c.name]=c.state()});this._curstate=b;this._touched=a},postfilter:function(){Filter.prototype.postfilter.call(this);this.f(this._touched,"postfilter");delete this._touchedi;delete this._curstate},accept:function(d,f){if(!this._touched){this.prefilter()}var a=this._touched;if(!a.length){return true}for(var c=0;c<a.length;c++){var b=a[c].accept(d,f[a[c].name]);if(b&&(this._oper=="or")||!b&&(this._oper!="or")){return b}}return this._oper=="and"}});function InputFilter(a,f,b,c,d){Filter.call(this,a,f,c,d);if(b){this.accept=b}}InputFilter.prototype=jq.extend(new Filter,{getVal:function(){return this.control().attr("value")},setVal:function(a){this.control().attr("value",a);this.updated(a);return a}});function CheckboxFilter(a,f,d,b,c,g){this.defVal=g||false;InputFilter.call(this,a,f,b,c,d)}CheckboxFilter.prototype=jq.extend(new InputFilter,{getVal:function(){return this.control().prop("checked")||""},setVal:function(a){this.control().prop("checked",a);this.updated(a);return a},adtString:function(a){return(this.adtName||this.name)+"/"+(a.checked?"/on":"/off")}});function RadioFilter(a,f,d,g,b,c){InputFilter.call(this,a,f,b,c,d);if(g!=null){this.defVal=g}}RadioFilter.prototype=new InputFilter().extend({getVal:function(){return this.control().filter(":checked").attr("value")},setVal:function(a){this.control().filter("*[value="+a+"]").prop("checked",true);this.updated(a);return a},untouched:function(){return this.state()==this.defVal},adtString:function(a){return(this.adtName||this.name)+"/"+a.value},stateString:function(){var a=InputFilter.prototype.stateString.call(this);return a==null?null:"{"+a+"}"},restore:function(a){InputFilter.prototype.restore.call(this,a.replace(/^{|}$/g,""))}});function SliderFilter(a,g,d,f,c,b){this.side=c;this.vattr=c>=0?"value":"values";InputFilter.call(this,a,g,b,d,f)}SliderFilter.prototype=jq.extend(new InputFilter,{initialVal:function(){var a=this.live()&&get_slider_range(this.control());return a?(this.side>=0?a[this.side]:a.slice()):null},init:function(){this.defVal=this.defVal||this.initialVal();var a=this.live()&&this.defVal&&this.getVal();if(a){this.updated(a,1)}return this},getVal:function(){return this.control().length&&this.control().slider(this.vattr)},setVal:function(d){var f=this.control();var b=this.vattr;if(!f.length){return}this._doClickCB=FilterBase.prototype._noop;if(jq.isArray(d)){jq.each(d,function(c,a){f.slider(b,c,a)})}else{f.slider(b,d)}this.updated(d);delete this._doClickCB;return d},untouched:function(){var a=this.state();return this.side>=0?a==this.defVal:samelist(a,this.defVal)},live:function(){return this.control().length&&this.control().data().slider},bindCB:function(a){InputFilter.prototype.bindCB.call(this,a);var b="slide.filter_"+this.name;jq(a).unbind(b).bind(b,{filter:this},function(d,c){d.data.filter._slideCB(d,c)});return true},stateString:function(){var a=this.state();return jq.isArray(a)&&a.join("-")||a},restore:function(a){if(this.side==null){a=a.split("-")}this.setVal(a)},_slideCB:function(a,b){this.control().slider(this.vattr,b[this.vattr]);a.data.filter.onchange(a)},adtString:function(a){return this.name+"&"+this.getVal()}});function OptionFilter(a,g,c,f,d,b){if(typeof f=="function"){this.initialVal=f}else{this._initVal=f}InputFilter.call(this,a,g,b,c,d)}OptionFilter.prototype=jq.extend(new InputFilter,{controlSelector:function(){return"input"},invertedState:function(){return this.allctrl||this._initVal&&this._initVal._length==0},initialVal:function(){if(this._initVal!=null){return(this._initVal=this.mkVal(this._initVal))}return this.mkVal(this.control())},_allFields:function(b){var a=this;return Filters.each(function(c,d){if(d.match(/^_/)){return null}return typeof(a[d])!="function"&&(b==null||b&&c||!b&&!c)&&d||null},this)},_listValues:function(a){return this._values(a).join(",")},mkVal:function(d,c,g){var a={_length:0};if(typeof(d)=="string"){d=d.split(",")}if(jq.isArray(d)||d.jquery){for(var b=0;b<d.length;b++){var h=d[b];var f=!d.jquery||!c||h.checked;if(h.value){h=h.value}if(!a[h]){a[h]=f;a._length++}}}else{a=d}if(g){a._exclusive=1}if(!a._values){a._values=OptionFilter.prototype._allFields}if(a._length==null){a._length=a._values().length}a.toString=OptionFilter.prototype._listValues;return a},haveAll:function(c,b){var d=(b||this.state())._values();for(var a=0;a<d.length;a++){if(!c[d[a]]){return false}}return true},userState:function(){if(this.state()._exclusive){return this._curstate}var a=this.mkVal(this.control(),1);a._fullstate=1;return a},shortState:function(){var b=this.defVal;var a={};this.control().each(function(){var c=this.value;if(this.checked&&!b[c]||!this.checked&&b[c]){a[c]=this.checked}});a._shortstate=1;if(this.state()._exclusive()){a._exclusive=1}return this.mkVal(a)},stateString:function(){var a=this.state();var b=a._values();if(!a._exclusive){b=this.control().map(function(){if(!this.checked){return this.value}});b.push("!")}return"{"+jq.map(b,function(c){return c.replace(",","%2C")}).join(",")+"}"},restore:function(f){if(!f){this.clear();return}var a=1;if(!this.invertedState()&&f.match(/^(.*),!}$/)){a=0;f=RegExp.$1}var c={};var d=f.replace(/^{|}$/g,"").split(",");jq.each(d,function(h,g){g=g.replace(/%2C/g,",");c[g]=true});c._exclusive=true;if(!a&&!this.invertedState()){var b={};this.control().each(function(){b[this.value]=!c[this.value]});b._full=1;c=b}return this.setVal(c)},getVal:function(){var b=this.mkVal(this.control().filter(":checked"));b._exclusive=this._exclusive||this.invertedState();if(!this._preset||Streaming.done){return b}var a=this.defVal;jq.each(this._preset._values(),function(){if(!a[this]){b[this]=true}});return b},setVal:function(a,b){if(this.invertedState()){b=1}a=this.mkVal(a,0,b);jq(this.control()).each(function(){if(!a._fullstate||a[this.value]!=null){this.checked=a[this.value]}});if(a._fullstate){a=this.getVal()}if(b||a._exclusive){a._exclusive=this._exclusive=1;if(!this.invertedState()){this._preset=a}}this.updated(a);return a},clear:function(){this._exclusive=this._preset=null;InputFilter.prototype.clear.call(this)},untouched:function(b){if(!this.invertedState()&&this._exclusive&&this._preset&&!Streaming.done){return false}var a=this.state();if(a._length!=this.defVal._length){return false}for(var c in a){if((!b||!b[c])&&!c.match(/^_/)&&(a[c]&&!this.defVal[c])||(!a[c]&&this.defVal[c])){return false}}return true},checkCheckAll:function(a){if(!this.allctrl||!this.allctrl.prop("checked")){return false}return this.allctrl.attr("value")==jq(a).attr("value")?this.clear():this.allctrl.prop("checked",false)},onchange:function(a){this.checkCheckAll(a.target);InputFilter.prototype.onchange.call(this,a)},optionsel:function(a){return"#"+this.name+a},_uncheckFor:function(a){this.control().prop("checked",false)},checkOne:function(b,a){Filters.set_pricesort(this.fullname(),a);this._uncheckFor(b);this._exclusive=1;jq(this.optionsel(b))[0].click();this._preset=this.state()},toggle:function(a,c,b){if(typeof c=="string"){c=this.control().filter(c)}if(c&&c.jquery){c.prop("checked",a)}else{this.control().each(function(f,d){if(!c||c[d.value]){d.checked=a}})}this._exclusive=!a;this.updated(this.getVal());refilter();if(b){addAdt("filter/"+(this.adtName||this.name)+"/"+b)}else{if(!c){addAdt("filter/"+(this.adtName||this.name)+"/"+(a?"select_all":"clear_all"))}}},adtString:function(a){return(this.adtName||this.name)+"/"+R9.utils.slugify(a.value)+(a.checked?(this._curstate._length==1?"/only":"/on"):"/off")},bindCB:function(a){a=jq(a);var b=this.handledEvent(a);if(this.container||a.length>3&&(this.container=jq("#fs_content_"+this.sectionname))){if(this.container.length==0){delete this.container}else{if(this.container.length){this.container=this.container[0]}}}if(this.container){jq(this.container).undelegate(this.controlSelector(),b).delegate(this.controlSelector(),b,{filter:this},FilterUI.prototype._clickCB)}else{a.unbind(b).bind(b,{filter:this},FilterUI.prototype._clickCB)}return true}});function ProviderFilter(){RadioFilter.call(this,"pvdflt","Sites Searched");this.container=jq("#providerData")}ProviderFilter.prototype=new RadioFilter().extend({accept:function(b,c){for(var a=0;a<b._p.length;a++){if(b._p[a]._code==c){return true}}return false},filterReason:function(a){return"filter_providers_"+(a.value.match(/[^:]*/)[0]||"all")},generator:function(){return new ProviderFilter()},adtString:null});function TrueProviderFilter(){InputFilter.call(this,"truepvd","True Providers")}TrueProviderFilter.prototype=new InputFilter();function PriceFilter(a){if(a==null){a=1}this._showcur=true;if(Filters.priceRange){var f=roundTo(Filters.priceRange.max,10,true);var c=Filters.priceRange.min;jq("#low_price").html(mkCurrency(c));jq("#low_price_label").html(mkCurrency(c));jq("#high_price_label").html(mkCurrency(f));var d=Filters.priceRange.initial&&roundTo(Filters.priceRange.initial,10,true)||f;this._showcur=getCurrencyPriceLength(c,_CURSYMBOL_WIDTH)*2+getCurrencyPriceLength(f,_CURSYMBOL_WIDTH)*2+"Precio".length<=33;var b={min:c,max:f,step:1};if(a<0){b.values=[c,d];b.lastvals=[c,d];b.range=true}else{b.value=d;b.range=a==0&&"max"||"min"}jq("#priceSliderDiv")[a>=0&&"slider"||"rangeSlider"](b)}SliderFilter.call(this,"price","Precio","#priceSliderDiv","price",a);this.init()}PriceFilter.prototype=new SliderFilter().extend({updated:function(b,c){SliderFilter.prototype.updated.call(this,b,c);if(this.side>=0){var a=[-1,-1];a[this.side]=b;b=a}if(b[0]>=0){jq("#low_price").html(displayPrice(b[0],this._showcur))}if(b[1]>=0){jq("#high_price").html(displayPrice(b[1],this._showcur))}}});function getCurrencyPriceLength(c,b){var a=""+c;return(a.length+b)}function getFilteredOutReasons(){return window.Filters&&{reasons:jq.map(Filters.touched(),function(a){if(a.heading!=null){return a}})}||{reasons:{}}}function clone(a){return jq.extend({},a)}function samelist(c,a){if(c==null||a==null){return c==a}if(c.length!=a.length){return false}for(var b=0;b<c.length;b++){if(c[b]!=a[b]){return false}}return true}var Filters=makeFilters();function Streamer(c,a,d){var b={done:c,lastPoll:a,url:"/s/jsresults?searchid="+SearchID,error:null,maxPolls:200,delay:250,pollCount:0,pollCount2:0,idleCount:0,startTime:window.Profiler&&Profiler._startTime||new Date().getTime(),poll:function(){this.pollTimer=null;this.pollCount++;this.dbg("Poll #"+this.pollCount+" >");this.doPoll(this.pollCount,this.done,this.lastPoll)},doPoll:function(h,f,g){if(window.ssRefreshResults){ssRefreshResults(h,f,g)}else{jq.getScript(this.url+"&final="+f+"&updateStamp="+g+"&poll="+h)}},stack:function(g,h){var f=g&&g.stack||window.printStackTrace&&printStackTrace({e:g}).join("\n\n")||"unavailable";this.dbg((h||"Error stack:")+"\n\n"+f);return f},err:function(h,g,j){var j=j||"";var f=((h&&h.name)?h.name:"ERROR")+": "+((h&&h.message)?h.message:"UNKNOWN ERROR");this.dbg("!!! "+f+(j.length>0?" while evaling: <pre>"+jq("<div/>").text(j).html()+"</pre>":""));this.error=h;this.done=false;this.stopTwoPhase();this.stack(h);if(!window.location.href.match("streamerr=")){this.clienttimeout("streamerr="+f.replace(/\s+/g,"+"))}else{alert("FATAL error has occured: "+f)}throw h},whenDone:function(g){var f=function(){g.apply(window.Streaming,Array.prototype.slice.call(arguments,1))};if(this.done){f()}else{jq(window).bind("r9.streaming.done",f)}},finalResults:function(f){if(!this.done){jq(window).trigger("r9.streaming.done")}this.done=true;if(f){this.secondPhase=true}},nextPoll:function(h,j){var g=this;if(!this.done&&this.pollCount>=this.maxPolls){this.dbg("Too many polls, and still not done: "+this.pollCount+">="+this.maxPolls+". ABORTING.");return this.clienttimeout()}if(j){this.dbg(j)}if(!this.done){var f=Math.ceil(this.delay*(1+Math.floor(this.pollCount/20)*0.5));this.pollTimer=window.setTimeout(function(){g.poll()},f);this.dbg("Nxt in "+f+": "+this.pollTimer);return true}else{if(h||this.secondPhase){return this.pollSecondPhase()}else{if(!this.stoppedPolling){this.dbg("POLL DONE.");this.stoppedPolling=true}}}return false},pollSecondPhase:function(){if(!window.SecondPhaseWait){this.dbg("No 2F.");return false}if(this.pollCount2<0){Streaming.dbg("2F ABORTED.");return false}this.dbg("2F in "+window.SecondPhaseWait);var f=this;if(this.pollCount2==0){this.scndPhaseTimeouts={ids:[window.setTimeout(function(){f.enoughresults()},SecondPhaseTimeout-5000),window.setTimeout(function(){f.stopTwoPhase()},SecondPhaseTimeout)],clear:function(){if(this.ids){for(i in this.ids){clearTimeout(this.ids[i])}}this.ids=null}}}this.pollCount2++;window.setTimeout(function(){f.checkSecondPhase()},window.SecondPhaseWait);return true},stillPolling:function(){return !this.done||this.pollCount2>0},checkSecondPhase:function(){if(window.SearchType=="hotel"){_ALLRESULTSLOADED=false}this.dbg("2F #"+this.pollCount2+" >");jq.getScript("/s/qrystat?searchid="+SearchID+"&cnt="+R9TotalResultCount+"&poll="+this.pollCount2)},stopTwoPhase:function(f){this.dbg("2F STOP.");this.pollCount2=-1;this.secondPhase=false;this.secondPhaseAvailable=true;f=jq.trim(f);if(f){jq("#aboveresultsmessagetd").html(f).show()}else{jq("#aboveresultsmessagetd").hide()}if(this.scndPhaseTimeouts){this.scndPhaseTimeouts.clear()}},doneSecondPhase:function(f){this.dbg("2F done.");this.stopTwoPhase(f);if(window.secondPhaseDone){window.secondPhaseDone()}},showAllResults:function(f){if(window.matrixClearSelected){matrixClearSelected()}if(this.secondPhaseAvailable){addAdt("2phase/addAllClicked");window.location.replace(window.location.href+"&showall=true")}else{Filters.undoAll(f)}},start:function(f){this.delay=f;this.poll()},beginResponse:function(f,g){f=f||this.pollCount;var h=this.stillPolling()?"Poll #"+f:"Update ...";this.dbg("Poll #"+f+" <: "+(g||"-"))},_dbglines:[],_dbgdiv:null,dbg:function(g){if(g==null){this._dbgdiv=(this._dbgdiv||jq("#traceoutput").html(this._dbglines.join(""))).toggle();if(this._dbgdiv.length==0){this._dbgdiv=null}if(this._dbgdiv){this._dbglines=[];if(window.Isrch){window.Isrch.dbgwin()}}return}var f=new Date().getTime()-this.startTime;if(this._dbgdiv){this._dbgdiv.append(f+": "+g+"<br/>")}else{this._dbglines.push(f,": ",g,"<br/>")}},checkpoint:function(f){this.dbg("Checkpoint: "+f)},dbg2:function(f){this.dbg(f)},enoughresults:function(){jq.get("/s/sparkle?action=killseeker&searchid="+SearchID);try{jq("#enoughtbuttonspan").hide();jq("#enoughtbuttonspanoff").innerHTML="Cargando resultados de b\u00FAsqueda..."}catch(f){}},clienttimeout:function(f){if(this.done){this.dbg("TMT: DONE.");return}this.enoughresults();this.done=true;this.dbg("TMT: ABORT.");var g=this;window.setTimeout(function(){g.dbg("TMT: reloading");if(window.R9Admin){var j=g.error==null?"Timeout":g.error.name+":"+g.error.message;if(g.error&&g.error.name=="STLDPRG"){j="Stalled progress."}jq("#traceoutput").show();if(!confirm("Forcing reload because of "+j+". This message is only visible to admin.")){return false}}if(window.Filters){Filters.saveState()}if(document.location.hash){var h=document.location.pathname+"/"+document.location.hash.substring(1)+"?force=remaining&clienttimeout=true"+(f?"&"+f:"");loadResults(h)}else{if(window.location.href.indexOf("?force",0)==-1){window.location.replace(window.location.href+"?force=remaining&clienttimeout=true"+(f?"&"+f:""))}else{window.location.reload()}}},500);return false}};if(d&&!b.done){window.setTimeout(function(){b.clienttimeout()},d)}b._created=new Date();b.dbg("CRT");return b};

;var jsck_streaming_es_es="v425";
/* et=16, mt=56, c=p4, i=sparkle004, v=R114, cc=none, r=none */

