/*!
*Autor: Alexandre do Prado Servian
*Data:05/05/2011
*email:alexandreservian@gmail.com
*/
$(document).ready(function(){
	form_login();
	menu();
	menu2();
	voltar_top();	
	abas();
})

function form_login(){
	$('.abrir_logar').toggle(function(){
		$('.box_login').stop().animate({marginTop: "0px"}, 500 );
	},
	function(){
	    $('.box_login').stop().animate({marginTop: "-39px"}, 400 );
	})
}

function menu(){
	$('.menu li .a2').hover(function(){		
		 $(this).toggleClass('a4');
    })    
}
function menu2(){	
	$('.menu2 li').click(function(){		
		 $(this).find('ul:first').stop(true, true).slideToggle(200);
		 icon= $(this).find('.a2').toggleClass('a3');
	}) 
	$('.pro_ul li').hover(function(){		
		 icon= $(this).find('h2').toggleClass('h2_1');
	}) 
	$('.estru_ul li').click(function(){		
		 $(this).find('ul:first').stop(true, true).slideToggle(200);
	}) 
}	
function voltar_top(){
	$('.subr').click(function(){
    $('html, body').animate({scrollTop:0}, 'slow');
  });
}
function abas(){
	$('.abas_ul li a').click(function(){
		return false;
	})
		
	$('#tal_cont').hide();
	var noticia;	
	var hash = window.location.hash;
	if (hash !='')
	{
		noticia = $(hash).html();
		$('.abas_ul li a[href="' + hash + '"]').parent().addClass('ativo');		
	} else {
		noticia = $('#tal_cont div:first-child').html();			
		$('.abas_ul li:first-child').addClass('ativo');		
	}	
	$('#info').append('<div>' + noticia + '</div>').find('div').slideDown();
	$('.abas_ul li a').click(function(){
		$('.abas_ul li').removeClass('ativo');
		$(this).parent().addClass('ativo');
		var ancora = $(this).attr('href');
		var nome = ancora.substr(1, ancora.length);
		noticia = $('#tal_cont div[id="' + nome + '"]').html();
		$('#info').empty();
		$('#info').append('<div>' + noticia + '</div>').find('div').slideDown();
	return false;
	})	
}
