$(document).ready(function(){
	//atual
	var atual = "";

	 
	//banner
	$(function(){
		$('#incBanner').cycle({ 
			fx: 'fade', 
			speed:  8000 ,
			next:   '#incDireita', 
			prev:   '#incEsquerda',
			sinc: true
		});
	});
	
	$(function() {
		$("a[rel=lightbox]").colorbox();
    });
	
	//menu
	$(function(){
		$("a[title=MENU]").click(function(){
			if($(this).attr("id") != atual){
				
				var id = $(this).attr("id");
	
				$("#incConteudo").html("");
				$("#incConteudo").hide();
				
				$("#carregando").show("slow");
				
				$.post("deposito.php", {
					namePost: "showPagina",
					id: id
				}, function(data){
					$("#carregando").hide("slow");
					$("#incConteudo").html(data);
					$("#incConteudo").show("slow");
				});
				
				atual = $(this).attr("id");
			}
		});
		return false;
	});
	
	
	
	//contato
	$(function(){
		$("a[title=CONTATO]").click(function(){
			if($(this).attr("title") != atual){
			
				$("#incConteudo").html("");
				$("#incConteudo").hide();
				
				$("#carregando").show("slow");
				
				$.post("deposito.php", {
					namePost: "showContato"
				}, function(data){
					$("#carregando").hide("slow");
					$("#incConteudo").html(data);
					$("#incConteudo").show("slow");
				});
				
				atual = $(this).attr("title");
			}
		});
		return false;
	});

	//validar news
	$(function(){
		$("#formNews").validate({
			messages:{
				nome: {required: "*"},
				email: {required: "*", email: "**"}
			}
		});
	});
	
	//validar buscsar
	$(function(){
		$("#formBuscar").validate({
			messages:{
				valorBuscar: {required: "*"}
			}
		});
	});

	//news 
	$(function(){
		$("#formNews").submit(function(){
			if($("#formNews").valid()){		
					
				$("#msgNews").html("");
				$("#msgNews").hide("slow");
			
				$.post("deposito.php", {
					namePost: "news",
					nome: $("#nome").val(),
					email: $("#email").val()
					
				}, function(data){
					
					$("#msgNews").html(data);
					
					$("#msgNews").show("slow");
					
					setTimeout(function() {
						
						$("#nome").val("");
						$("#email").val("");
					
					
						$("#msgNews").html("");
						$("#msgNews").hide("slow");
					},2000);
					
					
				});
			}
			return false;
		});
	});
	
	//buscar 
	$(function(){
		$("#formBuscar").submit(function(){
			if($("#formBuscar").valid()){	
				
				$("#incConteudo").slideUp("slow");
				
				$("#carregando").show("slow");	
							
				$.post("deposito.php", {
					namePost: "buscar",
					valorBuscar: $("#valorBuscar").val()
					
				}, function(data){
					
					$("#carregando").hide("slow");
					
					$("#incConteudo").html(data);
					
					$("#incConteudo").slideDown("slow");
					
					$("#valorBuscar").val("");
					
				});
			}
			return false;
		});
	});
	
	//fonte
	$(function(){
		var fonte = 12;
		$("#maisFonte").click(function(){
			if ( fonte < 26){  
				 fonte = fonte+1;  
				 $("#incConteudo").css({"font-size" : fonte+"px"});  
			 } 
			 return false;
		});
	});
	
	//fonte
	$(function(){	
		$("#menosFonte").click(function(){
			if ( fonte > 08){  
				 fonte = fonte-1;  
				 $("#incConteudo").css({"font-size" : fonte+"px"});  
			 } 
			 return false;
		});
	});
	}); 
