/* generated Sat Feb 11 01:55:00 EST 2012 */

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 e=document.getElementById("cb"+d);if(a){jq("#compareToRow").show();if(c.style.display=="none"){c.style.display="";e.checked=e.defaultChecked;e.value=d;initCmp2CTR();cmp2CTR.recordCheck(d,e.defaultChecked);cmp2CTR.recordVisible(d,true)}}else{e.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 e=c.comparetokayak;for(var b=0;b<e.length;b++){if(e[b].checked){if(CMP2_HIDDEN){e[b].checked=false}else{if(e[b].value!=null&&e[b].value!=""){a.push({code:e[b].value,group:e[b].className,input:e[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 e=c.comparetosite;for(var b=0;b<e.length;b++){if(e[b].checked){if(CMP2_HIDDEN||!jq(e[b]).is(":visible")){e[b].checked=false}else{if(e[b].value!=null&&e[b].value!=""){a.push({code:e[b].value,group:e[b].className,input:e[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(i,h){b(i,4,(h)?"1":"0")};this.recordCheck=function(i,h){b(i,5,(h)?"1":"0")};this.recordTerm=function(h,i){b(h,3,i)};this.startUpdate=function(){f=false};this.endUpdate=function(){e();f=true};var g=d;var c=null;var a=6;var f=true;function b(m,k,n){try{if(c==null){if(g==null){return}c=new Object();var j=g.value.split(";");for(var i in j){var h=j[i].split("|");c[h[0]]=h}}if(3<=k&&k<a){var l=c[m];if(l!=null&&l.length==a&&l[k]!=n){l[k]=n;if(f){e()}}}}catch(o){}}function e(){try{if(c==null){return}if(g==null){return}var i="";for(var h in c){if(i.length>0){i+=";"}i+=c[h].join("|")}g.value=i}catch(j){}}}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("Starting new search...");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,e,d,b){var b=this._getUrl(b,e);if(!b){return true}var a=this._getWindow(b,this._getWindowName(e),c,d);if(!a){return false}this._handleInitialWindowFocus(a);this._preparePopUpWindow(a);a.init(a);return true},_getWindow:function(c,e,b,d){try{return this._top.window.open(c,e,"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}});

;var jsck_compareto_core_en_in="v428";
/* et=1, mt=5, c=p2, i=sparkle008, v=R114, cc=2, r=none */

