var activo=1;var last=0; var last_act=0;
function goto(url)
{
document.location=url;
}
$(document).ready(function() {   
	$(".nivel_1").click(function () {		
		var el=$(this).attr('id');	
			var el1="#sec_"+el;
		if (last!=el1)
		{
			$('#sec_'+el).toggle();	
			$(this).addClass("nivel_1_act");
					}
		if (last!=0 && last!=el1 ) 
		{		
			$(last).toggle();		
			$(last_act).removeClass("nivel_1_act");
		}			
		last="#sec_"+el;
		last_act=this;
	});  
		
	if($.browser.msie && $.browser.version<"7.0")
	{
	$(function(){
		
		$("<div>")
			.css({
				'position': 'absolute',
				'top': '0px',
				'left': '0px',
				backgroundColor: 'black',
				'opacity': '0.7',
				'width': '100%',
				'height': $('body').height(),
				zIndex: 5000
			})
			.appendTo("body");
			
		$("<div style='color:#000;background: url(/layout_images/browser.jpg)'><div style='float:left;padding-top:200px;padding-left:150px;'><li><a href='http://www.microsoft.com/windows/internet-explorer/default.aspx' style='color:#000'>Internet Explorer 8<a/></li><li><a href='http://www.mozilla.com/en-US/firefox/ie.html'  style='color:#000'>Firefox<a/></li><li><a href='http://www.google.com/chrome'  style='color:#000'>Chrome<a/></li><li><a href='http://www.apple.com/safari/'  style='color:#000'>Safari<a/></li></span></div></div>")
			.css({
				backgroundColor: 'white',
				'top': '50%',
				'left': '50%',
				marginLeft: -300,
				marginTop: -200,
				width: 579,
				paddingRight: 10,
				paddingLeft: 10,
				paddingTop: 10,
				height: 379,
				'position': 'absolute',
				zIndex: 6000
			})
			.appendTo("body");
	});		
	}

		//prettyphoto
		
		$("a[rel^='lightbox']").prettyPhoto({             
			animationSpeed: 'normal', 
			padding: 40, 
			opacity: 0.85, 
			showTitle: false, 
			allowresize: true,
			counter_separator_label: '/', 
			theme: 'light_square' 
			});  
	
		//slidshow _ destaques
		$(".foto_d .desc").show();
			$(".foto_d .block").animate({ opacity: 0.85 }, 1 );	
			$('.texto_d ul li:first').addClass('active');
			$('.texto_d ul li:last').addClass('last');
			$('.texto_d ul li').click(function(){
				var imgAlt = $(this).find('img').attr('alt'); 
				var imgTitle = $(this).find('a').attr('href');
				var imgID = $(this).find('img').attr('id'); 				
				var imgDesc = $(this).find('.block').html(); 
				var imgDescHeight = $('.foto_d').find('.block').height(); 
				if ($(this).is('.active')) { 
				return false;
				} else {
					$(".foto_d img").animate({ opacity: 0}, 250 );
					$(".foto_d .block").animate({ opacity: 0, marginBottom: -imgDescHeight, padding:10, width: 180 }, 250 , function() {
					$(".foto_d .block").html(imgDesc).animate({ opacity: 0.85, marginBottom: "0" }, 250 );
					$(".foto_d a img").attr({ src: imgTitle , alt: imgAlt}).animate({ opacity: 1}, 250 );
					$(".foto_d a").attr({ href: imgID});
					});
				}
			$('.texto_d ul li').removeClass('active'); 
			$(this).addClass('active');
			return false;
				}) .hover(function(){
				$(this).addClass('hover');
				}, function() {
				$(this).removeClass('hover');
				});
			pauseClickNext = false;
			$('.foto_d').hover(
			function () {
			pauseClickNext = true;
			},
			function () {
			pauseClickNext = false;
			}
			);
			var clickNext = function(){
				if(!pauseClickNext) {
				/// find the next li after .active
				var $next_li = $('li.active').next('li');
				if($('li.active').hasClass('last') ){
				$('.texto_d ul li:first').trigger('click');
				} else {
				$next_li.trigger('click');
				}
				}
			};
			setInterval(clickNext, 5000);
});
	

function replaceText(text){
	while(text.lastIndexOf("&") > 0){
		text = text.replace('&', '[i-Stats]');
	}
	return text;
}

var web_referrer = replaceText(document.referrer);
istat = new Image(1,1);
istat.src = "counter.php?sw="+screen.width+"&sc="+screen.colorDepth+"&referer="+web_referrer+"&page="+location.href;
	function addLoadEvent(func) {	
	  var oldonload = window.onload;	
	  if (typeof window.onload != 'function') {	
	    window.onload = func;	
	  } else {	
	    window.onload = function() {	
	      if (oldonload) {	
	        oldonload();	
	      }	
	      func();	
	    }	
	  }
}	  