// JavaScript Document
$(document).ready(function(){
	
	var ip = aleatorio(6,9);
	swfobject.embedSWF("swf/diga.swf", "diga", 35, 18, "9.0.0", "expressInstall.swf", {embed: true}, {wmode:'transparent'});
	swfobject.embedSWF("swf/mundosuperprint.swf", "mundo", "100%", "100%", "9.0.0", "expressInstall.swf", {embed: true}, {wmode:'transparent'});
	var anima = Math.floor(Math.random()*31);
	if( ip == 6){
		swfobject.embedSWF("swf/anima.swf", "anima", "100%", "100%", "9.0.0", "expressInstall.swf", {embed: true}, {wmode:'transparent'});
	}else if( ip == 7){
		swfobject.embedSWF("swf/anima-move.swf", "anima", "100%", "100%", "9.0.0", "expressInstall.swf", {embed: true}, {wmode:'transparent'});
	}else if( ip == 8){
		swfobject.embedSWF("swf/anima-mundo-mundo.swf", "anima", "100%", "100%", "9.0.0", "expressInstall.swf", {embed: true}, {wmode:'transparent'});
	}
	
	$('.carregador, a.fechar').css({'display' : 'none'});
	//.home-super-news ul li:hover a.imgnot {
	//width: 400px;
	$('span.temp').animate({'width': 0}, 8000, function(){tempo(0)});
	
	$('.home-super-news ul li').hover( function(){
		$(this).find('a.imgnot').stop().animate({'width' : 316, 'backgroundColor' : '#e8e8e8'},{queue:false, duration: 'fast'});
		$(this).find('a.vejamais').stop().animate({'opacity' : 1},{queue:false, duration: 'fast'});
	},function(){
		$(this).find('a.imgnot').stop().animate({'width' : 128, 'backgroundColor' : '#ffa00b'},{queue:false, duration: 'fast'});
		$(this).find('a.vejamais').stop().animate({'opacity' : .1},{queue:false, duration: 'fast'});
	});
	$('.conhecahome').hover( function(){
		$(this).find('a.imgsuper').stop().animate({'height' : 236, 'backgroundColor' : '#e8e8e8'},{queue:false, duration: 'fast'});
		$(this).find('a.vejamais').stop().animate({'opacity' : 1},{queue:false, duration: 'fast'});
	},function(){
		$(this).find('a.imgsuper').stop().animate({'height' : 148, 'backgroundColor' : '#71bebb'},{queue:false, duration: 'fast'});
		$(this).find('a.vejamais').stop().animate({'opacity' : .1},{queue:false, duration: 'fast'});
	});
	$('.home-depoimento').hover( function(){
		$(this).find('a.imgdepoimento').stop().animate({'width' : 426, 'backgroundColor' : '#e8e8e8'},{queue:false, duration: 'fast'});
		$(this).find('a.vejamais').stop().animate({'opacity' : 1},{queue:false, duration: 'fast'});
	},function(){
		$(this).find('a.imgdepoimento').stop().animate({'width' : 167, 'backgroundColor' : '#407738'},{queue:false, duration: 'fast'});
		$(this).find('a.vejamais').stop().animate({'opacity' : .1},{queue:false, duration: 'fast'});
	});
	$('.vejatodos').hover( function(){
		$(this).find('span.aover').stop().animate({'margin-top' : -5},{queue:false, duration: 'fast'});
		$(this).find('a, input').stop().animate({'color' : '#fff'},{queue:false, duration: 'fast'});
	},function(){
		$(this).find('span.aover').stop().animate({'margin-top' : -35},{queue:false, duration: 'fast'});
		$(this).find('a, input').stop().animate({'color' : '#7a7a7a'},{queue:false, duration: 'fast'});
	});
	$('.nuns ul li').hover( function(){
		$(this).find('span.aover').stop().animate({'margin-top' : -2},{queue:false, duration: 'fast'});
		$(this).find('a').stop().animate({'color' : '#fff'},{queue:false, duration: 'fast'});
	},function(){
		$(this).find('span.aover').stop().animate({'margin-top' : -26},{queue:false, duration: 'fast'});
		$(this).find('a').stop().animate({'color' : '#7a7a7a'},{queue:false, duration: 'fast'});

	});
	
	$('a.g-modal, ul.thumbs li a').hover( function(){
		$(this).find('img').stop().animate({'opacity' : .60},{queue:false, duration: 'slow'});
	},function(){
		$(this).find('img').stop().animate({'opacity' : 1},{queue:false, duration: 'slow'});
	});
	
	
	$('.navigation ul li').hover( function(){
		$(this).find('span.aover').stop().animate({'margin-top' : -60},{queue:false, duration: 'fast'});
		$(this).find('a').stop().animate({'color' : '#fff'},{queue:false, duration: 'fast'});
	},function(){
		$(this).find('span.aover').stop().animate({'margin-top' : 0},{queue:false, duration: 'fast'});
		$('li.marcado').find('span.aover').stop().animate({'margin-top' : -60},{queue:false, duration: 'fast'});
		$(this).find('a').stop().animate({'color' : '#0eaba5'},{queue:false, duration: 'fast'});
	});
	$('.nuns ul li a').click(function(e){
		$('span.temp').stop();
		navegacao($(this).attr('tabindex'));
		return false;
	});
	
	
	$('a.allcategorias').click(function(e){
		$('.all-categorias').slideToggle("easinInSine");
		return false;
	});
	
	
	$('#depoimentosobe').click(function(e){
		$('.deposuper .home-depoimento').slideDown("easinInSine");
		$('#depoimentosobe').css({'cursor' : 'default'});
		return false;
	});
	$('.superdicas ul li').click(function(e){
		$(this).find('.lidica').slideToggle("easinInSine");
		return false;
	});
	$('.all-categorias').hover( function(){
		$(this).find('ul').css({'backgroundColor' : '#fafafa'});
		$(this).find('ul li').css({'display' : 'block'});
	},function(){
		$(this).find('ul').css({'backgroundColor' : '#407839'});
		$(this).find('ul li').css({'display' : 'none'});
		$('li.no-link').css({'display' : 'block', 'backgroundColor' : '#407839 !important'});
	});
	
	$('.all-categorias ul li').hover( function(){
		$(this).stop().animate({'backgroundColor' : '#407839'},{queue:false, duration: 'slow'});
		$(this).find('a').stop().animate({'color' : '#fff'},{queue:false, duration: 'slow'});
		$('.no-link').stop().animate({'backgroundColor' : '#fafafa'},{queue:false, duration: 'slow'});
	},function(){
		$(this).stop().animate({'backgroundColor' : '#fafafa'},{queue:false, duration: 'slow'});
		$(this).find('a').stop().animate({'color' : '#7a7a7a'},{queue:false, duration: 'slow'});
		$('li.no-link').css({'display' : 'block', 'backgroundColor' : '#407839 !important'});
	});
	
});

var time=0;
function tempo(t){
	if(t<3){
		time=t+1;
	}else{
		time=0;
	}
	navegacao(time);
}
function navegacao(x){
	x= parseInt(x);
	
	$(".nuns ul li").removeClass("num_marc");
	$('.nuns ul li.num'+x).addClass("num_marc");
	$('span.temp').css({'width': 104});
	$('ul.trabalho').animate({'top' : -(x * 255)}, 'slow');
	$('.descricao-trab ul').animate({'top' : -(x * 105)}, 'slow');
	$('span.temp').animate({'width': 0}, 8000, function(){tempo(x)});
	
}
function marcacao(marc){
	$('.li'+marc).addClass('marcado');
	$('.li'+ marc + ' a').addClass('amarcado');
}

function aleatorio(inferior,superior){ 
	numPossibilidades = superior - inferior 
	aleat = Math.random() * numPossibilidades 
	aleat = Math.floor(aleat) 
	return parseInt(inferior) + aleat 
} 
