<!--
  function mudaCarroselConteudo(posicao){
    //função que decide se no div carrossel-conteudo (index.php do www.samsclub.com.br) vai ser exibido os divs televendas e tabloide (posicao 1) ou tabloide e cadastrese (posicao 2)
    if(posicao == '1'){
      document.getElementById('televendas').style.display = 'block';
      document.getElementById('tabloide-dir').style.display = 'block';//tabloide vai ter dois divs o tabloide-dir e o tabloide-esq
      document.getElementById('link-proximo').style.display = 'block';
      document.getElementById('link-anterior').style.display = 'none';
      document.getElementById('tabloide-esq').style.display = 'none';
      document.getElementById('cadastrese').style.display = 'none';
    }else{
      document.getElementById('televendas').style.display = 'none';
      document.getElementById('tabloide-dir').style.display = 'none';
      document.getElementById('link-proximo').style.display = 'none';
      document.getElementById('link-anterior').style.display = 'block';
      document.getElementById('tabloide-esq').style.display = 'block';
      document.getElementById('cadastrese').style.display = 'block';
    }
  }
  
	function validacaoContato(){
		var d = document.formContato;
		var frase = ' é de preenchimento obrigatório!';
		if(d.nome.value == ''){ alert('O campo "Nome"' + frase); d.nome.focus(); return false; }
		if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(d.email.value))) { alert("Dados inválidos no campo Email. Favor verificar!"); d.email.focus(); return false; }
		if(d.mensagem.value == ''){ alert('O campo "Mensagem"' + frase); d.mensagem.focus(); return false; }
		return true;
	}

	function validacaoCadastroSocio(local){
		var d = document.formCadastro;
		var frase = ' é de preenchimento obrigatório!';
		if (d.nome.value == ""){ alert('O campo "Nome"' + frase); d.nome.focus(); return false; }
		if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(d.email.value))) { alert("Dados inválidos no campo Email. Favor verificar!"); d.email.focus(); return false; }
		if (d.ddd1.value == ""){ alert('O campo "DDD"' + frase); d.ddd1.focus(); return false; }
		if (d.tel1.value == ""){ alert('O campo "Fone"' + frase); d.tel1.focus(); return false; }
		return true;
	}

	function validacaoCadastroIndique(){
		var d = document.formCadastroIndique;
		var frase = ' deve ser preenchido!';
		if (document.getElementById('nomeindicador').value == ""){ alert('O campo "Nome do Indicador"' + frase); document.getElementById('nomeindicador').focus(); return false; }
		if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('eindicador').value))) {
			alert("Dados inválidos no campo Email do Indicador. Favor verificar!");
			document.getElementById('eindicador').focus();
			return false;
		}
		for(i=1;i<=5;i++){
			if ((document.getElementById('dddcel'+i).value != "" || document.getElementById('celular'+i).value != "" || document.getElementById('ddd'+i).value != "" || document.getElementById('telefone'+i).value != "" || document.getElementById('e'+i).value != "") && document.getElementById('nome'+i).value == ""){
				alert('O ' + i + 'º campo "Nome"' + frase);
				document.getElementById('nome'+i).focus();
				return false;
			}
			if ((document.getElementById('dddcel'+i).value != "" || document.getElementById('celular'+i).value != "" || document.getElementById('telefone'+i).value != "" || document.getElementById('e'+i).value != "" || document.getElementById('nome'+i).value != "") && document.getElementById('ddd'+i).value == ""){
				alert('O ' + i + 'º campo "DDD"' + frase);
				document.getElementById('ddd'+i).focus();
				return false;
			}
			var telefone = document.getElementById('telefone'+i).value;
			telefone = telefone.charAt(0);
			if ( telefone == "9" || telefone == "8" || telefone == "7") {
				alert("Utilize o número de um telefone fixo.");
				document.getElementById('telefone'+i).focus();
				return false;
			}
			if ((document.getElementById('dddcel'+i).value != "" || document.getElementById('celular'+i).value != "" || document.getElementById('e'+i).value != "" || document.getElementById('nome'+i).value != "" || document.getElementById('ddd'+i).value != "") && document.getElementById('telefone'+i).value == ""){
				alert('O ' + i + 'º campo "Telefone"' + frase);
				document.getElementById('telefone'+i).focus();
				return false;
			}
			if((document.getElementById('dddcel'+i).value != "" || document.getElementById('celular'+i).value != "") && (document.getElementById('ddd'+i).value == "" || document.getElementById('telefone'+i).value == "")){
				alert("Para preenchimento do número de celular é necessário um número de telefone fixo!");
				document.getElementById('telefone'+i).focus();
				return false;
			}
		}
		
		for(i=1;i<=5;i++){
			if(document.getElementById('e'+i).value != ""){
				email = document.getElementById('e'+i).value;
				if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email))) {
					alert("Dados inválidos no campo Email da 1º linha. Favor verificar!");
					document.getElementById('e'+i).focus();
					return false;
				}
			}
		}
	
		if( (d.nome1.value == "" && d.ddd1.value == "" && d.telefone1.value == "") && 
			(d.nome2.value == "" && d.ddd2.value == "" && d.telefone2.value == "") && 
			(d.nome3.value == "" && d.ddd3.value == "" && d.telefone3.value == "") && 
			(d.nome4.value == "" && d.ddd4.value == "" && d.telefone4.value == "") && 
			(d.nome5.value == "" && d.ddd5.value == "" && d.telefone5.value == "") ){
			alert("Ao menos uma indicação deve ser feita!");
			d.nome1.focus();
			return false;
		}
		return true;
	}
  
  function mostraForm(status, conteudo){
    //posiçao pode ser fechado que é o default, ou aberto, pro formulario inteiro nao apenas pra seção do form que difere entre pf e pj
    if(status == 'fechado'){
      document.getElementById('PJ').style.display = 'none';
      document.getElementById('PF').style.display = 'none';
      document.getElementById('cadastraEmail').style.display = 'none';
    }else{
      //se a posição não é fechado entao sera aberto, mais deve decidir se é aberto pra pj ou pf
      document.getElementById('cadastraEmail').style.display = 'block';
      if(conteudo == "PF"){
        document.getElementById('PJ').style.display = 'none';
        document.getElementById('PF').style.display = 'block';
      }else{
        document.getElementById('PJ').style.display = 'block';
        document.getElementById('PF').style.display = 'none';
      }
      //sempre seta o switch do form de cadastro de acordo com o que foi recebido como conteudo, ou seja, o form é pra pj ou pf, mais apenas quando o form for exibido se tentar setar com o form escondido da erro
      document.getElementById('p').value = conteudo;
    }
	}

	function selecionarTodos(){
		if(document.getElementById('todos').checked){ estado = 'true'; } else { estado = ''; }
		for(i=1;i<=8;i++){ document.getElementById('informacao'+i).checked = estado; }
	}
	function carregar(formulario, pagina, local) {
		ajax = ajaxInit();
		document.getElementById(local).innerHTML += "Carregando ...";
		if(ajax){
			ajax.open('POST', pagina+'.php', true);
			ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			ajax.onreadystatechange = function(){
				//if(ajax.readyState == 1) { idOpcao.innerHTML = "Carregando..."; }
				if(ajax.readyState == 4) {
					if(ajax.status == 200) {
						document.getElementById(local).innerHTML = ajax.responseText;
					}
				}
			}
			var params = capturaDados(formulario);
			ajax.send(params);
			document.getElementById(local).innerHTML = '';
		}
	}
	function carregar_interna(formulario, pagina, local) {
		ajax = ajaxInit();
		document.getElementById(local).innerHTML += "Carregando ...";
		if(ajax){
			ajax.open('POST', '../' + pagina+'.php', true);
			ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			ajax.onreadystatechange = function(){
				//if(ajax.readyState == 1) { idOpcao.innerHTML = "Carregando..."; }
				if(ajax.readyState == 4) {
					if(ajax.status == 200) {
						document.getElementById(local).innerHTML = ajax.responseText;
					}
				}
			}
			var params = capturaDados(formulario);
			ajax.send(params);
			document.getElementById(local).innerHTML = '';
		}
	}

	function validacaoCadastreSeuEmail(){
		var d = document.formCadastreSeuEmail;
		var j=0;
		var tipo = document.getElementById('p').value;
		var frase = ' deve ser preenchido!';
		switch(tipo){
			case 'PF':
				if(d.nome.value == ""){ alert('O campo "Nome"' + frase); d.nome.focus(); return false; }
				if(d.sobrenome.value == ""){ alert('O campo "Sobrenome"' + frase); d.sobrenome.focus(); return false; }
				if(d.apelido.value == ""){ alert('O campo "Apelido"' + frase); d.apelido.focus(); return false; }
				if(d.nascimento.value == ""){ alert('O campo "Nascimento"' + frase); d.nascimento.focus(); return false; }
				if(!ValidaCPF(d.cpf.value)){ alert("O campo 'CPF'" + frase); d.cpf.focus(); return false; }
				if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(d.email.value))){ alert('Dados inválidos no campo "Email"! Favor verificar.'); d.email.focus(); return false; }
				if(d.ddd01.value == ""){ alert('O campo "DDD" do Fone 01' + frase); d.ddd01.focus(); return false; }
				if(d.tel01.value == ""){ alert('O campo "Fone 01"' + frase); d.tel01.focus(); return false; }
        /*inicio, sergio.campos@landesign.art.br o campo atuação foi excluido do formulario, 26/07/2010*/
				/*if(d.atuacao02.value == ""){ alert('O campo "Atuação"' + frase); d.atuacao02.focus(); return false; }*/
        /*fim, 26/07/2010*/
			break;
			case 'PJ':
				if(d.razao.value == ""){ alert('O campo "Razão"' + frase); d.razao.focus(); return false; }
				if(d.fantasia.value == ""){ alert('O campo "Fantasia"' + frase); d.fantasia.focus(); return false; }
				if(d.cnpj.value == ''){ alert("O campo 'CNPJ'" + frase); d.cnpj.focus(); return false; }
				if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(d.email.value))){ alert('Dados inválidos no campo "Email"! Favor verificar.'); d.email.focus(); return false; }
				if(d.ddd01.value == ""){ alert('O campo "DDD" do Fone 01' + frase); d.ddd01.focus(); return false; }
				if(d.tel01.value == ""){ alert('O campo "Fone 01"' + frase); d.tel01.focus(); return false; }
        /*inicio, sergio.campos@landesign.art.br o campo atuação foi excluido do formulario, 26/07/2010*/
				/*if(d.atuacao01.value == ""){ alert('O campo "Atuação"' + frase); d.atuacao01.focus(); return false; }*/
        /*fim, 26/07/2010*/
			break;
		}
		if(d.estado.value == ""){ alert('O campo "Estado"' + frase); d.estado.focus(); return false; }
		if(d.cidade.value == ""){ alert('O campo "Cidade"' + frase); d.cidade.focus(); return false; }
		for(i=1;i<=8;i++){ if(document.getElementById('informacao'+i).checked){ j++; } }
		if(j == 0){ alert('Ao menos uma informação deve ser selecionada' + frase); return false; }
		return true;
	}

	function validaBuscaBeneficios(){ carregar_interna('formBuscaBeneficios', 'ajax', 'resultadoBuscaBeneficio'); }



	function carregarAnimacao(){
		flash  = '<iframe frameborder="0" hspace="0" vspace="0" height="750" width="1036" marginheight="0" marginwidth="0" scrolling="no" name="bannerTempo" id="bannerTempo" src="teste.html" allowtransparency="true"></iframe>';
		document.getElementById('bannerTemp').innerHTML = flash;
	}

	function mostraResposta(p){
		for(i=1;i<=18;i++){
			document.getElementById('p'+i).style.display = 'none';
		}
		document.getElementById('p'+p).style.display = 'block';
	}

	function mostraSustentabilidade(p){
		var aux;
		//se eu executar o for antes do if o if sera irrelevante ja que todos estarao com display = none e portanto aux sempre vai receber block
		if(document.getElementById('s'+p).style.display != 'block'){//se o detalhes clicado ta fechado (!= block)
			aux = 'block';
		}else{
			aux = 'none';
		}
		//depois de decidir se o detalhe clicado vai ser aberto ou fechado eu fecho todos os detalhes com o for
		for(i=1;i<=10;i++){
			document.getElementById('s'+i).style.display = 'none';
		}
		//e abro ou fecho o detalhe clicado dependendo de qual era o status dele quando ele foi clicado
		document.getElementById('s'+p).style.display = aux;
	}

	function ajaxInit(){
		var xmlhttp;
		try{ xmlhttp = new XMLHttpRequest(); }
		catch(ee) {
			try{ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
			catch(e) {
				try{ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
				catch(E){ xmlhttp = false ;	}
			}
		}
		return xmlhttp;
	}


	function capturaDados(formulario){
		var arrayFormulario = document.getElementsByTagName('form');
		var campos = '';
		var navegador = navigator.appName;
		if(navegador == 'Netscape'){
			inicioArray = arrayFormulario[formulario].length;
			i=1;
			for(chaves in arrayFormulario[formulario]){ 
				if(i <= inicioArray ){
					if(campos!=''){ campos = campos + '&' }
					campos = campos + chaves + '=' + arrayFormulario[formulario][chaves].value;
				}i++;
			}
		} else {
			nCampos = arrayFormulario[formulario].length;
			totalArray=1;
			for(chaves in arrayFormulario[formulario]){ totalArray++; }
			inicioArray = totalArray-nCampos;
			i=1;
			for(chaves in arrayFormulario[formulario]){ 
				if(i >= inicioArray ){
					if(campos!=''){ campos = campos + '&' }
					campos = campos + chaves + '=' + arrayFormulario[formulario][chaves].value;
				}i++;
			}
		}
		return campos;
	}

	function numeros(e,src){
		if(window.event) { _TXT = e.keyCode; } 
			else if(e.which) { _TXT = e.which; }
			if(_TXT > 47 && _TXT < 58) { 
				return true;
			} else {
				if (_TXT != 8) { return false; } 
				else { return true; }
		}
	}
	
	function pula(campo, qtde, nextCampo){	if(campo.length == qtde){ document.getElementById(nextCampo).focus(); } }

	function chamaTabloide(){
		var informativo = document.formTabloide.selectTabloide.value;
		if(informativo != ''){
			document.formTabloide.action = 'http://www.euqueroeconomizar.com.br/site/informativo/tabloide/'+informativo+'.pdf';
			document.formTabloide.submit();
		}
	}

	function chamaTabloideEspecial(pasta){
		var informativo = document.getElementById(pasta).value;
		//var informativo = document.formTabloide.selectTabloideEspecial.value;
		if(informativo != ''){
//alteração sergio.campos@landesign.art.br 29/06/2010
			//document.formTabloide.action = 'http://www.euqueroeconomizar.com.br/site/informativo/'+pasta+'/'+informativo+'.pdf';
      document.formTabloide.action = 'http://www.euqueroeconomizar.com.br/site/informativo/'+pasta+'/'+informativo+'.html';
//alteração sergio.campos@landesign.art.br 29/06/2010
			document.formTabloide.submit();
		}
	}

	function chamaTabloideFestaJunina(){
		var informativo = document.getElementById('selectTabloideFestaJunina').value;
		window.open('http://www.euqueroeconomizar.com.br/site/informativo/festa_junina/'+informativo+'.pdf', 'festaJunina', 'height=600,width=800,resizable=yes,toolbar=yes,status=yes,menubar=yes,scrollbars=yes');
	}

	function cadastraEmail(){
		var d = document.formEmail;
		if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(d.email.value))) { alert("Dados inválidos no campo Email. Favor verificar!"); d.email.focus(); return false; }
		carregar('formEmail', 'ajax', 'respostaCadastro');
		d.reset();
	}

	function validacaoCadastreSe(){
		var d = document.formCadastreSe;
		var frase = ' é de preenchimento obrigatório!';
		if(d.nome.value == ''){ alert('O campo "Nome"' + frase); d.nome.focus(); return false; }
		if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(d.email.value))) { alert("Dados inválidos no campo Email. Favor verificar!"); d.email.focus(); return false; }
		if((d.telefone.value == '' && d.ddd.value != '') || (d.telefone.value != '' && d.ddd.value == '')){ alert('Preencha o telefone corretamente!'); d.ddd.focus(); return false; }
		if(d.documento.value != '' && d.numero_documento.value == ''){ alert('O número do documento' + frase); d.numero_documento.focus(); return false; }
		if(document.getElementById('documento').value != '' && d.numero_documento.value != ''){ 
			switch(document.getElementById('documento').value){ 
				case 'cpf': 
				if(!ValidaCPF(document.getElementById('numero_documento').value)){ alert("O campo 'CPF'" + frase); document.getElementById('numero_documento').focus(); return false; }
				d.numero.value = document.getElementById('campo_01').value;
				break;

				case 'cnpj':
				if(!validaCNPJ(document.getElementById('numero_documento').value)){ alert("O campo 'CNPJ'" + frase); document.getElementById('numero_documento').focus(); return false; }
				d.numero.value = document.getElementById('campo_02').value;
				break;
			}
		}
		d.dcto.value = document.getElementById('documento').value;
		carregar('formCadastreSe', 'ajax', 'respostaCadastreSe');
		d.reset();
	}



	function mudaImagem(id01, id02, id03, imagem01, imagem02, imagem03){ 
		document.getElementById(id01).src='images/'+imagem01;
		document.getElementById(id02).src='images/'+imagem02;
		document.getElementById(id03).src='images/'+imagem03;
	}

	function mostraDiv(id, imagem, div){
		document.getElementById(id).src='images/'+imagem;
		document.getElementById('bakers_chefs').style.display = 'none';
		document.getElementById('marca_sams').style.display = 'none';
		document.getElementById('members_mark').style.display = 'none';
		document.getElementById(div).style.display = 'block';
	}

	function mudaImagemMenu01(id, imagem){
		document.getElementById('submenu_01').src='images/submenu_vinhos_off.gif';
		document.getElementById('submenu_02').src='images/submenu_acougue_off.gif';
		document.getElementById('submenu_03').src='images/submenu_hortifruti_off.gif';
		document.getElementById('submenu_04').src='images/submenu_eletronicos_off.gif';
		document.getElementById('submenu_05').src='images/submenu_utilidades_off.gif';
		document.getElementById('submenu_06').src='images/submenu_panoramica_off.gif';
		document.getElementById(id).src='images/'+imagem;
	}

	function mostraDivMenu01(div){
		document.getElementById('vinhos').style.display = 'none';
		document.getElementById('acougue').style.display = 'none';
		document.getElementById('hortifruti').style.display = 'none';
		document.getElementById('eletronicos').style.display = 'none';
		document.getElementById('escritorio').style.display = 'none';
		document.getElementById(div).style.display = 'block';
	}

	function escreve_flash(nome,largura,altura){
		document.write('<object id="localFlash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+largura+'" height="'+altura+'" id="'+nome+'" align="middle">');
		document.write('<param name="allowScriptAccess" value="sameDomain" />');
		document.write('<param name="movie" value="tvs_flash/'+nome+'.swf" />');
		document.write('<param name="wmode" value="transparent" />'); 
		document.write('<param name="quality" value="high" />');
		document.write('<embed wmode="transparent" src="tvs_flash/'+nome+'.swf" quality="high" bgcolor="#ffffff" width="'+largura+'" height="'+altura+'" name="'+nome+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
		document.write('</object>');
	}

	function escreve_boxes(nome,largura,altura){
		document.write('<object id="localFlash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+largura+'" height="'+altura+'" id="'+nome+'" align="middle">');
		document.write('<param name="allowScriptAccess" value="sameDomain" />');
		document.write('<param name="movie" value="box_lateral/'+nome+'.swf" />');
		document.write('<param name="wmode" value="transparent" />'); 
		document.write('<param name="quality" value="high" />');
		document.write('<embed wmode="transparent" src="box_lateral/'+nome+'.swf" quality="high" bgcolor="#ffffff" width="'+largura+'" height="'+altura+'" name="'+nome+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
		document.write('</object>');
	}

	function trocaBgQuadros(div, bg){ 
		document.getElementById('bloco_bg_'+div).style.backgroundImage = 'url("./images/'+bg+'")';
	}

	function Dados(valor) {
		try { ajax = new ActiveXObject("Microsoft.XMLHTTP"); } 
		catch(e) { 
			try { ajax = new ActiveXObject("Msxml2.XMLHTTP"); }
			catch(ex) {
				try { ajax = new XMLHttpRequest(); }
				catch(exc) { alert("Esse browser não tem recursos para uso do Ajax"); ajax = null; }
			}
		}
		if(ajax) {
			document.getElementById('cidade').options.length = 1;
			alert(document.getElementById('cidade').options.length);
			idOpcao  = document.getElementById("opcoes");
			ajax.open("POST", "cidades.php", true);
			ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			ajax.onreadystatechange = function() {
				if(ajax.readyState == 1) { idOpcao.innerHTML = "Carregando..."; }
				if(ajax.readyState == 4 ) {
				   if(ajax.responseXML) { processXML(ajax.responseXML); }
				   else { idOpcao.innerHTML = "Primeiro selecione o estado."; }
				}
			}
			var params = "estado="+valor;
			ajax.send(params);
		} else { alert('Não entrou.'); }
	}

	function processXML(obj){
		var dataArray = obj.getElementsByTagName("cidade");
		if(dataArray.length > 0) {
			for(var i = 0 ; i < dataArray.length ; i++) {
				var item = dataArray[i];
				var codigo =  item.getElementsByTagName("codigo")[0].firstChild.nodeValue;
				var nome   =  item.getElementsByTagName("nome")[0].firstChild.nodeValue;
				idOpcao.innerHTML = "";
				var novo = document.createElement("option");
					novo.setAttribute("id", "opcoes");
					novo.value = codigo;
					novo.text  = nome;
					document.getElementById('cidade').options.add(novo);
			}
		} else { idOpcao.innerHTML = ""; }
	}


	function MM_preloadImages() {
	  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}
	
	function MM_swapImgRestore() {
	  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}
	
	function MM_findObj(n, d) {
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}
	
	function MM_swapImage() {
	  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}

	function mudaImagemHipercard(id01, id02, imagem01, imagem02){ 
		document.getElementById(id01).src='images/'+imagem01;
		document.getElementById(id02).src='images/'+imagem02;
	}

	function mostraDivHipercard(id, imagem, div){
		document.getElementById(id).src='images/'+imagem;
		document.getElementById('clientes').style.display = 'none';
		document.getElementById('afiliados').style.display = 'none';
		document.getElementById(div).style.display = 'block';
	}

	function fixaHipercard(){
		if(document.getElementById('clientes').style.display == 'block'){
			document.getElementById('subtit_01').src='images/subtit_clientes_on.gif';
			document.getElementById('subtit_02').src='images/subtit_afiliados_off.gif';
		}
		if(document.getElementById('afiliados').style.display == 'block'){
			document.getElementById('subtit_01').src='images/subtit_clientes_off.gif';
			document.getElementById('subtit_02').src='images/subtit_afiliados_on.gif';
		}
	}

	function fixaMarcas(){
		if(document.getElementById('bakers_chefs').style.display == 'block'){
			document.getElementById('subtit_01').src='images/subtit_bakers_on.gif';
			document.getElementById('subtit_02').src='images/subtit_marca_sams_off.gif';
			document.getElementById('subtit_03').src='images/subtit_members_off.jpg';
		}
		if(document.getElementById('marca_sams').style.display == 'block'){
			document.getElementById('subtit_01').src='images/subtit_bakers_off.gif';
			document.getElementById('subtit_02').src='images/subtit_marca_sams_on.gif';
			document.getElementById('subtit_03').src='images/subtit_members_off.jpg';
		}
		if(document.getElementById('members_mark').style.display == 'block'){
			document.getElementById('subtit_01').src='images/subtit_bakers_off.gif';
			document.getElementById('subtit_02').src='images/subtit_marca_sams_off.gif';
			document.getElementById('subtit_03').src='images/subtit_members_on.jpg';
		}
	}

	function fixaSams(){
		if(document.getElementById('tour360').src == 'tour/vinho/index.html'){
			document.getElementById('submenu_02').src='images/submenu_acougue_off.gif';
			document.getElementById('submenu_03').src='images/submenu_hortifruti_off.gif';
			document.getElementById('submenu_04').src='images/submenu_eletronicos_off.gif';
			document.getElementById('submenu_05').src='images/submenu_utilidades_off.gif';
			document.getElementById('submenu_06').src='images/submenu_panoramica_off.gif';
			document.getElementById('submenu_01').src='images/submenu_vinhos_on.gif';
		}
		if(document.getElementById('tour360').src == 'tour/congelados/index.html'){
			document.getElementById('submenu_01').src='images/submenu_vinhos_off.gif';
			document.getElementById('submenu_03').src='images/submenu_hortifruti_off.gif';
			document.getElementById('submenu_04').src='images/submenu_eletronicos_off.gif';
			document.getElementById('submenu_05').src='images/submenu_utilidades_off.gif';
			document.getElementById('submenu_06').src='images/submenu_panoramica_off.gif';
			document.getElementById('submenu_02').src='images/submenu_acougue_on.gif';
		}
		if(document.getElementById('tour360').src == 'tour/hortifruiti/index.html'){
			document.getElementById('submenu_01').src='images/submenu_vinhos_off.gif';
			document.getElementById('submenu_02').src='images/submenu_acougue_off.gif';
			document.getElementById('submenu_04').src='images/submenu_eletronicos_off.gif';
			document.getElementById('submenu_05').src='images/submenu_utilidades_off.gif';
			document.getElementById('submenu_06').src='images/submenu_panoramica_off.gif';
			document.getElementById('submenu_03').src='images/submenu_hortifruti_on.gif';
		}
		if(document.getElementById('tour360').src == 'tour/eletro/index.html'){
			document.getElementById('submenu_01').src='images/submenu_vinhos_off.gif';
			document.getElementById('submenu_02').src='images/submenu_acougue_off.gif';
			document.getElementById('submenu_03').src='images/submenu_hortifruti_off.gif';
			document.getElementById('submenu_05').src='images/submenu_utilidades_off.gif';
			document.getElementById('submenu_06').src='images/submenu_panoramica_off.gif';
			document.getElementById('submenu_04').src='images/submenu_eletronicos_on.gif';
		}
		if(document.getElementById('tour360').src == 'tour/utilidades/index.html'){
			document.getElementById('submenu_01').src='images/submenu_vinhos_off.gif';
			document.getElementById('submenu_02').src='images/submenu_acougue_off.gif';
			document.getElementById('submenu_03').src='images/submenu_hortifruti_off.gif';
			document.getElementById('submenu_04').src='images/submenu_eletronicos_off.gif';
			document.getElementById('submenu_06').src='images/submenu_panoramica_off.gif';
			document.getElementById('submenu_05').src='images/submenu_utilidades_on.gif';
		}
		if(document.getElementById('tour360').src == 'tour/cima/index.html'){
			document.getElementById('submenu_01').src='images/submenu_vinhos_off.gif';
			document.getElementById('submenu_02').src='images/submenu_acougue_off.gif';
			document.getElementById('submenu_03').src='images/submenu_hortifruti_off.gif';
			document.getElementById('submenu_04').src='images/submenu_eletronicos_off.gif';
			document.getElementById('submenu_05').src='images/submenu_utilidades_off.gif';
			document.getElementById('submenu_06').src='images/submenu_panoramica_on.gif';
		}
	}

	function ValidaCPF(numcpf){
		if(numcpf != "" ){
			numcpf = numcpf.substr(0, 3) + numcpf.substr(4, 3) + numcpf.substr(8, 3) + numcpf.substr(12, 2);
			if (numcpf == "00000000000" || 
				numcpf == "11111111111" || 
				numcpf == "22222222222" || 
				numcpf == "33333333333" || 
				numcpf == "44444444444" || 
				numcpf == "55555555555" || 
				numcpf == "66666666666" || 
				numcpf == "77777777777" || 
				numcpf == "88888888888" || 
				numcpf == "99999999999") {
				return false;
			} else {
				x = 0;
				soma = 0;
				dig1 = 0;
				dig2 = 0;
				texto = "";
				numcpf1="";
				len = numcpf.length;
				x = len -1;
				for (var i=0; i <= len - 3; i++) {
					y = numcpf.substring(i,i+1);
					soma = soma + ( y * x);
					x = x - 1;
					texto = texto + y;
				}
				dig1 = 11 - (soma % 11);
				if (dig1 == 10) dig1=0 ;
				if (dig1 == 11) dig1=0 ;
				numcpf1 = numcpf.substring(0,len - 2) + dig1 ;
				x = 11; soma=0;
				for (var i=0; i <= len - 2; i++) {
					soma = soma + (numcpf1.substring(i,i+1) * x);
					x = x - 1;
				}
				dig2= 11 - (soma % 11);
				if (dig2 == 10) dig2=0;
				if (dig2 == 11) dig2=0;
				if ((dig1 + "" + dig2) == numcpf.substring(len,len-2)) {
					return true;
				}
				return false;
			}
		} else { return false; }
	}

	function validaCNPJ(CNPJ){
		if (CNPJ.length < 18) { return false; }
		if ((CNPJ.charAt(3) != ".") || (CNPJ.charAt(7) != ".") || (CNPJ.charAt(11) != "/") || (CNPJ.charAt(16) != "-")){ return false; } 
        if(document.layers && parseInt(navigator.appVersion) == 4){
			x = CNPJ.substring(0,3);
			x += CNPJ. substring (3,7);
			x += CNPJ. substring (7,11);
			x += CNPJ. substring (11,16);
			x += CNPJ. substring (16,18);
			CNPJ = x;
		} else {
			CNPJ = CNPJ. replace (".","");
			CNPJ = CNPJ. replace (".","");
			CNPJ = CNPJ. replace ("-","");
			CNPJ = CNPJ. replace ("/","");
		}
		var nonNumbers = /\D/;
		if (nonNumbers.test(CNPJ)) { return false; }
       	tot  = 0; peso = 2; 
		for (i = 0;  i <= 12;  i++){ 
			tot += peso * parseInt(CNPJ.charAt(12 - i)); 
			peso++; 
			if(peso == 10){ peso = 2; } 
		} 
		if ((tot * 10 % 11 % 10) != parseInt(CNPJ.charAt(13))) { return false; } else { return true; }
	}

	function MM_format(e,src,mask) {
		if(window.event) { _TXT = e.keyCode; } 
		else if(e.which) { _TXT = e.which; }
		if(_TXT > 47 && _TXT < 58) { 
			var i = src.value.length; var saida = mask.substring(0,1); var texto = mask.substring(i)
			if (texto.substring(0,1) != saida) {
				src.value += texto.substring(0,1);
			} 
			return true;
			} else {
				if (_TXT != 8) { return false; } 
				else { return true; }
		}
	}

	function mostraCampoDocumento(valor){
		switch(valor){
			case 'cpf': campo = 'campo_01'; break;
			case 'cnpj': campo = 'campo_02'; break;
		}
		document.getElementById('campo_01').style.display = 'none';
		document.getElementById('campo_02').style.display = 'none';
		document.getElementById(campo).value='';
		document.getElementById(campo).style.display = 'block';
		
		if(valor == ''){ document.getElementById(campo).style.display = 'none'; }
	}

	function abrirMapa(clube){ window.open('mapaGoogle.php?local=' + clube, 'mapaGoogle', 'height=350,width=425,resizable=no,toolbar=no,status=no,menubar=no,scrollbars=no'); }

	function navegacaoCursos(clique){
		document.getElementById('botoes_cursos').style.display = 'none';
		document.getElementById('navegacao_cursos_menu').style.display = 'block';

		switch(clique){
			case 'vinhos':     fispal = 'none';  vinhos = 'block'; calendario = 'none';  break;
			case 'fispal':     fispal = 'block'; vinhos = 'none';  calendario = 'none';  break;
			case 'calendario': fispal = 'none';  vinhos = 'none';  calendario = 'block'; break;
			default: 
				fispal = 'none';
				vinhos = 'none';
				calendario = 'none';
				document.getElementById('navegacao_cursos_menu').style.display = 'none';
				document.getElementById('botoes_cursos').style.display = 'block';
		
		}

		document.getElementById('miolo_fispal').style.display = fispal;
		document.getElementById('miolo_vinhos').style.display = vinhos;
		document.getElementById('miolo_caledario').style.display = calendario;
	}

	function validacaoEstadao(){
		var d = document.formEstadao;
		var frase = ' deve ser preenchido!';
		if(d.nome.value == ""){ alert('O campo "Nome"' + frase); d.nome.focus(); return false; }
		if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(d.email.value))){ alert('Dados inválidos no campo "Email"! Favor verificar.'); d.email.focus(); return false; }
		if(d.ddd01.value == ""){ alert('O campo "DDD" do Fone 01' + frase); d.ddd01.focus(); return false; }
		if(d.fone01.value == ""){ alert('O campo "Fone 01"' + frase); d.fone01.focus(); return false; }
		if(d.ddd02.value == "" && d.fone02.value != ""){ alert('O campo "DDD" do Fone 02' + frase); d.ddd02.focus(); return false; }
		if(d.ddd02.value != "" && d.fone02.value == ""){ alert('O campo "Fone 02"' + frase); d.fone02.focus(); return false; }
		//if(d.cpf.value != ''){ if(!ValidaCPF(d.cpf.value)){ alert('O campo "CPF" contém dados inválidos! Favor verificar.'); return false } }
		if(!ValidaCPF(d.cpf.value)){ alert('O campo "CPF" contém dados inválidos! Favor verificar.'); d.cpf.focus(); return false }
		window.open('', 'estadao', 'width=540,height=305,status=no,toolbar=no,menubar=no,location=no,titlebar=no,directories=no');
		d.submit();
		d.reset();
	}

	function carregarAniversario(estado){
		document.getElementById('aniversario').style.display=estado;
		switch(estado){
			case 'block': 
				largura='974';
				altura='930';
				nome='bexigasSams6';
				flash  = '<object id="localFlash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+largura+'" height="'+altura+'" id="'+nome+'" align="middle">';
				flash += '<param name="allowScriptAccess" value="sameDomain" />';
				flash +='<param name="movie" value="tvs_flash/'+nome+'.swf" />';
				flash += '<param name="wmode" value="transparent" />';
				flash += '<param name="quality" value="high" />';
				flash += '<embed wmode="transparent" src="tvs_flash/'+nome+'.swf" quality="high" bgcolor="#ffffff" width="'+largura+'" height="'+altura+'" name="'+nome+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
				flash += '</object>';
				document.getElementById('aniversario').innerHTML = flash;
				break;

			case 'none': document.getElementById('aniversario').innerHTML = ''; break;
		}
	}

	function selecionarTodas(){
		d = document.getElementById('sTodas').checked;
		if(d){ marcar = 'checked'; } else { marcar = ''; }
		for(i=1;i<=9;i++){ document.getElementById('informacao'+i).checked = marcar; }
	}

	function textoFonte(classe){ document.getElementById('textoFonte').className = classe; }



	function desabilitaSubMenuTeste(){
		var pg = parent.document.getElementById('itemSubMenu').value;
		for(i=0;i<=19;i++){
			switch(i){
				case 1: local = 'socios'; break;
				case 2: local = 'duvidasfrequentes'; break;
				case 3: local = 'satisfacao'; break;
				case 9: local = 'bakerschefs'; break;
				case 10: local = 'marcasams'; break;
				case 11: local = 'membersmark'; break;
				case 13: local = 'entregagratis'; break;
				case 14: local = 'televendas'; break;
				case 16: local = 'cartoespresentes'; break;
				case 19: local = 'instalafacil'; break;
				default: local = '';
			}
			if(local != pg && local != ''){ parent.document.getElementById(local).src = 'images/menu_'+ local +'.gif'; }
		}
	}

	function habilitaTeste(local){
		desabilitaSubMenuTeste();
		parent.document.getElementById(local).src = 'images/menu_'+ local + '_on.gif';
	}

	function limparMenu(){
		for(i=0;i<=14;i++){
			switch(i){
				case  0: local = 'home'; break;
				case  1: local = 'oqueeh'; break;
				case  2: local = 'samspordentro'; break;
				case  3: local = 'marcasproprias'; break;
				case  4: local = 'programabeneficios'; break;
				case  5: local = 'fiquesocio'; break;
				case  6: local = 'cadastreseuemail'; break;
				case  7: local = 'indiqueseusamigos'; break;
				case  8: local = 'enderecos'; break;
				case  9: local = 'servicos'; break;
				case 10: local = 'sustentabilidade'; break;
				case 11: local = 'faleconosco'; break;
				case 12: local = 'vocesabia'; break;
				case 14: local = 'formasdepagamento'; break;
			}
			if(local != ''){ parent.document.getElementById(local).src = 'images/menu_'+ local +'.gif'; }
		}
	}

	function chamaEmailmkt(pasta, arquivo){
    //sergio.campos@landesign.art.br, alteração = nao permitir que esta função seja executada para o valor "Escolha seu clube" da combo box de email marketing
    if(arquivo == ""){//entender esse vazio = "Escolha seu clube"
      return;
    }
    window.open('http://mailing.euqueroeconomizar.com.br/'+pasta+'/'+arquivo+'.html', pasta, 'height=600,width=800,resizable=yes,toolbar=yes,status=yes,menubar=yes,scrollbars=yes');
	}

	function espacoBarra(){
		var navegador = navigator.appName;
		if(navegador == 'Netscape'){
			//document.getElementById('faixaHome').style.display = 'none';
			document.getElementById('faixaHome').height = '3';
		} else {
			//document.getElementById('faixaHome').style.display = 'block';
			document.getElementById('faixaHome').height = '5';
		}
	}
-->