jQuery(document).ready(function($) {
  $('a[rel*=facebox]').facebox()
}) 

$(document).ready(function() {
						   
	/*$('a[rel*=facebox]').click(function(){
		
		jQuery.facebox({ image: $(this).attr('href') });;
		
	}, function(){});*/
	
	$("#bt-area_restrita").click(function() { 
		//$("#formAreaRestrita").toggle('slow');
		$("#area_restrita").toggleClass('showForm');
		$(".showForm").animate({ top: "0px" }, 750 );
		$("#area_restrita").toggleClass('hideForm');
		$(".hideForm").animate({ top: "-28px" }, 750 );
	});
	
	var links = '';
	var linkPagina = '';
	
	//ATRIBUI A CLASSE ativo NA PÁGINA ATUAL
	$("#nav a").each(function(i) {
		links = $(this).attr('href');
		if ("<?php echo $pagina ?>" == links) {
			linkPagina = "mn-"+links;
			linkPagina = linkPagina.replace(".php","");
			$(this).addClass('ativo');
		}
	});
	
	var valorInicial = new Array();
	
	$("#formAreaRestrita .campo").each(function(i) {
		var formId = $(this).attr('id');
		valorInicial[formId] = $(this).attr('value');
	});
			
	$("#formAreaRestrita .campo").focus(function() {
		var valor = document.getElementById(this.id).value;
		var valorForm = document.getElementById(this.id).value;
		if (valorForm == valorInicial[this.id]) {
			document.getElementById(this.id).value = '';
		}
		
		// EXCESSÃO P/ O CAMPO SENHA
		if(this.id == 'formSenha'){
			document.getElementById(this.id).type = "password";
		}
		
	});
	
	$("#formAreaRestrita .campo").blur(function() {
		var valorForm = document.getElementById(this.id).value;
		
		// EXCESSÃO P/ O CAMPO SENHA
		if(this.id == 'formSenha' && valorForm == ''){
			document.getElementById(this.id).type = "text";
		}
		
		if (valorForm == '') {
			document.getElementById(this.id).value = valorInicial[this.id];
		}
	});
	
	$(".home #listaObrasRecentes li a").hover(function(){
		//$(this).find("span").fadeIn('slow');
		$('span',this).fadeIn('slow');
	},function(){
		$('span',this).fadeOut('slow');				   
	});
	
});

function mostraBg(){
	$("#bg").fadeIn('slow');
}
