Element.addMethods({scrollTo:function(element,left,top){var element=$(element);if(arguments.length==1){var pos=element.cumulativeOffset();window.scrollTo(pos[0],pos[1]);}else{element.scrollLeft=left;element.scrollTop=top;}
return element;}});Effect.Scroll=Class.create();Object.extend(Object.extend(Effect.Scroll.prototype,Effect.Base.prototype),{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);this.start(Object.extend({x:0,y:0},arguments[1]||{}));},setup:function(){var scrollOffsets=(this.element==window)?document.viewport.getScrollOffsets():Element._returnOffset(this.element.scrollLeft,this.element.scrollTop);this.originalScrollLeft=scrollOffsets.left;this.originalScrollTop=scrollOffsets.top;},update:function(pos){this.element.scrollTop=Math.round(this.options.y*pos+this.originalScrollTop);this.element.scrollLeft=Math.round(this.options.x*pos+this.originalScrollLeft);}});Effect.BlindUpABit=function(element){element=$(element);element.makeClipping();return new Effect.Scale(element,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:false},arguments[1]||{}));}
Effect.BlindDownABit=function(element){element=$(element);var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:false},arguments[1]||{}));}
$$('#reviews_tabs li').each(function(li){li.down('a').observe('click',function(){$$('#reviews_tabs li').invoke('removeClassName','on');$$('#reviews_info, #tripadvisor_info').each(function(div){div.hide();});$(this.readAttribute('href').sub("#","")).show();$(this).up('li').addClassName("on");});});function initLightboxButtons(hotel_id,supplier_hotel_id,search_id,sh_id){if(typeof(supplier_hotel_id)=='undefined'){supplier_hotel_id='';}
$$('.nlp_actions .lb_email').each(function(lighbox_init_button){if(search_id&&search_id!=''){lighbox_init_button.href="/send_hotel_info.html?hotel_id="+hotel_id+"&supplier_hotel_id="+supplier_hotel_id+"&pop=1&show_boards=1&hotel_index=1&search_id="+search_id;}else{lighbox_init_button.href="/send_hotel_info.html?hotel_id="+hotel_id+"&supplier_hotel_id="+supplier_hotel_id;}
if(sh_id){lighbox_init_button.href+='&sh='+sh_id;}
new lightbox(lighbox_init_button);});}
function initRatingStars(rating){if(rating&&document.getElementById('star_rating')!=null){for(var i=0;i<rating;i++){$('star_rating').insert(new Element('img',{'src':'/images/star.gif','alt':'*'}));}}}
function expandHotelDescription(){$('hotel_description').scrollTop=0;Effect.BlindDownABit('hotel_description',{scaleMode:'contents',scaleTo:100,scaleFrom:shrunk_percentage});$('hotel_description').removeClassName("minimised");$('hde_updown_arrow').addClassName('up');$('hde_button').update("Show less details");}
function shrinkHotelDescription(){Effect.BlindUpABit('hotel_description',{scaleMode:'contents',scaleTo:shrunk_percentage,scaleFrom:100});$('hotel_description').addClassName("minimised");$('hde_updown_arrow').removeClassName('up');$('otb-content').scrollTo();$('hde_button').update("Show more details");}
function toggleHotelDescription(){if($('hotel_description').hasClassName("minimised")){expandHotelDescription();}else{shrinkHotelDescription();}}
initial_hd_height=$('hotel_description_inner').getHeight();shrunk_percentage=Math.round((240/initial_hd_height)*100);if(initial_hd_height>240){$('hde_holder').update('<p><a id="hde_button" href="#" onclick="toggleHotelDescription(); return false;">Show more details</a></p>');$('hde_holder').down('p').insert({top:'<span id="hde_updown_arrow">&nbsp;</span>'});}else{$('hotel_description').removeClassName("minimised");}
gallery_images_count=$$('#image_list ul li').size();function imageGalleryThumbnails(){$$('#image_list li').each(function(li){li.down('a').onclick=function(){$$('a.nlp_selected_image').each(function(selectedImage){selectedImage.removeClassName('nlp_selected_image');});loadGalleryImage(this.href);this.addClassName('nlp_selected_image');return false;}});}
function loadGalleryImage(src){var image_details=gallery_images.get(src);var image_placeholder_width=$('nlp_image_large').down('td').getWidth();var image_placeholder_height=$('nlp_image_large').down('td').getHeight();if(image_details.get('width')>image_placeholder_width||image_details.get('height')>image_placeholder_height){$('nlp_image_large_img').addClassName('fill');}else{$('nlp_image_large_img').removeClassName('fill');}
$('nlp_image_large_img').src=src;}
if(gallery_images_count>0){Element.observe(window,'load',function(){gallery_images=new Hash();$$('#image_loader img').each(function(image){image.onerror=function(){alert("Error on image: "+image.src);}
gallery_images.set(image.src,$H({height:image.height,width:image.width}));});if(gallery_images_count==gallery_images.size()){$('image_loader').hide();}
loadGalleryImage(gallery_images.keys().first());imageGalleryThumbnails();});function scrollGalleryImages(direction){var amount_to_scroll=$('image_list').getHeight();if(Prototype.Browser.IE){amount_to_scroll+=4;}
if(direction=='up'){amount_to_scroll=-amount_to_scroll;}
new Effect.Scroll('image_list',{y:amount_to_scroll,x:0,duration:0.5});}
$$('.nlp_images li:first-child')[0].down('a').addClassName('nlp_selected_image');$('image_list').scrollTop=0;if(gallery_images_count>4){$('gallery_top_controls').update('<p><a href="javascript:scrollGalleryImages(\'up\')"><img src="/images/arrow-up-yellow.png" /></a></p>');$('gallery_bottom_controls').update('<p><a href="javascript:scrollGalleryImages()"><img src="/images/arrow-down-yellow.png" /></a></p>');}}