
function MoedaVerifica(valor, c) {
	
  var ValorFormat = valor;
  var campo       = eval("document."+c);
  //var campo = document.getElementById(c);
  LenValorFormat    = ValorFormat.length;
  VerifPagtoUsuario = LenValorFormat - 3;
  ValorIncorreto    = ValorFormat.charAt(VerifPagtoUsuario);
  div = document.getElementById("div"+campo.name)
  //div.style.display = 'none';
  div.className = "msgValorDisplay";
  
  // a vigula NAO esta antes das 2 casas do centavos ?
     if (ValorIncorreto != "," && valor != '') {
		campo.value = valor; //"0,00";
		campo.focus();
		//div.style.display = '';
		div.className = "msgValorIncorreto";
		div.innerHTML = 'O valor informado parece estar incorreto. <br> Digite um valor no formato 0,00';

/**/  //TrocoUsuario.value = "";
	    return false;
    }
    FindPonto2 = ValorFormat.indexOf("..");

	if (FindPonto2 != -1 && valor != '') {
		//campo.value = "0.00";
		campo.focus();              
		//div.style.display = '';
		div.className = "msgValorIncorreto"
		div.innerHTML = 'O valor informado parece estar incorreto. \n Não deve conter (..) \n Digite um valor no formato 0,00';	return false

	}
	return true;
}

function formataMoeda(objTextBox, SeparadorMilesimo, SeparadorDecimal, e){


	var sep = 0;
    var key = '';
    var i = j = 0;
    var len = len2 = 0;
    var strCheck = '0123456789';
    var aux = aux2 = '';
    var whichCode = (window.Event) ? e.which : e.keyCode;    
    // 13=enter, 8=backspace as demais retornam 0(zero)
    // whichCode==0 faz com que seja possivel usar todas as teclas como delete, setas, etc    
    if ((whichCode == 13) || (whichCode == 0) || (whichCode == 8)){
    	return true;
		
	}
    key = String.fromCharCode(whichCode); // Valor para o código da Chave
 
 
    if (strCheck.indexOf(key) == -1) 
    	return false; // Chave inválida
    len = objTextBox.value.length;

	for(i = 0; i < len; i++)
        if ((objTextBox.value.charAt(i) != '0') && (objTextBox.value.charAt(i) != SeparadorDecimal)) 
        	break;
    aux = '';
    for(; i < len; i++)
        if (strCheck.indexOf(objTextBox.value.charAt(i))!=-1) 
        	aux += objTextBox.value.charAt(i);
    aux += key;
    len = aux.length;
    if (len == 0) 
    	objTextBox.value = '';
    if (len == 1) 
    	objTextBox.value = '0'+ SeparadorDecimal + '0' + aux;
    if (len == 2) 
    	objTextBox.value = '0'+ SeparadorDecimal + aux;
    if (len > 2) {
        aux2 = '';
        for (j = 0, i = len - 3; i >= 0; i--) {
            if (j == 3) {
                aux2 += SeparadorMilesimo;
                j = 0;
            }
            aux2 += aux.charAt(i);
            j++;
        }
        objTextBox.value = '';
        len2 = aux2.length;
        for (i = len2 - 1; i >= 0; i--)
        	objTextBox.value += aux2.charAt(i);
        objTextBox.value += SeparadorDecimal + aux.substr(len - 2, len);
    }
    return false;
}
function SelectCheckAll(){ 
  
  for (i=0;i<document.Form.elements.length;i++) 
      if(document.Form.elements[i].type == "checkbox") 
		 document.Form.elements[i].checked=1;
}

function DesSelectCheckAll(){ 
  
  for (i=0;i<document.Form.elements.length;i++) 
      if(document.Form.elements[i].type == "checkbox") 
         document.Form.elements[i].checked=0;
		 document.Form.idMenuValores.value = "";
} 


function Left(str, n){

     if (n <= 0)
     return "";

       else if (n > String(str).length)
       return str;

         else
         return String(str).substring(0,n);
}

//----------------------------------------------------------------------------------
function VerificaTipoMenuAcesso(){

	//alert( document.Form.TipoMenuAcesso.value );

	if (document.Form.TipoMenuAcesso.value == 'Perfil') {
		document.getElementById("LinhaidPerfilAcesso").style.display = "block";
	}else if (document.Form.TipoMenuAcesso.value == 'Proprio')  {
		document.getElementById("LinhaidPerfilAcesso").style.display = "none";
	}


}
function GuardaCheckMenu(Valor,Checado){

	if (Checado == true)  {
	//--- Adicionando ---
		if (document.Form.idMenuValores.value == ""){
		sValue = Valor;
		}else{
		sValue = document.Form.idMenuValores.value +","+Valor;
		}
	
	}else {
	//--- Removendo ---
		var ArrayCampo = new String(document.Form.idMenuValores.value);
		var sValue = ""
		ArrayCampo = ArrayCampo.split(",");
		for (i=0;i<ArrayCampo.length;i++){
			
			if (parseInt(ArrayCampo[i]) != parseInt(Valor)) {
			
				if (sValue == ""){
				sValue  = ArrayCampo[i];
				}else{
				sValue = sValue + ","+ArrayCampo[i];
				}
			} //(ArrayCampo(i) != Valor)	
			
		}// for

	} //(Checado == true)
	document.Form.idMenuValores.value = sValue;
}



function GuardaCheckOpcaoGravar(Valor,Checado){

	alert(Checado+', '+Valor)
	if (Checado == true)  {
	//--- Adicionando ---
		if (document.Form.idOpcaoGravarValores.value == ""){
		sValue = Valor;
		}else{
		sValue = document.Form.idOpcaoGravarValores.value +","+Valor;
		}
	
	}else {
	//--- Removendo ---
		var ArrayCampo = new String(document.Form.idOpcaoGravarValores.value);
		var sValue = ""
		ArrayCampo = ArrayCampo.split(",");
		for (i=0;i<ArrayCampo.length;i++){
			
			if (parseInt(ArrayCampo[i]) != parseInt(Valor)) {
			
				if (sValue == ""){
				sValue  = ArrayCampo[i];
				}else{
				sValue = sValue + ","+ArrayCampo[i];
				}
			} //(ArrayCampo(i) != Valor)	
			
		}// for

	} //(Checado == true)
	document.Form.idOpcaoGravarValores.value = sValue;
}



function MudaComboTipoMenu(){

	document.Form.TipoMenuAcesso.options[0].selected = true;
	document.Form.idPerfilAcesso.options[0].selected = true;
	VerificaTipoMenuAcesso();

}
function EnableCheckBoxGravar(valor, checado) {

	if (checado == true) {
	
		document.getElementById(valor).disabled = ""   
		
	}else {
	
		document.getElementById(valor).disabled = "disabled"   
	}

}


function TrocaCorSelecionada(id) {

	if (document.getElementById(id).className == 'CorMenuCheckedOff') {
	document.getElementById(id).className = 'CorMenuCheckedOn';
	}else{
	document.getElementById(id).className = 'CorMenuCheckedOff';
	}

}
//To implement this only on specific PNGs, add the following to each PNG image you wish to transform:



//Função de validação de CPF
function validaCPFDiv(cpf) {

		 cpf = document.Form.CPF.value;
		 
		 if (cpf == "") {
			 document.Form.Alerta.value = 'Por favor, preencha o campo C.P.F.';
			 return false;
		 }else{
		 
		 cpf = cpf.replace(".", "");
		 cpf = cpf.replace(".", "");
		 cpf = cpf.replace(".", ""); 
		 cpf = cpf.replace("-", ""); 
		 
		 erro = new String;
		 if ((cpf.length < 11) && (cpf != "")) erro += "São necessarios 11 digitos para verificacao do CPF! \n\n"; 
		 var nonNumbers = /\D/;
		 if (nonNumbers.test(cpf)) erro += "A verificacao de CPF suporta apenas numeros!                \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!";
		 	 }
		   }
		
		document.Form.Alerta.value = erro;

		if (erro == "") 
		 {
		   document.Form.CPF.value = cpf;
		   document.Form.submit();
		   //location.href = "LoginValidarCPF.asp"
		 }
		 
		return false;		
}

function SalvaPergunta( v, d ) {
	
	if (d == 0) {		
		if (v == "" || v == 0) {
			document.getElementById("msgReposta").style.display = "";
		} else {
			document.getElementById("btnConfirmacao").src = "../images/btn_Aguarde.gif";
			document.FormPergunta.EmDuvida.value = 'N';
			document.FormPergunta.Excluido.value = 'N';
			document.FormPergunta.submit();
		}
	}else{
		document.FormPergunta.Excluido.value = 'N';
		document.FormPergunta.EmDuvida.value = 'S';
		document.FormPergunta.submit();
	}
}

function Reseta(idRR){
	
	idRR = document.getElementById("idRespostaResidente").value;
	
	if (idRR == "") {
		document.FormPergunta.reset();
	}else{
		document.FormPergunta.Excluido.value = 'S';
		document.FormPergunta.submit();
	}
}
// ------------------------------ FIM DE FUNCOES PARA AJAX --------------------------------------
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 AbrePaginaSwf(url) {
	dominio = document.domain;
	
	if (dominio.indexOf('varosoft') >= 0 ) {
	subVar = "/clientes/sbcm/web";
	}else{
	subVar = "";	
	}
	location.href = "http://" + dominio + subVar + "/"+ url
}

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 OcultaTR() { 
document.getElementById("CorpoClinicoView").style.display = "none";
}

function MostraTRcontrole(lugar, controle) {
	
	if(controle == 1 ){
		document.getElementById(lugar).style.display = "";
	}else{
		document.getElementById(lugar).style.display = "none";
	}
}

//------------------------------------------
//Limita Caractere para Textarea Resumo
function LimitaCaractere(qtd){
    limite = qtd;
    myTextArea = document.forms[0].Resumo;

    if (myTextArea.value.length > limite) {
        myTextArea.value = myTextArea.value.substr(0, (myTextArea.value.length - (myTextArea.value.length - limite)));
    }
}

//------------------------------------------
function MostraTR(lugar) {
	if(document.getElementById(lugar).style.display == "none"){
		document.getElementById(lugar).style.display = "";
	}else{
		document.getElementById(lugar).style.display = "none";
	}
}

//------------------------------------------
function TrocaTR(div1, div2) {

if(document.getElementById(div1).style.display == "none"){
		document.getElementById(div1).style.display = "";
		document.getElementById(div2).style.display = "none";
	}else{
		document.getElementById(div1).style.display = "none";
		document.getElementById(div2).style.display = "";
	}
}
// ------------------------------ FIM DE FUNCOES PARA AJAX --------------------------------------
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 UploadVideo(a,i,t,p){

	if (a == 'REM') {	
		w = window.confirm('Deseja realmente excluir a Video?');
		if (w == true) {
			window.open('UpLoadVideoRem.asp?id='+i+'&tbl='+t+'&PaginaRetorno='+p,'Mini','width=100 height=100');
		}
	} else {
		window.open('UpLoadVideo.asp?id='+i+'&tbl='+t+'&PaginaRetorno='+p,'Mini','width=600 height=410');
	}
}



/*---------------------------------------------*/
// 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;
	}



/*---------------------------------------------*/
function tabAutomatico(cO,mL,cD){
var cD   = eval("document."+cD);

	if ( cO == mL ) {
		 cD.focus();   
	}
}

function PaginaManutencao() {
	alert('Desculpe, Página em Desenvolvimento!');
	}
	
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;
	}
}


//Funcao para Exlcuir Registros 
function ExcluirRegistro(id,Item, tbl,PaginaRetorno, PaginaOrigem ) {
	
	var confirmacao2 = window.confirm('Deseja Realmente excluir '+Item+' ?');
	var confirmacao = window.confirm('Confirma a Exclusão de '+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;
		}
	}
}

//Funcao Logoff
function Logoff() {
	var confirmacao = window.confirm('Deseja realmente Sair ?');
	if (confirmacao == true) { 
	document.location.href = 'logoff.asp';	
    }
	else{	
   	document.location.href='#';
  }
}

function Opener(url) { 
  opener.location.href=url;
  window.close();
}

function EnviaFormPopup(f,a, w,h){
/*
	f -> form
	a -> Ação ( open / close )
	w -> largura
	h -> altura
*/	


	var form = eval("document."+f);

	if (a == "open") {
		window.open('','Mini','width='+w+', height='+h);
		
	}else if (a == "close") {
		window.close;
	}
	form.submit();
}



// 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 += "São 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 numeros
function SomenteNumeros(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)){return true;}
		return false;
	}
	
//------------- Email CORRETO ---------------




function valida_email(c) {
var FormEmail = eval("document."+ c);

//alert(FormEmail.value);

if (FormEmail.value == "") {
} else {
  prim = FormEmail.value.indexOf("@")
  if(prim < 2) {
  alert("O e-mail informado não contem @.");
  FormEmail.focus();
  FormEmail.select();
  return false;
  }
  if(FormEmail.value.indexOf("@",prim + 1) != -1) {
  alert("O e-mail informado parece não conter um PROVEDOR valido depois do @.");
  FormEmail.focus();
  FormEmail.select();
  return false;
  }
  if(FormEmail.value.indexOf(".") < 1) {
  alert("O e-mail informado parece não conter um ponto (.) indicando seu provedor.");
  FormEmail.focus();
  FormEmail.select();
  return false;
  }
  if(FormEmail.value.indexOf(" ") != -1) {
  alert("O e-mail informado parece não estar correto.");
  FormEmail.focus();
  FormEmail.select();
  return false;
  }
  if(FormEmail.value.indexOf("zipmeil.com") > 0) {
  alert("O e-mail informado parece não estar correto.");
  FormEmail.focus();
  FormEmail.select();
  return false;
  }
  if(FormEmail.value.indexOf("hotmeil.com") > 0) {
  alert("O e-mail informado parece não estar correto.");
  FormEmail.focus();
  FormEmail.select();
  return false;
  }
  if(FormEmail.value.indexOf(".@") > 0) {
  alert("O valor inserido ( .@ ) iFormado parece não estar correto.");
  FormEmail.focus();
  FormEmail.select();
  return false;
  }
  if(FormEmail.value.indexOf("@.") > 0) {
  alert("O e-mail informado parece não estar correto.");
  FormEmail.focus();
  FormEmail.select();
  return false;
  }
  if(FormEmail.value.indexOf(".com.br.") > 0) {
  alert("O e-mail informado parece não estar correto.");
  FormEmail.focus();
  FormEmail.select();
  return false;
  }
  if(FormEmail.value.indexOf("/") > 0) {
  alert("O e-mail informado parece não estar correto. Caracter ilegal ( / )");
  FormEmail.focus();
  FormEmail.select();
  return false;
  }
  if(FormEmail.value.indexOf("[") > 0) {
  alert("O e-mail informado parece não estar correto. Caracter ilegal ( [ )");
  FormEmail.focus();
  FormEmail.select();
  return false;
  }
  if(FormEmail.value.indexOf("]") > 0) {
  alert("O e-mail informado parece não estar correto. Caracter ilegal ( ] )");
  FormEmail.focus();
  FormEmail.select();
  return false;
  }
  if(FormEmail.value.indexOf("(") > 0) {
  alert("O e-mail informado parece não estar correto. Caracter ilegal ( ( )");
  FormEmail.focus();
  FormEmail.select();
  return false;
  }
  if(FormEmail.value.indexOf(")") > 0) {
  alert("O e-mail informado parece não estar correto. Caracter ilegal ( ) )");
  FormEmail.focus();
  FormEmail.select();
  return false;
  }
  if(FormEmail.value.indexOf("..") > 0) {
  alert("O e-mail informado parece não estar correto. Caracter ilegal ( .. )");
  FormEmail.focus();
  FormEmail.select();
  return false;
  }
  if(FormEmail.value.indexOf("www") != -1) {
  alert("O e-mail informado parece não estar correto. Caracter ilegal ( .www. )");
  FormEmail.focus();
  FormEmail.select();
  return false;
  }
}
  return true;
}



function CaractereIlegal (e,punct)	{		

  if (document.all){
  var evt=event.keyCode;
  }else{
  var evt = e.charCode;}
  if (evt==39){
  return false;
  }
  return true;
}




// VERIFICA CAMPOS EM BRANCO
function checkCampos(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];
		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 "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 AlertaOper() {
	alert('Por favor, clique em Salvar e selecione esta opção Novamente.');
}
//----------------------------------------------------------------------------------
function AbreImagem(img, w, h) {
	window.open ("Visualizar_imagem.asp?ImagemNome="+img,"","width="+w+", height="+h+", scrollbars=no, resizable=no");
}
//----------------------------------------------------------------------------------
//----------------------------------------------------------------------------------
function MostraTRimg(linha,imagem, img1, img2) {

	var linha = document.getElementById(linha);
    var urlImg = '../images/';
	  if (linha.style.display=='none') {
		   linha.style.display='';
	       if(imagem != null) 
		   	 imagem.src= urlImg +img2+'.gif';
	  } else {
		   linha.style.display='none';
	       if(imagem != null) 
		     imagem.src= urlImg +img1+'.gif';
      }

}
//----------------------------------------------------------------------------------
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 ExibeImagem(campo,img) { 
	img.src = campo.value;
}
