<!--
/*
var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])
*/
var strGif = "../images/transparente.gif"
var strFilter = "progid:DXImageTransform.Microsoft.AlphaImageLoader"
var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])
function fixPNG(myImage) 
{
    if ((version >= 5.5) && (version < 7) && (document.body.filters)) 
    {
       var imgID = (myImage.id) ? "id='" + myImage.id + "' " : ""
	   var imgClass = (myImage.className) ? "class='" + myImage.className + "' " : ""
	   var imgTitle = (myImage.title) ? 
		             "title='" + myImage.title  + "' " : "title='" + myImage.alt + "' "
	   var imgStyle = "display:inline-block;" + myImage.style.cssText;
	   var strNewHTML = "<span " + imgID + imgClass + imgTitle
                  + " style=\"" + "width:" + myImage.width 
                  + "px; height:" + myImage.height 
                  + "px;" + imgStyle + ";"
                  + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
                  + "(src=\'" + myImage.src + "\', sizingMethod='scale');\"></span>"
	   myImage.outerHTML = strNewHTML	  
    }
}

//To implement this only on specific PNGs, add the following to each PNG image you wish to transform:

function UploadArquivo(a,i,t,p,n,idG){
	
	if (a == 'REM') {	
		w = window.confirm('Deseja realmente excluir o arquivo?');
		if (w == true) {
			window.open('UpLoadArquivoRemover.asp?id='+i+'&tbl='+t+'&PaginaRetorno='+p,'Mini','width=400 height=300');
		}
	} else {
		window.open('UpLoadArquivo.asp?acao='+a+'&idGrupoArquivo='+idG+'&NomeArquivo='+n+'&id='+i+'&tbl='+t+'&PaginaRetorno='+p,'Mini','width=600 height=410');
	}
}

function MostraTRLoop(lugar, id, qtdTR) {

	for (i=1;i<=qtdTR;i++){
	//alert(lugar + i);
	document.getElementById(lugar + i).style.display = "none";
	}
	document.getElementById(lugar + id).style.display = "";
}

function AlteraImagem( NomeImg, IMG1, IMG2, key ){
	
//	document[NomeImg].src = IMG2;
/*

	varImg1 = document[NomeImg];
	varImg1.src = IMG1;
	fixPNG(varImg1);
	alert(varImg1.src);

/*/
	varImg2 = document[NomeImg];
	varImg2.src = IMG2;
	//alert(varImg2.src);

	//alert(key)
	if (key == 1 ) {
		fixPNG(varImg2);
	}
	
	//document.getElementById( NomeImg ).src = IMG2;

}
function MostraTR(lugar) {
	if(document.getElementById(lugar).style.display == "none"){
		document.getElementById(lugar).style.display = "";
	}else{
		document.getElementById(lugar).style.display = "none";
	}
}

function MostraTRLoop(lugar, id, qtdTR) {

	for (i=1;i<=qtdTR;i++){
	//alert(lugar + i);
	document.getElementById(lugar + i).style.display = "none";
	}
	document.getElementById(lugar + id).style.display = "";
}

function UploadImagem(a,i,t,p){

	if (a == 'REM') {	
		w = window.confirm('Deseja realmente excluir a imagem?');
		if (w == true) {
			window.open('UpLoadImagemRemover.asp?id='+i+'&tbl='+t+'&PaginaRetorno='+p,'Mini','width=400 height=300');
		}
	} else {
		window.open('UpLoadImagem.asp?id='+i+'&tbl='+t+'&PaginaRetorno='+p,'Mini','width=600 height=410');
	}
}

function ExibeImagem(campo,img) { 
	img.src = campo.value;
}

function MontaDataNascimento() {
		
	dia = document.Form.DiaNascimento.value;
	mes = document.Form.MesNascimento.value;
	ano = document.Form.AnoNascimento.value;
	document.Form.DataNascimento.value = dia+'/'+mes+'/'+ano;
		
}


function MontaDataNascimento() {

	dia = document.Form.DiaNascimento.value;
	mes = document.Form.MesNascimento.value;
	ano = document.Form.AnoNascimento.value;
	document.Form.DataNascimento.value = dia+'/'+mes+'/'+ano;
	
}

// Bloqueia eventos do botao direito do mouse

function DesabilitaEnter(event)
{
//Internet Explorer
if(window.event && window.event.keyCode == 13)
{
return false;
}

//Netscape e Mozilla
if (event && event.which == 13)
{
return false;
}
}



function Bloqueia(e) {
	if (window.event) {
		var X = window.event.keyCode;
		var Ctrl = window.event.ctrlKey;
		if (Ctrl && (X == 78 || X == 116 || X == 122) ) {
			window.event.keyCode = 8;
			if (window.event.keyCode == 8) {
				window.event.cancelBubble = true;
			    window.event.returnValue = false;
			    return false;
			}
		}
	}
	else {
		var X = e.which;
		if (X == 110) return(false);
	}	

	if (navigator.appName == 'Netscape') {
	  window.captureEvents(Event.KEYPRESS);
	  window.onkeypress = Bloqueia;
	}
}


//----------------- Fim de Funcao Para Bloquear Barra de Status -------------------------

     var hellotext=" Kit em casa - Faça suas compras com mais comodidade ! ";
     var thetext="";
     var started=false;
     var step=0;
     var times=1;
     function msgBarraStatus(){
     times--
     if (times==0) {
         if (started==false){
		     started = true;
		     window.status = hellotext;
		     setTimeout("anim()",1);
		 	 }
	     thetext = hellotext;
	     }
     }
     
	 function showstatustext(txt)    {
	     thetext = txt;
	     setTimeout("msgBarraStatus()",5000)
	     times++
     }

     function anim()     { 
     step++
     if (step==12) {step=1}
     if (step==1) {window.status='>>=========='+thetext+'==========<<'}
     if (step==2) {window.status='=>>========='+thetext+'=========<<='}
     if (step==3) {window.status='==>>========'+thetext+'========<<=='}
     if (step==4) {window.status='===>>======='+thetext+'=======<<==='}
     if (step==5) {window.status='====>>======'+thetext+'======<<===='}
     if (step==6) {window.status='=====>>====='+thetext+'=====<<====='}
     if (step==7) {window.status='======>>===='+thetext+'====<<======'}
     if (step==8) {window.status='=======>>==='+thetext+'===<<======='}
     if (step==9) {window.status='========>>=='+thetext+'==<<========'}
     if (step==10) {window.status='=========>>='+thetext+'=<<========='}
     if (step==11) {window.status='==========>>'+thetext+'<<=========='}
     setTimeout("anim()",100);
     }
// Para chamar a funcão devo usar onLoad="msgBarraStatus();"
//----------------- Fim de Funcao Para Bloquear Barra de Status -------------------------


//Funcao Logoff
function Logoff() {
	var confirmacao = window.confirm('Deseja realmente Sair ?');
	if (confirmacao == true) { 
	document.location.href = 'logoff.asp';	
    }
	else{	
   	document.location.href='#';
  }
}


function CaractereIlegal (e,punct)	{		

  if (document.all){
  var evt=event.keyCode;
  }else{
  var evt = e.charCode;}
  if (evt==39){
  return false;
  }
  return true;
}

//------------------------------------------------
function ApagaMsgAlerta(id) {
	document.getElementById('MsgAlerta'+id).style.display = "none";
}
//------------------------------------------------
function AdicionarCarrinho(id,tbl,idOrigem,Qtd,valor) {

var form = eval("document.Form"+idOrigem);

if (Qtd == 0) {
	  alert("Por favor, insira a Quantidade igual ou superior a 1")
	  Campo.focus();
	  Campo.value = 1;
	  return false;
  }else{
	form.VetorPedidoItem.value = id+","+tbl+","+idOrigem+","+Qtd+","+valor;
	alert(form.VetorPedidoItem.value);
	form.action.value = "Incluir_Vetor";
	form.submit();
	//alert("O Item foi adicionado ao seu carrinho de Compras!");
  }
}
// ----- Funcao que verifica a quantidade de itens no carrinho antes de atualizar a quantidade ------------

function VerificaCarrinho(QtdEstoque,QtdSolicitada,Form,id){

	var Formulario = eval("document."+Form);
	
	if( parseInt(QtdSolicitada) > parseInt(QtdEstoque) ){
	document.getElementById('MsgAlerta'+id).style.display = "";
	Formulario.Qtd.value = 1;			
	}
	
	if( QtdSolicitada = '' || parseInt(QtdSolicitada) == 0){
	//document.getElementById('MsgAlerta'+id).style.display = "";
	alert('Por favor, insira a Quantidade igual ou superior a 1');
	Formulario.Qtd.value = 1;				
	}

}
// ---------- funcao para adicionar itens ao carrinho de compras (bandeja) -------------------
function MontaKit(id,idOrigem,Qtd,valor) {

var form = eval("document.Form"+idOrigem);

  if (Qtd == 0) {
  alert("Por favor, insira a Quantidade igual ou superior a 1")
  }
  else{

	form.VetorKitItem.value = id+","+idOrigem+","+Qtd+","+valor;
	form.action.value = "Incluir_VetorKit";
	//form.PaginaInclude.value = "MontaKit";
	form.submit();

  }
}  
//----------------------------------------------------------------------------------
function RemoverCarrinho(msg, url, acao) {
	var confirmacao = window.confirm(msg);
	if (confirmacao == true) {
		
		if (acao == "u") {
			document.location.href=url;
		} else {
			var form = eval("document."+url);
			form.submit();
		}	
	 }
}		
//----------------------------------------------------------------------------------
function AtualizaQtdCarrinho(xForm){
  Formulario = eval("document."+xForm);
  qtd = Formulario.qtd;
  Formulario.submit();
  }

//----------------------------------------------------------------------------------
function EnviaFormBrinde(){
 document.Add_Brinde.action='BrindeProduto_gravar.asp';
  checkCampos('Add_Brinde','idBrinde,De,Ate,Qtd',' Brinde, De, Até, Quantidade');
  }
  
//----------------------------------------------------------------------------------
function ValidaContatoHP(){
	if (document.Form.Nome.value==""){
	alert ('O campo Nome é de preenchimento obrigatório');
	document.Form.Nome.focus();
	return (false);
	}
	
	if (document.Form.email.value==""){
	alert ('O campo E-mail é de preenchimento obrigatório');
	document.Form.email.focus();
	return (false);
	}	
	
	if (document.Form.Assunto.value==""){
	alert ('O campo Assunto é de preenchimento obrigatório');
	document.Form.Assunto.focus();
	return (false);
	}		
	
	if (document.Form.Mensagem.value==""){
	alert ('O campo Mensagem é de preenchimento obrigatório');
	document.Form.Mensagem.focus();
	return (false);
	}			
 return (true);
}

//Funcao para Exlcuir Registros 
function Left(str, n){

     if (n <= 0)
     return "";

       else if (n > String(str).length)
       return str;

         else
         return String(str).substring(0,n);
}


function ExcluirRegistro(id,Item, tbl,PaginaRetorno,p,c,o,PaginaOrigem ) {
	var confirmacao = window.confirm('Deseja Realmente excluir '+Item+' ?');

	if (confirmacao == true) { 
		if (PaginaOrigem != undefined) {
		document.location.href = PaginaOrigem+'?id='+id;
		}else{	
		document.location.href = 'ExcluirRegistro.asp?Id='+id+'&tbl='+tbl+'&PaginaRetorno='+PaginaRetorno+'&p='+p+'&c='+c+'&o='+o;
		}
	}
}



// FORMATAÇÃO DE CAIXAS DE TEXTO (UNIVERSAL)
function txtBoxFormat(objForm, strField, sMask, evtKeyPress,punct) {
      var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;

      if(document.all) {
        nTecla = evtKeyPress.keyCode; }
      else if(document.layers) {
        nTecla = evtKeyPress.which;
      }

      sValue = objForm[strField].value;

      sValue = sValue.toString().replace( "-", "" );
      sValue = sValue.toString().replace( "-", "" );
      sValue = sValue.toString().replace( ".", "" );
      sValue = sValue.toString().replace( ".", "" );
      sValue = sValue.toString().replace( "/", "" );
      sValue = sValue.toString().replace( "/", "" );
      sValue = sValue.toString().replace( "(", "" );
      sValue = sValue.toString().replace( "(", "" );
      sValue = sValue.toString().replace( ")", "" );
      sValue = sValue.toString().replace( ")", "" );
      sValue = sValue.toString().replace( " ", "" );
      sValue = sValue.toString().replace( " ", "" );
      fldLen = sValue.length;
      mskLen = sMask.length;

      i = 0;
      nCount = 0;
      sCod = "";
      mskLen = fldLen;

      while (i <= mskLen) {


        bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/"))
        bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))

        if (bolMask) {
          sCod += sMask.charAt(i);
          mskLen++; }
        else {
          sCod += sValue.charAt(nCount);
          nCount++;
        }

        i++;
      }

      objForm[strField].value = sCod;
	  }

//Função de validação de CPF
        function validaCPF(cpf) {
                 
				 if (cpf == "") {
				 
				 VarCpf = document.Form.CPF;
				 cpf = document.Form.CPF.value;
				 
				 
				 }else{
				 VarCpf = eval("document.Form."+cpf);
				 cpf = eval("document.Form."+cpf+".value");
				 
				 }
				 cpf = cpf.replace(".", "");
				 cpf = cpf.replace(".", "");
				 cpf = cpf.replace(".", ""); 
				 cpf = cpf.replace("-", ""); 
				 
                 erro = new String;
                 if ((cpf.length < 11) && (cpf != "")) erro += "Sao necessarios 11 digitos para verificacao do CPF! \n\n"; 
                 var nonNumbers = /\D/;
                 if (nonNumbers.test(cpf)) erro += "A verificacao de CPF suporta apenas numeros!"+ cpf+ " \n\n"; 
                 if (cpf == "00000000000" || cpf == "11111111111" || cpf == "22222222222" || cpf == "33333333333" || cpf == "44444444444" || cpf == "55555555555" || cpf == "66666666666" || cpf == "77777777777" || cpf == "88888888888" || cpf == "99999999999"){
                        erro += "Numero de CPF invalido!"
               }
               var a = [];
               var b = new Number;
               var c = 11;
               for (i=0; i<11; i++){
                      a[i] = cpf.charAt(i);
                      if (i < 9) b += (a[i] * --c);
               }
               if ((x = b % 11) < 2) { a[9] = 0 } else { a[9] = 11-x }
               b = 0;
               c = 11;
               for (y=0; y<10; y++) b += (a[y] * c--); 
               if ((x = b % 11) < 2) { a[10] = 0; } else { a[10] = 11-x; }
               if ((cpf.charAt(9) != a[9]) || (cpf.charAt(10) != a[10])){
                       erro +="Digito verificador com problema!";
               }
               if (erro.length > 0){
                       alert(erro);
					   VarCpf.focus();
					   return false;
					   
               }
            return true;
			Maskcpf = cpf.substr(0, 3) + '.' + cpf.substr(3, 6) + '.' + cpf.substr(6, 9) + '-' + cpf.substr(9, 11);
			VarCpf.value = Maskcpf;
			
      }
// ---------- funcao para adicionar itens ao carrinho de compras (bandeija) -------------------

// funcao somente ponto
	function SomenteNumeroPonto(e,punct)
	{		
		if (document.all){var evt=event.keyCode;}
		else{var evt = e.charCode;}
		var min_key = (punct?43:47);
		if ((evt <20) || (evt >min_key && evt<58) || (evt==46)){return true;}
		return false;
	}


// funcao somente numeros
function SomenteNumeros(e,punct, fE)
	{		
	
		// fE -> Flag Enter
		if (document.all){var evt=event.keyCode;}
		else{var evt = e.charCode;}
		var min_key = (punct?43:47);
		if (fE == "S")
		return desabilitarenter(); 

		if (evt <20 || (evt >min_key && evt<58)){return true;}
		return false;
	}
	

///-------------------- Nao permitir 0 ou nulo
function NegarNulo(valor, fc ) {
	var Campo = eval("document."+fc);
	if (valor == 0) {
	alert("Por favor, insira a Quantidade igual ou superior a 1");
	Campo.focus();
	Campo.value = 1;
	return false;
	} 
	}
	
	
//------------- Email CORRETO ---------------

function valida_email() {
if (Form.email.value == "") {

} else {
  prim = Form.email.value.indexOf("@")
  if(prim < 2) {
  alert("O e-mail informado não contem @.");
  Form.email.focus();
  Form.email.select();
  return false;
  }
  if(Form.email.value.indexOf("@",prim + 1) != -1) {
  alert("O e-mail informado parece não conter um PROVEDOR valido depois do @.");
  Form.email.focus();
  Form.email.select();
  return false;
  }
  if(Form.email.value.indexOf(".") < 1) {
  alert("O e-mail informado parece não conter um ponto (.) indicando seu provedor.");
  Form.email.focus();
  Form.email.select();
  return false;
  }
  if(Form.email.value.indexOf(" ") != -1) {
  alert("O e-mail informado parece não estar correto.");
  Form.email.focus();
  Form.email.select();
  return false;
  }
  if(Form.email.value.indexOf("zipmeil.com") > 0) {
  alert("O e-mail informado parece não estar correto.");
  Form.email.focus();
  Form.email.select();
  return false;
  }
  if(Form.email.value.indexOf("hotmeil.com") > 0) {
  alert("O e-mail informado parece não estar correto.");
  Form.email.focus();
  Form.email.select();
  return false;
  }
  if(Form.email.value.indexOf(".@") > 0) {
  alert("O valor inserido ( .@ ) iFormado parece não estar correto.");
  Form.email.focus();
  Form.email.select();
  return false;
  }
  if(Form.email.value.indexOf("@.") > 0) {
  alert("O e-mail informado parece não estar correto.");
  Form.email.focus();
  Form.email.select();
  return false;
  }
  if(Form.email.value.indexOf(".com.br.") > 0) {
  alert("O e-mail informado parece não estar correto.");
  Form.email.focus();
  Form.email.select();
  return false;
  }
  if(Form.email.value.indexOf("/") > 0) {
  alert("O e-mail informado parece não estar correto. Caracter ilegal ( / )");
  Form.email.focus();
  Form.email.select();
  return false;
  }
  if(Form.email.value.indexOf("[") > 0) {
  alert("O e-mail informado parece não estar correto. Caracter ilegal ( [ )");
  Form.email.focus();
  Form.email.select();
  return false;
  }
  if(Form.email.value.indexOf("]") > 0) {
  alert("O e-mail informado parece não estar correto. Caracter ilegal ( ] )");
  Form.email.focus();
  Form.email.select();
  return false;
  }
  if(Form.email.value.indexOf("(") > 0) {
  alert("O e-mail informado parece não estar correto. Caracter ilegal ( ( )");
  Form.email.focus();
  Form.email.select();
  return false;
  }
  if(Form.email.value.indexOf(")") > 0) {
  alert("O e-mail informado parece não estar correto. Caracter ilegal ( ) )");
  Form.email.focus();
  Form.email.select();
  return false;
  }
  if(Form.email.value.indexOf("..") > 0) {
  alert("O e-mail informado parece não estar correto. Caracter ilegal ( .. )");
  Form.email.focus();
  Form.email.select();
  return false;
  }
  if(Form.email.value.indexOf("www") != -1) {
  alert("O e-mail informado parece não estar correto. Caracter ilegal ( .www. )");
  Form.email.focus();
  Form.email.select();
  return false;
  }
}
  return true;
}
/*--------------------------------------------------------------*/
function ValidarLogin(f) {
	
	var Form = eval("document."+f);
	
	if (Form.email.value=="") {
	alert('O campo E-mail é de preechimento obrigatório!');
	Form.email.focus();
	return (false);
	}
	if (Form.senha.value=="") {
	alert('O campo Senha é de preechimento obrigatório!');
	Form.senha.focus();
	return (false);
	}
Form.submit();
}

// VERIFICA CAMPOS EM BRANCO
function checkCampos(form,valor){	
	
	var frm = eval("document."+form);
	//alert(frm);
	
	var ValorCampo = valor;
	
	var ArrayCampo = new String(ValorCampo) 
	
	ArrayCampo = ArrayCampo.split(",");

	var nomedocampo = ArrayCampo;
	var descricao = ArrayCampo;
	
	var msgAlert = "Por favor complete os seguintes Campos:\n\n";
	var msg = msgAlert.length;
	
	for (var i = 0; i < nomedocampo.length; i++){
		var objetos = frm.elements[nomedocampo[i]];
		var Ly = "Linha" + nomedocampo[i];
		var ExibeIcone = null;
	
		//alert(Ly);
		document.getElementById(Ly).style.display = "none";
		if (objetos){
			switch(objetos.type){
			case "select-one":
				if (objetos.selectedIndex == -1 || 
					objetos.options[objetos.selectedIndex].text == "" || objetos.value == ""){
					msgAlert += " - " + descricao[i] + "\n";
					document.getElementById(Ly).style.display = "";
				}
				break;
			case "select-multiple":
				if (objetos.selectedIndex == -1){
					msgAlert += " - " + descricao[i] + "\n";
					document.getElementById(Ly).style.display = "";
				}
				break;

			case "file":
			case "text":
			case "textarea":
			case "password":
			
				if (objetos.value == "" || objetos.value == null ){
					msgAlert += " - " + descricao[i] + "\n";
					document.getElementById(Ly).style.display = "";
				}
				break;
			default:
			}
			if (objetos.type == undefined){
				var blnchecked = false;
				for (var j = 0; j < objetos.length; j++){
					if (objetos[j].checked){
						blnchecked = true;
					}
				}
				if (!blnchecked){
					msgAlert += " - " + descricao[i] + "\n";
					document.getElementById(Ly).style.display = "";
				}
			}
		}
	}
	
	if (msgAlert.length == msg){
		//alert('Todos os Campos estão Preenchidos!');
		
		frm.submit();
		return true;
	}else{
		//alert(msgAlert);
		return false;
	}
	
} //checkCampos
						
						
//----------------------------------------------------------------------------------
function checkCamposValida(form,valor){

	var frm = eval("document."+form);
	
	var ValorCampo = valor;
	
	var ArrayCampo = new String(ValorCampo) 
	
	ArrayCampo = ArrayCampo.split(",");

	var nomedocampo = ArrayCampo;
	var descricao = ArrayCampo;

	var msgAlert = "Por favor complete os seguintes Campos:\n\n";
	var msg = msgAlert.length;
	
	for (var i = 0; i < nomedocampo.length; i++){
		var objetos = frm.elements[nomedocampo[i]];
		var Ly = "Linha" + nomedocampo[i];
	
		//alert(Ly);
		document.getElementById(Ly).style.display = "none";
		if (objetos){
			switch(objetos.type){
			case "select-one":
				if (objetos.selectedIndex == -1 || 
					objetos.options[objetos.selectedIndex].text == "" || objetos.value == ""){
					msgAlert += " - " + descricao[i] + "\n";
					document.getElementById(Ly).style.display = "";
					
				}
				break;
			case "select-multiple":
				if (objetos.selectedIndex == -1){
					msgAlert += " - " + descricao[i] + "\n";
					document.getElementById(Ly).style.display = "";
				}
				break;

			case "text":
			case "textarea":
			case "password":
				if (objetos.value == "" || objetos.value == null ){
					msgAlert += " - " + descricao[i] + "\n";
					document.getElementById(Ly).style.display = "";
				}
				break;
			default:
			}
			if (objetos.type == undefined){
				var blnchecked = false;
				for (var j = 0; j < objetos.length; j++){
					if (objetos[j].checked){
						blnchecked = true;
					}
				}
				if (!blnchecked){
					msgAlert += " - " + descricao[i] + "\n";
					document.getElementById(Ly).style.display = "";
				}
			}
		}
	}

	if (msgAlert.length == msg){
		//alert('Todos os Campos estão Preenchidos!');
		return true;
	}else{
		//alert(msgAlert);
		return false;
	}
	
} //checkCampos

//----------------------------------------------------------------------------------

// Funcao para verificar Senha e confirmacao de Senha
function ValidaSenha(Senha,SenhaX) {

if (Senha.value == "") {

	alert('Preencha o campo Senha para continuar!');
	Senha.focus();
	return (false);
	
}else{
	
	if (Senha.value != SenhaX.value) {

	alert('A confirmação da senha, não coincide com a senha digitada');
	SenhaX.value = "";
	Senha.value = "";
	Senha.focus();
	return (false);
	}					
  }
} // ValidaSenha

//----------------------------------------------------------------------------------
function AbreImagem(img, w, h) {
	window.open ("Visualizar_imagem.asp?ImagemNome="+img,"","width="+w+" height="+h+" scrollbars=no resizable=no");
}

function AbreImagemCertificado(img, w, h) {
	window.open ("Visualizar_imagem_certificado.asp?ImagemNome="+img,"","width="+w+" height="+h+" scrollbars=no resizable=no");
}
	
function Opener(url){
	 opener.location.href=url;
	 window.close();
}
	 //----------------------------------------------------------------------------------
function MostraTR(lugar) {
	if(document.getElementById(lugar).style.display == "none"){
		document.getElementById(lugar).style.display = "";
	}else{
		document.getElementById(lugar).style.display = "none";
	}
}
//----------------------------------------------------------------------------------
function MostraDiv( Ly, y){
var Ly
	if (y==1) { 
			void(document.all[Ly].style.visibility='visible');
	} else {
			void(document.all[Ly].style.visibility='hidden')
	}
}
//----------------------------------------------------------------------------------
function MostraInput(Linha) {

  var Linha = document.getElementById(Linha);
  var Campo = document.FormBusca.Filtro.value

  if (Campo == ''){
  Linha.style.display='none';
  }else {
  Linha.style.display='';
  }
}
//----------------------------------------------------------------------------------
function MostraTRimg(linha,imagem, img1, img2) {

	var linha = document.getElementById(linha);
	
	  if (linha.style.display=='none') {
		   linha.style.display='';
	       if(imagem != null) 
		   	 imagem.src='../images/'+img2+'.gif';
	  } else {
		   linha.style.display='none';
	       if(imagem != null) 
		     imagem.src='../images/'+img1+'.gif';
      }

}

//----------------------------------------------------------------------------------
function EncomendarPedido(Quantidade, idProduto,Tp) {
	var qtd = eval("document."+Quantidade+".value");
	location.href='ProdutoEncomendar.asp?idProduto='+idProduto+'&qtd='+qtd+'&tp='+Tp+'';
}
//----------------------------------------------------------------------------------
function AlertaFiltro() {
alert("Esta coluna não pode ser filtrada")
}
//----------------------------------------------------------------------------------
function desabilitarenter() {
//alert('funcao');
var tecla = event.keyCode;
if ((tecla == 13)) { 
    return false;
}
return tecla;
}
//-----------------------------------------------
function EnterSubmit(f) {
var form = eval("document."+f);
var tecla = event.keyCode;
if ((tecla == 13)) { 
    EnviaBusca("Sub")
}
return tecla;
}
//----------------------------------------------------
function tabAutomatico(cO,mL,cD){
var cD   = eval("document."+cD);

	if ( cO == mL ) {
		 cD.focus();   
	}
}
//-------------------------------------------------------
function ValidaCondPagto(tipo,ValorTotal, ValorParcelado){
//var tipo = document.Form.tipo.value;
	document.FormEnviar.tipo.value=tipo;
	if ((tipo == "VISA" ) || (tipo == "REDECARD" )) {
	
	valorMaximoParcelado = parseFloat(ValorParcelado);
	ValorTotal = parseFloat(ValorTotal);
	
	//alert(valorMaximoParcelado+' '+ ValorTotal)
	if (ValorTotal <  valorMaximoParcelado) {

		document.Form.idCondPagto.value = 1;
		document.Form.idCondPagto.disabled = true;

	}else{

		document.Form.idCondPagto.disabled = false;
		document.FormEnviar.idCondPagto_x.value = 1;  
	}
	
    
	}else{
	document.Form.idCondPagto.value = 1;
	document.Form.idCondPagto.disabled = true;
	}
			  
}

function Left(str, n){

     if (n <= 0)
     return "";

       else if (n > String(str).length)
       return str;

         else
         return String(str).substring(0,n);
}


/*  ------------------------  formata moeda  ------------------ */ 
function FormataMoeda(CampoCent) {
	//A formatacao da moeda foi alterada. agora utilizando ponto como separador de casa decimais - 25-7-2006

	var valor = eval("document."+CampoCent);

	if ((valor.value=='') || (isNaN(valor.value)) || (valor.value == "0") || (valor.value == 0 ) ) {
		valor.value = "R$ 0.00";
	} else
		
		valor.value = valor.value.replace(",", ".");
		valor.value = valor.value.replace("R$ ", "");

		lenvalor  = valor.value.length;
		AchaPonto = valor.value.indexOf(".")
	
	    if (AchaPonto == -1)  {

			valor.value = valor.value + ".00";

		} else {

			LenTroco =  valor.value.length;
			
			CharCorreto = AchaPonto + 3;
			
			if (LenTroco > CharCorreto) {

				//alert(CharCorreto);
				valor.value = Left(valor.value,CharCorreto);
				
			} else if (LenTroco == CharCorreto) {	

				valor.value = valor.value;

			} else if (LenTroco < CharCorreto) {

				valor.value = valor.value+"0";

			}
			
		}			
		valor.value = "R$ " + valor.value;
	} // valor = ""
/*------------------------------ fim de formata moeda ------------------- */

function EnviaFormPopup(f,t,w,h){
	window.open('',t,'width='+w+' height='+h+'');
	form = eval("document."+f);
	form.submit();
}

// VERIFICA CAMPOS EM BRANCO
function checkCamposBusca(form,valor){	
	
	var frm = eval("document."+form);
	//alert(frm);
	
	var ValorCampo = valor;
	
	var ArrayCampo = new String(ValorCampo) 
	
	ArrayCampo = ArrayCampo.split(",");

	var nomedocampo = ArrayCampo;
	var descricao = ArrayCampo;
	
	var msgAlert = "Por favor complete os seguintes Campos:\n\n";
	var msg = msgAlert.length;
	
	for (var i = 0; i < nomedocampo.length; i++){
		var objetos = frm.elements[nomedocampo[i]];
		var Ly = "Linha" + nomedocampo[i];
		var ExibeIcone = null;
	
		//alert(Ly);
		//document.getElementById(Ly).style.display = "none";
		if (objetos){
			switch(objetos.type){
			case "select-one":
				if (objetos.selectedIndex == -1 || 
					objetos.options[objetos.selectedIndex].text == "" || objetos.value == ""){
					msgAlert += " - " + descricao[i] + "\n";
					//document.getElementById(Ly).style.display = "";
				}
				break;
			case "select-multiple":
				if (objetos.selectedIndex == -1){
					msgAlert += " - " + descricao[i] + "\n";
					//document.getElementById(Ly).style.display = "";
				}
				break;

			case "file":
			case "text":
			case "textarea":
			case "password":
			
				if (objetos.value == "" || objetos.value == null ){
					msgAlert += " - " + descricao[i] + "\n";
					//document.getElementById(Ly).style.display = "";
				}
				break;
			default:
			}
			if (objetos.type == undefined){
				var blnchecked = false;
				for (var j = 0; j < objetos.length; j++){
					if (objetos[j].checked){
						blnchecked = true;
					}
				}
				if (!blnchecked){
					msgAlert += " - " + descricao[i] + "\n";
					//document.getElementById(Ly).style.display = "";
				}
			}
		}
	}
	
	if (msgAlert.length == msg){
		//alert('Todos os Campos estão Preenchidos!');
		
		frm.submit();
		return true;
	}else{
		document.FormBusca.ValorBusca.value = "Preencha a Busca";
		//alert(msgAlert);
		return false;
	}
	
} //checkCampos

// VERIFICA CAMPOS EM BRANCO
function checkCamposLogin(form,valor){	
	
	var frm = eval("document."+form);
	//alert(frm);
	
	var ValorCampo = valor;
	
	var ArrayCampo = new String(ValorCampo) 
	
	ArrayCampo = ArrayCampo.split(",");

	var nomedocampo = ArrayCampo;
	var descricao = ArrayCampo;
	
	var msgAlert = "Por favor complete os seguintes Campos:\n\n";
	var msg = msgAlert.length;
	
	for (var i = 0; i < nomedocampo.length; i++){
		var objetos = frm.elements[nomedocampo[i]];
		var Ly = "Linha" + nomedocampo[i];
		var ExibeIcone = null;
	
		//alert(Ly);
		//document.getElementById(Ly).style.display = "none";
		if (objetos){
			switch(objetos.type){
			case "select-one":
				if (objetos.selectedIndex == -1 || 
					objetos.options[objetos.selectedIndex].text == "" || objetos.value == ""){
					msgAlert += " - " + descricao[i] + "\n";
					//document.getElementById(Ly).style.display = "";
				}
				break;
			case "select-multiple":
				if (objetos.selectedIndex == -1){
					msgAlert += " - " + descricao[i] + "\n";
					//document.getElementById(Ly).style.display = "";
				}
				break;

			case "file":
			case "text":
			case "textarea":
			case "password":
			
				if (objetos.value == "" || objetos.value == null ){
					msgAlert += " - " + descricao[i] + "\n";
					//document.getElementById(Ly).style.display = "";
				}
				break;
			default:
			}
			if (objetos.type == undefined){
				var blnchecked = false;
				for (var j = 0; j < objetos.length; j++){
					if (objetos[j].checked){
						blnchecked = true;
					}
				}
				if (!blnchecked){
					msgAlert += " - " + descricao[i] + "\n";
					//document.getElementById(Ly).style.display = "";
				}
			}
		}
	}
	
	if (msgAlert.length == msg){
		//alert('Todos os Campos estão Preenchidos!');
		
		frm.submit();
		return true;
	}else{
		//alert(document.FormLogin.UsuarioLogin.value == '');
		if (document.FormLogin.UsuarioLogin.value == '') { 
			document.FormLogin.UsuarioLogin.value = "Preencha o Login";
		}
		if  (document.FormLogin.SenhaLogin.value == '') {
			//document.FormLogin.SenhaLogin.value = "Preencha a Senha";
		}
		//alert(msgAlert);
		return false;
	}
	
} //checkCampos

-->
