﻿$(document).ready(function(){
//----------

//FUNÇÔES
	
	(function($) {
	$.fn.customFadeIn = function(speed, callback) {
		$(this).fadeIn(speed, function() {
			if(!$.support.opacity)
				$(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
	$.fn.customFadeOut = function(speed, callback) {
		$(this).fadeOut(speed, function() {
			if(!$.support.opacity)
				$(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
	$.fn.customFadeTo = function(speed,to,callback) {
		return this.animate({opacity: to}, speed, function() {
			if (to == 1 && jQuery.browser.msie)
				this.style.removeAttribute('filter');
			if (jQuery.isFunction(callback))
				callback();
		});
	};
})(jQuery);

	
	// efeito hover
	$(".fl_dir,.fl_esq,.voltar").mouseover(function(){
											$(this).css('color','#03cdf9');
											});
	$(".fl_dir,.fl_esq,.voltar").mouseout(function(){
											$(this).css('color','#999');
											});
	
	$('#mapa').lightBox({fixedNavigation:true});
	
	// efeitos nas transições de cada segmento
	
	$(".categotiasRel").click(function(){
							   $('.categotiasRel').addClass('sair');
							   $(this).removeClass('sair');
							   $('.sair,#mapa').customFadeOut(800);
							   $(this).delay(800).animate({left: "0px" },500);
							   $('.fl_esq,.fl_dir,.desc_cada,.voltar').delay(1300).customFadeIn("slow");
							   });
	
	$(".prod1").click(function(){
							   $('.slider').html($('#box_1').html());
								$('.gal1 a').lightBox({fixedNavigation:true});
								// total
								$("#total").css('height','1220px');
								
								// textos
								$("#seguimentos").animate({height: "1158px"},700);
								// telefone
								$("#tel").customFadeOut(200);
								$("#tel").css('top','1340px');
								$("#tel").delay(300).customFadeIn(200);
								// temperatura
								$("#temp").customFadeOut(200);
								$("#temp").css('top','1366px');
								$("#temp").delay(300).customFadeIn(200);
								
								$("#rodape").animate({top: "1414px"},700);
								$("#seguimentos_left,#seguimentos_right").customFadeOut(400);
								$(".titnone").css('display','none')
								
$(".R1").click(function(){
						$('.referNone').css('display','none');
						$('.R11').css('display','inline');
						
						  });

$(".R2").click(function(){
						$('.referNone').css('display','none');
						$('.R22').css('display','inline');
						  });

$(".R3").click(function(){
						$('.referNone').css('display','none');
						$('.R33').css('display','inline');
						  });

$(".R4").click(function(){
						$('.referNone').css('display','none');
						$('.R44').css('display','inline');
						  });

$(".R5").click(function(){
						$('.referNone').css('display','none');
						$('.R55').css('display','inline');
						  });
$(".R6").click(function(){
						$('.referNone').css('display','none');
						$('.R66').css('display','inline');
						  });
$(".R7").click(function(){
						$('.referNone').css('display','none');
						$('.R77').css('display','inline');
						  });
$(".R8").click(function(){
						$('.referNone').css('display','none');
						$('.R88').css('display','inline');
						  });


								
							   });
	
	
	$(".prod2").click(function(){
							   $('.slider').html($('#box_2').html());
								$('.gal2 a').lightBox({fixedNavigation:true});
								
								// total
								$("#total").css('height','740px');
								
								// textos
								$("#seguimentos").animate({height: "400px"},700);
								// telefone
								$("#tel").customFadeOut(200);
								$("#tel").css('top','582px');
								$("#tel").delay(300).customFadeIn(200);
								// temperatura
								$("#temp").customFadeOut(200);
								$("#temp").css('top','608px');
								$("#temp").delay(300).customFadeIn(200);
								
								$("#rodape").animate({top: "656px"},700);
								$("#seguimentos_left,#seguimentos_right").customFadeOut(400);
								$(".titnone").css('display','none')
								
							   });
	$(".prod3").click(function(){
							   $('.slider').html($('#box_3').html());
								$('.gal3 a').lightBox({fixedNavigation:true});
								
								// total
								$("#total").css('height','1050px');
								
								// textos
								$("#seguimentos").animate({height: "700px"},700);
								// telefone
								$("#tel").customFadeOut(200);
								$("#tel").css('top','882px');
								$("#tel").delay(300).customFadeIn(200);
								// temperatura
								$("#temp").customFadeOut(200);
								$("#temp").css('top','908px');
								$("#temp").delay(300).customFadeIn(200);
								
								$("#rodape").animate({top: "956px"},700);
								$("#seguimentos_left,#seguimentos_right").customFadeOut(400);
								$(".titnone").css('display','none')
							   });
	$(".prod4").click(function(){
							   $('.slider').html($('#box_4').html());
								$('.gal4 a').lightBox({fixedNavigation:true});
								
								// total
								$("#total").css('height','700px');
								
								// textos
								$("#seguimentos").animate({height: "350px"},700);
								// telefone
								$("#tel").customFadeOut(200);
								$("#tel").css('top','532px');
								$("#tel").delay(300).customFadeIn(200);
								// temperatura
								$("#temp").customFadeOut(200);
								$("#temp").css('top','558px');
								$("#temp").delay(300).customFadeIn(200);
								
								$("#rodape").animate({top: "606px"},700);
								$("#seguimentos_left,#seguimentos_right").customFadeOut(400);
								$(".titnone").css('display','none')
							   });
	$(".prod5").click(function(){
							   $('.slider').html($('#box_5').html());
								$('.gal5 a').lightBox({fixedNavigation:true});
							   });
	
	
	$(".voltar").click(function(){
								$('.fl_esq,.fl_dir,.desc_cada,.cnipa,.voltar,.categotiasRel').css('display','none');
								$('.prod1').css('left','0px');
								$('.prod1').customFadeIn(500);
								$('.prod3').css('left','230px');
								$('.prod3').delay(300).customFadeIn(500);
								$('.prod4').css('left','465px');
								$('.prod4').delay(400).customFadeIn(500);
								$('.prod5').css('left','700px');
								$('.prod5').delay(500).customFadeIn(500);
								$('#mapa').delay(500).customFadeIn(500);
								$('.slider').html(' ');
								
								$('.desc_cada').scrollTop('0px');
								
								// total
								$("#total").css('height','auto');
								
								// textos
								$("#seguimentos").animate({height: "325px"},500);
								
								// telefone
								$("#tel").css('display','none');
								$("#tel").css('top','507px');
								$("#tel").delay(300).customFadeIn(200);
								
								// temperatura
								$("#temp").css('display','none');
								$("#temp").css('top','532px');
								$("#temp").delay(300).customFadeIn(200);
								$('#box_6').delay(100).customFadeOut(200);
								$("#rodape").animate({top: "581px"},500);
								
								$("#seguimentos_left,#seguimentos_right").customFadeIn(500);
								$(".titnone").css('display','inline')
								
								
								});
	contato = function()
	{
		$(".categotiasRel").customFadeOut(200);
		$('.slider').html('');
		$(".voltar").customFadeIn(200);
		$("#box_6").customFadeIn(200);
		
		// total
								$("#total").css('height','auto');
								
								// textos
								$("#seguimentos").animate({height: "325px"},500);
								
								// telefone
								$("#tel").css('display','none');
								$("#tel").css('top','507px');
								$("#tel").delay(300).customFadeIn(200);
								
								// temperatura
								$("#temp").css('display','none');
								$("#temp").css('top','532px');
								$("#temp").delay(300).customFadeIn(200);
								$("#rodape").animate({top: "581px"},500);
								
								$("#seguimentos_left,#seguimentos_right").customFadeIn(500);
								$(".titnone").css('display','inline')
		
	}
	
	


	
	
	//------------------------------------------------------
	enviaCont = function()
	{
		if (_vazio('nome','NOME')) return false;
		if (_mail('email')) return false;
		if (_vazio('fone','TELEFONE')) return false;
		if (_vazio('msg','MENSAGEM')) return false;

		$.post("index.php", $('#fmCont').serialize()+"&acao=cont",
			function(data){
				alert(data);
				document.getElementById('fmCont').reset();
			});
	}
	



	
	
			   
							   
							   
	
	
//----------
})
