(function(b){if(!b.browser.safari&&typeof window.console!=='undefined'&&typeof window.console.log==='function'){b.log=window.console.log}else{b.log=function(){}}b.params_to_json=b.params_to_json||function(a){a=String(a);a=a.substring(a.indexOf('?')+1);a=a.replace(/\+/g,'%20');if(a.substring(0,1)==='{'&&a.substring(a.length-1)==='}'){return eval(decodeURIComponent(a))}a=a.split(/\&|\&amp\;/);var c={};for(var d=0,g=a.length;d<g;++d){var f=a[d]||null;if(f===null){continue}f=f.split('=');if(f===null){continue}var h=f[0]||null;if(h===null){continue}if(typeof f[1]==='undefined'){continue}var l=f[1];h=decodeURIComponent(h);l=decodeURIComponent(l);try{l=eval(l)}catch(e){}var k=h.split('.');if(k.length===1){c[h]=l}else{var j='';for(ii in k){h=k[ii];j+='.'+h;eval('json'+j+' = json'+j+' || {}')}eval('json'+j+' = value')}}return c};b.LightboxClass=function(){this.construct()};b.fn.lightbox=function(c){b.Lightbox=b.Lightbox||new b.LightboxClass();if(b.Lightbox.ie6&&!b.Lightbox.ie6_support){return this}c=b.extend({start:false,events:true},c);var d=b(this);if(c.events){b(d).unbind().click(function(){var a=b(this);if(!b.Lightbox.init(b(a)[0],d)){return false}if(!b.Lightbox.start()){return false}return false});b(d).addClass('lightbox-enabled')}if(c.start){var g=b(this);if(!b.Lightbox.init(b(g)[0],d)){return this}if(!b.Lightbox.start()){return this}}return this};b.extend(b.LightboxClass.prototype,{images:{list:[],image:false,prev:function(a){if(typeof a==='undefined'){a=this.active();if(!a){return a}}if(this.first(a)){return false}return this.get(a.index-1)},next:function(a){if(typeof a==='undefined'){a=this.active();if(!a){return a}}if(this.last(a)){return false}return this.get(a.index+1)},first:function(a){if(typeof a==='undefined'){return this.get(0)}return a.index===0},last:function(a){if(typeof a==='undefined'){return this.get(this.size()-1)}return a.index===this.size()-1},single:function(){return this.size()===1},size:function(){return this.list.length},empty:function(){return this.size()===0},clear:function(){this.list=[];this.image=false},active:function(a){if(typeof a==='undefined'){return this.image}if(a!==false){a=this.get(a);if(!a){return a}}this.image=a;return true},add:function(a){if(a[0]){for(var c=0;c<a.length;c++){this.add(a[c])}return true}var d=this.create(a);if(!d){return d}d.index=this.size();this.list.push(d);return true},create:function(a){var c={src:'',title:'',description:'',name:'',index:-1,color:null,width:null,height:null,image:true};if(a.image){c.src=a.src||c.src;c.title=a.title||c.title;c.description=a.description||c.description;c.name=a.name||c.name;c.color=a.color||c.color;c.width=a.width||c.width;c.height=a.height||c.height;c.index=a.index||c.index}else if(a.tagName){a=b(a);if(a.attr('src')||a.attr('href')){c.src=a.attr('src')||a.attr('href');c.title=a.attr('title')||a.attr('alt')||c.title;c.name=a.attr('name')||'';c.color=a.css('backgroundColor');var d=c.title.indexOf(': ');if(d>0){c.description=c.title.substring(d+2)||c.description;c.title=c.title.substring(0,d)||c.title}}else{c=false}}else{c=false}if(!c){b.log('ERROR','We dont know what we have:',a);return false}return c},get:function(a){if(typeof a==='undefined'||a===null){return this.active()}else if(typeof a==='number'){a=this.list[a]||false}else{a=this.create(a);if(!a){return false}var c=false;for(var d=0;d<this.size();d++){var g=this.list[d];if(g.src===a.src&&g.title===a.title&&g.description===a.description){c=g}}a=c}if(!a){b.log('ERROR','The desired image doesn\'t exist: ',a,this.list);return false}return a},debug:function(){return b.Lightbox.debug(arguments)}},constructed:false,src:null,baseurl:null,files:{js:{lightbox:'js/jquery.lightbox.js',colorBlend:'js/jquery.color.js'},css:{lightbox:'css/jquery.lightbox.css'},images:{prev:'images_template/prev.gif',next:'images_template/next.gif',blank:'images_template/blank.gif',loading:'images_template/loading.gif'}},text:{image:'Imagem',of:'de',close:'Fechar X',closeInfo:'Você pode clicar em qualquer lugar fora da imagem para fechar.',download:'Link direto para baixar a imagem.',help:{close:'Click fora da imagem para fechar<br />Tecle <b>P</b> para próxima e <b>A</b> para anterior',interact:'Passe o mouse para interagir'},about:{text:'SINESP',title:'',link:'http://www.sinesp.org.br'}},keys:{close:'f',prev:'a',next:'p'},handlers:{show:null},opacity:0.9,padding:null,speed:400,rel:'lightbox',auto_relify:true,auto_scroll:'follow',auto_resize:true,ie6:null,ie6_support:true,ie6_upgrade:true,colorBlend:null,download_link:true,show_linkback:true,show_info:'auto',show_extended_info:'auto',options:['auto_scroll','auto_resize','download_link','show_info','show_extended_info','ie6_support','ie6_upgrade','colorBlend','baseurl','files','text','show_linkback','keys','opacity','padding','speed','rel','auto_relify'],construct:function(f){var h=typeof this.constructed==='undefined'||this.constructed===false;this.constructed=true;var l=h;f=b.extend({},f);if(h&&(typeof f.files==='undefined')){this.src=b('script[src*='+this.files.js.lightbox+']:first').attr('src');if(!this.src){l=false}else{this.baseurl=this.src.substring(0,this.src.indexOf(this.files.js.lightbox));var k=this;b.each(this.files,function(d,g){b.each(this,function(a,c){k.files[d][a]=k.baseurl+c})});delete k;f=b.extend(f,b.params_to_json(this.src))}}else if(typeof f.files==='object'){var k=this;b.each(f.files,function(d,g){b.each(this,function(a,c){this[a]=k.baseurl+c})});delete k}else{l=false}for(i in this.options){var j=this.options[i];if((typeof f[j]==='object')&&(typeof this[j]==='object')){this[j]=b.extend(this[j],f[j])}else if(typeof f[j]!=='undefined'){this[j]=f[j]}}if(h&&navigator.userAgent.indexOf('MSIE 6')>=0){this.ie6=true}else{this.ie6=false}if(l||typeof f.download_link!=='undefined'||typeof f.colorBlend!=='undefined'||typeof f.files==='object'||typeof f.text==='object'||typeof f.show_linkback!=='undefined'||typeof f.scroll_with!=='undefined'){b(function(){b.Lightbox.domReady()})}return true},domReady:function(){var c=document.getElementsByTagName(b.browser.safari?'head':'body')[0];var d=this.files.css;var g=this.files.js;if(this.ie6&&this.ie6_upgrade){g.ie6='http://www.savethedevelopers.org/say.no.to.ie.6.js'}if(this.colorBlend===true&&typeof b.colorBlend==='undefined'){this.colorBlend=true}else{this.colorBlend=typeof b.colorBlend!=='undefined';delete g.colorBlend}for(stylesheet in d){var f=document.createElement('link');f.type='text/css';f.rel='stylesheet';f.media='screen';f.href=d[stylesheet];f.id='lightbox-stylesheet-'+stylesheet.replace(/[^a-zA-Z0-9]/g,'');b('#'+f.id).remove();c.appendChild(f)}for(script in g){var h=document.createElement('script');h.type='text/javascript';h.src=g[script];h.id='lightbox-script-'+script.replace(/[^a-zA-Z0-9]/g,'');b('#'+h.id).remove();c.appendChild(h)}delete g;delete d;delete c;b('#lightbox,#lightbox-overlay').remove();b('body').append('<div id="lightbox-overlay"><div id="lightbox-overlay-text">'+(this.show_linkback?'<p><span id="lightbox-overlay-text-about"><a href="#" title="'+this.text.about.title+'">'+this.text.about.text+'</a></span></p><p>&nbsp;</p>':'')+'<p><span id="lightbox-overlay-text-close">'+this.text.help.close+'</span><br/>&nbsp;<span id="lightbox-overlay-text-interact">'+this.text.help.interact+'</span></p></div></div><div id="lightbox"><div id="lightbox-imageBox"><div id="lightbox-imageContainer"><img id="lightbox-image" /><div id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="'+this.files.images.loading+'" /></a></div></div></div><div id="lightbox-infoBox"><div id="lightbox-infoContainer"><div id="lightbox-infoHeader"><span id="lightbox-caption">'+(this.download_link?'<a href="#" title="'+this.text.download+'" id="lightbox-caption-title"></a>':'<span id="lightbox-caption-title"></span>')+'<span id="lightbox-caption-seperator"></span><span id="lightbox-caption-description"></span></span></div><div id="lightbox-infoFooter"><span id="lightbox-currentNumber"></span><span id="lightbox-close"><a href="#" id="lightbox-close-button" title="'+this.text.closeInfo+'">'+this.text.close+'</a></span></div><div id="lightbox-infoContainer-clear"></div></div></div></div>');this.resizeBoxes();this.repositionBoxes();b('#lightbox,#lightbox-overlay,#lightbox-overlay-text-interact').hide();if(this.ie6&&this.ie6_support){b('#lightbox-overlay').css({position:'absolute',top:'0px',left:'0px'})}b.each(this.files.images,function(){var a=new Image();a.onload=function(){a.onload=null;a=null};a.src=this});b(window).unbind().resize(function(){b.Lightbox.resizeBoxes('resized')});if(this.scroll==='follow'){b(window).scroll(function(){b.Lightbox.repositionBoxes()})}b('#lightbox-nav-btnPrev').unbind().hover(function(){b(this).css({'background':'url('+b.Lightbox.files.images.prev+') left 45% no-repeat'})},function(){b(this).css({'background':'transparent url('+b.Lightbox.files.images.blank+') no-repeat'})}).click(function(){b.Lightbox.showImage(b.Lightbox.images.prev());return false});b('#lightbox-nav-btnNext').unbind().hover(function(){b(this).css({'background':'url('+b.Lightbox.files.images.next+') right 45% no-repeat'})},function(){b(this).css({'background':'transparent url('+b.Lightbox.files.images.blank+') no-repeat'})}).click(function(){b.Lightbox.showImage(b.Lightbox.images.next());return false});if(this.show_linkback){b('#lightbox-overlay-text-about a').click(function(){window.open(b.Lightbox.text.about.link);return false})}b('#lightbox-overlay-text-close').unbind().hover(function(){b('#lightbox-overlay-text-interact').fadeIn()},function(){b('#lightbox-overlay-text-interact').fadeOut()});b('#lightbox-caption-title').click(function(){window.open(b(this).attr('href'));return false});b('#lightbox-overlay, #lightbox, #lightbox-loading-link, #lightbox-btnClose').unbind().click(function(){b.Lightbox.finish();return false});if(this.auto_relify){this.relify()}return true},relify:function(){var g={};var f=0;var h=this.rel;b.each(b('[@rel*='+h+']'),function(a,c){var d=b(c).attr('rel');if(d===h){d=f}if(typeof g[d]==='undefined'){g[d]=[];f++}g[d].push(c)});b.each(g,function(a,c){b(c).lightbox()});return true},init:function(a,c){if(typeof c==='undefined'){c=a;a=0}this.images.clear();if(!this.images.add(c)){return false}if(this.images.empty()){b.log('WARNING','Lightbox started, but no images: ',a,c);return false}if(!this.images.active(a)){return false}return true},start:function(){this.visible=true;if(this.scroll==='disable'){b(document.body).css('overflow','hidden')}b('embed, object, select').css('visibility','hidden');this.resizeBoxes('general');this.repositionBoxes({'speed':0});b('#lightbox-infoFooter').hide();b('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-infoBox').hide();b('#lightbox-overlay').css('opacity',this.opacity).fadeIn(400,function(){b('#lightbox').fadeIn(300);if(!b.Lightbox.showImage(b.Lightbox.images.active())){b.Lightbox.finish();return false}});return true},finish:function(){b('#lightbox').hide();b('#lightbox-overlay').fadeOut(function(){b('#lightbox-overlay').hide()});b('embed, object, select').css({'visibility':'visible'});this.images.active(false);if(this.scroll==='disable'){b(document.body).css('overflow','visible')}this.visible=false},resizeBoxes:function(a){if(a!=='transition'){var c=b(this.ie6?document.body:document);b('#lightbox-overlay').css({width:c.width(),height:c.height()});delete c}switch(a){case'general':return true;break;case'resized':if(this.auto_resize===false){this.repositionBoxes({'nHeight':m,'speed':this.speed});return true}case'transition':default:break}var d=this.images.active();if(!d||!d.width||!this.visible){b.log('WARNING','A resize occured while no image or no lightbox...');return false}var g=d.width;var f=d.height;var h=b(window).width();var l=b(window).height();if(this.auto_resize!==false){var k=Math.floor(h*(4/5));var j=Math.floor(l*(4/5));var n;while(g>k||f>j){if(g>k){n=k/g;g=k;f=Math.floor(f*n)}if(f>j){n=j/f;f=j;g=Math.floor(g*n)}}}var p=b('#lightbox-imageBox').width();var q=b('#lightbox-imageBox').height();var o=(g+(this.padding*2));var m=(f+(this.padding*2));var r=p-o;var s=q-m;b('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css('height',m);b('#lightbox-infoBox').css('width',o);if(a==='transition'){if(r===0&&s===0){this.pause(this.speed/3);this.showImage(null,3)}else{b('#lightbox-image').width(g).height(f);b('#lightbox-imageBox').animate({width:o,height:m},this.speed,function(){b.Lightbox.showImage(null,3)})}}else{b('#lightbox-image').animate({width:g,height:f},this.speed);b('#lightbox-imageBox').animate({width:o,height:m},this.speed)}this.repositionBoxes({'nHeight':m,'speed':this.speed});return true},repositioning:false,reposition_failsafe:false,repositionBoxes:function(a){if(this.repositioning){this.reposition_failsafe=true;return null}this.repositioning=true;a=b.extend({},a);a.callback=a.callback||null;a.speed=a.speed||'slow';var c=this.getPageScroll();var d=a.nHeight||parseInt(b('#lightbox').height(),10);var g=c.yScroll+(b(window).height()-d)/2.5;var f=c.xScroll;var h={left:f,top:g};if(a.speed){b('#lightbox').animate(h,'slow',function(){if(b.Lightbox.reposition_failsafe){b.Lightbox.repositioning=b.Lightbox.reposition_failsafe=false;b.Lightbox.repositionBoxes(a)}else{b.Lightbox.repositioning=false;if(a.callback){a.callback()}}})}else{b('#lightbox').css(h);if(this.reposition_failsafe){this.repositioning=this.reposition_failsafe=false;this.repositionBoxes(a)}else{this.repositioning=false}}return true},visible:false,showImage:function(a,c){a=this.images.get(a);if(!a){return a}c=c||1;var d=c>1&&this.images.active().src!==a.src;var g=c>2&&b('#lightbox-image').attr('src')!==a.src;if(d||g){b.log('We wanted to skip a few steps: ',a,c,d,g);c=1}switch(c){case 1:this.KeyboardNav_Disable();b('#lightbox-loading').show();b('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-infoBox').hide();b('#lightbox-imageBox').unbind();if(!this.images.active(a)){return false}if(a.width&&a.height){this.showImage(null,2)}else{var f=new Image();f.onload=function(){a.width=f.width;a.height=f.height;b.Lightbox.showImage(null,2);f.onload=null;f=null};f.src=a.src}break;case 2:b('#lightbox-image').attr('src',a.src);if(typeof this.padding==='undefined'||this.padding===null||isNaN(this.padding)){this.padding=parseInt(b('#lightbox-imageContainer').css('padding-left'),10)||parseInt(b('#lightbox-imageContainer').css('padding'),10)||0}if(this.colorBlend){b('#lightbox-overlay').animate({'backgroundColor':a.color},this.speed*2);b('#lightbox-imageBox').css('borderColor',a.color)}this.resizeBoxes('transition');break;case 3:b('#lightbox-loading').hide();b('#lightbox-image').fadeIn(this.speed*1.5,function(){b.Lightbox.showImage(null,4)});this.preloadNeighbours();if(this.handlers.show!==null){this.handlers.show(a)}break;case 4:var h=b('#lightbox-caption-title').html(a.title||'');if(this.download_link){h.attr('href',this.download_link?a.src:'')}delete h;b('#lightbox-caption-seperator').html(a.description?': ':'');b('#lightbox-caption-description').html(a.description||'&nbsp;');if(this.images.size()>1){b('#lightbox-currentNumber').html(this.text.image+'&nbsp;'+(a.index+1)+'&nbsp;'+this.text.of+'&nbsp;'+this.images.size())}else{b('#lightbox-currentNumber').html('&nbsp;')}b('#lightbox-imageBox').unbind('mouseover').mouseover(function(){b('#lightbox-infoBox').slideDown('fast')});b('#lightbox-infoBox').unbind('mouseover').mouseover(function(){b('#lightbox-infoFooter').slideDown('fast')});if(this.show_extended_info===true){b('#lightbox-imageBox').trigger('mouseover');b('#lightbox-infoBox').trigger('mouseover')}else if(this.show_info===true){b('#lightbox-imageBox').trigger('mouseover')}b('#lightbox-nav-btnPrev, #lightbox-nav-btnNext').css({'background':'transparent url('+this.files.images.blank+') no-repeat'});if(!this.images.first(a)){b('#lightbox-nav-btnPrev').show()}if(!this.images.last(a)){b('#lightbox-nav-btnNext').show()}b('#lightbox-nav').show();this.KeyboardNav_Enable();break;default:b.log('ERROR','Don\'t know what to do: ',a,c);return this.showImage(a,1)}return true},preloadNeighbours:function(){if(this.images.single()||this.images.empty()){return true}var a=this.images.active();if(!a){return a}var c=this.images.prev(a);var d;if(c){d=new Image();d.src=c.src}var g=this.images.next(a);if(g){d=new Image();d.src=g.src}},KeyboardNav_Enable:function(){b(document).keydown(function(a){b.Lightbox.KeyboardNav_Action(a)})},KeyboardNav_Disable:function(){b(document).unbind()},KeyboardNav_Action:function(a){a=a||window.event;var c=a.keyCode;var d=a.DOM_VK_ESCAPE||27;var g=String.fromCharCode(c).toLowerCase();if(g===this.keys.close||c===d){return b.Lightbox.finish()}if(g===this.keys.prev||c===37){return b.Lightbox.showImage(b.Lightbox.images.prev())}if(g===this.keys.next||c===39){return b.Lightbox.showImage(b.Lightbox.images.next())}return true},getPageScroll:function(){var a,c;if(self.pageYOffset){c=self.pageYOffset;a=self.pageXOffset}else if(document.documentElement&&document.documentElement.scrollTop){c=document.documentElement.scrollTop;a=document.documentElement.scrollLeft}else if(document.body){c=document.body.scrollTop;a=document.body.scrollLeft}var d={'xScroll':a,'yScroll':c};return d},pause:function(a){var c=new Date();var d=null;do{d=new Date()}while(d-c<a)}});if(typeof b.Lightbox==='undefined'){b.Lightbox=new b.LightboxClass()}})(jQuery);