$(document).ready(function() {
	
		
		$('.efeito_fade').append('<span class="hover"></span>').each(function () {
	  		var $span = $('> span.hover', this).css('opacity', 0);
	  		$(this).hover(function () {
	    		$span.stop().fadeTo(600, 1);
	 		}, function () {
	   	$span.stop().fadeTo(1000, 0);
	  		});
		});
		
		
	//$('#slider').nivoSlider(); 
		/* Define the function that triggers to fade in the background as soon as the image has loaded */
		$("img#bg").load(function()
			{
				/* Fade in during 3 seconds */
				$("img#bg").fadeTo(1000,1);
				
				/* Animate the picture description during 1 second */
				//setTimeout(function() { $("#image_description").animate({right: '+=150'}, 1000) }, 1000);
			
				/* Set the timeout to fade out the image and the description after 10 seconds*/
		    	setTimeout(function() 
			    	{
			    		//$("#image_description").animate({right: '-=150'}, 1000);
			    		$("img#bg").fadeOut(1000);
			    		
			    		/* Load the next image after 4 seconds */
			    		setTimeout(LoadImages,1000);
			    	}
			    	,10000);
			}			
		)
	
		/* Start the slideshow one second after the page is ready */ 
		setTimeout(LoadImages,100);
		
		
		
		
		
		//$("#paginas").hide();
		
	$("#quem-somos").click(function () {
			
				
	$('#tabela').animate({
    width: '600px'
  }, 2000, function() {
    // Animation complete.
  });
  
  $('#sombra').animate({
    width: '634px'
  }, 2000, function() {
    // Animation complete.
  });
  
  
  
	$("#sombra").css("background-image", "url(img/sombra-maior-ie7.png)");
	$("#banner").hide(2000);
	 
	 		
	$("#paginas").show(1000);
	$("#paginas").load("quem-somos.php?cache="+ Math.random());
	$("#quem-somos").css("color", "#F37435");
	$("#projetos").css("color", "#999");
	$("#depoimentos").css("color", "#999");
		$("#prestacao").css("color", "#999");
		$("#apoio").css("color", "#999");
		$("#licitacoes").css("color", "#999");
		$("#imprensa").css("color", "#999");
		$("#contato").css("color", "#999");
		
	
	 
	 
		
	
		
		//$("#tabela").css("width", "600px");
		 });
		 
		 
		 
		 $("#projetos").click(function () {
			 $("#banner").hide(2000);
			 	$('#tabela').animate({
    width: '600px'
  }, 2000, function() {
    // Animation complete.
  });
  
  $('#sombra').animate({
    width: '634px'
  }, 2000, function() {
    // Animation complete.
  });
  
  $("#sombra").css("background-image", "url(img/sombra-maior-ie7.png)");
			
		$("#paginas").show(2000);
		 
		
		$("#quem-somos").css("color", "#999");
		$("#projetos").css("color", "#F37435");
		$("#depoimentos").css("color", "#999");
		$("#prestacao").css("color", "#999");
		$("#apoio").css("color", "#999");
		$("#licitacoes").css("color", "#999");
		$("#imprensa").css("color", "#999");
		$("#contato").css("color", "#999");
		
	
$("#paginas").load("projetos.php?cache="+ Math.random());

		
		
		
		 });
		 
		 
		  $("#depoimentos").click(function () {
			  $("#banner").hide(2000);
			 	$('#tabela').animate({
    width: '600px'
  }, 2000, function() {
    // Animation complete.
  });
  
   $('#sombra').animate({
    width: '634px'
  }, 2000, function() {
    // Animation complete.
  });
  
  $("#sombra").css("background-image", "url(img/sombra-maior-ie7.png)");
  
  
		$("#paginas").show(2000);
		$("#paginas").load("depoimentos.php?cache="+ Math.random());
		$("#quem-somos").css("color", "#999");
		$("#projetos").css("color", "#999");
		$("#depoimentos").css("color", "#F37435");
		$("#prestacao").css("color", "#999");
		$("#apoio").css("color", "#999");
		$("#licitacoes").css("color", "#999");
		$("#imprensa").css("color", "#999");
		$("#contato").css("color", "#999");
		
		 });
		 
		 
		  $("#prestacao").click(function () {
			  $("#banner").hide(2000);
			 	$('#tabela').animate({
    width: '600px'
  }, 2000, function() {
    // Animation complete.
  });
  
   $('#sombra').animate({
    width: '634px'
  }, 2000, function() {
    // Animation complete.
  });
  
  $("#sombra").css("background-image", "url(img/sombra-maior-ie7.png)");
  
  
		$("#paginas").show(2000);
		$("#paginas").load("prestacao-de-contas.php?cache="+ Math.random());
		$("#quem-somos").css("color", "#999");
		$("#projetos").css("color", "#999");
		$("#depoimentos").css("color", "#999");
		$("#prestacao").css("color", "#F37435");
		$("#apoio").css("color", "#999");
		$("#licitacoes").css("color", "#999");
		$("#imprensa").css("color", "#999");
		$("#contato").css("color", "#999");
		
		 });
		 
		 
		   $("#apoio").click(function () {
			   $("#banner").hide(2000);
			 	$('#tabela').animate({
    width: '600px'
  }, 2000, function() {
    // Animation complete.
  });
  
   $('#sombra').animate({
    width: '634px'
  }, 2000, function() {
    // Animation complete.
  });
  
  $("#sombra").css("background-image", "url(img/sombra-maior-ie7.png)");
  
  
		$("#paginas").show(2000);
		$("#paginas").load("apoio.php?cache="+ Math.random());
		$("#quem-somos").css("color", "#999");
		$("#projetos").css("color", "#999");
		$("#depoimentos").css("color", "#999");
		$("#prestacao").css("color", "#999");
		$("#apoio").css("color", "#F37435");
		$("#licitacoes").css("color", "#999");
		$("#imprensa").css("color", "#999");
		$("#contato").css("color", "#999");
		
		 });
		 
		 
		    $("#licitacoes").click(function () {
				$("#banner").hide(2000);
			 	$('#tabela').animate({
    width: '600px'
  }, 2000, function() {
    // Animation complete.
  });
  
  
   $('#sombra').animate({
    width: '634px'
  }, 2000, function() {
    // Animation complete.
  });
  
  $("#sombra").css("background-image", "url(img/sombra-maior-ie7.png)");
  
  
		$("#paginas").show(2000);
		$("#paginas").load("licitacoes.php?cache="+ Math.random());
		$("#quem-somos").css("color", "#999");
		$("#projetos").css("color", "#999");
		$("#depoimentos").css("color", "#999");
		$("#prestacao").css("color", "#999");
		$("#apoio").css("color", "#999");
		$("#licitacoes").css("color", "#F37435");
		$("#imprensa").css("color", "#999");
		$("#contato").css("color", "#999");
		
		 });
		 
		 
		   $("#imprensa").click(function () {
			   $("#banner").hide(2000);
			 	$('#tabela').animate({
    width: '600px'
  }, 2000, function() {
    // Animation complete.
  });
  
   $('#sombra').animate({
    width: '634px'
  }, 2000, function() {
    // Animation complete.
  });
  
  $("#sombra").css("background-image", "url(img/sombra-maior-ie7.png)");
  
  
  
		$("#paginas").show(2000);
		$("#paginas").load("imprensa.php?cache="+ Math.random());
		$("#quem-somos").css("color", "#999");
		$("#projetos").css("color", "#999");
		$("#depoimentos").css("color", "#999");
		$("#prestacao").css("color", "#999");
		$("#apoio").css("color", "#999");
		$("#licitacoes").css("color", "#999");
		$("#imprensa").css("color", "#F37435");
		$("#contato").css("color", "#999");
		
		 });
		 
		 
		    $("#contato").click(function () {
				$("#banner").hide(2000);
			 	$('#tabela').animate({
    width: '600px'
  }, 2000, function() {
    // Animation complete.
  });
  
  
   $('#sombra').animate({
    width: '634px'
  }, 2000, function() {
    // Animation complete.
  });
  
  $("#sombra").css("background-image", "url(img/sombra-maior-ie7.png)");
  
  $("#banner").hide(2000);
		$("#paginas").show(2000);
		$("#paginas").load("contato.php?cache="+ Math.random());
		$("#quem-somos").css("color", "#999");
		$("#projetos").css("color", "#999");
		$("#depoimentos").css("color", "#999");
		$("#prestacao").css("color", "#999");
		$("#apoio").css("color", "#999");
		$("#licitacoes").css("color", "#999");
		$("#imprensa").css("color", "#999");
		$("#contato").css("color", "#F37435");
		
		 });
		 
		 
		
	
	
	
	$("#inicial").click(function () {
		
			 	$('#tabela').animate({
    width: '495px'
  }, 2000, function() {
    // Animation complete.
  });
  $("#paginas").hide(2000);
		$("#banner").show();
		$("#quem-somos").css("color", "#999");
		$("#projetos").css("color", "#999");
		$("#depoimentos").css("color", "#999");
		$("#prestacao").css("color", "#999");
		$("#apoio").css("color", "#999");
		$("#licitacoes").css("color", "#999");
		$("#imprensa").css("color", "#999");
		$("#contato").css("color", "#999");
		
		$('#sombra').animate({
    width: '529px'
  }, 2000, function() {
    // Animation complete.
  });
  
  $("#sombra").css("background-image", "url(img/sombra-ie7.png)");
	
				
				  
    });
	
	
	
	
	
	$("#doacao").click(function () {
		
			 	$('#tabela').animate({
    width: '495px'
  }, 2000, function() {
    // Animation complete.
  });
  $("#paginas").show(2000);
		$("#banner").hide();
		$("#quem-somos").css("color", "#999");
		$("#projetos").css("color", "#999");
		$("#depoimentos").css("color", "#999");
		$("#prestacao").css("color", "#999");
		$("#apoio").css("color", "#999");
		$("#licitacoes").css("color", "#999");
		$("#imprensa").css("color", "#999");
		$("#contato").css("color", "#999");
		
		$('#sombra').animate({
    width: '529px'
  }, 2000, function() {
    // Animation complete.
  });
  
  $("#sombra").css("background-image", "url(img/sombra-ie7.png)");
	
				$("#paginas").load("doacoes.php?cache="+ Math.random());
				  
    });
	
	
	
	
	
	
	
	
	
	
	
	
	$('.interno').bind('click', function(e) { 
	
	$('#tabela').animate({
    width: '600px'
  }, 2000, function() {
    // Animation complete.
  });
  
  
   $('#sombra').animate({
    width: '634px'
  }, 2000, function() {
    // Animation complete.
  });
  
  $("#sombra").css("background-image", "url(img/sombra-maior-ie7.png)");
  
            
  var url = $(this).attr('href');
  $('#paginas').load(url); // load the html response into a DOM element
  e.preventDefault(); // stop the browser from following the link
});




	
		
		
    });

    function LoadImage(iNr)
	{
	
		/* Assign the new image to the background */
		$("img#bg").attr("src", aImages[iNr]);
 		
 		/* Assign the artist name to the description */
 		$("#image_artist").html(aArtists[iNr]);
 		
 		/* Assign the image url to the description */
        $("a#image_url").attr("href", aURL[iNr]);
        $("a#image_url").html("Acesse");
                        	
    };
    
    function LoadImages()
    {
    	
    	/* Select a random image number and make sure this is not equal to the previous image */
    	while(iPrev == iRnd)
    	{
    		iRnd = Math.floor(Math.random()*aImages.length);
    	}
    	
    	/* Show the selected image */
    	LoadImage(iRnd);
    	
    	iPrev = iRnd;
    	
    };
