/* generated Wed Feb 22 13:11:54 EST 2012 */

if(typeof R9==="undefined"){R9=new Object()}R9.CompareTo={_currentForm:null,_getFormType:function(a){if(typeof a.tab!=="undefined"){return a.tab.value}else{return"unknown"}},_getMaxCompares:function(a){if(typeof a.comparetomax!=="undefined"){return a.comparetomax.value}else{return 5}},_getCurrentCompares:function(a){return jq(a).find(".compareToCheckboxes input[name=comparetosite]:visible").size()},_getArgs:function(c){var b=this._getFormType(c);var a="";if(b==="flights"){a="ptype=flights";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;a+="&cabin=e"}else{if(b==="hotels"){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}else{if(b==="cars"){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;if(typeof c.citycode2!=="undefined"&&typeof c.location2!=="undefined"){a+="&location2="+c.location2.value;a+="&citycode2="+c.citycode2.value}}else{if(b==="vacations"){a="ptype=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}}}}return a},_showBox:function(b){var c=this._getFormType(b);var a=false;if(c==="flights"){if(b.origin.value!==""&&b.destination.value!==""){a=true}}else{if(c==="hotels"){if(b.othercity.value!==""){a=true}}else{if(c==="cars"){if(b.location.value!==""){a=true}}else{if(c==="vacations"){if(b.origin.value!==""&&b.destination.value!==""){a=true}}}}}if(a===true){jq(b).find(".compareToBox").show()}else{jq(b).find(".compareToBox").hide()}return a},_hideAllCompareTos:function(a){jq(a).find("input[name=comparetosite]").closest("label").hide()},_compare2chk:function(b){this._hideAllCompareTos(b);var a=this._setCmp2Count;this._currentForm=b;jq.getScript("/s/cmp2chk?"+this._getArgs(b),a)},_setCmp2Count:function(){},_shouldLaunchFromCheckbox:function(a){if(a.closest("label").is(":visible")&&a.is(":visible")&&a.val()!=null&&a.val()!=""){return true}else{return false}},_addCheckedCompareTos:function(b,a){var c=this;jq(b).find("input[name=comparetosite]:checked").each(function(d){if(c._shouldLaunchFromCheckbox(jq(this))===true){a.push({code:jq(this).val()})}})},launch:function(d){if(typeof d.comparetosite==="undefined"){return true}var a=new Array();this._addCheckedCompareTos(d,a);this._uncheckAllHidden(d);var c=new R9.utils.windowopener({searchType:this._getFormType(d),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},_checkAll:function(a){jq(a).closest("form").find(".compareToCheckboxes input[name=comparetosite]:visible").prop("checked",true)},_uncheckAllHidden:function(a){jq(a).find(".compareToCheckboxes input[name=comparetosite]:hidden").prop("checked",false)},smartboxCallback:function(a){if(this._showBox(a)===true){this._compare2chk(a)}},checkCallback:function(b,h,f){if(h!=null&&h.indexOf("KAYAK")==0){return}try{var g=this._currentForm;var d=this._getMaxCompares(g);var a=this._getCurrentCompares(g);var e=jq(g).find("label."+h);if(typeof e!="undefined"){if(b===true&&a<d){e.show()}else{e.hide()}}}catch(c){}},_checkboxClick:function(b){var a="false";if(jq(b).is(":checked")){a="true"}jq.ajax({type:"POST",url:"/k/cookie",data:{action:"setmeta",metacookie:jq(b).val(),metavalue:a}})},init:function(a){var b=this;jq(a).find("input[name=comparetosite]").click(function(){b._checkboxClick(jq(this))});jq(a).find("label.compareAll a").click(function(){b._checkAll(jq(this))});b.smartboxCallback(a)}};function cmp2set(a,c,b){R9.CompareTo.checkCallback(a,c,b)}function setCmp2Count(){};

;var jsck_commoncompareto="v430";
/* et=0, mt=2, c=p2, i=sparkle003, v=R115, cc=2, r=none */

