// FUNÇÃO VALIDAÇÃO DE E-MAIL ------- INICIO

// FUNÇÃO VALIDAÇÃO DE E-MAIL ------- INICIO

var menuTR_ativo = '';
var subMenu_ativo = '';
var menuPai_ativo = '';

function showMenu(subMenu, menuPai, menuTR){
       
    if(document.getElementById(subMenu_ativo)){
        document.getElementById(subMenu_ativo).style.display = 'none';
        //	Setados a classe original do menu "pai"
        document.getElementById(menuPai_ativo).className = 'menu_categorias'
        document.getElementById(subMenu_ativo).className = 'Menu03_categoria_link'
        document.getElementById(menuTR_ativo).className = 'Menu03_categoria'
    }
    
    document.getElementById(subMenu).style.display = '';
    // setados uma nova classe para o menu "pai"
    document.getElementById(menuPai).className = 'Menu03_categoria_link'
    document.getElementById(subMenu).className = 'Menu03_categoria_link'
    document.getElementById(menuTR).className = 'Menu03_categoriaA'

    subMenu_ativo = subMenu;
   	menuPai_ativo = menuPai;
   	menuTR_ativo = menuTR;
}

// Menu RollOver 
function MM_swapImgRestore() { //v3.0
  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_preloadImages() { //v3.0
  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_findObj(n, d) { //v4.01
  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() { //v3.0
  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 abrir(pagina)
{
newwindow=window.open(pagina, '_blank', 'width=328,height=265,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,left=300,top=200')
}

function abrir2(pagina)
{
newwindow=window.open(pagina, '_blank', 'width=550,height=400,toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,left=300,top=200')
}
// -->


function mostraLinha(nome){
	nome = document.getElementById( nome );

	if(nome.style.display == 'none')
		{	nome.style.display = '';	} 
	else{	nome.style.display = 'none'	}	
}

 function ocultaLinha(nome){
	nome = document.getElementById( nome );

	if(nome.style.display == '')
		{	nome.style.display = 'none';	} 
	else{	nome.style.display = ''	}	
}


 <!--
function popup(strImgUrl) {
	var win=window.screen, w=win.width, h=win.height, l=(w-480)/2, t=(h-700)/2;
	 0;window.open('popup.asp?'+strImgUrl,'popupIMG','toolbar=no,directories=no,location=no,status=no,menubar=no,scrollbars=no,scrolling=no,resizable=no,width='+w+',height='+h+',left='+l+',top='+t);
}
//-->
 

function valida_news()
{

f = document.news;


	if(f.c_nome.value.length < 3) {
		alert('Nome não pode estar em branco ou conter menos que 3 caracteres!');
		f.c_nome.focus();
		return false;
	}

	if(f.c_nome.value == 'Nome'){
		alert('Nome não pode estar em branco ou conter menos que 3 caracteres!');
		f.c_nome.focus();
		return false;
	}

	if(f.c_email.value.length < 3) {
		alert('E-mail não pode estar em branco!');
		f.c_email.focus();
		return false;
	}

	if(!ver_email(f.c_email)) {
		alert('E-mail inválido!\nUtilize um e-mail no formato: nome@empresa.com');
		f.c_email.focus();		
		return false;
	}


	f.c_enviar.disabled = true;
	return true;

}


function ver_email(campo)
{
	//esta função retorna um valor logico 
	//testa a validade do e-mail
	// o mesmo deverá conter apenas 1 arroba e no minimo 1 ponto apos esse arroba
	//recebe um parametro que seria o nome do campo, junto com o nome do form
	//ex.: document.form.campo
	
	var posa, arroba=0, ponto=0;
	var n = campo.value.length;
	var v = campo.value;

	
	//verificação do arroba
	//inicia-se em 3 o looping
	//serve para certificar-se de que o usuario digitou um nome com no minimo 3 letras
	for (i=3;i<=n;i++) {
		if (v.charAt(i) == '@') {
			posa = i; //posição em que estao o arroba
			arroba = arroba + 1;	
		}
	}

	
	//verificação do ponto
	//inicia-se a ver em posa+3 
	// serve para certificar-se de que o usuario ira digitar um provedor com no minimo 2 letras
	for (i=posa + 3;i<=n;i++) {
		if (v.charAt(i) == '.') {
			ponto = 1;
			
		}
	}

	
	if (arroba == 1 && ponto == 1) 
		return true;
	else 
		return false;


}

// FUNÇÃO VALIDAÇÃO DE E-MAIL ------- FIM

// FUNÇÃO VALIDAÇÃO DA NEWSLETTER ------- INICIO




// FUNÇÃO VALIDAÇÃO DA NEWSLETTER ------- FIM


// FUNÇÃO LIMITA TEXT-AREA ------- INICIO

function limita_textarea(campo,n)
{
//função que limita a qtde de caracteres do campo text area
//utilizar no campo: onKeyPress="return limita_textarea(this,n) , onde n é qtde de caracteres

	if (campo.value.length > n - 1) {
		return false;
	} else {
		return true;
	}
 
}

// FUNÇÃO LIMITA TEXT-AREA ------- FIM

// Alerta se a quantidade colocada no carrinho for superior a estoque

function validaMedidas() 
{ 
var01 = document.getElementById("cQtdeProduto").value
if(var01>30) {
alert("Você não pode adicionar quantidade superior ao estoque ao seu carrinho!");}
}

// FUNÇÃO QUE IMPEDE COPIAR E COLAR ------- INICIO

function nao_cola() {
	
	var ctrl=window.event.ctrlKey;
	var tecla=window.event.keyCode; 

		if (ctrl && tecla==86) return false;
		if (ctrl && tecla==67) return false;
}


// FUNÇÃO QUE IMPEDE COPIAR E COLAR ------- FIM

//SO NUMEROS - INICIO
function Tecla(e)
{
	if (document.all) // Internet Explorer
		var tecla = event.keyCode;
	else if(document.layers) // Nestcape
		var tecla = e.which;
		if (tecla > 47 && tecla < 58) // numeros de 0 a 9
			return true;
		else
			{
				if (tecla != 8) // backspace
					event.keyCode = 0;
					//return false;
				else
					return true;
			}
}
//SO NUMEROS - FIM

// FUNÇÃO ALTERA A IMAGEM PRINCIPAL ------- INICIO

   // na pagina detalhes


// FUNÇÃO ALTERA A IMAGEM PRINCIPAL ------- FIM


// VERIFICAÇÃO DE CPF -------------- INICIO
function verificaCpf (pCpf)
{

 //CPF informado
var cpf = pCpf.replace(".","");
cpf = cpf.replace(".","");
cpf = cpf.replace("-","");


var numerosCpf = new Array(10); 

// contador, posição, digito do cpf, digitop a conferir, variavel para calculos
var i, n, digito, verDigito, soma;


//verificação da entrada

if (cpf.length != 11)
	return false;


//separando os valores do cpf, sem os digitos
for (i=0;i<=8;i++)
{
	numerosCpf[i] = cpf.substr(i,1);
}

//capturando os digitos
digito = cpf.slice(9);


//conferindo o 10 digito

soma = 0;
for (i=8;i>=0;i--)
	soma = soma + numerosCpf[8-i] * (i+2);

numerosCpf[9] = soma % 11;

if (numerosCpf[9] < 2)
	numerosCpf[9] = 0;
else
	numerosCpf[9] = 11 - numerosCpf[9];



//conferindo o 11° digito

soma = 0;
for (i=9;i>=0;i--)
	soma = soma + numerosCpf[9-i] * (i+2);

numerosCpf[10] = soma % 11;

if (numerosCpf[10] < 2)
	numerosCpf[10] = 0;
else
	numerosCpf[10] = 11 - numerosCpf[10];



//comparando agora os dois digitos

verDigito = numerosCpf[9] * 10 + numerosCpf[10];

if (verDigito == digito)
	return true;
else
	return false;


//fim da função
}

//VERIFICAÇÃO DE CPF ------------- FIM

//SÓ INTEIROS

function Inteiros(){
var caract = new RegExp(/^[0-9]+$/i);
var caract = caract.test(String.fromCharCode(event.keyCode));

if(!caract){
alert("Caracter inválido: " +String.fromCharCode(event.keyCode));
event.keyCode=0;
return;
}
}
 


//EXIBE NOVO LAYER (DIV) --------- INICIO

function mostraDiv (pDiv, pImagem)
{
var statusAtual = pDiv.style.display;
	if (statusAtual == 'none')
	{
		pImagem.src = 'imagens/veja_menos.gif';
		pDiv.style.display = '';
	}
	else
	{
		pImagem.src = 'imagens/veja_mais.gif';
		pDiv.style.display = 'none';
	}


}


<!--

<!--
  function mOvr(src,clrOver) {
    if (!src.contains(event.fromElement)) {
	  src.style.cursor = 'hand';
	  src.bgColor = clrOver;
	}
  }
  function mOut(src,clrIn) {
	if (!src.contains(event.toElement)) {
	  src.style.cursor = 'default';
	  src.bgColor = clrIn;
	}
  }
  function mClk(src) {
    if(event.srcElement.tagName=='TD'){
	  src.children.tags('A')[0].click();
    }
  }
// -->
//-->
 

function ismaxlength(obj){
var mlength=obj.getAttribute? parseInt(obj.getAttribute("maxlength")) : ""
if (obj.getAttribute && obj.value.length>mlength)
obj.value=obj.value.substring(0,mlength)
}

 

var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}


//EXIBE NOVO LAYER (DIV) --------- FIM


									   
									   
 
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
 
