// JavaScript Document
// Função para iniciar as demais
$(document).ready(function() {
    linksRetorno();
    linksExternos();
    configureEvents();
	configureCSS();
	sifr_site();
	if(light_regiao == 'mostrar'){
		tb_show('','../php/light_regiao.php?TB_iframe=true&width=560&height=117&modal=true','');
	}
	if(light_campanha == 'mostrar' && light_regiao != 'mostrar'){
		tb_show('','../html/light_video_campanha2.htm?keepThis=true&TB_iframe=true&width=450&height=372','');
	}
	if(light_programete == 'mostrar' && light_regiao != 'mostrar'){
		tb_show('','../html/light_video_campanha3.htm?keepThis=true&TB_iframe=true&width=450&height=372','');
	}
	
	/*if (light_liquidacao == 'mostrar') {
		var width = $('body').width();
		tb_show('','../html/light_liquidacao.htm?keepThis=true&TB_iframe=true&width='+width+'&height=300','');
		
	}*/
});
var id_atual = 0;
function sifr_site(){
	if(typeof sIFR == "function"){
		sIFR.replaceElement(".topo-menu", "../flash/sifr.swf", "#89949E", null, null, null, 0, 0, 0, 0);
		sIFR.replaceElement(".topo-menu2", "../flash/sifr.swf", "#89949E", null, null, null, 0, 0, 0, 0);
		sIFR.replaceElement(".topo-menu-quebra", "../flash/sifr.swf", "#89949E", null, null, null, 0, 0, 0, 0);
		sIFR.replaceElement(".topo-regiao", "../flash/sifr.swf", "#8E4771", null, null, null, 0, 0, 0, 0);
		sIFR.replaceElement(".rodape-politica", "../flash/sifr.swf", "#58585A", null, null, null, 0, 0, 0, 0);
		sIFR.replaceElement(".rodape-trabalhe", "../flash/sifr.swf", "#58585A", null, null, null, 0, 0, 0, 0);
		sIFR.replaceElement(".rodape-extrato", "../flash/sifr.swf", "#58585A", null, null, null, 0, 0, 0, 0);
		sIFR.replaceElement(".rodape-quebra", "../flash/sifr.swf", "#58585A", null, null, null, 0, 0, 0, 0);
		sIFR.replaceElement(".rodape-visite", "../flash/sifr.swf", "#B5B5B6", null, null, null, 0, 0, 0, 0);
		sIFR.replaceElement(".rodape-paqueta", "../flash/sifr.swf", "#58585A", null, null, null, 0, 0, 0, 0);
		sIFR.replaceElement(".rodape-onze", "../flash/sifr.swf", "#58585A", null, null, null, 0, 0, 0, 0);
		$(".topo-menu").css("visibility","visible");
		$(".topo-menu2").css("visibility","visible");
		$(".topo-menu-quebra").css("visibility","visible");
		$(".topo-regiao").css("visibility","visible");
		$(".rodape-politica").css("visibility","visible");
		$(".rodape-trabalhe").css("visibility","visible");
		$(".rodape-extrato").css("visibility","visible");
		$(".rodape-quebra").css("visibility","visible");
		$(".rodape-visite").css("visibility","visible");
		$(".rodape-paqueta").css("visibility","visible");
		$(".rodape-onze").css("visibility","visible");
	};
}
// Funcao para inserir _blank em links externos
function linksRetorno() {
	$("a[rel=back]").click( function(){ history.back(); return false });
}
// Funcao para inserir _blank em links externos
function linksExternos() {
	$("a[rel=external]").attr("target", "_blank");
}

function configureEvents() {
	frmFaleConosco();
	frmCadastre();
	frmIndique();
	//REFERENTE AO COMBO DE ESTADO DO FALE CONOSCO
	if($("#fale-conosco-estados").length > 0){
		$('#fale-conosco-estados').change(function() {
			uf = $('#fale-conosco-estados').val();
			$.ajax({ url: "../php/busca_cidades.php?uf="+uf, context: document.body, success: function(retorno){
				retorno = retorno.split(",");
				if(retorno != ''){
					$('#fale-conosco-cidades').html("<option value=''>Selecione a Cidade</option>");
					for(x=0; x < retorno.length; x++){
						cidade = retorno[x].split("|");
						$('#fale-conosco-cidades').append("<option value='"+cidade[0]+"'>"+cidade[1]+"</option>");
					}
				}else{
					$('#fale-conosco-cidades').html("<option value=''>Selecione o Estado</option>");
				}
			}});
		});	
	}
	
	//REFERENTE AO COMBO DE ESTADO DO CADASTRE
	if($("#cadastre-estados").length > 0){
		$('#cadastre-estados').change(function() {
			uf = $('#cadastre-estados').val();
			$.ajax({ url: "../php/busca_cidades.php?uf="+uf, context: document.body, success: function(retorno){
				retorno = retorno.split(",");
				if(retorno != ''){
					$('#cadastre-cidades').html("<option value=''>Selecione a Cidade</option>");
					for(x=0; x < retorno.length; x++){
						cidade = retorno[x].split("|");
						$('#cadastre-cidades').append("<option value='"+cidade[0]+"'>"+cidade[1]+"</option>");
					}
				}else{
					$('#cadastre-cidades').html("<option value=''>Selecione o Estado</option>");
				}
			}});
		});	
	}
	
	//REFERENTE AS FLECHAS DE NAVEGAÇÃO DOS PRODUTOS
	if($("#colecao-seta-esq").length > 0){
		$('#colecao-seta-esq').click(function() {
											  
			//REFERENTE A BORDA CSS
			$(".colecao-categorias-bloco").removeClass('borda-produto');
											  
			var elems = $(".produto-foto");
			if(elems.length > 0){
				id_atual = parseInt(id_atual)-1;
				if(id_atual < 0){
					id_atual = elems.length-1;
				}
				id_produto = elems[id_atual].id.replace('produto-','');
				$(".colecao-produto").html("<img src='"+elems[id_atual].src.replace('p_','')+"' />");
				$(".colecao-cod").html('<span class="bld">Cód. </span>'+$(elems[id_atual]).attr("alt"));
				$(".colecao-ref").html('<span class="bld">Ref. </span>'+$(elems[id_atual]).attr("title"));
			}
			
			id = $(elems[id_atual]).parent().parent().attr('id');
			id = id.replace('bloco-','');
			if($("#bt-mais-"+id).length > 0){
				
				$("#bt-mais-"+id).attr('src','../img/bt-menos.gif');
				$.ajax({ url: "../php/busca_categorias.php?id_categoria="+id+"&limit=todos", context: document.body, success: function(retorno){
					retorno = retorno.split('|');
					$("#bloco-"+id).html(retorno[0]);
					if ($('.bt-mais-colecao').length > 0) {
						$('.bt-mais-colecao').click(mostraCategoria);
					}
					if ($('.produto-foto').length > 0) {
						$('.produto-foto').click(mostraProduto);
					}
					var flashvars = {
						tipo: retorno[2],
						categoria: retorno[1]
					};
					var params = {
					  menu: "false",
					  wmode: "transparent"
					};
					var attributes = {
					  id: "flash-categoria-titulo-'.$id_categoria.'",
					  name: "flash-categoria-titulo-'.$id_categoria.'"
					};
					
					swfobject.embedSWF("../flash/titulo.swf", "flash-categoria-titulo-"+id, "507", "37", "9.0.0","", flashvars, params, attributes);
					$("#div-produto-"+id_produto).addClass('borda-produto');
				}});
				//REFERENTE A MARGIN DO RODAPE
				var tam_total = $(".colecao-categorias").height();
				var margin_total = $(".colecao-categorias").css('margin-top');
				margin_total = margin_total.replace("px","");
				margin_total = parseInt(tam_total)+parseInt(margin_total);
			
				$("#rodape-colecao").css('margin-top',margin_total+170);
				$("#rodape-colecao").css('margin-bottom',20);
			}
			
			
		});
		$('#colecao-seta-dir').click(function() {
			var elems = $(".produto-foto");
			if(elems.length > 0){
				id_atual = parseInt(id_atual)+1;
				if(id_atual > elems.length-1){
					id_atual = 0;
				}
				id_produto = elems[id_atual].id.replace('produto-','');
				$(".colecao-produto").html("<img src='"+elems[id_atual].src.replace('p_','')+"' />");
				$(".colecao-cod").html('<span class="bld">Cód. </span>'+$(elems[id_atual]).attr("alt"));
				$(".colecao-ref").html('<span class="bld">Ref. </span>'+$(elems[id_atual]).attr("title"));
				
				//REFERENTE A BORDA CSS
				$(".colecao-categorias-bloco").removeClass('borda-produto');
				$("#div-produto-"+elems[id_atual].id.replace("produto-","")).addClass('borda-produto');
			}
			
			
			id = $(elems[id_atual]).parent().parent().attr('id');
			id = id.replace('bloco-','');
			if($("#bt-mais-"+id).length > 0){
				
				$("#bt-mais-"+id).attr('src','../img/bt-menos.gif');
				$.ajax({ url: "../php/busca_categorias.php?id_categoria="+id+"&limit=todos", context: document.body, success: function(retorno){
					retorno = retorno.split('|');
					$("#bloco-"+id).html(retorno[0]);
					if ($('.bt-mais-colecao').length > 0) {
						$('.bt-mais-colecao').click(mostraCategoria);
					}
					if ($('.produto-foto').length > 0) {
						$('.produto-foto').click(mostraProduto);
					}
					var flashvars = {
						tipo: retorno[2],
						categoria: retorno[1]
					};
					var params = {
					  menu: "false",
					  wmode: "transparent"
					};
					var attributes = {
					  id: "flash-categoria-titulo-'.$id_categoria.'",
					  name: "flash-categoria-titulo-'.$id_categoria.'"
					};
					
					swfobject.embedSWF("../flash/titulo.swf", "flash-categoria-titulo-"+id, "507", "37", "9.0.0","", flashvars, params, attributes);
					$("#div-produto-"+id_produto).addClass('borda-produto');
				}});
				//REFERENTE A MARGIN DO RODAPE
				var tam_total = $(".colecao-categorias").height();
				var margin_total = $(".colecao-categorias").css('margin-top');
				margin_total = margin_total.replace("px","");
				margin_total = parseInt(tam_total)+parseInt(margin_total);
			
				$("#rodape-colecao").css('margin-top',margin_total+170);
				$("#rodape-colecao").css('margin-bottom',20);
			}
			
			
			
		});
	}

	//REFERENTE AOS TÍTULOS EM FLASH DA COLEÇÃO
	if($("#arr-flash-titulos").length > 0){
		var arr = $("#arr-flash-titulos").html();
		arr = arr.split(",");
		for(z=0; z < arr.length; z++){
			arr2 = arr[z].split("|");
			var flashvars = {
				tipo: arr2[0],
				categoria: arr2[1]
			};
			var params = {
			  menu: "false",
			  wmode: "transparent"
			};
			var attributes = {
			  id: "flash-categoria-titulo-"+arr2[2],
			  name: "flash-categoria-titulo-"+arr2[2]
			};
			swfobject.embedSWF("../flash/titulo.swf", "flash-categoria-titulo-"+arr2[2], "507", "37", "9.0.0","", flashvars, params, attributes);	
		}
		//REFERENTE A MARGIN DO RODAPE
		var tam_total = $(".colecao-categorias").height();
		var margin_total = $(".colecao-categorias").css('margin-top');
		margin_total = margin_total.replace("px","");
		margin_total = parseInt(tam_total)+parseInt(margin_total);

		$("#rodape-colecao").css('margin-top',margin_total+50);
		$("#rodape-colecao").css('margin-bottom',20);
	}

	//REFERENTE AO BOTÃO DA THUMB DO PRODUTO
	if ($('.produto-foto').length > 0) {
		$('.produto-foto').click(mostraProduto);
	}

	//REFERENTE AO BOTÃO CHECKBOX FEMININO
	if ($('#chk-feminino').length > 0) {
		$('#chk-feminino').click(function() {
			src = this.src.split("/");
			pos = src.length;
			src = src[pos-1];
			if(src == 'bg-colecao-check-on.gif'){
				this.src = '../img/bg-colecao-check-off.gif';
				$(".Feminino").remove();
				$.ajax({ url: "../php/busca_categorias_todas.php?id_tipo=1", context: document.body, success: function(retorno){
					retorno = retorno.split('|');
					if ($('.bt-mais-colecao').length > 0) {
						$('.bt-mais-colecao').click(mostraCategoria);
					}
					if ($('.produto-foto').length > 0) {
						$('.produto-foto').click(mostraProduto);
					}
					arr_ids = retorno[1];
					arr_ids = arr_ids.split(",");
					for(z=0; z < arr_ids.length; z++){
						$("#chk-"+arr_ids[z]).attr('src','../img/bg-colecao-check-off.gif');
					}
				}});
					//REFERENTE A MARGIN DO RODAPE
					var tam_total = $(".colecao-categorias").height();
					var margin_total = $(".colecao-categorias").css('margin-top');
					margin_total = margin_total.replace("px","");
					margin_total = parseInt(tam_total)+parseInt(margin_total);
					if($('.colecao-categorias').height() == '0'){
						$("#rodape-colecao").css('margin-top',margin_total+220);
					}else{
						$("#rodape-colecao").css('margin-top',margin_total+50);
					}
					$("#rodape-colecao").css('margin-bottom',20);
			}else{
				this.src = '../img/bg-colecao-check-on.gif';
				$.ajax({ url: "../php/busca_categorias_todas.php?id_tipo=1", context: document.body, success: function(retorno){
					retorno = retorno.split('|');
					$(".colecao-categorias").prepend(retorno[0]);
					if ($('.bt-mais-colecao').length > 0) {
						$('.bt-mais-colecao').click(mostraCategoria);
					}
					if ($('.produto-foto').length > 0) {
						$('.produto-foto').click(mostraProduto);
					}
					
					arr_ids = retorno[1];
					arr_ids = arr_ids.split(",");
					arr_titulos = retorno[2];
					arr_titulos = arr_titulos.split(",");
					for(z=0; z < arr_ids.length; z++){
						$("#chk-"+arr_ids[z]).attr('src','../img/bg-colecao-check-on.gif');
						var flashvars = {
							tipo: 'Feminino',
							categoria: arr_titulos[z]
						};
						var params = {
						  menu: "false",
						  wmode: "transparent"
						};
						var attributes = {
						  id: "flash-categoria-titulo-",
						  name: "flash-categoria-titulo-"
						};
						swfobject.embedSWF("../flash/titulo.swf", "flash-categoria-titulo-"+arr_ids[z], "507", "37", "9.0.0","", flashvars, params, attributes);	
					}
					//REFERENTE A MARGIN DO RODAPE
					var tam_total = $(".colecao-categorias").height();
					var margin_total = $(".colecao-categorias").css('margin-top');
					margin_total = margin_total.replace("px","");
					margin_total = parseInt(tam_total)+parseInt(margin_total);
			
					$("#rodape-colecao").css('margin-top',margin_total+50);
					$("#rodape-colecao").css('margin-bottom',20);
				}});

			}
		});
	}
	
	//REFERENTE AO BOTÃO CHECKBOX MASCULINO
	if ($('#chk-masculino').length > 0) {
		$('#chk-masculino').click(function() {
			src = this.src.split("/");
			pos = src.length;
			src = src[pos-1];
			id = this.id;
			id = id.replace("chk-","");
			if(src == 'bg-colecao-check-on.gif'){
				this.src = '../img/bg-colecao-check-off.gif';
				$(".Masculino").remove();
				$.ajax({ url: "../php/busca_categorias_todas.php?id_tipo=2", context: document.body, success: function(retorno){
					retorno = retorno.split('|');
					if ($('.bt-mais-colecao').length > 0) {
						$('.bt-mais-colecao').click(mostraCategoria);
					}
					if ($('.produto-foto').length > 0) {
						$('.produto-foto').click(mostraProduto);
					}
					arr_ids = retorno[1];
					arr_ids = arr_ids.split(",");
					for(z=0; z < arr_ids.length; z++){
						$("#chk-"+arr_ids[z]).attr('src','../img/bg-colecao-check-off.gif');
					}
				}});
					//REFERENTE A MARGIN DO RODAPE
					var tam_total = $(".colecao-categorias").height();
					var margin_total = $(".colecao-categorias").css('margin-top');
					margin_total = margin_total.replace("px","");
					margin_total = parseInt(tam_total)+parseInt(margin_total);
					if($('.colecao-categorias').height() == '0'){
						$("#rodape-colecao").css('margin-top',margin_total+220);
					}else{
						$("#rodape-colecao").css('margin-top',margin_total+50);
					}
					$("#rodape-colecao").css('margin-bottom',20);
				
			}else{
				this.src = '../img/bg-colecao-check-on.gif';
				$.ajax({ url: "../php/busca_categorias_todas.php?id_tipo=2", context: document.body, success: function(retorno){
					retorno = retorno.split('|');
					$(".colecao-categorias").prepend(retorno[0]);
					if ($('.bt-mais-colecao').length > 0) {
						$('.bt-mais-colecao').click(mostraCategoria);
					}
					if ($('.produto-foto').length > 0) {
						$('.produto-foto').click(mostraProduto);
					}
					
					arr_ids = retorno[1];
					arr_ids = arr_ids.split(",");
					arr_titulos = retorno[2];
					arr_titulos = arr_titulos.split(",");
					for(z=0; z < arr_ids.length; z++){
						$("#chk-"+arr_ids[z]).attr('src','../img/bg-colecao-check-on.gif');
						var flashvars = {
							tipo: 'Masculino',
							categoria: arr_titulos[z]
						};
						var params = {
						  menu: "false",
						  wmode: "transparent"
						};
						var attributes = {
						  id: "flash-categoria-titulo-",
						  name: "flash-categoria-titulo-"
						};
						swfobject.embedSWF("../flash/titulo.swf", "flash-categoria-titulo-"+arr_ids[z], "507", "37", "9.0.0","", flashvars, params, attributes);	
					}
					//REFERENTE A MARGIN DO RODAPE
					var tam_total = $(".colecao-categorias").height();
					var margin_total = $(".colecao-categorias").css('margin-top');
					margin_total = margin_total.replace("px","");
					margin_total = parseInt(tam_total)+parseInt(margin_total);
			
					$("#rodape-colecao").css('margin-top',margin_total+50);
					$("#rodape-colecao").css('margin-bottom',20);
				}});
			}
		});
	}

	//REFERENTE AO BOTÃO CHECKBOX DA COLEÇÃO
	if ($('.chk-categoria').length > 0) {
		$('.chk-titulo').click(function(){
			id = this.id;
			id = id.replace('chk-titulo-','');
			$('#chk-'+id).click();
		});
		$('.chk-categoria').click(function() {
			src = this.src.split("/");
			pos = src.length;
			src = src[pos-1];
			id = this.id;
			id = id.replace("chk-","");
			if(src == 'bg-colecao-check-on.gif'){
				this.src = '../img/bg-colecao-check-off.gif';
				$("#bloco-"+id).remove();
				
				//REFERENTE A MARGIN DO RODAPE
				if($('.colecao-categorias').height() > 200){
					var tam_total = $(".colecao-categorias").height();
					var margin_total = $(".colecao-categorias").css('margin-top');
					margin_total = margin_total.replace("px","");
					margin_total = parseInt(tam_total)+parseInt(margin_total);
		
					$("#rodape-colecao").css('margin-top',margin_total+20);
					$("#rodape-colecao").css('margin-bottom',20);
				}
			}else{
				this.src = '../img/bg-colecao-check-on.gif';
				$.ajax({ url: "../php/busca_categorias.php?id_categoria="+id, context: document.body, success: function(retorno){
					retorno = retorno.split('|');
					$(".colecao-categorias").prepend(retorno[0]);
					if ($('.bt-mais-colecao').length > 0) {
						$('.bt-mais-colecao').click(mostraCategoria);
					}
					if ($('.produto-foto').length > 0) {
						$('.produto-foto').click(mostraProduto);
					}
					
					var flashvars = {
						tipo: retorno[2],
						categoria: retorno[1]
					};
					var params = {
					  menu: "false",
					  wmode: "transparent"
					};
					var attributes = {
					  id: "flash-categoria-titulo-'.$id_categoria.'",
					  name: "flash-categoria-titulo-'.$id_categoria.'"
					};
					
					swfobject.embedSWF("../flash/titulo.swf", "flash-categoria-titulo-"+id, "507", "37", "9.0.0","", flashvars, params, attributes);
					
				}});
				//REFERENTE A MARGIN DO RODAPE
				var tam_total = $(".colecao-categorias").height();
				var margin_total = $(".colecao-categorias").css('margin-top');
				margin_total = margin_total.replace("px","");
				margin_total = parseInt(tam_total)+parseInt(margin_total);
	
				$("#rodape-colecao").css('margin-top',margin_total+230);
				$("#rodape-colecao").css('margin-bottom',20);
			}
		});
	}

	//REFERENTE AO BOTÃO MAIS DA COLEÇÃO
	if ($('.bt-mais-colecao').length > 0) {
		$('.bt-mais-colecao').click(mostraCategoria);
	}

	//REFERENTE AO BOTÃO CADASTRE
	if ($('#cadastre-bt').length > 0) {
		$('#cadastre-bt').click(function() {
			if($('#cadastre-bloco').css('display') == 'none'){
				$('#cadastre-bloco').show('fast');
			}else{
				$('#cadastre-bloco').hide('fast');
			}
		});
	}
	
	//REFERENTE AO BOTÃO FECHAR DO CADASTRE
	if ($('#cadastre-bt-fechar').length > 0) {
		$('#cadastre-bt-fechar').click(function() {
			$("#cadastre-bloco").hide();
		});
	}
	
	//REFERENTE AO OVER NO MENU
	$('.menu-colecao').mouseover(function() {
		$('.menu-colecao').addClass("menu-colecao-over");
		$('#menu-over').show();
	});
	$('#menu-over').mouseover(function() {
		$('.menu-colecao').addClass("menu-colecao-over");
		$('#menu-over').show();
	});
	$('.menu-colecao').mouseout(function() {
		$('.menu-colecao').removeClass("menu-colecao-over");
		$('#menu-over').hide();
	});
	$('#menu-over').mouseout(function() {
		$('.menu-colecao').removeClass("menu-colecao-over");
		$('#menu-over').hide();
	});
	$('.menu-campanha').mouseover(function() {
		$('.menu-campanha').addClass("menu-campanha-over");
	});
	$('.menu-campanha').mouseout(function() {
		$('.menu-campanha').removeClass("menu-campanha-over");
	});
	$('.menu-cartao-presente').mouseover(function() {
		$('.menu-cartao-presente').addClass("menu-cartao-presente-over");
	});
	$('.menu-cartao-presente').mouseout(function() {
		$('.menu-cartao-presente').removeClass("menu-cartao-presente-over");
	});
	$('.menu-cartao-paqueta').mouseover(function() {
		$('.menu-cartao-paqueta').addClass("menu-cartao-paqueta-over");
	});
	$('.menu-cartao-paqueta').mouseout(function() {
		$('.menu-cartao-paqueta').removeClass("menu-cartao-paqueta-over");
	});
	$('.menu-loja').mouseover(function() {
		$('.menu-loja').addClass("menu-loja-over");
	});
	$('.menu-loja').mouseout(function() {
		$('.menu-loja').removeClass("menu-loja-over");
	});
	
	
	// Referente ao Cartão Paquetá - RS/SC
	if ($('#bt-cartao-paqueta-rs').length > 0) {
		$('#bt-cartao-paqueta-rs').click(function() { if ($('#div-cartao-paqueta-rs').css('display') == 'none') { $('#div-cartao-paqueta-rs').show(); $('#div-cartao-paqueta-sc').hide(); $(window).scrollTop(0); } else { $('#div-cartao-paqueta-rs').hide() }});
		$('#bt-cartao-paqueta-sc').click(function() { if ($('#div-cartao-paqueta-sc').css('display') == 'none') { $('#div-cartao-paqueta-rs').hide(); $('#div-cartao-paqueta-sc').show(); $(window).scrollTop(0); } else { $('#div-cartao-paqueta-sc').hide() }});
	}
}

function mostraProduto(){
	var elems = $(".produto-foto");
	for(z=0; z < elems.length; z++){
		if(elems[z].id == this.id){
			id_atual = z;
		}
	}
	src = this.src.split("/");
	pos = src.length;
	src = src[pos-1];
	id = this.id;
	id = id.replace("produto-","");
	//REFERENTE A BORDA CSS
	$(".colecao-categorias-bloco").removeClass('borda-produto');
	id_produto = id;
	//AJAX
	$.ajax({ url: "../php/busca_produtos.php?id_produto="+id, context: document.body, success: function(retorno){
		$("#produto-bloco").html(retorno);
		if ($('.produto-foto').length > 0) {
			$('.produto-foto').click(mostraProduto);
		}
	}});

	id = $(elems[id_atual]).parent().parent().attr('id');
	id = id.replace('bloco-','');
	if($("#bt-mais-"+id).length > 0){
		
		$("#bt-mais-"+id).attr('src','../img/bt-menos.gif');
		$.ajax({ url: "../php/busca_categorias.php?id_categoria="+id+"&limit=todos", context: document.body, success: function(retorno){
			retorno = retorno.split('|');
			$("#bloco-"+id).html(retorno[0]);
			if ($('.bt-mais-colecao').length > 0) {
				$('.bt-mais-colecao').click(mostraCategoria);
			}
			if ($('.produto-foto').length > 0) {
				$('.produto-foto').click(mostraProduto);
			}
			var flashvars = {
				tipo: retorno[2],
				categoria: retorno[1]
			};
			var params = {
			  menu: "false",
			  wmode: "transparent"
			};
			var attributes = {
			  id: "flash-categoria-titulo-'.$id_categoria.'",
			  name: "flash-categoria-titulo-'.$id_categoria.'"
			};
			
			swfobject.embedSWF("../flash/titulo.swf", "flash-categoria-titulo-"+id, "507", "37", "9.0.0","", flashvars, params, attributes);
			$("#div-produto-"+id_produto).addClass('borda-produto');
		}});
		//REFERENTE A MARGIN DO RODAPE
		var tam_total = $(".colecao-categorias").height();
		var margin_total = $(".colecao-categorias").css('margin-top');
		margin_total = margin_total.replace("px","");
		margin_total = parseInt(tam_total)+parseInt(margin_total);
	
		$("#rodape-colecao").css('margin-top',margin_total+170);
		$("#rodape-colecao").css('margin-bottom',20);
	}else{
		$("#div-produto-"+id_produto).addClass('borda-produto');
	}
	$(document).scrollTop(0);
}

function mostraCategoria(param){
	if(param == 'menos'){
		this.src = '../img/bt-menos.gif';
	}
	src = this.src.split("/");
	pos = src.length;
	src = src[pos-1];
	id = this.id;
	id = id.replace("bt-mais-","");
	if(src == 'bt-mais.gif'){
		this.src = '../img/bt-menos.gif';
		$.ajax({ url: "../php/busca_categorias.php?id_categoria="+id+"&limit=todos", context: document.body, success: function(retorno){
			retorno = retorno.split('|');
			$("#bloco-"+id).html(retorno[0]);
			if ($('.bt-mais-colecao').length > 0) {
				$('.bt-mais-colecao').click(mostraCategoria);
			}
			if ($('.produto-foto').length > 0) {
				$('.produto-foto').click(mostraProduto);
			}
			var flashvars = {
				tipo: retorno[2],
				categoria: retorno[1]
			};
			var params = {
			  menu: "false",
			  wmode: "transparent"
			};
			var attributes = {
			  id: "flash-categoria-titulo-'.$id_categoria.'",
			  name: "flash-categoria-titulo-'.$id_categoria.'"
			};
			
			swfobject.embedSWF("../flash/titulo.swf", "flash-categoria-titulo-"+id, "507", "37", "9.0.0","", flashvars, params, attributes);
		}});
		//REFERENTE A MARGIN DO RODAPE
		var tam_total = $(".colecao-categorias").height();
		var margin_total = $(".colecao-categorias").css('margin-top');
		margin_total = margin_total.replace("px","");
		margin_total = parseInt(tam_total)+parseInt(margin_total);
	
		$("#rodape-colecao").css('margin-top',margin_total+170);
		$("#rodape-colecao").css('margin-bottom',20);

	}else{
		this.src = '../img/bt-mais.gif';
		$.ajax({ url: "../php/busca_categorias.php?id_categoria="+id, context: document.body, success: function(retorno){
			retorno = retorno.split('|');
			$("#bloco-"+id).html(retorno[0]);
			if ($('.bt-mais-colecao').length > 0) {
				$('.bt-mais-colecao').click(mostraCategoria);
			}
			if ($('.produto-foto').length > 0) {
				$('.produto-foto').click(mostraProduto);
			}
			var flashvars = {
				tipo: retorno[2],
				categoria: retorno[1]
			};
			var params = {
			  menu: "false",
			  wmode: "transparent"
			};
			var attributes = {
			  id: "flash-categoria-titulo-'.$id_categoria.'",
			  name: "flash-categoria-titulo-'.$id_categoria.'"
			};
			
			swfobject.embedSWF("../flash/titulo.swf", "flash-categoria-titulo-"+id, "507", "37", "9.0.0","", flashvars, params, attributes);
			
		}});
		//REFERENTE A MARGIN DO RODAPE
		var tam_total = $(".colecao-categorias").height();
		var margin_total = $(".colecao-categorias").css('margin-top');
		margin_total = margin_total.replace("px","");
		margin_total = parseInt(tam_total)+parseInt(margin_total);
	
		$("#rodape-colecao").css('margin-top',margin_total);
		$("#rodape-colecao").css('margin-bottom',20);

	}	
}
function configureCSS() {
	if ($.browser.msie) {
		if (parseInt($.browser.version) < 8){
			$(".icone").css("display","block").css("position","relative");
		}

		if (parseInt($.browser.version) == 7) {
			$("body").addClass('ie7');
		}

		if (parseInt($.browser.version) <= 6) {
			$("body").addClass('ie6');
			
			var estilos = [
				'.blog-cabecalho',
				'.equipe-cabecalho-topo',
				'#index-mulher',
				'#institucional-mulher',
				'#campanha-mulher',
				'#cartao-presente-mulher',
				'#politica-mulher',
				'img'
			];
		
			for (var i=0; i<estilos.length; i++) {
				if(estilos[i] != 'img'){
					var fundo = $(estilos[i]).css('background');
					if(fundo){
						$(estilos[i]).css('background','none');
						var tam = fundo.length;
						fundo = fundo.substr(5,tam-7);
						$(estilos[i]).html("<img src='"+fundo+"' />");
					}
				}
				DD_belatedPNG.fix(estilos[i]);
			}
		}
	}
}

///////////////
//  FLASHS  //
/////////////
//REFERENTE AO FLASH DOS DESTAQUES DA INDEX
var flashvars = {
	xml: "../php/busca_destaques.php"
};
var params = {
  menu: "false",
  wmode: "transparent"
};
var attributes = {
  id: "flash-index-colecao",
  name: "flash-index-colecao"
};

swfobject.embedSWF("../flash/destaques.swf", "flash-index-colecao", "263", "233", "9.0.0","", flashvars, params, attributes);
//REFERENTE AO FLASH DO HISTÓRICO
var flashvars = {
};
var params = {
  menu: "false",
  wmode: "transparent"
};
var attributes = {
  id: "flash-institucional-historico",
  name: "flash-institucional-historico"
};

swfobject.embedSWF("../flash/historico.swf", "institucional-historico-flash", "374", "164", "9.0.0","", flashvars, params, attributes);