$(function(){vai=0;home=0;$('#book').hide();if(location.hash=="#meio"||location.hash=="#meioh"){vai=1}if(location.hash=="#meioh"){$('.voltar').attr("href","home/#meio")}$('#book').booklet({width:880,height:555,arrows:true,hash:true,pagePadding:0,closed:true,manual:false,overlays:false,shadows:true,hovers:false,pageNumbers:false,after:meio()});$('.b-arrow').click(function(){getpagina();if(pagina==1)$("#zoomesq").hide();else $("#zoomesq").show();if(pagina>maxpaginas)$("#zoomdir").hide();else $("#zoomdir").show()});$('#apag_num').click(function(e){e.preventDefault();var val=parseInt($('#numero_da_pagina').val());if(val>0){location.href="#/pag/"+val+"/"}});function meio(){$('#loading').hide();$('#book').show();if(vai){$.scrollTo("700px","slow")}}$(".subs a").fancybox({opacity:false,padding:0,scrolling:'no','autoDimensions':false,'width':365,'height':440,showCloseButton:false,overlayColor:"#000000",href:"popup.html"});var cache=[];$.preLoadImages=function(){var args_len=arguments.length;for(var i=args_len;i--;){var cacheImage=document.createElement('img');cacheImage.src=arguments[i];cache.push(cacheImage)}};$("#menu a.menu1 img").mouseover(function(){var src=$(this).attr("src").match(/[^\.]+/)+"_1.png";$(this).attr("src",src)}).mouseout(function(){var src=$(this).attr("src").replace("_1","");$(this).attr("src",src)});$.preLoadImages("imagens/menu/home_1.png","imagens/menu/noticias_1.png","imagens/menu/em-foco_1.png","imagens/menu/leaseplan_1.png","imagens/menu/zoom_1.png","imagens/menu/roadtrip_1.png","imagens/menu/parcerias_1.png","imagens/menu/contactos_1.png");$('#azoomdir').click(function(e){e.preventDefault();getpagina();zoom(revista_actual,pagina)});$('#azoomesq').click(function(e){e.preventDefault();getpagina();zoom(revista_actual,pagina-1)});getpagina();if(pagina==1)$("#zoomesq").hide();else $("#zoomesq").show();if(pagina>maxpaginas)$("#zoomdir").hide();else $("#zoomdir").show()});function salta(){$.scrollTo("700px","slow")}function acima(){$.scrollTo("0px","slow")}function pag_revista(pagnr){location.hash="#/pag/"+pagnr+"/";acima()}function getpagina(){if(location.hash.indexOf("#/page/")!=-1);pagina=location.hash.substring(7)}function zoom(r,p){$.fancybox({opacity:true,margin:0,padding:0,scrolling:'no','autoScale':true,'autoDimensions':true,showCloseButton:false,overlayColor:"#000000",href:"zoom.php?r="+r+"&p="+p})}