$(function(){
	function abrirJanela(width, height, nome,barra) {
		var top; var left; 
		if (barra == "") {
			barra = 0;
		}
		top = ( (screen.height/2) - (height/2) )
		left = ( (screen.width/2) - (width/2) )
		window.open(nome, "","toolbar=0,location=0,directories=0,status=0,menubar=0,resizable=0,scrollbars=1,width="+width+",height="+height+",left="+left+",top="+top);
	}
	var valores = new Array;
	$('input[type=text],textarea').each(function(){
			valores[$(this).attr('name')] = $(this).attr('value');
	});
	$('input[type=text],textarea').focus(function(){
	
		if ($(this).attr('value') == valores[$(this).attr('name')]){
			$(this).val('');
		}
															
	}); 
	$('input[type=text],textarea').blur(function(){
	
		if ($(this).attr('value') == ""){
			$(this).val(valores[$(this).attr('name')]);
		}
															
	});
	$('a[href=""]').click(function(){
		return false;
	});
	$('#topo2 li:last').css({
		padding: '0',
		backgroundImage: 'none'
	});
	$('#topo2 li li a:last').css({
		borderBottom: '0'
	});
	$('.noticias li:last').css({
		paddingBottom: '0',
		background: 'none'
	});
	$('#topo2 ul li').hover(function(){
		$('ul',this).stop(false,true).toggle('slow');
	});
	$('#gallery').gallery({
		interval: 5500,
		width: '943px',
		height: '276px',
		thumbWidth: 30,
		thumbHeight: 16
	});
	$('#fotos_editor a').lightBox({fixedNavigation:true});
	$("#telefone").mask("(99) 9999-9999? / 9999-9999");
	$("#form_contato, #form_gostei_imovel").validate({
		rules: {
			nome: "required",
			email: {
				required: true,	
				email: true
			},
			telefone: "required",
			mensagem: "required"			
		},
		messages: {
			nome: "Favor informar o Nome!",
			email: {
				required:"Favor informar um E-mail valido!",
				email:"Favor informar um E-mail valido!"
			},			
			telefone: "Favor informar o Telefone!",
			mensagem: "Favor informar a Mensagem!"
		}	
	});
	$('#mycarousel').jcarousel({
        vertical: true,
		wrap: 'circular',
        scroll: 2
    });
	$("#formNews").validate({
		rules: {
			nome_news: "required",
			email_news: {
				required: true,	
				email: true
			}				
		},
		messages: {
			nome_news: "Favor informar o Nome!",
			email_news: {
				required:"Favor informar um E-mail valido!",
				email:"Favor informar um E-mail valido!"
			}
		}	
	});

});
