$(document).ready( function() {
	
	$("#carregandoSite").show();
	
	$(".fix-cores ul li").tipTip({defaultPosition: 'left'});
	
	//$.post('home.php', {},function(resposta){
		//$("#conteudoSite").html(resposta);
		
		setTimeout(function(){
			//$('html, body').animate({scrollLeft:'2690px'}, 0);
			$('html, body').animate({scrollLeft:'2690px'}, 0);
			$("#carregandoSite").hide();
		}, 500);

			
	//Chama a fun��o no load da pagina
	posicionaTela($('body').width());
	
	//Chama a fun��o no resize da pagina
	$(window).bind("resize", function(){
		winLar = $('body').width();	
			posicionaTela(winLar);
	});
	
	boolCadastrou = false;
	
	// Grava News
	$("#btnEnviarNews").click(function(){
		var email = $("#Txtemailnews").val();
		if( email == "" || ((email.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1)) ){
			$("#Txtemailnews").css("color","red").val("Digite seu e-mail corretamente!");
		}
		else{
			if(boolCadastrou == false){
				$.post('envia-news.php', {email: email},
				function(resposta) {
					$("#Txtemailnews").val(resposta);
				});
			}
			boolCadastrou = true;
		}
	});
	
	
	
	// Form de participa��o 
	
	//Envia Contato
	$(".bt-submit").click(function(){
		var nome = $("#txtNome").val();
		var email = $("#txtEmail").val();
		var assunto = $("#txtAssunto").val();
		var mensagem = $("#txtMensagem").val();
		
		if( nome == "" || nome == "Nome" || email == "" || email == "Email" || ((email.search(/^\w+((-\w+)|(\.\w+))*\@\w+((\.|-)\w+)*\.\w+$/) == -1)) || mensagem == "Destinat&aacute;rio" || mensagem == "" || mensagem == "Assunto" || mensagem == "" || mensagem == "Mensagem" || mensagem == "" ){
			alert("Preencha todos os campos corretamente.");
			return false;
		}
		else{
		
			$.post('faleConosco.php', {txtNome: nome, txtEmail: email, txtAssunto: assunto, txtMensagem: mensagem }, 
			function(resposta){
								
				if (resposta != "Erro"){
					$("#txtNome").val('Nome');
					$("#txtEmail").val('Email');
					$("#txtAssunto").val('Assunto');
					$("#txtMensagem").val('Mensagem');
					$("body").append("<div class='floater-contato'><div class='msg-floater'><span class='close-x'>x</span>Agradecemos por seu contato. Responderemos em breve.<br/><br/><br/>Cordialmente,<br/>Atendimento ao Cliente<br/><span style='color:green;'>Siris Produtos</span><br/><br/><br/><br/>Mais beleza para suas lojas. Mais conforto para seus clientes.</div></div>");
					//Fecha floater contato
					$(".close-x").click(function(){
						$(".floater-contato").fadeOut();
					});
				}
				else {
					//$(".error").html("Mensagem enviada com sucesso!");
					alert("Erro, tente novamente");
					return false;
				}
			});
		}
	});
	
	
	//BG body
	function posicionaTela(winLar){
			
			if((winLar >= 0) && (winLar <= 1010)) {
				$('body').attr('class','');
				$('body').addClass('res1024');
			}
			if((winLar >= 1010) && (winLar <= 1290)) {
				$('body').attr('class','');
				$('body').addClass('res1280');
			}
			if((winLar >= 1290) && (winLar <= 1370)) {
				$('body').attr('class','');
				$('body').addClass('res1366');
			}
			if((winLar >= 1370) && (winLar <= 1500)) {
				$('body').attr('class','');
				$('body').addClass('res1440');
			}
			if((winLar >= 1501) && (winLar <= 1680)) {
				$('body').attr('class','');
				$('body').addClass('res1600');
			}
			if((winLar >= 1681) && (winLar <= 1800)) {
				$('body').attr('class','');
				$('body').addClass('res1680');
			}
			if((winLar >= 1801) && (winLar <= 1920)) {
				$('body').attr('class','');
				$('body').addClass('res1920');
			}	
	}
	
	// Noticias paginacao
	
	var newsGrupo = $("ul.news a");
		for (var i = 0; i < newsGrupo.length; i += 4) {
			newsGrupo.slice(i, i + 4).wrapAll("<li></li>");
		}
			
	setTimeout(function(){
		$('ul.news').after('<div id="paginacao-news">').cycle({ 
			fx:'fade',
			speed:500,
			timeout:false,
			next:'.bt-noticias-right', 
			prev:'.bt-noticias-left',
			pager:'#paginacao-news'
		});
	$("article").find("#paginacao-news").next("#paginacao-news").hide();
	}, 500);
	
	
	// menu slide principal
	
	$("li.home").click(
        function () {
			$('html, body').animate({scrollLeft: $('section.home').offset().left}, 2000);
			$('section').removeClass('active');
			$('nav li').removeClass('active');
			$('section.home').addClass('active');
			$(this).addClass('active');
    });
	
	$("li.produtos").click(
        function () {
			$('html, body').animate({scrollLeft: $('section.produtos').offset().left}, 2000);
			$('section').removeClass('active');
			$('nav li').removeClass('active');
			$('section.produtos').addClass('active');
			$(this).addClass('active');
    });
	
	$("li.siris").click(
        function () {
			$('html, body').animate({scrollLeft: $('section.siris').offset().left}, 2000);
			$('section').removeClass('active');
			$('nav li').removeClass('active');
			$('section.siris').addClass('active');
			$(this).addClass('active');
    });
	
	$("li.novidades").click(
        function () {
			$('html, body').animate({scrollLeft: $('section.novidades').offset().left}, 2000);
			$('section').removeClass('active');
			$('nav li').removeClass('active');
			$('section.novidades').addClass('active');
			$(this).addClass('active');
    });
	
	$("li.contato").click(
        function () {
			$('html, body').animate({scrollLeft: $('section.contato').offset().left}, 2000);
			$('section').removeClass('active');
			$('nav li').removeClass('active');
			$('section.contato').addClass('active');
			$(this).addClass('active');
    });
	
	$('div.news a').last().css('borderBottom','none');
	
	/*$("ul.news li").click(
        function () {
			var ID = $(this).attr("id");
			alert(ID);
    });*/
	
	//Depoimento
	
	$("span.bt-depoimento").click(function(){
			$(this).next().fadeIn();
			$("span.bt-fechar-depoimento").click(function(){
				$("div.depoimento").fadeOut();
		});	
    });
	
	// Slide Mascara Siris
	
	$('div.slider-siris').cycle({ 
			fx:'fade',
			speed:2000,
			timeout:4000
		});
	
	// menu produtos
	
	$("ul.menu-produtos li").click(
        function () {
			$("ul.menu-produtos li").removeClass('active');
			$(this).addClass('active');
			//$("aside .bt-left, aside .bt-right").fadeOut();
    });
	
	$("section.produtos .texto ul.tipos li").click(
        function () {
			var strCategoria = $("#btnCategoria").val().replace(" ","");
			$("section.produtos .texto div.grupo-"+strCategoria+" ul.tipos li").removeClass('active');
			$(this).addClass('active');
    });
	
	//FUN��O QUE CAPTURA OS VALORES DOS INPUTS HIDDEM E MONTA A IMG QUE DEVE RETORNAR
	function retornaImagem()
	{
		var strCategoria = $("#btnCategoria").val().replace(" ","");
		var strSubCategoria = $("#btnSubCategoria").val().replace(" ","");
		var strTipo = $("#btnTipo").val().replace(" ","");
		var strCor = $("#btnCor").val().replace(" ","");

		var strImg = "img/produtos/"+strCategoria+ "-" + strSubCategoria + "-" + strTipo + "-" + strCor + ".png";
		strImg = strImg.replace("--","-").replace("--","-").replace("--","-").replace("--","-").replace("siris150","").replace("--","-").replace("ecoflex-ecoflex","ecoflex");
		
		//alert(strImg);
		$(".produto-"+strCategoria+" aside div.box-img img."+strTipo+"").attr('src',strImg);
	}
	
	//FUN��O QUE CONTROLA QUAL CONTEUDO DEVE SER EXIBIDO DE ACORDO COM O MENU CLICADO
	function controlaConteudoMenu(strMenu)
	{
		$("section.produtos .tipo-produto").hide().removeClass('grupo-active');
		$("section.produtos .produto-"+strMenu+"").show().addClass('grupo-active');
		$("section.produtos .produto-"+strMenu+" .grupo-"+strMenu+"").show();
		
		//RESETA OS INPUTS
		resetaInputs(strMenu);
		
		//SETA O VALOR PARA O INPUT CATEGORIA
		controlaValoresInputsHiddem("btnCategoria",strMenu);

		controlaOsValoresNoClickDoMenu(strMenu);

		if(strMenu == "ecoflex")
		{
			controlaModelos()
		}
		
		RetornaNomeProduto()
	}
	
	function controlaOsValoresNoClickDoMenu(strMenu){
			switch (strMenu) {
		case "carrinho":
			controlaTrocaDeImagemSubCat("");
			break;
		case "ecoflex":
			retornaImagemTrocaSubCatEcoflex("");
			break;
		case "pallets":
			controlaTrocaDeImagemSubCat("");
			break;
		case "caixas":
			break;
		case "cesta":
			break;
		}
	}
	
	//FUN��O QUE RESETA TODOS OS INPUTS E CHAMA A FUN��O PARA SETAR VALORES DEFAULT
	function resetaInputs(strMenu)
	{
		$("#btnCategoria").val("");
		$("#btnSubCategoria").val("");
		$("#btnTipo").val("");
		$("#btnCor").val("");

		//CHAMA VALORES DEFAULT
		setaValoresDefault(strMenu);
	}
	
	//FUN��O QUE SETA OS VALORES DEFAULT
	function setaValoresDefault(strMenu)
	{
		var strSubCategoria = $("#btnSubCategoria").val().replace(" ","");

		switch (strMenu) {
		case "carrinho":
			SubCategoria = strSubCategoria;
			strTipo = "base";
			strCor = "cinza";
			$("section.produtos .produto-"+strMenu+" span.bt-left, section.produtos .produto-"+strMenu+" span.bt-right").fadeIn();
			$("section.produtos .produto-"+strMenu+" .grupo-"+strMenu+" ul.cores").hide();
			$("section.produtos .produto-"+strMenu+" .grupo-"+strMenu+" ul.cores-base").show().addClass('active');
			break;
		case "ecoflex":
			SubCategoria = strSubCategoria;
			strTipo = "base";
			strCor = "cinza";
			$("section.produtos .produto-"+strMenu+" span.bt-left, section.produtos .produto-"+strMenu+" span.bt-right").fadeIn();
			$("section.produtos .produto-"+strMenu+" .grupo-"+strMenu+" ul.cores").hide();
			$("section.produtos .produto-"+strMenu+" .grupo-"+strMenu+" ul.cores-base").show().addClass('active');
			if(strSubCategoria == "ecoflex-abastecedor"){
				$("section.produtos .produto-"+strMenu+" .grupo-"+strMenu+" ul.tipos li.acessorio").show();
			}else{
				$("section.produtos .produto-"+strMenu+" .grupo-"+strMenu+" ul.tipos li.acessorio").hide();
			}
			break;
		case "pallets":
			SubCategoria = strSubCategoria;
			strTipo = "pallets";
			strCor = "preto";
			$("section.produtos .produto-"+strMenu+" .grupo-"+strMenu+" ul.cores").show();
			$("section.produtos .produto-"+strMenu+" aside span.bt-left").show();
			$("section.produtos .produto-"+strMenu+" aside span.bt-right").show();
			break;
		case "caixas":
			SubCategoria = strSubCategoria;
			strTipo = "caixas";
			strCor = "branca";
			$("section.produtos .produto-"+strMenu+" .grupo-"+strMenu+" ul.cores").show();
			$("section.produtos .produto-"+strMenu+" aside span.bt-left").hide();
			$("section.produtos .produto-"+strMenu+" aside span.bt-right").hide();
			break;
		case "cesta":
			SubCategoria = strSubCategoria;
			strTipo = "alca";
			strCor = "cinza";
			$("section.produtos .produto-"+strMenu+" .grupo-"+strMenu+" ul.cores").hide();
			$("section.produtos .produto-"+strMenu+" .grupo-"+strMenu+" ul.cores-alca").show();
			$("section.produtos .produto-"+strMenu+" img.alca").show();
			$("section.produtos .produto-"+strMenu+" ul.tipos li.alca").show();
			$("section.produtos .produto-"+strMenu+" aside span.bt-left").hide();
			$("section.produtos .produto-"+strMenu+" aside span.bt-right").hide();
			break;
		}
		$("#btnCategoria").val(strMenu);
		$("#btnSubCategoria").val(SubCategoria);
		$("#btnTipo").val(strTipo);
		$("#btnCor").val(strCor);
	}
	
	//FUN��O QUE CONTROLA OS TIPOS
	function controlaConteudoTipo(strTipo)
	{
		$("ul.cores").hide();
		$("ul.cores-"+strTipo+"").show();
		//SETA O VALOR PARA O INPUT TIPO
		controlaValoresInputsHiddem("btnTipo",strTipo);
	}
	
	//FUN��O QUE CONTROLA AS CORES
	function controlaConteudoCor(strCor)
	{
		//SETA O VALOR PARA O INPUT TIPO
		controlaValoresInputsHiddem("btnCor",strCor);
	}

	//FUN��O RESPONSAVEL POR SETAR VALOR PARA CADA INPUT
	function controlaValoresInputsHiddem(strNomeBotao, strValor)
	{
		$("#" +strNomeBotao).val(strValor);
	}
	
	$("ul.menu-produtos li").click(function () {
		controlaConteudoMenu($(this).attr("tipo"));
    });

	$("section.produtos ul.tipos li").click(function () {
		controlaConteudoTipo($(this).attr("class").replace("active",""));
	});

	$("section.produtos ul.cores li").click(function () {
		controlaConteudoCor($(this).attr("class").replace("active",""));
		retornaImagem();
	});

	//Pagina��o
	$("section.produtos aside span.bt-left").click(function () {
			$('aside div.box-img').hide();
			$(".imgLoading").show();
			
			controlaPaginacaoLeft();

			setTimeout(function(){
			$('aside div.box-img').show();
				$(".imgLoading").hide();
			}, 1000);
			
			RetornaNomeProduto();
	});
	$("section.produtos aside span.bt-right").click(function () {
			$('aside div.box-img').hide();
			$(".imgLoading").show();
			
			controlaPaginacaoRight();

			setTimeout(function(){
			$('aside div.box-img').show();
				$(".imgLoading").hide();
			}, 1000);
			
			RetornaNomeProduto();
		
	});

	function controlaPaginacaoLeft()
	{
		var strCat = $("#btnCategoria").val();
		var strSub = $("#btnSubCategoria").val();
		switch (strCat) {
		case "carrinho":
			if(strSub == "siris150"){strProx = "siris210";}
			if(strSub == "siris210"){strProx = "siris25";}
			if(strSub == "siris25"){strProx = "";}
			if(strSub == "carrinho"){strProx = "siris25";}
			if(strSub == ""){strProx = "siris210";}
			break;
		case "ecoflex":
			if(strSub == ""){strProx = "ecoflex-abastecedor";}
			if(strSub == "ecoflex"){strProx = "ecoflex-abastecedor";}
			if(strSub == "ecoflex-abastecedor"){strProx = "ecoflex-90";}
			if(strSub == "ecoflex-90"){strProx = "ecoflex-120";}
			if(strSub == "ecoflex-120"){strProx = "";}
			break;
		case "pallets":
			if(strSub == ""){strProx = "runner";}
			if(strSub == "pallets"){strProx = "runner";}
			if(strSub == "runner"){strProx = "";}
			break;
		case "caixas":
			break;
		case "cesta":
			break;
		}
		controlaTrocaDeImagemSubCat(strProx);
		setaValoresDefault(strCat);

	}

	function controlaPaginacaoRight()
	{
		var strCat = $("#btnCategoria").val();
		var strSub = $("#btnSubCategoria").val();
		switch (strCat) {
		case "carrinho":
			if(strSub == "siris150"){strProx = "siris25";}
			if(strSub == "siris25"){strProx = "siris210";}
			if(strSub == "siris210"){strProx = "";}
			if(strSub == "carrinho"){strProx = "siris25";}
			if(strSub == ""){strProx = "siris25";}
			break;
		case "ecoflex":
			if(strSub == ""){strProx = "ecoflex-120";}
			if(strSub == "ecoflex"){strProx = "ecoflex-120";}
			if(strSub == "ecoflex-120"){strProx = "ecoflex-90";}
			if(strSub == "ecoflex-90"){strProx = "ecoflex-abastecedor";}
			if(strSub == "ecoflex-abastecedor"){strProx = "";}
			break;
		case "pallets":
			if(strSub == ""){strProx = "runner";}
			if(strSub == "pallets"){strProx = "runner";}
			if(strSub == "runner"){strProx = "";}
			break;
		case "caixas":
			break;
		case "cesta":
			break;
		}
		controlaTrocaDeImagemSubCat(strProx);
		setaValoresDefault(strCat);
	}
	
	function controlaTrocaDeImagemSubCat(strProx)
	{
			$("#btnCor").val("cinza");
			controlaValoresInputsHiddem("btnSubCategoria",strProx);
			var strCat = $("#btnCategoria").val();
			
			switch (strCat) {
			case "carrinho":
				retornaImagemTrocaSubCatCarrinho();
				controlaAlcas(strCat,strProx);
				break;
			case "ecoflex":
				retornaImagemTrocaSubCatEcoflex();
				break;
			case "pallets":
				controlaValoresInputsHiddem("btnCor","preto");
				retornaImagemTrocaSubCatPallets();
				desligaCores(strProx);
				break;
			case "caixas":
				break;
			case "cesta":
				break;
			}
	}
	
	function controlaAlcas(strMenu,strProx)
	{
		$("section.produtos .produto-"+strMenu+" .grupo-"+strMenu+" ul.cores-base").show().addClass('active');;

		if(strProx == "siris25"){
			$("section.produtos .produto-"+strMenu+" .carrinho .alca").attr('src',"img/produtos/carrinho-siris25-alca-cinza.png");
			$("section.produtos .produto-"+strMenu+" .grupo-"+strMenu+" ul.tipos li.alca").show();
			$("section.produtos .produto-"+strMenu+" aside div.box-img img.alca").show();
			$("section.produtos .produto-"+strMenu+" .grupo-"+strMenu+" ul.tipos li.acessorio").hide();
			$("section.produtos .produto-"+strMenu+" aside div.box-img img.acessorio").hide();
		}else{
			$("section.produtos .produto-"+strMenu+" .grupo-"+strMenu+" ul.tipos li.acessorio").show();
			$("section.produtos .produto-"+strMenu+" aside div.box-img img.acessorio").show();
			$("section.produtos .produto-"+strMenu+" .grupo-"+strMenu+" ul.tipos li.alca").hide();
			$("section.produtos .produto-"+strMenu+" aside div.box-img img.alca").hide();
			$("li.alca").css("display", "none");
			$(".alca").css("display", "none");
		}
	}
	
	function retornaImagemTrocaSubCatCarrinho()
	{
		var strCategoria = $("#btnCategoria").val().replace(" ","");
		var strSubCategoria = $("#btnSubCategoria").val().replace(" ","");
		var strTipo = $("#btnTipo").val().replace(" ","");
		var strCor = $("#btnCor").val().replace(" ","");

		var strImgBase = "img/produtos/"+strCategoria+ "-" + strSubCategoria + "-base-" + strCor + ".png";
		var strImgCesto = "img/produtos/"+strCategoria+ "-" + strSubCategoria + "-cesto-" + strCor + ".png";
		var strImgAcessorio = "img/produtos/"+strCategoria+ "-" + strSubCategoria + "-acessorio-" + strCor + ".png";
		strImgBase = strImgBase.replace("--","-").replace("--","-").replace("--","-").replace("--","-").replace("siris150","").replace("--","-");
		strImgCesto = strImgCesto.replace("--","-").replace("--","-").replace("--","-").replace("--","-").replace("siris150","").replace("--","-");
		strImgAcessorio = strImgAcessorio.replace("--","-").replace("--","-").replace("--","-").replace("--","-").replace("siris150","").replace("--","-");
		
		//alert(strImg);
		$(".produto-"+strCategoria+" aside div.box-img img.base").attr('src',strImgBase);
		$(".produto-"+strCategoria+" aside div.box-img img.cesto").attr('src',strImgCesto);
		
		if(strSubCategoria == ""){
				$(".produto-"+strCategoria+" aside div.box-img img.acessorio").attr('src',strImgAcessorio);
				$(".produto-"+strCategoria+" img.alca").remove();
				$(".produto-"+strCategoria+" aside div.box-img img.acessorio").remove();
				$("div.carrinho").append("<img src='img/produtos/carrinho-acessorio-cinza.png' alt='' class='acessorio' id='acessorio' />");
		}else if(strSubCategoria == "siris210"){
		
			$(".produto-"+strCategoria+" aside div.box-img img.acessorio").attr('src',strImgAcessorio);
			$(".produto-"+strCategoria+" img.alca").remove();
			$(".produto-"+strCategoria+" aside div.box-img img.acessorio").remove();
			$("div.carrinho").append("<img src='img/produtos/carrinho-siris210-acessorio-cinza.png' alt='' class='acessorio' id='acessorio' />");
		
		}else{
			$(".produto-"+strCategoria+" aside div.box-img img.acessorio").hide();
			$(".produto-"+strCategoria+" aside div.box-img img.acessorio").remove();
			$(".produto-"+strCategoria+" img.alca").remove();
			$("div.carrinho").append("<img src='img/produtos/carrinho-siris25-alca-cinza.png' alt='' class='alca' id='alca' />");
		}
	}

	function retornaImagemTrocaSubCatEcoflex()
	{
		var strCategoria = $("#btnCategoria").val().replace(" ","");
		var strSubCategoria = $("#btnSubCategoria").val().replace(" ","");
		var strTipo = $("#btnTipo").val().replace(" ","");
		var strCor = $("#btnCor").val().replace(" ","");

		var strImgBase = "img/produtos/"+strCategoria+ "-" + strSubCategoria + "-base-" + strCor + ".png";
		var strImgCesto = "img/produtos/"+strCategoria+ "-" + strSubCategoria + "-cesto-" + strCor + ".png";
		var strImgAcessorio = "img/produtos/"+strCategoria+ "-" + strSubCategoria + "-acessorio-" + strCor + ".png";
		strImgBase = strImgBase.replace("--","-").replace("--","-").replace("--","-").replace("--","-").replace("ecoflex-ecoflex","ecoflex");
		strImgCesto = strImgCesto.replace("--","-").replace("--","-").replace("--","-").replace("--","-").replace("ecoflex-ecoflex","ecoflex");
		strImgAcessorio = strImgAcessorio.replace("--","-").replace("--","-").replace("--","-").replace("--","-").replace("ecoflex-ecoflex","ecoflex");
		
		//alert(strImg);
		$(".produto-"+strCategoria+" aside div.box-img img.base").attr('src',strImgBase);
		$(".produto-"+strCategoria+" aside div.box-img img.cesto").attr('src',strImgCesto);
		$(".produto-"+strCategoria+" aside div.box-img img.acessorio").attr('src',strImgAcessorio);
		
		if(strSubCategoria == "ecoflex-abastecedor"){
			
			$(".produto-"+strCategoria+" aside div.box-img img.acessorio").attr('src',strImgAcessorio);
			$(".produto-"+strCategoria+" aside div.box-img img.acessorio").remove();
			$("div.ecoflex").append("<img src='img/produtos/ecoflex-abastecedor-acessorio-cinza.png' alt='' class='acessorio' id='acessorio' />");
		
		}else{
			
			$(".produto-"+strCategoria+" aside div.box-img img.acessorio").hide();
			$(".produto-"+strCategoria+" aside div.box-img img.acessorio").remove();
		}
	}
	
	function retornaImagemTrocaSubCatPallets()
	{
		var strCategoria = $("#btnCategoria").val().replace(" ","");
		var strSubCategoria = $("#btnSubCategoria").val().replace(" ","");
		var strTipo = $("#btnTipo").val().replace(" ","");
		var strCor = $("#btnCor").val().replace(" ","");

		var strImgBase = "img/produtos/"+strCategoria+ "-" + strSubCategoria + "-" + strTipo + "-" + strCor + ".png";
		strImgBase = strImgBase.replace("--","-").replace("--","-").replace("--","-").replace("--","-");
		
		//alert(strImgBase);
		$(".produto-"+strCategoria+" aside div.box-img img.pallets").attr('src',strImgBase);
	}

	function desligaCores(strProx)
	{
			if(strProx == ""){
				$(".grupo-pallets ul.cores li").show();
				$(".produto-pallets .palletRunner").hide();
				$(".produto-pallets .palletDefault").show();
			}else{
				$(".produto-pallets .palletRunner").show();
				$(".produto-pallets .palletDefault").hide();
				$(".grupo-pallets ul.cores li").first().show().next().hide().next().hide().next().hide();
			}
	}
	
	
	$("div.info-modelos span").click(
        function () {
			controlaModelos();
			controlaTrocaDeImagemSubCat($(this).attr("tipo"));
    });	

	function controlaModelos()
	{
		$("div.info").fadeOut();
		$("h3.nome-produto").show();
		$("span.bt-tecnicas, span.bt-diferenciais, span.bt-modelos, span.bt-dimensoes, span.bt-opcionais, span.bt-cesto").removeClass('bt-active');
	}

	$("div.info span.bt-fechar").click(
        function () {
			controlaModelos();
    });	

	// Botoes de Informa�oes tecnicas
	$("span.bt-tecnicas, span.bt-diferenciais, span.bt-modelos, span.bt-dimensoes, span.bt-opcionais, span.bt-cesto").click(
        function () {
			
			$("div.info, h3.nome-produto").hide();
			$("span.bt-tecnicas, span.bt-diferenciais, span.bt-modelos, span.bt-dimensoes, span.bt-opcionais, span.bt-cesto").removeClass('bt-active');
			$(this).addClass('bt-active');
			$(this).next().fadeIn();
			
			if($(this).attr("class") == "bt-diferenciais bt-active"){
				//carregaInfoModelos();
				var strSub = $("#btnSubCategoria").val();
				if(strSub == ""){
					$(this).next().fadeIn();
				}else if(strSub == "siris210"){
					$(this).next().hide();
					$(this).next().next().fadeIn();
				}else if(strSub == "siris25"){
					$(this).next().hide();
					$(this).next().next().hide();
					$(this).next().next().next().fadeIn();
				}else if(strSub == "ecoflex-120"){
					$(this).next().fadeIn();
				}else if(strSub == "ecoflex-90"){
					$(this).next().fadeIn();
				}else if(strSub == "ecoflex-abastecedor"){
					$(this).next().hide();
					$(this).next().next().fadeIn();
				}
			}
			
			if($(this).attr("class") == "bt-opcionais bt-active"){
				var strSub = $("#btnSubCategoria").val();
				if(strSub == ""){
					$(this).next().fadeIn();
				}else if(strSub == "siris210"){
					$(this).next().hide();
					$(this).next().next().fadeIn();
				}else if(strSub == "siris25"){
					$(this).next().hide();
					$(this).next().next().hide();
					$(this).next().next().next().fadeIn();
				}else if(strSub == "ecoflex-120"){
					$(this).next().hide();
					$(this).next().next().fadeIn();
				}else if(strSub == "ecoflex-90"){
					$(this).next().hide();
					$(this).next().next().hide();
					$(this).next().next().next().fadeIn();
				}else if(strSub == "ecoflex-abastecedor"){
					$(this).next().hide();
					$(this).next().next().hide();
					$(this).next().next().next().hide();
					$(this).next().next().next().next().fadeIn();
				}
			}			
			
			if($(this).attr("class") == "bt-tecnicas bt-active"){
				var strSub = $("#btnSubCategoria").val();
				if(strSub == ""){
					$(this).next().fadeIn();
				}else if(strSub == "runner"){
					$(this).next().hide();
					$(this).next().next().fadeIn();
				}
			}
			
    });	

	function carregaInfoModelos()
	{
		var strSub = $("#btnSubCategoria").val();
		$("div ." + strSub).show();
	}
	
//	$("div.carrinho .bt-prod").click(
//        function () {
//			$("div.info").fadeOut();
//    });	

	$("div.info dt").click(function () {
		var textDesc = $(this).next().html();
		var classImg = $(this).children().attr('src');
			$('body').append("<div class='bg-filter'></div><div class='floater'><img src='" + classImg + "' alt='" + textDesc + "' /><p>" + textDesc + "</p><span class='bt-fechar-figure' title='Fechar'>Fechar</span></figure>");
			$("span.bt-fechar-figure").click(function (){
				$('.bg-filter, .floater').remove();
			});
	});
	
	$("span.bt-prod").click(function () {
			var strValor = $(this).attr("id");	 
			
			controlaValoresInputsHiddem("btnSubCategoria", strValor);
			controlaTrocaDeImagemSubCat(strValor);	 
			RetornaNomeProduto();

			setTimeout(function(){
			$('aside div.box-img').show();
				$(".imgLoading").hide();
			}, 1000);
			
			
    });	


	function RetornaNomeProduto()
	{
		var strCat = $("#btnCategoria").val();
		var strSub = $("#btnSubCategoria").val();
		
		
		switch (strCat) {
		case "carrinho":
				switch (strSub) {
				case "":
					strRetorno = "Siris 150";
					break;
				case "siris150":
					strRetorno = "Siris 150";
					break;
				case "siris25":
					strRetorno = "Siris 25";
					break;
				case "siris210":
					strRetorno = "Siris 210";
					break;
				}
			break;
		case "ecoflex":
				switch (strSub) {
				case "":
					strRetorno = "Ecoflex 60";
					break;
				case "ecoflex-90":
					strRetorno = "Ecoflex 90";
					break;
				case "ecoflex-120":
					strRetorno = "Ecoflex 120";
					break;
				case "ecoflex-abastecedor":
					strRetorno = "Ecoflex Abastecedor";
					break;
				}
			break;
		case "pallets":
				switch (strSub) {
				case "pallets":
					strRetorno = "Pallets";
					break;
				case "":
					strRetorno = "Pallets";
					break;
				case "runner":
					strRetorno = "Pallets Runner";
					break;
				}
			break;
		case "caixas":
			strRetorno = "Caixas Multiuso";
			break;
		case "cesta":
			strRetorno = "Cesta";
			break;
		}
		
		$("section.produtos .produto-"+strCat+" aside h3.nome-produto").html(strRetorno);
	}




	//fim do post carrega pagina
	//});
	
	$("div.texto li, ul.menu-produtos li").click(
        function () {
			//$("div.info").fadeOut();
			$("span.bt-tecnicas, span.bt-diferenciais, span.bt-modelos, span.bt-dimensoes, span.bt-opcionais, span.bt-cesto").removeClass('bt-active');
    });	
	
	
	$("ul.menu-produtos li.pallets").click(
        function () {
			$(".produto-pallets .bt-right, .produto-pallets .bt-left").css('display','block!important');
    });	
	
	
});

