// JQUERY
(function($){tile = function() {
		// MENU
		$('#navContent a').mouseover(function () {
			$(this).stop().animate({backgroundPosition: '0px 0px'});
		});
		$('#navContent a').mouseout(function () {
			$(this).stop().animate({backgroundPosition: '-184px 0px'});
		});
		// BANNER
		$("#homeProject01_btnRight").click(function () {
			$("#homeProject01").hide("slide", { direction: "left" }, 1100);
			$("#homeProject02").show("slide", { direction: "right" }, 1000);
			bannerRotation = 2;
		});
		$("#homeProject02_btnLeft").click(function () {
			$("#homeProject02").hide("slide", { direction: "right" }, 1100);
			$("#homeProject01").show("slide", { direction: "left" }, 1000);
			bannerRotation = 1;
		});
		$("#homeProject02_btnRight").click(function () {
			$("#homeProject02").hide("slide", { direction: "left" }, 1100);
			$("#homeProject03").show("slide", { direction: "right" }, 1000);
			bannerRotation = 3;
		});
		$("#homeProject03_btnLeft").click(function () {
			$("#homeProject03").hide("slide", { direction: "right" }, 1100);
			$("#homeProject02").show("slide", { direction: "left" }, 1000);
			bannerRotation = 2;
		});
		// AGENDA
		$("#btnMonth01_right").click(function () {
			$("#agendaMonth01").hide("slide", { direction: "left" }, 1000);
			$("#agendaMonth02").show("slide", { direction: "right" }, 1000);
		});
		$("#btnMonth02_left").click(function () {
			$("#agendaMonth02").hide("slide", { direction: "right" }, 1000);
			$("#agendaMonth01").show("slide", { direction: "left" }, 1000);
		});
		$("#btnMonth02_right").click(function () {
			$("#agendaMonth02").hide("slide", { direction: "left" }, 1000);
			$("#agendaMonth03").show("slide", { direction: "right" }, 1000);
		});
		$("#btnMonth03_left").click(function () {
			$("#agendaMonth03").hide("slide", { direction: "right" }, 1000);
			$("#agendaMonth02").show("slide", { direction: "left" }, 1000);
		});
		// PARTNERS
		$("#btnPartnerBlock01_right").click(function () {
			$("#partnersBlock01").hide("slide", { direction: "left" }, 1000);
			$("#partnersBlock02").show("slide", { direction: "right" }, 1000);
			partnerRotation = 2;
		});
		$("#btnPartnerBlock02_left").click(function () {
			$("#partnersBlock02").hide("slide", { direction: "right" }, 1000);
			$("#partnersBlock01").show("slide", { direction: "left" }, 1000);
			partnerRotation = 1;
		});
		$("#btnPartnerBlock02_right").click(function () {
			$("#partnersBlock02").hide("slide", { direction: "left" }, 1000);
			$("#partnersBlock03").show("slide", { direction: "right" }, 1000);
			partnerRotation = 3;
		});
		$("#btnPartnerBlock03_left").click(function () {
			$("#partnersBlock03").hide("slide", { direction: "right" }, 1000);
			$("#partnersBlock02").show("slide", { direction: "left" }, 1000);
			partnerRotation = 2;
		});
		$("#btnPartnerBlock03_right").click(function () {
			$("#partnersBlock03").hide("slide", { direction: "left" }, 1000);
			$("#partnersBlock04").show("slide", { direction: "right" }, 1000);
			partnerRotation = 4;
		});
		$("#btnPartnerBlock04_left").click(function () {
			$("#partnersBlock04").hide("slide", { direction: "right" }, 1000);
			$("#partnersBlock03").show("slide", { direction: "left" }, 1000);
			partnerRotation = 3;
		});
		$("#btnPartnerBlock04_right").click(function () {
			$("#partnersBlock04").hide("slide", { direction: "left" }, 1000);
			$("#partnersBlock05").show("slide", { direction: "right" }, 1000);
			partnerRotation = 5;
		});
		$("#btnPartnerBlock05_left").click(function () {
			$("#partnersBlock05").hide("slide", { direction: "right" }, 1000);
			$("#partnersBlock04").show("slide", { direction: "left" }, 1000);
			partnerRotation = 4;
		});
		// BTN FADE
		$(".btnServicos,.btnDestaques,.btn").mouseover(function () {
			$(this).stop().animate({opacity: 0.60});
		});
		$(".btnServicos,.btnDestaques,.btn").mouseout(function () {
			$(this).stop().animate({opacity: 1});
		});
	};
})(jQuery);

// BANNER - ROTACAO AUTOMATICA
var bannerRotation = 1;

function changeBannerTimer() {
	switch (bannerRotation) {
	case 1:
		$("#homeProject01").hide("slide", { direction: "left" }, 1100);
		$("#homeProject02").show("slide", { direction: "right" }, 1000);
		bannerRotation = 2;
		break;
	case 2:
		$("#homeProject02").hide("slide", { direction: "left" }, 1100);
		$("#homeProject03").show("slide", { direction: "right" }, 1000);
		bannerRotation = 3;
		break;
	case 3:
		$("#homeProject03").hide("slide", { direction: "right" }, 1100);
		$("#homeProject01").show("slide", { direction: "left" }, 1000);
		bannerRotation = 1;
		break;
	}
	counterBanner();
}

// BANNER - ROTACAO AUTOMATICA
var partnerRotation = 1;

function changePartnerTimer() {
	switch (partnerRotation) {
		case 1:
			$("#partnersBlock01").hide("slide", { direction: "left" }, 1000);
			$("#partnersBlock02").show("slide", { direction: "right" }, 1000);
			partnerRotation = 2;
			break;
		case 2:
			$("#partnersBlock02").hide("slide", { direction: "left" }, 1000);
			$("#partnersBlock03").show("slide", { direction: "right" }, 1000);
			partnerRotation = 3;
			break;
		case 3:
			$("#partnersBlock03").hide("slide", { direction: "left" }, 1000);
			$("#partnersBlock04").show("slide", { direction: "right" }, 1000);
			partnerRotation = 4;
			break;
		case 4:
			$("#partnersBlock04").hide("slide", { direction: "left" }, 1000);
			$("#partnersBlock05").show("slide", { direction: "right" }, 1000);
			partnerRotation = 5;
			break;
		case 5:
			$("#partnersBlock05").hide("slide", { direction: "right" }, 1000);
			$("#partnersBlock01").show("slide", { direction: "left" }, 1000);
			partnerRotation = 1;
			break;
	}
	counterPartner();
}

function counter() {
	counterBanner();
	counterPartner();
}

// ROTACAO AUTOMATICA
function counterBanner() {
	var t=setTimeout("changeBannerTimer()",6000);
}

function counterPartner() {
	var t=setTimeout("changePartnerTimer()",6000);
}

// LIMPAR CAMPO ONFOCUS
function clearText(elm){
	if (elm.defaultValue == elm.value)
		elm.value = ""
}

// OCULTAR/MOSTRAR GALERIA 
function toggleGallery(elm1,elm2) {
	var galleryObj = ["event01","event02","event03"]
	var galleryBtns = ["galleryBtn01","galleryBtn02","galleryBtn03"]
	
	for (x in galleryObj) {
		document.getElementById(galleryObj[x]).style.display = "none";
	}
	for (x in galleryBtns) {
		document.getElementById(galleryBtns[x]).style.backgroundColor = "#DDD";
	}

	document.getElementById(elm1).style.display = "block";
	document.getElementById(elm2).style.backgroundColor = "transparent";
}

// OCULTAR/MOSTRAR OBJETO POR PARAMETRO 
function toggleObject(obj) {
	var objectDisplay = document.getElementById(obj).style.display;
	
	if (objectDisplay == "none") {
		document.getElementById(obj).style.display = "inline";
	}
	else {
		document.getElementById(obj).style.display = "none";
	}
}

// DIA DO MES
function today() {
	var d = new Date();
	var day = d.getDate();
	document.getElementById(day).className = "today";
}
