jQuery.iUtil={getPosition:function(e)
{var x=0;var y=0;var es=e.style;var restoreStyles=false;if(jQuery(e).css('display')=='none'){var oldVisibility=es.visibility;var oldPosition=es.position;restoreStyles=true;es.visibility='hidden';es.display='block';es.position='absolute';}
var el=e;while(el){x+=el.offsetLeft+(el.currentStyle&&!jQuery.browser.opera?parseInt(el.currentStyle.borderLeftWidth)||0:0);y+=el.offsetTop+(el.currentStyle&&!jQuery.browser.opera?parseInt(el.currentStyle.borderTopWidth)||0:0);el=el.offsetParent;}
el=e;while(el&&el.tagName&&el.tagName.toLowerCase()!='body')
{x-=el.scrollLeft||0;y-=el.scrollTop||0;el=el.parentNode;}
if(restoreStyles==true){es.display='none';es.position=oldPosition;es.visibility=oldVisibility;}
return{x:x,y:y};},getPositionLite:function(el)
{var x=0,y=0;while(el){x+=el.offsetLeft||0;y+=el.offsetTop||0;el=el.offsetParent;}
return{x:x,y:y};},getSize:function(e)
{var w=jQuery.css(e,'width');var h=jQuery.css(e,'height');var wb=0;var hb=0;var es=e.style;if(jQuery(e).css('display')!='none'){wb=e.offsetWidth;hb=e.offsetHeight;}else{var oldVisibility=es.visibility;var oldPosition=es.position;es.visibility='hidden';es.display='block';es.position='absolute';wb=e.offsetWidth;hb=e.offsetHeight;es.display='none';es.position=oldPosition;es.visibility=oldVisibility;}
return{w:w,h:h,wb:wb,hb:hb};},getSizeLite:function(el)
{return{wb:el.offsetWidth||0,hb:el.offsetHeight||0};},getClient:function(e)
{var h,w,de;if(e){w=e.clientWidth;h=e.clientHeight;}else{de=document.documentElement;w=window.innerWidth||self.innerWidth||(de&&de.clientWidth)||document.body.clientWidth;h=window.innerHeight||self.innerHeight||(de&&de.clientHeight)||document.body.clientHeight;}
return{w:w,h:h};},getScroll:function(e)
{var t=0,l=0,w=0,h=0,iw=0,ih=0;if(e&&e.nodeName.toLowerCase()!='body'){t=e.scrollTop;l=e.scrollLeft;w=e.scrollWidth;h=e.scrollHeight;iw=0;ih=0;}else{if(document.documentElement){t=document.documentElement.scrollTop;l=document.documentElement.scrollLeft;w=document.documentElement.scrollWidth;h=document.documentElement.scrollHeight;}else if(document.body){t=document.body.scrollTop;l=document.body.scrollLeft;w=document.body.scrollWidth;h=document.body.scrollHeight;}
iw=self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0;ih=self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0;}
return{t:t,l:l,w:w,h:h,iw:iw,ih:ih};},getMargins:function(e,toInteger)
{var el=jQuery(e);var t=el.css('marginTop')||'';var r=el.css('marginRight')||'';var b=el.css('marginBottom')||'';var l=el.css('marginLeft')||'';if(toInteger)
return{t:parseInt(t)||0,r:parseInt(r)||0,b:parseInt(b)||0,l:parseInt(l)};else
return{t:t,r:r,b:b,l:l};},getPadding:function(e,toInteger)
{var el=jQuery(e);var t=el.css('paddingTop')||'';var r=el.css('paddingRight')||'';var b=el.css('paddingBottom')||'';var l=el.css('paddingLeft')||'';if(toInteger)
return{t:parseInt(t)||0,r:parseInt(r)||0,b:parseInt(b)||0,l:parseInt(l)};else
return{t:t,r:r,b:b,l:l};},getBorder:function(e,toInteger)
{var el=jQuery(e);var t=el.css('borderTopWidth')||'';var r=el.css('borderRightWidth')||'';var b=el.css('borderBottomWidth')||'';var l=el.css('borderLeftWidth')||'';if(toInteger)
return{t:parseInt(t)||0,r:parseInt(r)||0,b:parseInt(b)||0,l:parseInt(l)||0};else
return{t:t,r:r,b:b,l:l};},getPointer:function(event)
{var x=event.pageX||(event.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft))||0;var y=event.pageY||(event.clientY+(document.documentElement.scrollTop||document.body.scrollTop))||0;return{x:x,y:y};},traverseDOM:function(nodeEl,func)
{func(nodeEl);nodeEl=nodeEl.firstChild;while(nodeEl){jQuery.iUtil.traverseDOM(nodeEl,func);nodeEl=nodeEl.nextSibling;}},purgeEvents:function(nodeEl)
{jQuery.iUtil.traverseDOM(nodeEl,function(el)
{for(var attr in el){if(typeof el[attr]==='function'){el[attr]=null;}}});},centerEl:function(el,axis)
{var clientScroll=jQuery.iUtil.getScroll();var windowSize=jQuery.iUtil.getSize(el);if(!axis||axis=='vertically')
jQuery(el).css({top:clientScroll.t+((Math.max(clientScroll.h,clientScroll.ih)-clientScroll.t-windowSize.hb)/2)+'px'});if(!axis||axis=='horizontally')
jQuery(el).css({left:clientScroll.l+((Math.max(clientScroll.w,clientScroll.iw)-clientScroll.l-windowSize.wb)/2)+'px'});},fixPNG:function(el,emptyGIF){var images=jQuery('img[@src*="png"]',el||document),png;images.each(function(){png=this.src;this.src=emptyGIF;this.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+png+"')";});}};[].indexOf||(Array.prototype.indexOf=function(v,n){n=(n==null)?0:n;var m=this.length;for(var i=n;i<m;i++)
if(this[i]==v)
return i;return-1;});jQuery.iFisheye={build:function(options)
{return this.each(function()
{var el=this;el.fisheyeCfg={items:jQuery(options.items,this),container:jQuery(options.container,this),pos:jQuery.iUtil.getPosition(this),itemWidth:options.itemWidth,itemsText:options.itemsText,proximity:options.proximity,valign:options.valign,halign:options.halign,maxWidth:options.maxWidth,containerWidth:options.containerWidth};jQuery(window).bind('resize',function()
{el.fisheyeCfg.pos=jQuery.iUtil.getPosition(el);jQuery.iFisheye.positionItems(el);});jQuery.iFisheye.positionItems(el);jQuery(document).bind('mousemove',function(e)
{var pointer=jQuery.iUtil.getPointer(e);var espaco=el.fisheyeCfg.containerWidth/el.fisheyeCfg.items.length;if((pointer.y<=el.fisheyeCfg.pos.y+70)){if(el.fisheyeCfg.halign&&el.fisheyeCfg.halign=='center')
var posx=pointer.x-el.fisheyeCfg.pos.x-(el.offsetWidth-espaco*el.fisheyeCfg.items.size())/2-espaco/2;else if(el.fisheyeCfg.halign&&el.fisheyeCfg.halign=='right')
var posx=pointer.x-el.fisheyeCfg.pos.x-el.offsetWidth+espaco*el.fisheyeCfg.items.size();else
var posx=pointer.x-el.fisheyeCfg.pos.x;var posy=Math.pow(pointer.y-el.fisheyeCfg.pos.y-el.offsetHeight/2,2);el.fisheyeCfg.items.each(function(nr)
{distance=Math.sqrt(Math.pow(posx-nr*espaco,2)
+posy);distance-=el.fisheyeCfg.itemWidth/2;distance=distance<0?0:distance;distance=distance>el.fisheyeCfg.proximity?el.fisheyeCfg.proximity:distance;distance=el.fisheyeCfg.proximity-distance;extraWidth=el.fisheyeCfg.maxWidth*distance/el.fisheyeCfg.proximity;this.style.width=el.fisheyeCfg.itemWidth+extraWidth+'px';this.style.left=(espaco)*nr+(el.fisheyeCfg.maxWidth/2)-(extraWidth/2)+"px";this.style.top=16-(extraWidth/2)+"px";});}else{el.fisheyeCfg.items.each(function(nr)
{this.style.width=el.fisheyeCfg.itemWidth+'px';this.style.left=espaco*nr+el.fisheyeCfg.maxWidth/2+"px";this.style.top="16px";});}});})},positionItems:function(el)
{var espaco=el.fisheyeCfg.containerWidth/el.fisheyeCfg.items.length;el.fisheyeCfg.items.each(function(nr)
{this.style.width=el.fisheyeCfg.itemWidth+'px';this.style.left=espaco*nr+el.fisheyeCfg.maxWidth/2+"px";});}};jQuery.fn.Fisheye=jQuery.iFisheye.build;(function($){$.fn.widgetMosaico=function(params){var options={$mosaico:$('.glb-mosaico'),$combo:$('.combo',$('.glb-mosaico')),$comboMosaico:$('.combo-mosaico',$('.glb-mosaico')),$comboOptions:$('.combo-options',$('.glb-mosaico')),$cabecalhoHome:$('.cabecalho-home'),$cabecalhoInterna:$('.cabecalho-internas')};var opt=$.extend(options,params);init=function(){if(opt.$cabecalhoHome.length==1){fishEyeMosaico();if(/MSIE (\d+\.\d+);/.test(navigator.userAgent)){var ieversion=new Number(RegExp.$1);if(ieversion<=9){opt.$mosaico.addClass("ie");var larguraIE=($(".glb-mosaico .combo-options").width()<79)?"79":$(".glb-mosaico .combo-options").width();$(".glb-mosaico .combo-options").css("width",larguraIE+"px");}}}else{opt.$mosaico.find('.itens').addClass('mosaico-internas');opt.$mosaico.addClass('glb-mosaico-internas');opt.$combo.addClass('combo-internas');bindEscudosInternas();}
$("li:last",opt.$comboOptions).addClass("ultima-linha");$(".item-ativo").css("visibility","visible");bindAbaMosaico();};bindEscudosInternas=function(){$('.escudo',$('.mosaico-internas')).fadeTo(0,0.55).mouseenter(function(){$(this).stop().animate({'opacity':1},100);}).mouseleave(function(){$(this).stop().animate({'opacity':0.55},300);});};bindAbaMosaico=function(){opt.$comboMosaico.unbind().bind({click:function(){if(!$(this).hasClass('combo-mosaico-ativo')){$(this).closest(".combo").addClass('combo-mosaico-aba-ativo-internas');$(this).addClass('combo-mosaico-ativo');opt.$combo.addClass('combo-mosaico-over');opt.$comboOptions.show();}else{resetComboMosaico();}
return false;}});opt.$combo.unbind().bind({mouseenter:function(){if(!$(this).hasClass('combo-mosaico-inativo')){$(this).addClass('combo-mosaico-over');}},mouseleave:function(){resetComboMosaico();$(this).removeClass('combo-mosaico-over');}});bindItensAbaTimes();};resetComboMosaico=function(){opt.$comboMosaico.removeClass('combo-mosaico-ativo');opt.$comboMosaico.closest(".combo").removeClass('combo-mosaico-aba-ativo-internas');opt.$comboOptions.hide();};bindItensAbaTimes=function(){opt.$comboOptions.find('a').unbind().bind("click",function(){var $event=$(this);if(!$event.hasClass("ativo")){opt.$comboOptions.find('a').removeClass("ativo");$event.addClass("ativo");opt.$mosaico.find('.item-ativo').css('visibility','hidden').removeClass('item-ativo');var idItemClicado=$event.attr("class").replace(' ativo','');$(".glb-mosaico #"+idItemClicado).css('visibility','visible').addClass('item-ativo');resetComboMosaico();populaComboMosaico();}
return false;});populaComboMosaico();};populaComboMosaico=function(){var txAbaSelecionada=opt.$comboOptions.find('a.ativo').text();opt.$comboMosaico.find('span').text(txAbaSelecionada);if(opt.$comboOptions.find('ul li').length<=1){opt.$comboMosaico.parent().addClass('combo-mosaico-inativo');opt.$comboMosaico.unbind().bind('click',function(event){event.preventDefault();});opt.$comboOptions.remove();}};fishEyeMosaico=function(){$.each($('.glb-mosaico .itens'),function(){$(this).Fisheye({maxWidth:15,items:'a',container:'.ativo',itemWidth:30,proximity:50,halign:'center',valign:'center',containerWidth:840});});};init();};})(jQuery);$(document).ready(function(){$('.glb-mosaico').widgetMosaico();});
