var markerImage={url:"/images/marker_blue.png",width:12,height:12,anchorX:6,anchorY:6,shadow:"/images/shadow.png"},favMarkerImage={url:"/images/marker_green.png",width:12,height:12,anchorX:6,anchorY:6,shadow:"/images/shadow.png"},viewedMarkerImage={url:"/images/marker_blue.png",width:12,height:12,anchorX:6,anchorY:6,shadow:"/images/shadow.png"},markerImageHover={url:"/images/marker_red.png",width:12,height:12,anchorX:6,anchorY:6,shadow:"/images/shadow.png"},favMarkerImageHover={url:"/images/marker_red.png",
width:12,height:12,anchorX:6,anchorY:6,shadow:"/images/shadow.png"},viewedMarkerImageHover={url:"/images/marker_red.png",width:12,height:12,anchorX:6,anchorY:6,shadow:"/images/shadow.png"};
function gotoBooking(d){d.item.list=="favorites"?window.open($("#favoriteslist_"+d.item.id+" .favinfo >a").attr("href")):d.item.list=="viewed"?window.open($("#myviewlist_"+d.item.id+" .viewinfo >a").attr("href")):d.item.list=="page"&&(addToViewed(d.item.id)&&$.ajax({type:"POST",url:"/php/get-fav-viewed-hotel-details-BKG.php",data:"action=single&hotel_id="+d.item.id,dataType:"xml",success:function(d){if($(d).find("errorcode").text()=="0"){var a="",c=[];$(d).find("hotel").each(function(){a+='<div class="myviewlist" id="myviewlist_'+
$(this).find("hotel_id").text()+'">';a+=' \t<div class="viewinfo">';a+='\t\t\t<a class="viewtitle" href="'+getAffiliateLink($(this).find("bkg_hotel_url").text())+'" title="'+$(this).find("name").text()+'" target="_blank">'+$(this).find("name").text()+($(this).find("stars").text()!=""?'<span class="viewstar" ><img src="/images/'+$(this).find("stars").text()+'-stars.gif" alt="'+$(this).find("name").text()+'" /></span>':"")+"</a>";a+="\t\t</div>";a+='\t\t<div class="viewright">';a+='\t\t\t<a href="javascript:void(0);" class="vdel" alt="Delete this hotel from my list">X</a><a href="javascript:void(0);" class="vadd" alt="Add this hotel to my favorites">Add to Favorites</a>';
a+="\t\t</div>";a+="</div>";a+='<div id="info_viewed_'+$(this).find("hotel_id").text()+'" class="marker_popup">';a+=' \t<div class="BubbleTemplate">';a+=' \t\t<span class="cpe_name">'+$(this).find("name").text()+"</span>";a+='\t\t\t<div class="Container">';a+='\t\t\t\t<div class="LeftBox">';a+='\t\t\t\t\t<span class="cpe_pix"><img class="cpe_photo" src="'+$(this).find("image").text()+'" alt="'+$(this).find("hotel_id").text()+" in "+$(this).find("city").text()+", "+$(this).find("country").text()+'" /></span>';
a+='\t\t\t\t\t<span class="cpe_price"><span class="cpe_avg">Starting from</span><br /><hotel id="v'+$(this).find("hotel_id").text()+'"><span id="uv'+$(this).find("hotel_id").text()+'" value="'+$(this).find("currency").text()+'">$ </span><span id="hv'+$(this).find("hotel_id").text()+'" value="'+$(this).find("rate").text()+'">'+formatNumber(roundCurrency(remNumFormat($(this).find("rate").text())))+"</span></hotel></span>";a+="\t\t\t\t</div>";a+='\t\t\t\t<div class="RightBox">';a+='\t\t\t\t\t<span class="cpe_add">'+
$(this).find("address").text()+",<br />"+$(this).find("city").text()+"</span><br />";a+='\t\t\t\t\t<span class="cpe_text">'+$(this).find("short_description").text()+"....</span>";a+="\t\t\t\t</div>";a+="\t\t\t</div>";a+="\t\t</div>";a+="\t</div>";var b={address:$(this).find("address").text(),id:$(this).find("hotel_id").text(),lat:$(this).find("lat").text(),lng:$(this).find("lng").text(),list:"viewed",geocoded:$(this).find("geocoded").text()};c.push(b)});getAddressArray(c,function(a){gotoBooking(a)})}$("#myviewarea").append(a).parent().show();
changeDefaultCurrency()},error:function(){}}),window.open($("#cpe_"+d.item.id+" >a").attr("href")))}
$(document).ready(function(){changeDefaultCurrency(function(){sort($.cookie("sort"))});if(GBrowserIsCompatible){map=new GMap2(document.getElementById("mapcontainer"));bounds=new GLatLngBounds;var d=map.getDefaultUI();d.maptypes.hybrid=!1;d.maptypes.satellite=!1;d.maptypes.physical=!1;map.setUI(d);$('<div id="message" />').appendTo(map.getPane(G_MAP_FLOAT_SHADOW_PANE));var f=[];$(".cpe_container[address]").each(function(){var a={address:$(this).attr("address"),id:$(this).attr("hid"),lat:$(this).attr("lat"),
lng:$(this).attr("lng"),list:"page",geocoded:"0",blat:$(this).attr("lat"),blng:$(this).attr("lng")};f.push(a)});getAddressArray(f,function(a){gotoBooking(a)})}showViewed(function(){if(GBrowserIsCompatible){var a=[];$(".myviewlist[address]").each(function(){var c={address:$(this).attr("address"),id:$(this).attr("hid"),lat:$(this).attr("lat"),lng:$(this).attr("lng"),list:"viewed",geocoded:"0",blat:$(this).attr("lat"),blng:$(this).attr("lng")};a.push(c)});getAddressArray(a,function(a){gotoBooking(a)});
a=[];$(".favoriteslist[address]").each(function(){var c={address:$(this).attr("address"),id:$(this).attr("hid"),lat:$(this).attr("lat"),lng:$(this).attr("lng"),list:"favorites",blat:$(this).attr("lat"),blng:$(this).attr("lng")};a.push(c)});getAddressArray(a,function(a){gotoBooking(a)})}});$("div.cpe_container >a").live("click",function(){var a=$(this).parent().attr("id").split("_")[1];addToViewed(a)&&$.ajax({type:"POST",url:"/php/get-fav-viewed-hotel-details-BKG.php",data:"action=single&hotel_id="+
a,dataType:"xml",success:function(a){if($(a).find("errorcode").text()=="0"){var b="",d=[];$(a).find("hotel").each(function(){b='<div class="myviewlist" id="myviewlist_'+$(this).find("hotel_id").text()+'">';b+=' \t<div class="viewinfo">';b+='\t\t\t<a class="viewtitle" href="'+getAffiliateLink($(this).find("bkg_hotel_url").text())+'" title="'+$(this).find("name").text()+'" target="_blank">'+$(this).find("name").text()+($(this).find("stars").text()!=""?' <span class="viewstar" ><img src="/images/'+$(this).find("stars").text()+
'-stars.gif" alt="'+$(this).find("name").text()+'" /></span>':"")+"</a>";b+="\t\t</div>";b+='\t\t<div class="viewright">';b+='\t\t\t<a href="javascript:void(0);" class="vdel" alt="Delete this hotel from my list">X</a><a href="javascript:void(0);" class="vadd" alt="Add this hotel to my favorites">Add to Favorites</a>';b+="\t\t</div>";b+="</div>";b+='<div id="info_viewed_'+$(this).find("hotel_id").text()+'" class="marker_popup">';b+=' \t<div class="BubbleTemplate">';b+=' \t\t<span class="cpe_name">'+
$(this).find("name").text()+"</span>";b+='\t\t\t<div class="Container">';b+='\t\t\t\t<div class="LeftBox">';b+='\t\t\t\t\t<span class="cpe_pix"><img class="cpe_photo" src="'+$(this).find("image").text()+'" alt="'+$(this).find("hotel_id").text()+" in "+$(this).find("city").text()+", "+$(this).find("country").text()+'" /></span>';b+='\t\t\t\t\t<span class="cpe_price"><span class="cpe_avg">Starting from</span><br /><hotel id="v'+$(this).find("hotel_id").text()+'"><span id="uv'+$(this).find("hotel_id").text()+
'" value="'+$(this).find("currency").text()+'">$ </span><span id="hv'+$(this).find("hotel_id").text()+'" value="'+$(this).find("rate").text()+'">'+formatNumber(roundCurrency(remNumFormat($(this).find("rate").text())))+"</span></hotel></span>";b+="\t\t\t\t</div>";b+='\t\t\t\t<div class="RightBox">';b+='\t\t\t\t\t<span class="cpe_add">'+$(this).find("address").text()+",<br />"+$(this).find("city").text()+"</span><br />";b+='\t\t\t\t\t<span class="cpe_text">'+$(this).find("short_description").text()+
"....</span>";b+="\t\t\t\t</div>";b+="\t\t\t</div>";b+="\t\t</div>";b+="\t</div>";$("#myviewarea").append(b).parent().show();var a={address:$(this).find("address").text(),id:$(this).find("hotel_id").text(),lat:$(this).find("lat").text(),lng:$(this).find("lng").text(),list:"viewed",geocoded:$(this).find("geocoded").text()};d.push(a)});getAddressArray(d,function(a){gotoBooking(a)});changeDefaultCurrency()}},error:function(){}})});$("a.vadd").live("click",function(){var a=$(this).parent().parent().attr("id").split("_")[1];
addToFav(a);$.ajax({type:"POST",url:"/php/get-fav-viewed-hotel-details-BKG.php",data:"action=single&hotel_id="+a,dataType:"xml",success:function(c){if($(c).find("errorcode").text()=="0"){var b="",d=[];$(c).find("hotel").each(function(){b+='<div class="favoriteslist" id="favoriteslist_'+$(this).find("hotel_id").text()+'" from="favorites" hid="'+$(this).find("hotel_id").text()+'" address="'+$(this).find("address").text()+", "+$(this).find("city").text()+", "+$(this).find("country").text()+'" lat="'+
$(this).find("lat").text()+'" lng="'+$(this).find("lng").text()+'" curr="'+$(this).find("currency").text()+'">';b+='\t\t<p class="favoriteimg"><img class="cpe_pix" alt="'+$(this).find("name").text()+", "+$(this).find("city").text()+", "+$(this).find("country").text()+'" src="'+$(this).find("image").text()+'"></p>';b+='     <div class="favinfo">';b+='\t\t   \t<a class="favtitle" target="_blank" href="'+getAffiliateLink($(this).find("bkg_hotel_url").text())+'">'+$(this).find("name").text()+" "+($(this).find("stars").text().replace(/\s+/,
"")!=""?'<span class="favstar"><img alt="'+$(this).find("name").text()+'" src="/images/'+$(this).find("stars").text()+'-stars.gif" /></span>':"")+"</a>";b+='\t\t\t<p class="favdetail">'+$(this).find("address").text()+", "+$(this).find("city").text()+", "+$(this).find("country").text()+"</p>";b+="\t\t</div>";b+='\t\t<div class="favright"><a alt="Delete this hotel from my list" id="fdel_'+$(this).find("hotel_id").text()+'" class="fdel" href="javascript:void(0);">X</a><a alt="Booking information" href="'+
getAffiliateLink($(this).find("bkg_hotel_url").text())+'&stabref=3" class="fbook" target="_blank">BOOK</a></div>';b+="</div>";b+='<div id="info_fav_'+$(this).find("hotel_id").text()+'" class="marker_popup">';b+=' \t<div class="BubbleTemplate">';b+=' \t\t<span class="cpe_name">'+$(this).find("name").text()+"</span>";b+='\t\t\t<div class="Container">';b+='\t\t\t\t<div class="LeftBox">';b+='\t\t\t\t\t<span class="cpe_pix"><img class="cpe_photo" src="'+$(this).find("image").text()+'" alt="'+$(this).find("hotel_id").text()+
" in "+$(this).find("city").text()+", "+$(this).find("country").text()+'" /></span>';b+='\t\t\t\t\t<span class="cpe_price"><span class="cpe_avg">Starting from</span><br /><hotel id="f'+$(this).find("hotel_id").text()+'"><span id="uf'+$(this).find("hotel_id").text()+'" value="'+$(this).find("currency").text()+'">$ </span><span id="hf'+$(this).find("hotel_id").text()+'" value="'+$(this).find("rate").text()+'">'+formatNumber(roundCurrency(remNumFormat($(this).find("rate").text())))+"</span></hotel></span>";
b+="\t\t\t\t</div>";b+='\t\t\t\t<div class="RightBox">';b+='\t\t\t\t\t<span class="cpe_add">'+$(this).find("address").text()+",<br />"+$(this).find("city").text()+"</span><br />";b+='\t\t\t\t\t<span class="cpe_text">'+$(this).find("short_description").text()+"....</span>";b+="\t\t\t\t</div>";b+="\t\t\t</div>";b+="\t\t</div>";b+="\t</div>";$("#favoritesarea").append(b).parent().show();var a={address:$(this).find("address").text(),id:$(this).find("hotel_id").text(),lat:$(this).find("lat").text(),lng:$(this).find("lng").text(),
list:"favorites",geocoded:$(this).find("geocoded").text()};d.push(a)});getAddressArray(d,function(a){gotoBooking(a)});changeDefaultCurrency();$("#myviewlist_"+a).remove()}},error:function(){}})});$("a.vdel").live("click",function(){var a=$(this).parent().parent().attr("id").split("_")[1];removeFromViewed(a);$("#myviewlist_"+a).remove();$.each(markers,function(c,b){b.id==a&&b.list=="viewed"&&($(".hotel_map_hover").removeClass("hotel_map_hover"),map.removeOverlay(markers[c]),$("#message").hide().empty())})});
$("a.viewtitle").live("click",function(){window.open($(this).attr("href"))});$("a.fbook").live("click",function(a){a.preventDefault();window.open($(this).attr("href"))});$("a.favtitle").live("click",function(a){a.preventDefault();window.open($(this).attr("href"))});$("a.fdel").live("click",function(){var a=$(this).attr("id").split("_")[1];removeFromFav(a);$(".hotel_map_hover").removeClass("hotel_map_hover");$("#favoriteslist_"+a).remove();$.each(markers,function(c,b){b.id==a&&b.list=="favorites"&&
(map.removeOverlay(markers[c]),$("#message").hide().empty())})})});function sort(d){if(d==null||d==void 0)d="rate,a";$("#sort option[value="+d+"]").attr("selected","selected");$.cookie("sort",d,{expires:365,path:"/"});d=d.split(",");sortHotels(d[0],d[1])}
function sortHotels(d,f){var a=[];$(".cpe_container[address]").each(function(){var b={id:$(this).attr("hid"),name:$.trim($(this).find(".cpe_name").eq(0).html()),rate:parseInt($("#hm"+$(this).attr("hid")).attr("value"),10)};a.push(b)});switch(d){case "rate":if(f=="a")for(var c=0;c<a.length-1;c++)for(var b=c+1;b<a.length;b++){if(a[c].rate>a[b].rate){var e=a[c];a[c]=a[b];a[b]=e}}else for(c=0;c<a.length-1;c++)for(b=c+1;b<a.length;b++)a[c].rate<a[b].rate&&(e=a[c],a[c]=a[b],a[b]=e);break;case "name":if(f==
"a")for(c=0;c<a.length-1;c++)for(b=c+1;b<a.length;b++)a[c].name>a[b].name&&(e=a[c],a[c]=a[b],a[b]=e);else for(c=0;c<a.length-1;c++)for(b=c+1;b<a.length;b++)a[c].name<a[b].name&&(e=a[c],a[c]=a[b],a[b]=e)}if($(".jsMarker").length>0){for(var b=Math.round(a.length/3)+1,e=$("<div></div>"),g=0;g<3;g++){for(var h=$('<div class="column"></div>'),j=g*b,c=0;c<b;c++)if(a[j+c]){var i=a[j+c].id;i&&($("#cpe_"+i).clone().appendTo(h),$("#info_cpe_"+i).clone().appendTo(h))}h.clone().appendTo(e)}$(".jsHotelsDiv").html(e.html());
e.remove()}else{b=parseInt(Math.random()*1E3,10);$('<div id="hidden_div'+b+'" style="display:none;"/>').appendTo("body");for(c=0;c<a.length;c++)$("#cpe_"+a[c].id).clone().appendTo($("#hidden_div"+b)),$("#info_cpe_"+a[c].id).clone().appendTo($("#hidden_div"+b)),$("#cpe_"+a[c].id).remove(),$("#info_cpe_"+a[c].id).remove();$(".jsMarker .jsHotelsDiv").html($("#hidden_div"+b).html());$("#hidden_div"+b).remove()}};
