$(function() {
		$("#imgs-event-top img, .loading-inputs").hide();
		$("#imgs-event-top img:eq(0)").show();
		$(".thumb-next-party-event-top img:eq(0)").css("border-color","#e0570e");
		t=setTimeout("changeImg('1')", "5000");
		
		
		
		$(".thumb-next-party-event-top img").click(function(){
			clearTimeout(t);
			t=setTimeout("changeImg('"+$(this).attr("id")+"')", "5000");
			$(".thumb-next-party-event-top img").css("border-color","white");
			$(".thumb-next-party-event-top img:eq("+$(this).attr("id")+")").css("border-color","#e0570e");
			$("#imgs-event-top img").hide();
			$("#imgs-event-top img:eq("+$(this).attr("id")+")").show();
			
		});
		
		$(".twtr-profile-img").hide();
		
		$("#send-newsletter, #send-sms").mouseover(function(){
			$(this).css("background-color","#5b1900");
		});
		
		$("#send-newsletter, #send-sms").mouseout(function(){
			$(this).css("background-color","#3f1100");
		});
		
		$(".divison-footer-data input").focus(function() {
			$(this).val("");
		});
		
		
		$(".picture-thumb-index img").mouseover(function(){
			$(this).css("border-color","#a65614");
		});
		
		$(".picture-thumb-index img").mouseout(function(){
			$(this).css("border-color","#4f2100");
		});
		
		$("#send-newsletter").click(function(){
			$("#input-newsletter, #send-newsletter").hide();
			$("#input-newsletter-ok").show();

			$.post('classes/control/mailCTRL.php', 
					{ act: "add",
					  name : $("#name-news").val(),
					  mail : $("#mail-news").val()
					  },
					function(resposta){
						  $("#input-newsletter-ok").html("<p>"+$("#name-news").val()+", obrigado por seu cadastro.</p>");
				    }
			);

		});
		
		$("#send-sms").click(function(){
			$("#input-sms, #send-sms").hide();
			$("#input-sms-ok").show();

			$.post('classes/control/smsCTRL.php', 
					{ act: "add",
					  name : $("#name-sms").val(),
					  ddd : $("#ddd").val(),
					  cel : $("#cel").val()
					  },
					function(resposta){
						  $("#input-sms-ok").html("<p>"+$("#name-news").val()+", obrigado por seu cadastro.</p>");
				    }
			);

		});
		
		$("#view-all-gallery").hover(function () {
	        $(this).css("background-color","571900");
	    }, function () {
	    	$(this).css("background-color","471500");
	    });
});

function changeImg(pos){
	var prev = pos-1;
	//alert(prev);
	//alert(pos);
	
	if(pos == 0){
		prev = $("#imgs-event-top img").size()-1;
	}
	
	$("#imgs-event-top img:eq("+pos+")").show();
	$("#imgs-event-top img:eq("+prev+")").hide();
	
	$(".thumb-next-party-event-top img:eq("+pos+")").css("border-color","#e0570e");
	$(".thumb-next-party-event-top img:eq("+prev+")").css("border-color","white");
	
	pos++;
	
	if(pos == $("#imgs-event-top img").size()){
		pos = 0;
	}
	
	t=setTimeout("changeImg("+pos+")", "5000");
}

function changeTweet(){
	$(".twtr-hd").hide(); 
	$("#twtr-widget-1").css("left","-20px");
	$(".twtr-tweet-text p").css("text-align","left");
	$(".twtr-join-conv").html("Acesse nosso Twiter");
	$(".twtr-tweet").css("border-bottom-color","#842200");
}
