<!--
document.onkeydown = idKey;
var KeyID;
function idKey(e) {
	KeyID = (window.event) ? event.keyCode : e.keyCode;
	ShiftPressed = (window.event) ? event.shiftKey : e.shiftKey;
	ControlPressed = (window.event) ? event.ctrlKey : e.ctrlKey;
}

function isEmpty(pStrText){
	var	len = pStrText.length;
	var pos;
	var vStrnewtext = "";

	for (pos=0; pos<len; pos++){
		if (pStrText.substring(pos, (pos+1)) != " "){
			vStrnewtext = vStrnewtext + pStrText.substring(pos, (pos+1));
		}
	}

	if (vStrnewtext.length > 0)
		return false;
	else
		return true;
}

function isCPFCNPJ(campo,pType){
   if( isEmpty( campo ) ){return false;}

   var campo_filtrado = "", valor_1 = " ", valor_2 = " ", ch = "";
   var valido = false;
        
   for (i = 0; i < campo.length; i++){
      ch = campo.substring(i, i + 1);
      if (ch >= "0" && ch <= "9"){
         campo_filtrado = campo_filtrado.toString() + ch.toString()
         valor_1 = valor_2;
         valor_2 = ch;
      }
      if ((valor_1 != " ") && (!valido)) valido = !(valor_1 == valor_2);
   }
   if (!valido) campo_filtrado = "12345678912";

   if (campo_filtrado.length < 11){
      for (i = 1; i <= (11 - campo_filtrado.length); i++){campo_filtrado = "0" + campo_filtrado;}
   }

	if(pType <= 1){
		if ( ( campo_filtrado.substring(9,11) == checkCPF( campo_filtrado.substring(0,9) ) ) && ( campo_filtrado.substring(11,12)=="") ){return true;}
	}

	if((pType == 2) || (pType == 0)){
		if (campo_filtrado.length >= 14){
			if ( campo_filtrado.substring(12,14) == checkCNPJ( campo_filtrado.substring(0,12) ) ){ return true;}
		}
	}
	
	return false;
}

function checkCNPJ(vCNPJ){
   var mControle = "";
   var aTabCNPJ = new Array(5,4,3,2,9,8,7,6,5,4,3,2);
   for (i = 1 ; i <= 2 ; i++){
      mSoma = 0;
      for (j = 0 ; j < vCNPJ.length ; j++)
         mSoma = mSoma + (vCNPJ.substring(j,j+1) * aTabCNPJ[j]);
      if (i == 2 ) mSoma = mSoma + ( 2 * mDigito );
      mDigito = ( mSoma * 10 ) % 11;
      if (mDigito == 10 ) mDigito = 0;
      mControle1 = mControle ;
      mControle = mDigito;
      aTabCNPJ = new Array(6,5,4,3,2,9,8,7,6,5,4,3);
   }
   return( (mControle1 * 10) + mControle );
}

function checkCPF(vCPF){
   var mControle = ""
   var mContIni = 2, mContFim = 10, mDigito = 0;
   for (j = 1 ; j <= 2 ; j++){
      mSoma = 0;
      for (i = mContIni ; i <= mContFim ; i++)
         mSoma = mSoma + (vCPF.substring((i-j-1),(i-j)) * (mContFim + 1 + j - i));
      if (j == 2 ) mSoma = mSoma + ( 2 * mDigito );
      mDigito = ( mSoma * 10 ) % 11;
      if (mDigito == 10) mDigito = 0;
      mControle1 = mControle;
      mControle = mDigito;
      mContIni = 3;
      mContFim = 11;
   }
   return( (mControle1 * 10) + mControle );
}

function trim(str, chars) {
	return ltrim(rtrim(str, chars), chars);
}
 
function ltrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}
 
function rtrim(str, chars) {
	chars = chars || "\\s";
	return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

var DepartamentosOver = false;
//
function Departamentos(a) {
	if (a==9) {
		document.getElementById("departamentos").style.visibility = "visible";
		deptInt = setInterval ( "Departamentos(8)", 500 );
	}
	if (a==8&&!DepartamentosOver) {
		document.getElementById("departamentos").style.visibility = "hidden";
		clearInterval(deptInt);
	}
	if (a==1) DepartamentosOver = true;
	if (a==0) DepartamentosOver = false;
}

var ParcelamentosOver = false;
//
function Parcelamentos(a) {
	if (a==9) {
		panchor = document.getElementById("parcelamentos_anchor")
		ppos = findPos(panchor);
		ppos[0] = ppos[0]-340;
		ppos[1] = ppos[1]-135;
		document.getElementById("parcelamentos").style.left = ppos[0]+"px";
		document.getElementById("parcelamentos").style.top = ppos[1]+"px";
		document.getElementById("parcelamentos").style.visibility = "visible";
		parcInt = setInterval ( "Parcelamentos(8)", 300 );
	}
	if (a==8&&!ParcelamentosOver) {
		document.getElementById("parcelamentos").style.visibility = "hidden";
		clearInterval(parcInt);
	}
	if (a==1) ParcelamentosOver = true;
	if (a==0) ParcelamentosOver = false;
}

function validaBusca (form_id) {
	var kw = trim(document.getElementById("keyword").value);
	if (kw.length>1) {
		document.getElementById(form_id).submit();
	} else {
		alert("Digite uma palavra válida para a busca!");
	}
}

function ValidaFormaPagamento (form_obj) {
	for (i=0;i<form_obj.length;i++) {
		if (form_obj[i].checked) return true; 
	}
	alert("Selecione uma forma de pagamento e clique em Prosseguir");
	return false;
}

function LembreteSenha() {
	window.open('cliente_lembrete.php?email='+document.getElementById("email").value,'indicarproduto','width=400,height=400,status=yes,scrollbars=no,resizable=no');
}

function indicar(p) {
	window.open('produto_indicarpop.php?p='+p,'indicarproduto','width=400,height=400,status=yes,scrollbars=no,resizable=no');
}

function sac(p) {
	window.open('produto_sacpop.php?p='+p,'sacproduto','width=400,height=400,status=yes,scrollbars=no,resizable=no');
}

function ValidaEntrega (form_obj) {
	if (!document.getElementById("entrega1").checked && !document.getElementById("entrega2").checked) {
		alert("Selecione um endereço para entrega e clique em Prosseguir");
		return false;
	}
	if (!document.getElementById("entrega1").checked) {
		for (i=0;i<form_obj.length;i++) {
			if ( (form_obj[i].value == "" || form_obj[i].value == "#") && form_obj[i].lang == "br") {
				alert("Preencha corretamente todos os campos obrigatórios (*)!\nCampo: "+form_obj[i].name);
				return false;
			}
		}
	}
	return true;
}

function PFPJ(v) {
	if (v.value=="PF") { 
		document.getElementById("sexo_div").style.display = "";
		document.getElementById("nascimento_div").style.display = "";
		document.getElementById("nome_div").innerHTML = "Nome:";
		document.getElementById("cpf_div").innerHTML = "CPF:";
		document.getElementById("cpf2_div").innerHTML = '<input type="text" id="cpf" maxlength="14" onkeypress="return FormataCPF(this);" onkeyup="autoTab(this,14,1);" lang="br" name="cpf" />*';
		document.getElementById("rg_div").innerHTML = "RG:";
		document.getElementById("rg2_div").innerHTML = '<input type="text" name="rg" id="rg" maxlength="13" onkeypress="return FormataRG(this);" onkeyup="autoTab(this,13,1);" lang="br" />*';
		document.getElementById("empresa_div").innerHTML = "Empresa:";
		document.getElementById("nascimento").lang = "BR";
		document.getElementById("pfpj_sel").value = "PF";
	} else {
		document.getElementById("sexo_div").style.display = "none";
		document.getElementById("nascimento_div").style.display = "none";
		document.getElementById("nome_div").innerHTML = "Raz&atilde;o social:";
		document.getElementById("cpf_div").innerHTML = "CNPJ:";
		document.getElementById("cpf2_div").innerHTML = '<input type="text" id="cnpj" maxlength="18" onkeypress="return FormataCNPJ(this);" onkeyup="autoTab(this,18,1);" lang="br" name="cpf" />*';
		document.getElementById("rg_div").innerHTML = "IE:";
		document.getElementById("rg2_div").innerHTML = '<input type="text" name="rg" id="rg" maxlength="15" onkeypress="return FormataIE(this);" onkeyup="autoTab(this,15,1);" />';
		document.getElementById("empresa_div").innerHTML = "Nome para contato:";
		document.getElementById("nascimento").lang = "";
		document.getElementById("pfpj_sel").value = "PJ";
	}
}

function FinalizarCompra(url) {
	if (document.getElementById("freteok").value==0) { 
		alert("Informe o CEP correto para calcular o frete!");
		return;
	}
	if (document.getElementById("vtotal").value==0) { 
		alert("Não há produtos no seu carrinho!");
		location.href = 'carrinho.php';
		return;
	}
	location.href = url;
}

function findPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft
		curtop = obj.offsetTop
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft
			curtop += obj.offsetTop
		}
	}
	return [curleft,curtop];
}

function ValueSubmit(campo,valor) {
	document.getElementById(campo).value = valor;
	document.getElementById(campo).form.submit();
}

function ConfirmaClick (msg) {
	if (confirm(msg)) {
		return true;
	} else {
		return false;
	}
}

function GoSubmitA(url,formobj) {
	document.getElementById(formobj).action = url;
	document.getElementById(formobj).submit();
}

function GoTo(url) {
	location.href = url;
}

function GoToBlank(url) {
	window.open(url);
}

function validaFormGeral(form_obj) {
	for (i=0;i<form_obj.length;i++) {
		if ( (form_obj[i].value == "" || form_obj[i].value == "#") && form_obj[i].lang == "br") {
			alert("Preencha corretamente todos os campos obrigatórios (*)!\nCampo: "+form_obj[i].name);
			return false;
		}
	}
	return true;
}

function validaFormCadastro(form_obj) {
	for (i=0;i<form_obj.length;i++) {
		if ( (form_obj[i].value == "" || form_obj[i].value == "#") && form_obj[i].lang == "br") {
			alert("Preencha corretamente todos os campos obrigatórios (*)!\nCampo: "+form_obj[i].name);
			return false;
		}
	}
	if (	(document.getElementById("fone_01_ddd").value=="" || document.getElementById("fone_01").value=="") &&
			(document.getElementById("fone_02_ddd").value=="" || document.getElementById("fone_02").value=="") &&
			(document.getElementById("fone_03_ddd").value=="" || document.getElementById("fone_03").value=="") ) {
		alert("Preencha ao menos um número de telefone para contato!");
		return false;
	}
	if (document.getElementById("email2")&&(document.getElementById("email2").value!=document.getElementById("email").value)) {
		alert("E-mail incorreto!");
		return false;
	}
	if (document.getElementById("cep").value.length<9) {
		alert("CEP Incorreto!");
		return false;
	}
	if (document.getElementById("pfpj_sel").value=="PF") {
		if (!isCPFCNPJ(document.getElementById("cpf").value,1)) {
			alert("CPF incorreto!");
			return false;
		}
	}
	if (document.getElementById("pfpj_sel").value=="PJ") {
		if (!isCPFCNPJ(document.getElementById("cnpj").value,2)) {
			alert("CNPJ incorreto!");
			return false;
		}
	}
	if (document.getElementById("cadastrar")) {
		if ( document.getElementById("senha").value!=document.getElementById("senha2").value || document.getElementById("senha").value=="" ) {
			alert("Redigite a sua senha por favor!");
			return false;
		}
	} else {
		if ( document.getElementById("senhaatual").value!="" ) {
			if ( document.getElementById("senha").value!=document.getElementById("senha2").value || (document.getElementById("senha").value=="" || document.getElementById("senha2").value=="") ) {
				alert("Redigite a sua senha por favor!");
				return false;
			}
		}
	}
	return true;
}

function FormataCPF(campo) {

	// Somente Números
	if ( ShiftPressed ) return false;
	
	var tecla = KeyID;
	vr = campo.value;
	vr = vr.replace(/\D/g,"");
	tam = vr.length +1;

	if (tecla == 8 ) { tam = tam - 1 ; }
		
	if (tecla == 8 || tecla == 46 || tecla == 9 || (tecla >= 48 && tecla <= 57) || (tecla >= 96 && tecla <= 105) ) {
	 	if ( (tam > 3) && (tam <= 6) ){
	 		campo.value = vr.substr(0,3) + '.' + vr.substr(3) ; }
	 	if ( (tam >= 7) && (tam <= 9) ){
	 		campo.value = vr.substr(0,3) + '.' + vr.substr(3,3) + '.' + vr.substr(6) ; }
	 	if ( tam >= 10 ){
	 		campo.value = vr.substr(0,3) + '.' + vr.substr(3,3) + '.' + vr.substr(6,3) + '-' + vr.substr(9) ; }
		return true;
	} else {
		return false;
	}
}

function FormataIE(campo) {

	// Somente Números
	if ( ShiftPressed ) return false;
	
	var tecla = KeyID;
	vr = campo.value;
	vr = vr.replace(/\D/g,"");
	tam = vr.length +1;

	if (tecla == 8 ) { tam = tam - 1 ; }
		
	if (tecla == 8 || tecla == 46 || tecla == 9 || (tecla >= 48 && tecla <= 57) || (tecla >= 96 && tecla <= 105) ) {
	 	if ( (tam > 3) && (tam <= 6) ){
	 		campo.value = vr.substr(0,3) + '.' + vr.substr(3) ; }
	 	if ( (tam >= 7) && (tam <= 9) ){
	 		campo.value = vr.substr(0,3) + '.' + vr.substr(3,3) + '.' + vr.substr(6) ; }
	 	if ( tam >= 10 ){
	 		campo.value = vr.substr(0,3) + '.' + vr.substr(3,3) + '.' + vr.substr(6,3) + '.' + vr.substr(9) ; }
		return true;
	} else {
		return false;
	}
}

function FormataCNPJ(campo) {

	// Somente Números
	if ( ShiftPressed ) return false;
	
	var tecla = KeyID;
	vr = campo.value;
	vr = vr.replace(/\D/g,"");
	tam = vr.length +1;

	if (tecla == 8 ) { tam = tam - 1 ; }
		
	if (tecla == 8 || tecla == 46 || tecla == 9 || (tecla >= 48 && tecla <= 57) || (tecla >= 96 && tecla <= 105) ) {
	 	if ( (tam > 2) && (tam <= 5) ){
	 		campo.value = vr.substr(0,2) + '.' + vr.substr(2) ; }
	 	if ( (tam >= 6) && (tam <= 8) ){
	 		campo.value = vr.substr(0,2) + '.' + vr.substr(2,3) + '.' + vr.substr(5) ; }
		if ( (tam >= 9) && (tam <= 12) ){
	 		campo.value = vr.substr(0,2) + '.' + vr.substr(2,3) + '.' + vr.substr(5,3) + '/' + vr.substr(8) ; }
	 	if ( tam >= 13 ){
	 		campo.value = vr.substr(0,2) + '.' + vr.substr(2,3) + '.' + vr.substr(5,3) + '/' + vr.substr(8,4) + '-' + vr.substr(12) ; }
		return true;
	} else {
		return false;
	}
}

function FormataRG(campo) {

	// Somente Números
	if ( ShiftPressed ) return false;
	
	var tecla = KeyID;
	vr = campo.value;
	vr = vr.replace(/\D/g,"");
	tam = vr.length +1;

	if (tecla == 8 ) { tam = tam - 1 ; }
		
	if (tecla == 8 || tecla == 46 || tecla == 9 || (tecla >= 48 && tecla <= 57) || (tecla >= 96 && tecla <= 105) ) {
	 	if ( (tam > 2) && (tam <= 5) ){
	 		campo.value = vr.substr(0,2) + '.' + vr.substr(2) ; }
	 	if ( (tam >= 6) && (tam <= 8) ){
	 		campo.value = vr.substr(0,2) + '.' + vr.substr(2,3) + '.' + vr.substr(5) ; }
	 	if ( (tam >= 9) ){
	 		campo.value = vr.substr(0,2) + '.' + vr.substr(2,3) + '.' + vr.substr(5,3) + '-' + vr.substr(8) ; }
		return true;
	} else {
		return false;
	}
}

function FormataDinheiro(campo,tammax) {

	// Somente Números
	if ( ShiftPressed ) return false;
	
	var tecla = KeyID;
	vr = campo.value;
	vr = vr.replace( "/", "" );
	vr = vr.replace( "/", "" );
	vr = vr.replace( ",", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace(/^[0]+/g,"")
	tam = vr.length;

	if (tam < tammax && tecla != 8){ tam = vr.length + 1 ; }

	if (tecla == 8 ){	tam = tam - 1 ; }
		
	if ( tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ){
		if ( tam <= 2 ){ 
	 		var zeros = '';
			for (i=2;i>=tam+1;i--) { zeros = zeros + '0'; }
	 		campo.value = '0,'+zeros+vr ; }
	 	if ( (tam > 2) && (tam <= 5) ){
	 		campo.value = vr.substr( 0, tam - 2 ) + ',' + vr.substr( tam - 2, tam ) ; }
	 	if ( (tam >= 6) && (tam <= 8) ){
	 		campo.value = vr.substr( 0, tam - 5 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
	 	if ( (tam >= 9) && (tam <= 11) ){
	 		campo.value = vr.substr( 0, tam - 8 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
	 	if ( (tam >= 12) && (tam <= 14) ){
	 		campo.value = vr.substr( 0, tam - 11 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ; }
	 	if ( (tam >= 15) && (tam <= 17) ){
	 		campo.value = vr.substr( 0, tam - 14 ) + '.' + vr.substr( tam - 14, 3 ) + '.' + vr.substr( tam - 11, 3 ) + '.' + vr.substr( tam - 8, 3 ) + '.' + vr.substr( tam - 5, 3 ) + ',' + vr.substr( tam - 2, tam ) ;}
	}

	// Somente Números
	if ( tecla == 8 || tecla == 46 || tecla == 9 || (tecla >= 48 && tecla <= 57) || (tecla >= 96 && tecla <= 105) ) return true; // Permite #s, BS, Del e Tab
	return false;
}

function FormataPeso(campo,tammax) {

	// Somente Números
	if ( ShiftPressed ) return false;
	
	var tecla = KeyID;
	vr = campo.value;
	vr = vr.replace( "/", "" );
	vr = vr.replace( "/", "" );
	vr = vr.replace( ",", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace( ".", "" );
	vr = vr.replace(/^[0]+/g,"")
	tam = vr.length;

	if (tam < tammax && tecla != 8){ tam = vr.length + 1 ; }

	if (tecla == 8 ){	tam = tam - 1 ; }
		
	if ( tecla == 8 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105 ){
		if ( tam <= 3 ){ 
			var zeros = '';
			for (i=3;i>=tam+1;i--) { zeros = zeros + '0'; }
	 		campo.value = '0,'+zeros+vr ; }
	 	if ( (tam > 3) && (tam <= 6) ){
	 		campo.value = vr.substr( 0, tam - 3 ) + ',' + vr.substr( tam - 3, tam ) ; }
	 	if ( (tam >= 7) && (tam <= 9) ){
	 		campo.value = vr.substr( 0, tam - 6 ) + '.' + vr.substr( tam - 6, 3 ) + ',' + vr.substr( tam - 3, tam ) ; }
	 	if ( (tam >= 10) && (tam <= 12) ){
	 		campo.value = vr.substr( 0, tam - 9 ) + '.' + vr.substr( tam - 9, 3 ) + '.' + vr.substr( tam - 6, 3 ) + ',' + vr.substr( tam - 3, tam ) ; }
	 	if ( (tam >= 13) && (tam <= 15) ){
	 		campo.value = vr.substr( 0, tam - 12 ) + '.' + vr.substr( tam - 12, 3 ) + '.' + vr.substr( tam - 9, 3 ) + '.' + vr.substr( tam - 6, 3 ) + ',' + vr.substr( tam - 3, tam ) ; }
	 	if ( (tam >= 16) && (tam <= 18) ){
	 		campo.value = vr.substr( 0, tam - 15 ) + '.' + vr.substr( tam - 15, 3 ) + '.' + vr.substr( tam - 12, 3 ) + '.' + vr.substr( tam - 9, 3 ) + '.' + vr.substr( tam - 6, 3 ) + ',' + vr.substr( tam - 3, tam ) ;}
	}

	// Somente Números
	if ( tecla == 8 || tecla == 46 || tecla == 9 || (tecla >= 48 && tecla <= 57) || (tecla >= 96 && tecla <= 105) ) return true; // Permite #s, BS, Del e Tab
	return false;
}

function FormataData(campo) {

	// Somente Números
	if ( ShiftPressed ) return false;
	
	var tecla = KeyID;
	vr = campo.value;
	vr = vr.replace( ".", "" );
	vr = vr.replace( "/", "" );
	vr = vr.replace( "/", "" );
	tam = vr.length + 1;

	if ( tecla != 9 && tecla != 8 ){
		if ( tam > 2 && tam < 5 )
			campo.value = vr.substr( 0, tam - 2  ) + '/' + vr.substr( tam - 2, tam );
		if ( tam >= 5 && tam <= 10 )
			campo.value = vr.substr( 0, 2 ) + '/' + vr.substr( 2, 2 ) + '/' + vr.substr( 4, 4 ); 
	}
	
	// Somente Números
	if ( tecla == 8 || tecla == 46 || tecla == 9 || (tecla >= 48 && tecla <= 57) || (tecla >= 96 && tecla <= 105) ) return true; // Permite #s, BS, Del e Tab
	return false;
}

function FormataHora(campo) {

	// Somente Números
	if ( ShiftPressed ) return false;
	
	var tecla = KeyID;
	vr = campo.value;
	vr = vr.replace( ".", "" );
	vr = vr.replace( ":", "" );
	vr = vr.replace( ":", "" );
	tam = vr.length + 1;

	if ( tecla != 9 && tecla != 8 ){
		if ( tam > 2 && tam < 5 )
			campo.value = vr.substr( 0, tam - 2  ) + ':' + vr.substr( tam - 2, tam );
	}

	// Somente Números
	if ( tecla == 8 || tecla == 46 || tecla == 9 || (tecla >= 48 && tecla <= 57) || (tecla >= 96 && tecla <= 105) ) return true; // Permite #s, BS, Del e Tab
	return false;
}

function FormataCEP(campo) {

	// Somente Números
	if ( ShiftPressed ) return false;
	
	var tecla = KeyID;
	vr = campo.value;
	vr = vr.replace( ".", "" );
	vr = vr.replace( "-", "" );
	vr = vr.replace( "-", "" );
	tam = vr.length + 1;

	if ( tecla != 9 && tecla != 8 ){
		if ( tam > 5 && tam < 9 )
			campo.value = vr.substr( 0, tam - 3  ) + '-' + vr.substr( tam - 3, tam );
	}

	// Somente Números
	if ( tecla == 8 || tecla == 46 || tecla == 9 || (tecla >= 48 && tecla <= 57) || (tecla >= 96 && tecla <= 105) ) return true; // Permite #s, BS, Del e Tab
	return false;
}

function FormataFone(campo) {

	// Somente Números
	if ( ShiftPressed ) return false;
	
	var tecla = KeyID;
	vr = campo.value;
	vr = vr.replace( ".", "" );
	vr = vr.replace( "-", "" );
	vr = vr.replace( "-", "" );
	tam = vr.length + 1;

	if ( tecla != 9 && tecla != 8 ){
		if ( tam > 4 && tam < 9 )
			campo.value = vr.substr( 0, tam - 4  ) + '-' + vr.substr( tam - 4, tam );
	}

	// Somente Números
	if ( tecla == 8 || tecla == 46 || tecla == 9 || (tecla >= 48 && tecla <= 57) || (tecla >= 96 && tecla <= 105) ) return true; // Permite #s, BS, Del e Tab
	return false;
}

function CampoNumerico () {
	var tecla = KeyID;
	if ( ShiftPressed ) return false;
	if ( tecla == 8 || tecla == 46 || tecla == 9 || tecla == 109 || (tecla >= 48 && tecla <= 57) || (tecla >= 96 && tecla <= 105) ) return true; // Permite #s, BS, Del e Tab
	return false;
}
	sl1 = "xml/xml_abas.php";
	sl2 = "xml/xml_carrinhoquant.php";
	sl3 = "xml/xml_frete.php";
	sl4 = "xml/xml_cep.php";

function autoTab(obj,lgt,jump) {
	if ( ControlPressed ) return;
	if (obj.value.length == lgt) {
		var tabindex = getIndex(obj)+jump;
		obj.form[tabindex].focus();	
	}
}

function getIndex(input) {
	var index = -1, i = 0, found = false;
	while (i < input.form.length && index == -1)
	if (input.form[i] == input) index = i;
	else i++;
	return index;
}
-->