var text_no_photos_hotel="Nao Existem Fotos para Esse Hotel.";var text_photo_count="de";var hotelid=0;var hotelName="";var mundiphotos=undefined;var photos_per_page=12;var currentpage=0;var currentphoto=0;var viewdisclosure=true;var viewnondisclosure=true;var allphotos=undefined;var disclosurephotos=new Object;var nondisclosurephotos=new Object;function requestPhotos(){var A="/subjectPhotosJSON?subjecttype=2&subjectid="+hotelid;$.getJSON(A,function(E){mundiphotos=E;allphotos=mundiphotos;currentpage=1;currentphoto=0;disclosurephotos.photos=new Array;nondisclosurephotos.photos=new Array;var D=0;var C=0;for(var B=0;B<mundiphotos.photos.length;B++){if(mundiphotos.photos[B].disclosure==true){disclosurephotos.photos[D++]=mundiphotos.photos[B]}else{nondisclosurephotos.photos[C++]=mundiphotos.photos[B]}}disclosurephotos.count=D;nondisclosurephotos.count=C;drawPage()})}function toggledisclosure(){viewdisclosure=!viewdisclosure;choosePhotoList()}function togglenondisclosure(){viewnondisclosure=!viewnondisclosure;choosePhotoList()}function choosePhotoList(){if(viewdisclosure&&viewnondisclosure){mundiphotos=allphotos}else{if(viewdisclosure){mundiphotos=disclosurephotos}else{if(viewnondisclosure){mundiphotos=nondisclosurephotos}else{mundiphotos=new Object;mundiphotos.count=0;mundiphotos.photos=new Array}}}currentpage=1;currentphoto=0;renderThumbs();renderCurrentPhoto()}function getPhotoCount(){return mundiphotos.count}function getPageCount(){return(Math.ceil(mundiphotos.count*1/photos_per_page))}function setCurrentPhoto(A){currentphoto=A;renderCurrentPhoto()}function nextPage(){if(currentpage<getPageCount()){currentpage++;currentphoto=(currentpage-1)*photos_per_page;renderThumbs();renderCurrentPhoto()}}function previousPage(){if(currentpage>1){currentpage--;currentphoto=(currentpage-1)*photos_per_page;renderThumbs();renderCurrentPhoto()}}function nextPhoto(){if(currentphoto<mundiphotos.count-1){currentphoto++;var A=Math.floor(currentphoto/photos_per_page+1);if(A!=currentpage){currentpage=A;renderThumbs()}renderCurrentPhoto()}}function previousPhoto(){if(currentphoto>0){currentphoto--;var A=Math.floor(currentphoto/photos_per_page+1);if(A!=currentpage){currentpage=A;renderThumbs()}renderCurrentPhoto()}}function renderCurrentPhoto(){if(mundiphotos.count<=0){$("#currentphoto").html(text_no_photos_hotel);$("#photos_pages").html("0 de 0");$("#owner_photo").html("");return }var B=mundiphotos.photos[currentphoto];var C="<img id='ble' src='/imgs/loading_mui_grande.gif' /><br />";$("#currentphoto").html(C);var A=new Image();A.onload=function(){var E=document.getElementById("ble");if(this.height>400){E.height=400}if(this.width>400){E.width=400}E.src=this.src};A.onerror=function(){var E=document.getElementById("ble");E.src="/imgs/dot.gif"};A.src=B.photo_file_url_big;$("#photos_pages").html((currentphoto+1)+" "+text_photo_count+" "+mundiphotos.count);var D=B.photo_title;if(!D||D==""){D=hotelName}if(B.owner_id==1){if(B.source=="Mundi"){$("#owner_photo").html(D+" (Divulgação)")}else{if(B.source==""){$("#owner_photo").html(D+"")}else{$("#owner_photo").html(D+" ("+B.source+")")}}}else{$("#owner_photo").html(D)}}function renderThumbs(){var G=(currentpage-1)*photos_per_page;var A=(currentpage*photos_per_page);if(A>mundiphotos.count){A=mundiphotos.count}var F="<ul>";var H=mundiphotos.photos;for(var E=G;E<A;E++){F+="<li>";F+="<a href='#' onclick='setCurrentPhoto("+E+"); return false;' >";F+="<img id='thumb_"+E+"' src='/imgs/loading_quadrado.gif' />";F+="</a>";F+="</li>"}F+="</ul>";$("#photos").html(F);var C=($.browser.msie&&parseInt($.browser.version)<=6);if(C){$("#menu_busca .sidelist #photos ul li").mouseover(function(){$(this).css("border-color","#fe5d00")}).mouseout(function(){$(this).css("border-color","#fff")})}for(var E=G;E<A;E++){var D=H[E];var B=new Image();B.ble=E;B.onload=function(){var I=document.getElementById("thumb_"+this.ble);I.src=this.src;I.width=59;I.height=59};B.onerror=function(){var I=document.getElementById("thumb_"+this.ble);I.src="/imgs/dot.gif"};B.src=D.photo_file_url_small}if(mundiphotos.count<=0){$("#pages").html("0 "+text_photo_count+" 0")}else{$("#pages").html(currentpage+" "+text_photo_count+" "+getPageCount())}}function drawPage(){if(mundiphotos==undefined){requestPhotos();return }renderThumbs();renderCurrentPhoto()};