swfobject.embedSWF("swf/2super_728x90_pagedit.swf", "headerIgPublicidade", "728", "90", "7.0.0");

$(function(){
	$("input, textarea, select, button").uniform();
});

$(document).ready(function(){ 

	/****** TOGGLE BOX *********/
	$('.toggleBox h3').click(function(){
		$(this).next().slideToggle('slow');
	});	
	
	/****** MODAL *********/
	//tabela de preços
	//$(".tabelaPreco .view").colorbox({iframe:true, innerWidth:600, innerHeight:500});
	$(".view").colorbox();
	
	/****** TABS *********/
	//tabela de preços
	//$(".tabs").tabs();
	
	/****** PROJETOS ESPECIAIS ******/
	
	$('.projetosEspeciais .arrowLeft').hide();
	if($('.projetosEspeciais ul li').length < 6){
		$('.projetosEspeciais .arrowRight').hide();
	}
	
	var peWidth = 127;
	var peLenght = $('.projetosEspeciais ul li').length;
	
	$('.projetosEspeciais .arrowRight').click(function() {
		var peMarginLeft = $('.projetosEspeciais ul').css('margin-left');
		var peAtual = Math.round(peMarginLeft.substring(0,peMarginLeft.length -2) / -peWidth);
		var animationLenght = 1 + (peAtual);
		
		$('.projetosEspeciais ul').animate({
			marginLeft: -peWidth * animationLenght 
		}, 500, 'easeInOutCubic',function(){
			$('.projetosEspeciais .arrowLeft').show();
			peMarginLeft = $('.projetosEspeciais ul').css('margin-left');
			peAtual = Math.round(peMarginLeft.substring(0,peMarginLeft.length -2) / -peWidth);
			if(peAtual + 5 == peLenght){
				$('.projetosEspeciais .arrowRight').hide();
			}
		});
		
	});
	
	$('.projetosEspeciais .arrowLeft').click(function() {
		var peMarginLeft = $('.projetosEspeciais ul').css('margin-left');
		var peAtual = Math.round(peMarginLeft.substring(0,peMarginLeft.length -2) / -peWidth);
		var animationLenght = (peAtual- 1);
		$('.projetosEspeciais ul').animate({
				marginLeft: -peWidth * animationLenght
		}, 500, 'easeInOutCubic',function(){
			$('.projetosEspeciais .arrowRight').show();
			peMarginLeft = $('.projetosEspeciais ul').css('margin-left');
			peAtual = Math.round(peMarginLeft.substring(0,peMarginLeft.length -2) / -peWidth);
			if(peAtual == 0){
				$('.projetosEspeciais .arrowLeft').hide();
			}
		});
	});
	
	/****** CALENDÁRIO ******/
	
	$('.calendario .arrowLeft').hide();
	if($('.calendario ul li').length < 2){
		$('.calendario .arrowRight').hide();
	}
	$('.calendario .mask div:not(:eq(0))').hide();
	
	$('.calendario .arrowRight').click(function() {
		var atual = $(".calendario .mask div:not(:hidden)").index();
		$(".calendario .mask div:not(:hidden)").hide('fast', function() {
			$(".calendario .mask div:eq("+(atual+1)+")").show('slow');
		});
		$('.calendario .arrowLeft').show();
		if(atual+2 == $(".calendario .mask div").length){
			$('.calendario .arrowRight').hide();
		}
	});
	
	$('.calendario .arrowLeft').click(function() {
		var atual = $(".calendario .mask div:not(:hidden)").index();
		$(".calendario .mask div:not(:hidden)").hide('fast', function() {
			$(".calendario .mask div:eq("+(atual-1)+")").show('slow');
		});
		
		$('.calendario .arrowRight').show();
		if(atual-1 == 0){
			$('.calendario .arrowLeft').hide();
		}
	});
	
});

