	/*	INICIO MENU */
	
	var moving = false;
	var mouseover=false;
	
	$(document).ready(function(){
		
		$("#menu_principal #menu li a span").hide();
		
		$("#menu_principal ul li").hover(
			function(){
				$(this).find("a span").stop(true,true).fadeIn(500);
			}
			,
			function(){
				$(this).find("a span").stop(true,true).fadeOut(500)
			}
		);
		
		/* INICIO CODIGO PRETTYPHOTO */
		$("a[rel^='prettyPhoto']").prettyPhoto({theme:'light_square'});
	
		//notícias
		
		if(o("legenda"))
		o("legenda").innerHTML = $("#galeria_img ul li a:eq(0)").attr('title');
		
		$(window).load(function(){				   
			$("#galeria_img ul").height($("#galeria_img ul li:eq(0)").height());
		});
		
		var n=0;
		//next 		
		$(".next").click(function(){
			
			if(!moving)
			{
				
				ulw = $(this).parent().find("ul").width();
				liw = $(this).parent().find("ul li").width();
				minleft = liw-ulw;

				//se a posição for maior que o total o botão trava
				if(parseInt($(this).parent().find("ul").css("left"))>minleft)
				{
					moving = true;
					n++;
					lih = $(this).parent().find("ul li:eq("+n+")").height();
					o("legenda").innerHTML = $(this).parent().parent().find("ul li a:eq("+n+")").attr('title');
					
					$(this).parent().find("ul").animate({left: '-='+liw,height:lih}, 1000, '', function(){ moving = false;});
					
					
				}

			}
		});
		
	    //prev
		$(".prev").click(function(){
						
			if(!moving)
			{

				//se a posição for menor que 0 o botão trava
				if(parseInt($(this).parent().find("ul").css("left"))<0)
				{	
					moving = true;
					n--;
					lih = $(this).parent().find("ul li:eq("+n+")").height();
					o("legenda").innerHTML = $(this).parent().parent().find("ul li img:eq("+n+")").attr('alt');
					
					$(this).parent().find("ul").animate({left: '+='+liw,height:lih}, 1000, '', function(){ moving = false; });

				}
			}
		});
	
		//thumbs_obra	
		//botão próximo 					  
		$(".bt_dir").click(function(){
			if(!moving)
			{
				//pega a largura total da div e diminui 340(a largura da imagem)
				ulw = $(this).parent().find("ul").width();
				liw = $(this).parent().find("ul li").width()*7;
				minleft = liw-ulw;
				//se a posição for maior que o total o botão trava
				if(parseInt($(this).parent().find("ul").css("left"))>minleft)
				{
					moving = true;
					$(this).parent().find("ul").animate({left: '-='+liw}, 2000, '', function(){ moving = false; });
				}
			}
		});
			
		//botão anterior
		$(".bt_esq").click(function(){
			if(!moving)
			{	
				//se a posição for menor que 0 o botão trava
				if(parseInt($(this).parent().find("ul").css("left"))<0)
				{	
					moving = true;
					$(this).parent().find("ul").animate({left: '+='+liw}, 2000, '', function(){ moving = false; 		});
				}
			}
		});
		
		//empreendimentos
		$(".seta_dir").click(function()
		{
			mouseover=true;
			prox($(this).parent().find(".mask_foto .fotos_emp"));
		});
		$(".seta_esq").click(function()
		{
			mouseover=true;
			ant($(this).parent().find(".mask_foto .fotos_emp"));
		});
	

    });
	
	/*	FIM MENU */

	function teste(obj,qnt)
	{
		$("#teste").width(($(".mask_foto").width()*qnt));
	}
	
	function prox(obj)
	{
		mask	= $(".mask_foto").width();
		tamanho = mask * $(obj).find("li").length;
		minLeft = mask-tamanho;
		
		$(obj).width(tamanho);
			
		if(!moving)
		{
			moving = true;
			
			$(obj).animate({left : "-="+mask+"px"}, 1000, "",
			function()
			{
				moving = false;
				if(parseInt($(obj).css("left")) <= minLeft)
				{
					$(obj).css('left', 0);
				}
			});
			
		}
	}
	
	function ant(obj)
	{
		mask	= $(".mask_foto").width();
		tamanho = mask * $(obj).find("li").length;
		minLeft = mask-tamanho;
		
		$(obj).width(tamanho);
		
		if(!moving)
		{
			
			if(parseInt($(obj).css("left")) >= 0)
			{
				$(obj).css('left', minLeft);
			}
			moving = true;
			
			$(obj).animate({left : "+="+mask+"px"}, 1000, "",
			function()
			{
				moving = false;
			});
		}
	}
	
