$(document).ready(function(){Z.FlightCtz={createPrePopWinLimit:1,prepop:new Array(),prepopIndex:0,city1:null,init:function(tab){var El=this;El.city1=$('div#tab-1 #city1');var arr_unselected=new Array();var count_unselected=0;var count_selected=0;var item_selected=0;var sArray=new Array();var checkPopupBlocker=false;var winpop=new Array();var selectedLink=0;var currentTime=new Date();currentTime.setDate(currentTime.getDate()+20);var month=currentTime.getMonth()+1;var day=currentTime.getDate();var year=currentTime.getFullYear();if(currentTime.getMonth()>month){year++;}
var today=month+"/"+day+"/"+year;currentTime.setDate(currentTime.getDate()+7);var month2=currentTime.getMonth()+1;var day2=currentTime.getDate();var year2=currentTime.getFullYear();if(currentTime.getMonth()>month2){year2++;}
var today2=month2+"/"+day2+"/"+year2;$('div#tab-1 #date1').val(today);$('div#tab-1 #date2').val(today2);var try1=false;var dates=$("#date1, #date2").datepicker({defaultDate:"+1w",showButtonPanel:true,minDate:0,changeMonth:true,changeYear:true,numberOfMonths:2,showOn:"both",buttonImage:"http://hotels.asia.com/images/icon-cal.gif",buttonImageOnly:true,onSelect:function(selectedDate){if(this.id=="date1"&&!try1){var dd=selectedDate.split('/');var tmpdate=new Date(dd[2],parseInt(dd[0],10)-1,dd[1]);tmpdate.setDate(tmpdate.getDate()+7);var m=tmpdate.getMonth()+1;var d=tmpdate.getDate();var y=tmpdate.getFullYear();var t=m+"/"+d+"/"+y;$('div#tab-1 #date2').val(t);}
if(this.id=="date1"){var option="minDate",instance=$(this).data("datepicker"),date=$.datepicker.parseDate(instance.settings.dateFormat||$.datepicker._defaults.dateFormat,selectedDate,instance.settings);dates.not(this).datepicker("option",option,date);}
El.createPrePopWin();},beforeShow:function(input,inst){var dateMin=0;if(input.id==="date2"){var dd=$('div#tab-1 #date1').val().split('/');var dd2=$('div#tab-1 #date2').val().split('/');var tmpdate=new Date(dd[2],parseInt(dd[0],10)-1,dd[1]);tmpdate.setDate(tmpdate.getDate()+1);dateMin=tmpdate;inst.drawMonthEx=0;if(parseInt(dd[2],10)<parseInt(dd2[2],10)){inst.drawMonthEx=-1;inst.txtboxclick=true;}else if(parseInt(dd[0],10)<parseInt(dd2[0],10)){inst.drawMonthEx=-1;inst.txtboxclick=true;}}
return{minDate:dateMin};},beforeShowDay:function(date){var dd1=dates[0].value.split('/');var dd2=dates[1].value.split('/');var dates1=[new Date(dd1[2],parseInt(dd1[0],10)-1,dd1[1]),new Date(dd2[2],parseInt(dd2[0],10)-1,dd2[1])];if(dates1[0]<=date&&dates1[1]>=date){return[true,'ui-state-highlight'];}else{}
return[true,''];},onClose:function(input,inst){if(!date2Popup){date2Popup=true;if(inst.id=='date1'){setTimeout(function(){$("#date2").datepicker("show");},300);}}}});var date2Popup=false;$('div#tab-1 #one_way').click(function(){if($(this).attr('checked')){$('#return_block').fadeOut('slow');}
El.createPrePopWin();});$('div#tab-1 #roundtrip').click(function(){if($(this).attr('checked')){$('#return_block').fadeIn('slow');}
El.createPrePopWin();});$('div#tab-1 #date1').blur(function(){var currentTime=new Date();var dd=$('div#tab-1 #date1').val().split('/');var tmpdate=new Date(dd[2],parseInt(dd[0],10)-1,dd[1]);if(tmpdate<currentTime)$('div#tab-1 #date1').val(today);});$('div#tab-1 #date2').blur(function(){var currentTime=new Date();var dd=$('#date2').val().split('/');var tmpdate=new Date(dd[2],parseInt(dd[0],10)-1,dd[1]);if(tmpdate<currentTime)$('#date2').val(today2);});$('div#tab-1 #city1').blur(function(){var a=$('div#tab-1 #city1').val();var b=$('div#tab-1 #city2').val();});$('div#tab-1 #city2').blur(function(){var a=$('#city1').val();var b=$('#city2').val();if(a==""||b==""||a=="Enter a City or Airport Code"||b=="Enter a City or Airport Code"){}else{var hcity=b.split('-')[0];$('div#tab-2 #city1').val(hcity);$('div#tab-3 #city1').val(b);$('div#tab-3 #city2').val(b);}});$('div#tab-1 #city1').dblclick(function(){$(this).val('');});$('div#tab-1 #city2').dblclick(function(){$(this).val('');});$('div#tab-1 #city1').click(function(){if($(this).val()!='Enter a City or Airport Code'&&$(this).val()!=''){$(this).focus();$(this).select();}});$('div#tab-1 #city2').click(function(){if($(this).val()!='Enter a City or Airport Code'&&$(this).val()!=''){$(this).focus();$(this).select();}});$('div#tab-1 #date1').click(function(){El.createPrePopWin();});$('div#tab-1 #date2').click(function(){El.createPrePopWin();});$('div#tab-1 #btn-check-all').click(function(){$('div#tab-1 ul#ctz-ads .chck').each(function(){$(this).attr('checked','checked');$(this).trigger('updateState');});$('div#tab-1 #btn-check-all').css('display','none');$('div#tab-1 #btn-uncheck-all').css('display','block');return false;});$('div#tab-1 #btn-uncheck-all').click(function(){$('div#tab-1 .chck').each(function(){$(this).attr('checked',false);$(this).trigger('updateState');});$('div#tab-1 #btn-uncheck-all').css('display','none');$('div#tab-1 #btn-check-all').css('display','block');});var supplierClick=new Array();$('div#tab-1 .search-btn').click(function(){arr_unselected=new Array();count_unselected=0;checkPopupBlocker=false;El.createPrePopWinLimit=1;sArray=new Array();$('#more-supplier').hide();supplierClick=new Array();count_selected=0;item_selected=0;var lastItemID='';var ii=0;var exit=false;El.createPrePopWin();var searchtype=(this.id=='search-btn')?'air':'air_hotel';$('.vtip').each(function(){if($(this).is(":visible")){$(this).fadeOut('fast',function(){$(this).fadeIn('fast');});exit=true;}});if(exit){exit=false;return exit;}
var city1=$('div#tab-1 #city1').val();var city2=$('div#tab-1 #city2').val();var date1=$('div#tab-1 #date1').val();var date2=$('div#tab-1 #date2').val();var adults=$('div#tab-1 #adults').val();var flighttype=($('div#tab-1 #one_way').attr('checked')?1:2);if(city1==''||city1.length<3||city1=='Enter a City or Airport Code'){alert('Enter a City or Airport Code');$('div#tab-1 #city1').fadeOut('fast');$('div#tab-1 #city1').fadeIn('fast');$('div#tab-1 #city1').focus();$('div#tab-1 #city1').select();return false;}
if(city2==''||city2.length<3||city2=='Enter a City or Airport Code'){alert('Enter a City or Airport Code');$('div#tab-1 #city2').fadeOut('fast');$('div#tab-1 #city2').fadeIn('fast');$('div#tab-1 #city2').focus();$('div#tab-1 #city2').select();return false;}
if(!isDate(date1)){date1=today;$('div#tab-1 #date1').val(date1);$('div#tab-1 #date1').focus();$('div#tab-1 #date1').select();}
if(!isDate(date2)){date2=today;$('div#tab-1 #date2').val(date2);$('div#tab-1 #date2').focus();$('div#tab-1 #date2').select();}
var d1=new Date(date1.split('/')[2],date1.split('/')[0]-1,date1.split('/')[1],23,59);var d2=new Date(date2.split('/')[2],date2.split('/')[0]-1,date2.split('/')[1],23,59);var curDate=new Date();if(d1.getTime()<curDate.getTime()){alert('Some required values are not correct.');$('div#tab-1 #date1').focus();return false;}
if(d2.getTime()<curDate.getTime()){alert('Some required values are not correct.');$('div#tab-1 #date2').focus();return false;}
if((d2.getTime()-d1.getTime())<0){alert('The departure date is later than the return date. Please enter correct values.');$('div#tab-1 #date2').focus();return false;}
if((d2.getTime()-d1.getTime())==0){$('div#tab-1 #date1').val(today);$('div#tab-1 #date2').val(today2);}
$('#gointo').html(city1+', '+city1+' '+'Depart: '+date1+' Return: '+date2);var n=$('div#tab-1 .chck:checked').length;if(n<1){$('#error2').show();setTimeout(function(){$('#error2').fadeOut('slow');},3500);return false;}else if(n<3){$('#error1').show();setTimeout(function(){$('#error1').fadeOut('slow');},3500);return false;}
pattern=new RegExp(/\(([^}]+)\)/);var newString1=pattern.exec(city1);var newString2=pattern.exec(city2);var a=(newString1!=undefined)?newString1[1]:city1
var b=(newString2!=undefined)?newString2[1]:city2
var cityInfo1=city1.split('-')[0];cityInfo1=cityInfo1.split(',')[0]+' '+a;var cityInfo2=city2.split('-')[0];cityInfo2=cityInfo2.split(',')[0]+' '+b;$('#trip-to').html(cityInfo1+" to "+cityInfo2);$('#trip-to-date').html('Departure: '+date1+'&nbsp;&nbsp;'+'Return: '+date2);$('#item-checked').html('').show();$('#mb-top-check-right-selected').html('');$('#mb-top-check-right-unselected').html('');$('#searc-more').html("Search for more best deals on <b>"+city2.split('-')[0]+"</b>");if(this.id=='search-btn-fh'){}else{var pattern=new RegExp(/\(([^}]+)\)/);var newString1=pattern.exec(city1);var newString2=pattern.exec(city2);var c1=(newString1!=undefined)?newString1[1]:city1;var c2=(newString2!=undefined)?newString2[1]:city2;var d1=$('div#tab-1 #date1').val();var d2=$('div#tab-1 #date2').val();if(c1==c2){alert('Arrival airport must be different');$('div#tab-1 #city2').select();$('div#tab-1 #city2').focus();return false;}
if(c1!=""&&c2!=""){var n=$('div#tab-1 .chck:checked').length;var nWindowsHor=n;var nWindowsVer=1;var winLeft=(10+parseInt(window.screen.availWidth/4));var windowWidth=50+(window.screen.availWidth-(60+parseInt(window.screen.availWidth/4)))/nWindowsHor;var windowHeight=screen.availHeight/nWindowsVer;for(i=0;i<n;i++){var c=new Object;c.left=Math.floor(winLeft+((i%nWindowsHor)*windowWidth+0.5));c.top=Math.floor(Math.floor(i/nWindowsHor)*windowHeight+0.5);c.width=Math.floor(windowWidth);c.height=Math.floor(windowHeight+0.5);sArray[i]=c;}
var ii=0;$('.tabs').html('');$('.tab_container').html('');popw=new Array();popX=1;popY=1;$('#various1').trigger('click');$('#mb-top-check-right-selected').html('');$('#mb-top-check-right-unselected').html('');ii=0;var arr=getAvailablePopWin();var guid=globalObj.guidGenerator();$('div#tab-1 ul.title-flights li div.tile').each(function(i,v){var obj=$(v).find('.url');var chk=$(v).find('.chck');if(obj[0]!=undefined&&$(chk).is(':checked')){var title__=$(v).find('.title').val();var img=$(v).find('.img').val();var type__='Air';var _id_=this.id;var url=obj.val();var referralURL=encodeURIComponent(""+document.domain);referralURL=referralURL.replace('www.','');var url="loader.php?template="+encodeURIComponent(category_name)+"&advertiser="+encodeURIComponent(title__)+"&widget_type=flight&memberid="+memberid+"&visitor="+guid+"&type=flight&from="+c1+"&to="+c2+"&url="+encodeURIComponent("click_flight.php?departureDate="+d1+"&returnDate="+d2+"&numTravelers=1&from="+c1+"&to="+c2+"&publisherID="+g_ctz+"&advertiserID="+_id_+"&referralURL="+referralURL);var divClass='def-tab';var winpopId_='';if(navigator.appName==globalObj.ie){winpopId_=arr.pop();if(El.prepop[winpopId_]){}else{divClass='def-unpopped';}}
var sup='<div class="mb-check-icon '+divClass+'"><a id="sup-win'+
$(this).parent()[0].id+'" href="javascript:;" class="sup"><img width="80" height="34" alt="Air" src="'+img+'">'+'<input type="hidden" class="_url" value="'+url+'" />'+'</a>'+'<span class="search-type" style="display:none;" >'+type__+'</span>'+'</div>';$('#mb-top-check-right-selected').append(sup);if($('#dispCompare_sbs').is(':checked')===true){popSBS(ii,url,$(this).parent()[0].id,sArray);}else{if(navigator.appName==globalObj.ie){$('#mb-top-check-right-selected').children(':last').find('.sup').data('prepop',winpopId_);popStackedIE(ii,url,winpopId_);}else{popStacked(ii,url,$(this).parent()[0].id);}}
supplierClick[$(this).parent()[0].id]=false;ii++;count_selected++;lastItemID=$(this).parent()[0].id;}});$('div#tab-1 ul.title-flights-hotels li div.tile').each(function(i,v){var obj=$(v).find('.url');var chk=$(v).find('.chck');if(obj[0]!=undefined&&$(chk).is(':checked')){var title__=$(v).find('.title').val();var img=$(v).find('.img').val();var type__='Air + Hotel';var _id_=this.id;var url=obj.val();var referralURL=encodeURIComponent(""+document.domain);referralURL=referralURL.replace('www.','');var url="loader.php?template="+encodeURIComponent(category_name)+"&advertiser="+encodeURIComponent(title__)+"&widget_type=flight&memberid="+memberid+"&visitor="+guid+"&type=flight&from="+c1+"&to="+c2+"&url="+encodeURIComponent("click_vacations.php?departureDate="+d1+"&returnDate="+d2+"&numTravelers=1&origin="+c1+"&destination="+c2+"&publisherID="+g_ctz+"&advertiserID="+_id_+"&referralURL="+referralURL);var divClass='def-tab';var winpopId_='';if(navigator.appName==globalObj.ie){winpopId_=arr.pop();if(El.prepop[winpopId_]){}else{divClass='def-unpopped';}}
var sup='<div class="mb-check-icon '+divClass+'"><a id="sup-win'+
$(this).parent()[0].id+'" href="javascript:;" class="sup"><img width="80" height="34" alt=" " src="'+img+'">'+'<input type="hidden" class="_url" value="'+url+'" />'+'</a>'+'<span class="search-type" style="display:none;">'+type__+'</span>'+'</div>';$('#mb-top-check-right-selected').append(sup);if($('#dispCompare_sbs').is(':checked')===true){popSBS(ii,url,$(this).parent()[0].id);}
else{if(navigator.appName==globalObj.ie){$('#mb-top-check-right-selected').children(':last').find('.sup').data('prepop',winpopId_);popStackedIE(ii,url,winpopId_);}else{popStacked(ii,url,$(this).parent()[0].id);}}
supplierClick[$(this).parent()[0].id]=false;count_selected++;lastItemID=$(this).parent()[0].id;ii++;}});$('div#tab-1 li div.tile').each(function(i,v){var obj=$(v).find('.url');var chk=$(v).find('.chck');var title__=$(v).find('.title').val();if(obj[0]!=undefined&&$(chk).is(':checked')==false){var _id_=this.id;var referralURL=encodeURIComponent(document.domain);referralURL=referralURL.replace('www.','');if($(v).parent().parent()[0].className=='title-flights'){var type__='Air';var url="loader.php?template="+encodeURIComponent(category_name)+"&advertiser="+encodeURIComponent(title__)+"&widget_type=flight&memberid="+memberid+"&visitor="+guid+"&type=flight&from="+c1+"&to="+c2+"&url="+encodeURIComponent("click_flight.php?departureDate="+d1+"&returnDate="+d2+"&numTravelers=1&from="+c1+"&to="+c2+"&publisherID="+g_ctz+"&advertiserID="+_id_+"&referralURL="+referralURL);}else{var type__='Air + Hotel';var url="loader.php?template="+encodeURIComponent(category_name)+"&advertiser="+encodeURIComponent(title__)+"&widget_type=flight&memberid="+memberid+"&visitor="+guid+"&type=flight&from="+c1+"&to="+c2+"&url="+encodeURIComponent("click_vacations.php?departureDate="+d1+"&returnDate="+d2+"&numTravelers=1&origin="+c1+"&destination="+c2+"&publisherID="+g_ctz+"&advertiserID="+_id_+"&referralURL="+referralURL);}
var img=$(v).find('.img').val();var sup='<div class="mb-box-icon"><a id="sup-win'+
$(this).parent()[0].id+'" href="javascript:;" class="sup-unselected"><img width="80" height="34" alt=" " src="'+img+'">'+'<input type="hidden" class="_url" value="'+url+'" />'+'</a>'+'<span class="search-type" >'+type__+'</span>'+'</div>';$('#mb-top-check-right-unselected').append(sup);count_unselected++;arr_unselected[$(this).parent()[0].id]=false;}});if(navigator.appName==globalObj.ie){$('#mb-top-check-right-selected').children().each(function(i,v){var val=$(this).find('.sup').data('prepop');if(val==undefined){$('.mb-check-icon:eq('+(i-1)+')').removeClass('def-tab').addClass('active-tab');lastItemID=$('.mb-check-icon:eq('+(i-1)+')').find('.sup')[0].id.replace('sup-win','');$('.mb-check-icon:eq('+(i-1)+')').find('.sup').data('click',true);supplierClick[lastItemID]=true;return false;}});}else{$('.mb-check-icon:last').removeClass('def-tab').addClass('active-tab');$('.mb-check-icon:last').find('.sup').data('click',true);supplierClick[lastItemID]=true;}
item_selected=count_selected-1;$('#item-checked').html(item_selected+' more sites to check');$('#checking-sites').html('Checking '+count_selected+' sites');$('.mb-check-icon').click(function(){$(this).find('.sup').trigger('click');});$('.sup').click(function(){if($(this).data('click')==undefined){item_selected--;if(item_selected<=0)
$('#item-checked').hide();else
$('#item-checked').html(item_selected+' more sites to check');$(this).data('click',true);}
$('.mb-check-icon').removeClass('active-tab');$('.mb-box-icon').removeClass('active-tab');$(this).parent().removeClass('def-tab');$(this).parent().removeClass('def-unpopped');$(this).parent().addClass('active-tab');$(this).parent().find('.def-tab2-img').hide();var id=$(this)[0].id.replace('sup-win','');supplierClick[id]=true;if(navigator.appName==globalObj.ie){var prePopId=$(this).data('prepop');if(El.prepop[prePopId]!=undefined){El.prepop[prePopId].focus();}else{var url=$(this).find('._url').val();var myWidth=(screen.availWidth>800)?(screen.availWidth-100):screen.availWidth;var myHeight=(screen.availHeight>600)?(screen.availHeight-100):(screen.availHeight-70);var myTop=Math.round((screen.availHeight-myHeight)/2)-25;var winLeft=10+parseInt($('#fancybox-wrap').css('width').replace('px',''));var windowWidth=(screen.width*.5);var windowHeight=(screen.height*.5);var strOptions='toolbar=no,scrollbars=no,resizable,location,height='+windowHeight+',width='+
windowWidth+',left='+winLeft+',top='+myTop+',screenX='+winLeft+',screenY='+myTop;El.prepopIndex++;var new_id=El.prepopIndex;$(this).data('prepop',new_id);El.prepop[new_id]=window.open(url,'win_'+new_id,strOptions);}}else{if(winpop[id]!=undefined){winpop[id].focus();}else{var url=$(this).find('._url').val();var myWidth=(screen.availWidth>800)?(screen.availWidth-100):screen.availWidth;var myHeight=(screen.availHeight>600)?(screen.availHeight-100):(screen.availHeight-70);var myTop=Math.round((screen.availHeight-myHeight)/2)-25;var winLeft=10+parseInt($('#fancybox-wrap').css('width').replace('px',''));var windowWidth=(screen.width*.5);var windowHeight=(screen.height*.5);var strOptions='toolbar=no,scrollbars=no,resizable,location,height='+windowHeight+',width='+
windowWidth+',left='+winLeft+',top='+myTop+',screenX='+winLeft+',screenY='+myTop;winpop[id]=window.open(url,'win_'+id,strOptions);}}
var allClicked=true;for(var o=0;o<supplierClick.length;o++){if(supplierClick[o]==false){allClicked=false;break;}}
if(allClicked){if($('#mb-top-check-right-unselected').children().length>0)
$('#more-supplier').slideDown();}
return false;});$('#sites-to-check').html(count_unselected+' more sites to check');$('.sup-unselected').click(function(i,v){if($(this).data('click')==undefined){count_unselected--;if(count_unselected<=0)
$('#sites-to-check').hide();else
$('#sites-to-check').html(count_unselected+' more sites to check');$(this).data('click',true);var newId=new Date();$(this).data('windId',newId.getTime());}
$('.mb-check-icon').removeClass('active-tab');$('.mb-box-icon').removeClass('active-tab');$(this).parent().removeClass('def-tab');$(this).parent().addClass('active-tab');var id=$(this)[0].id.replace('sup-win','');var obj=$(this).find('._url');var url=obj.val();id=$(this).data('windId');if(winpop[id]!=undefined){winpop[id].focus();}else{var myWidth=(screen.availWidth>800)?(screen.availWidth-100):screen.availWidth;var myHeight=(screen.availHeight>600)?(screen.availHeight-100):(screen.availHeight-70);var myTop=Math.round((screen.availHeight-myHeight)/2)-25;var winLeft=10+parseInt($('#fancybox-wrap').css('width').replace('px',''));var windowWidth=(screen.width*.5);var windowHeight=(screen.height*.5);var strOptions='toolbar=no,scrollbars=no,resizable,location,height='+windowHeight+',width='+
windowWidth+',left='+winLeft+',top='+myTop+',screenX='+winLeft+',screenY='+myTop;try{if(winpop[id]){winpop[id].focus();}else{winpop[id]=window.open(url,'win_'+id,strOptions);}}catch(e){return false;}}
return false;});$('div#tab-1 .chck:checked').each(function(){$(this).removeAttr('checked');$(this).trigger('updateState');});$('div#tab-1 #btn-uncheck-all').css('display','none');$('div#tab-1 #btn-check-all').css('display','block');}}
return false;});$('body').append('<p class="vtip" style="display: none" id="compare-msg-p"><img id="compare-vtipArrow" />Please select 2 sites to compare.</p>');function findPosEx(obj){var curleft=obj.offsetLeft||0;var curtop=obj.offsetTop||0;while(obj=obj.offsetParent){curleft+=obj.offsetLeft
curtop+=obj.offsetTop}
return{x:curleft,y:curtop};}
$("div#tab-1 #city1").autocomplete("post/flight-post.php",{delay:10,minChars:3,matchSubset:1,matchContains:1,cacheLength:10,selectFirst:true,width:'450px',errormsg:'Enter City or Airport Code or Name',onItemSelect:function(){$("div#tab-1 #city2").focus();}});$("div#tab-1 #city2").autocomplete("post/flight-post.php",{delay:10,minChars:3,matchSubset:1,matchContains:1,cacheLength:10,selectFirst:true,width:'450px',errormsg:'Enter City or Airport Code or Name',onItemSelect:onItemSelect});function onItemSelect(showResult){$('div#tab-1 #date1').focus();}
function bindCheckbox(){$('div#tab-1 .chck').click(function(){});}
bindCheckbox();function isDate(dateStr){var datePat=/^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/;var matchArray=dateStr.match(datePat);if(matchArray==null){return false;}
var month=matchArray[1];var day=matchArray[3];var year=matchArray[5];if(month<1||month>12){alert("Month must be between 1 and 12.");return false;}
if(day<1||day>31){alert("Day must be between 1 and 31.");return false;}
if((month==4||month==6||month==9||month==11)&&day==31){alert("Month "+month+" doesn`t have 31 days!")
return false;}
if(month==2){var isleap=(year%4==0&&(year%100!=0||year%400==0));if(day>29||(day==29&&!isleap)){alert("February "+year+" doesn`t have "+day+" days!");return false;}}
return true;}
var iid=0;function popSBS(rec,url,_id){var self=this;var topX=_sArray[rec].left;var topY=_sArray[rec].top;var sWidth=_sArray[rec].width;var sHeight=_sArray[rec].height;var strOptions='toolbar=no,scrollbars=no,resizable,location,height='+sHeight+',width='+
sWidth+',left='+topX+',top='+topY+',screenX='+topX+',screenY='+topY;if(winpop[_id]){try{winpop[_id].moveTo(topX,topY);winpop[_id].resizeTo(sWidth,sHeight);winpop[_id].focus();winpop[_id].location.href=url;winpop[_id].focus();}catch(e){}}else{var w=window.open(url,'win_'+_id,strOptions);if(w!=null||typeof(w)!='undefined'){winpop[_id]=w;}else{}}}
var iid2=0;function popStacked(rec,url,_id){var self=this;var topX=200*rec;var topY=100*rec;var sWidth=400;var sHeight=400;var to=100;if(navigator.appName=='Microsoft Internet Explorer'){to=window.screenTop;}else if(navigator.appName=='Netscape'){to=window.mozInnerScreenY;}else{to=window.outerHeight-window.innerHeight;}
var myWidth=(screen.availWidth>800)?(screen.availWidth-100):screen.availWidth;var myHeight=(screen.availHeight>600)?(screen.availHeight-100):(screen.availHeight-70);var myLeft=Math.round((screen.availWidth-myWidth)/2);var myTop=Math.round((screen.availHeight-myHeight)/2)-25;to=myTop;var w1=$('#fancybox-wrap').css('width');var w2=(w1*window.screen.availWidth/100);var s=10+parseInt(w1);topX=s+(100*rec);topY=to+(20*rec);sWidth=window.screen.availWidth-topX;sHeight=window.screen.availHeight-topY;sWidth=(screen.width*.5);sHeight=(screen.height*.5);var strOptions='toolbar=no,scrollbars=no,resizable,location,height='+sHeight+',width='+
sWidth+',left='+topX+',top='+topY+',screenX='+topX+',screenY='+topY;if(winpop[_id]){winpop[_id].close();winpop[_id]=undefined;}
var w=window.open(url,'win_'+_id,strOptions);if(checkPopupBlocker==false){checkPopupBlocker=true;var l=screen.width;var t=screen.height;var popup=window.open('','_blank','width=10, height=10, left='+l+', top='+t+',toolbar=no,scrollbars=no');if(popup==null||typeof(popup)=='undefined'){$.blockUI({message:$('#popup-blocker-msg'),baseZ:2000,css:{top:'41px',margin:'0 0 0 250px',border:'none',padding:'0px',cursor:'default'}});setTimeout(function(){$.unblockUI();},5000);}else{popup.close();}}
if(w!=null||typeof(w)!='undefined'){winpop[_id]=w;}else{}}
function popStackedIE(rec,url,_id){var self=this;var topX=200*rec;var topY=100*rec;var sWidth=400;var sHeight=400;var to=100;if(navigator.appName=='Microsoft Internet Explorer'){to=window.screenTop;}else if(navigator.appName=='Netscape'){to=window.mozInnerScreenY;}else{to=window.outerHeight-window.innerHeight;}
var myWidth=(screen.availWidth>800)?(screen.availWidth-100):screen.availWidth;var myHeight=(screen.availHeight>600)?(screen.availHeight-100):(screen.availHeight-70);var myLeft=Math.round((screen.availWidth-myWidth)/2);var myTop=Math.round((screen.availHeight-myHeight)/2)-25;to=myTop;var w1=$('#fancybox-wrap').css('width');var w2=(w1*window.screen.availWidth/100);var s=10+parseInt(w1);topX=s+(100*rec);topY=to+(20*rec);sWidth=window.screen.availWidth-topX;sHeight=window.screen.availHeight-topY;sWidth=(screen.width*.5);sHeight=(screen.height*.5);var strOptions='toolbar=no,scrollbars=no,resizable,location,height='+sHeight+',width='+
sWidth+',left='+topX+',top='+topY+',screenX='+topX+',screenY='+topY;if(El.prepop[_id]){try{El.prepop[_id].moveTo(topX,topY);El.prepop[_id].resizeTo(sWidth,sHeight);El.prepop[_id].focus();El.prepop[_id].location.href=url;El.prepop[_id].focus();return true;}catch(e){}}else{return false;}}
function getAvailablePopWin(){var retVal=new Array();for(var x=1;x<El.prepop.length;x++){try{if(El.prepop[x].location.hostname==''){retVal.push(x);}}catch(e){}}
return retVal;}
$("#various1").fancybox({'type':'inline','showCloseButton':false,'autoDimensions':true,'autoScale':true,'height':screen.availHeight-170,'onClosed':function(){if(activeMenu=="flights")
$('#sticky-ads').show();},'onComplete':function(){$("#fancybox-wrap").css({'left':'0px','top':'0px','bottom':'auto'});},onStart:function(){$("#fancybox-wrap").css({'left':'0px !important','top':'0px !important','bottom':'auto'});}});$('#popup-close').click(function(){$.fancybox.close();if(activeMenu=="flights")
$('#sticky-ads').show();});$('.close12').click(function(){$.unblockUI();return false;});$('.error-notification').click(function(){$(this).fadeOut();return false;});$(document).keyup(function(e){if(e.keyCode==27){$.unblockUI();}});$('.ads-img').click(function(){var chk=$(this).parent().find('.chck');if(chk.is(':checked')){chk.removeAttr('checked');}else{chk.attr('checked','checked');}});function first(){var city1=$('div#tab-1 #city1').val();var city2=$('div#tab-1 #city2').val();pattern=new RegExp(/\(([^}]+)\)/);var newString1=pattern.exec(city1);var newString2=pattern.exec(city2);var a=(newString1!=undefined)?newString1[1]:city1;var b=(newString2!=undefined)?newString2[1]:city2;return globalObj.getCtzAds({type:'flight',from:a,to:b},function(res){var response=jQuery.parseJSON(res);var providers=jQuery.parseJSON(res).form.providers.reverse();$("div#tab-1 #ctz-ads li:not(:last-child)").remove();for(var x=0;x<providers.length;x++){var checked='';if(providers[x].checked=='1'){checked='checked="yes"';}
switch(providers[x].name){case"Kayak":pub_id='1';break;case"Orbitz":pub_id='2';break;case"Hotwire":pub_id='3';break;case"Priceline":pub_id='4';break;case"TripAdvisor":pub_id='5';break;case"DealBase":pub_id='7';break;case"Expedia":pub_id='9';break;case"Travel Ticker":pub_id='10 ';break;case"Fly.com":pub_id='14';break;case"CheapTickets.com":pub_id='16';break;case"Shermans Travel":pub_id='29';break;}
var li=$('<li id="'+x+'"><div class="tile" id="'+pub_id+'">'+'<input id="flight-chck-'+x+'" type="checkbox" class="chck" '+checked+' />'+'<label for="flight-chck-'+x+'"><img class="ads-img" width="100px" src="'+providers[x].smallThumb+'"></label>'+'<input type="hidden" value="'+providers[x].smallThumb+'" class="img" />'+'<input type="hidden" value="Air" class="type" />'+'<input type="hidden" value="'+providers[x].name+'" class="title" />'+'<input type="hidden" value="" class="url" />'+'</div></li>');$('div#tab-1 #ctz-ads').prepend(li);}});}
function second(){var city1=$('div#tab-1 #city1').val();var city2=$('div#tab-1 #city2').val();pattern=new RegExp(/\(([^}]+)\)/);var newString1=pattern.exec(city1);var newString2=pattern.exec(city2);var a=(newString1!=undefined)?newString1[1]:city1;var b=(newString2!=undefined)?newString2[1]:city2;return globalObj.getCtzAds({type:'vacation',from:a,to:b},function(res){var response=jQuery.parseJSON(res);var providers=jQuery.parseJSON(res).form.providers.reverse();$("#ctz-ads2 li").remove();for(var x=0;x<providers.length;x++){var checked='';if(providers[x].checked=='1'){}
switch(providers[x].name){case"Kayak":pub_id='1';break;case"Orbitz":pub_id='2';break;case"Hotwire":pub_id='3';break;case"Priceline":pub_id='4';break;case"TripAdvisor":pub_id='5';break;case"DealBase":pub_id='7';break;case"Expedia":pub_id='9';break;case"Travel Ticker":pub_id='10 ';break;case"Fly.com":pub_id='14';break;case"CheapTickets.com":pub_id='16';break;case"Shermans Travel":pub_id='29';break;}
var li=$('<li id="'+x+'"><div class="tile" id="'+pub_id+'">'+'<input id="vacation-chck-'+x+'" type="checkbox" class="chck" '+checked+' />'+'<label for="vacation-chck-'+x+'"><img class="ads-img" width="100px" src="'+providers[x].smallThumb+'"></label>'+'<input type="hidden" value="'+providers[x].smallThumb+'" class="img" />'+'<input type="hidden" value="Air" class="type" />'+'<input type="hidden" value="'+providers[x].name+'" class="title" />'+'<input type="hidden" value="" class="url" />'+'</div></li>');$('#ctz-ads2').prepend(li);}});}
function showCtzResult(){$('div#tab-1 .result-container').show();$('div#tab-1 #search-btn').show();$('div#tab-1 #right-side-banner').hide();$('div#tab-1 .front-banner-ctz').css({background:'url("http://fliasia.s3.amazonaws.com/widget-wide/images/desc-trip-mama6.png") no-repeat scroll 0 0 transparent'});}
$('.flight-type').customInput();$('#searc-more').click(function(){$('#sticky-ads').hide();var city1=$('div#tab-1 #city1').val();var city2=$('div#tab-1 #city2').val();var date1=$('div#tab-1 #date1').val();var date2=$('div#tab-1 #date2').val();var adults=$('div#tab-1 #adults').val();var flighttype=($('div#tab-1 #one_way').attr('checked')?1:2);if(validateData()){window.location.replace('http://hdn.com/?'+('auto=1&city1='+city1+'&city2='+city2+'&date1='+date1+'&date2='+date2+'&flighttype='+flighttype+'&adult='+adults));}
return false;});function validateData(){var exit=false;$('.vtip').each(function(){if($(this).is(":visible")){$(this).fadeOut('fast',function(){$(this).fadeIn('fast');});exit=true;}});if(exit){exit=false;return exit;}
var city1=$('div#tab-1 #city1').val();var city2=$('div#tab-1 #city2').val();var date1=$('div#tab-1 #date1').val();var date2=$('div#tab-1 #date2').val();var adults=$('div#tab-1 #adults').val();if(city1==''||city1.length<3||city1=='Enter a City or Airport Code'){alert('Enter a City or Airport Code');$('div#tab-1 #city1').fadeOut('fast');$('div#tab-1 #city1').fadeIn('fast');$('div#tab-1 #city1').focus();$('div#tab-1 #city1').select();return false;}
if(city2==''||city2.length<3||city2=='Enter a City or Airport Code'){alert('Enter a City or Airport Code');$('div#tab-1 #city2').fadeOut('fast');$('div#tab-1 #city2').fadeIn('fast');$('div#tab-1 #city2').focus();$('div#tab-1 #city2').select();return false;}
if(!isDate(date1)){date1=today;$('div#tab-1 #date1').val(date1);$('div#tab-1 #date1').focus();$('div#tab-1 #date1').select();}
if(!isDate(date2)){date2=today;$('div#tab-1 #date2').val(date2);$('div#tab-1 #date2').focus();$('div#tab-1 #date2').select();}
var d1=new Date(date1.split('/')[2],date1.split('/')[0]-1,date1.split('/')[1],23,59);var d2=new Date(date2.split('/')[2],date2.split('/')[0]-1,date2.split('/')[1],23,59);var curDate=new Date();if(d1.getTime()<curDate.getTime()){alert('Some required values are not correct.');$('div#tab-1 #date1').focus();return false;}
if(d2.getTime()<curDate.getTime()){alert('Some required values are not correct.');$('div#tab-1 #date2').focus();return false;}
if((d2.getTime()-d1.getTime())<0){alert('The departure date is later than the return date. Please enter correct values.');$('div#tab-1 #date2').focus();return false;}
if((d2.getTime()-d1.getTime())==0){$('div#tab-1 #date1').val(today);$('div#tab-1 #date2').val(today2);}
return true;}},createPrePopWin:function(check){var El=this;if(navigator.appName==globalObj.ie&&El.createPrePopWinLimit<5){El.prepopIndex++;if(check==undefined||check==false){El.createPrePopWinLimit++;}
El.prepop[El.prepopIndex]=window.open('','_blank','width=10, height=10, left='+screen.width+', top='+screen.height+',toolbar=no,scrollbars=no,resizable,location');El.prepop[El.prepopIndex].blur();window.focus();}}}});
