function ValidaCampos(nome,valor,divRetorno,nomecampo)
{
	var erro = 0;
	if ($x(nome).value!='') 
		{
		
			$x(divRetorno).innerHTML='<img src="images/ok.png" width="16" height="16" alt="">';
		}
			else 
				{  
	
					erro = 1;
					$x(divRetorno).innerHTML='<img src="images/erro.png" width="16" height="16" alt=""> ';
				}
	
	
	if(nome == 'txtEmail' || nome == 'txtConfirmaEmail')
		{
			var email = ValidaEmail(valor);
				if (email == 1)
					{
						erro = 1;
						$x(divRetorno).innerHTML='<img src="images/erro.png" width="16" height="16" alt=""> "' + nomecampo + '" não é um Email válido!';
					}
					else if(email == 0)
					{
						if ($x('txtEmail').value != '' && $x('txtConfirmaEmail').value !='') 
						{
							if ($x('txtEmail').value == $x('txtConfirmaEmail').value)
								{
									$x(divRetorno).innerHTML='<img src="images/ok.png" width="16" height="16" alt="">';
									$x('msgEmail').innerHTML= '<b><i>"' + $x('txtEmail').value+'"</i></b>';
								}
								else
									{
										erro = 1;
										$x('retConfirmaEmail').innerHTML='<img src="images/erro.png" width="16" height="16" alt=""> Email e Confirmação de Email não conferem!';
									}
						}
					}
		}	
	if(nome == 'txtConfirmaSenha' || nome == 'txtSenha')
		{
			if ($x('txtSenha').value != '' && $x('txtConfirmaSenha').value !='') 
						{
							if ($x('txtSenha').value == $x('txtConfirmaSenha').value)
								{
									$x(divRetorno).innerHTML='<img src="images/ok.png" width="16" height="16" alt="">';
								}
								else
									{
										erro = 1;
										$x('retConfirmaSenha').innerHTML='<img src="images/erro.png" width="16" height="16" alt=""> Senha e Confirmação de Senha não conferem!';
									}
						}
		}
	if (erro == 0) 
			$x("btnContinua").disabled=false; 
				else 
			$x("btnContinua").disabled=true;
}

function ValidaEmail(valor){
	var reEmail = /^[\w-]+(\.[\w-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;
			if (reEmail.test(valor)) 
				{
					var retEmail = 0;
				}
				else if (valor != null && valor != '') 
					{
						var retEmail = 1;
					}
			return retEmail;
}
function a(vlr,divRetorno,nomecampo){
	if(vlr == '')
		{
			$x(divRetorno).innerHTML='<img src="images/erro.png" width="16" height="16" alt=""> "' + nomecampo + '" obrigatório!';
			$x('cmdTipoPerfil').focus();
		}
		else
		{
			$x(divRetorno).innerHTML='<img src="images/ok.png" width="16" height="16" alt="">';
		}
		
}
function $x(quem){
 //apelido só pra não ficar repetindo o document.getElementById
 return document.getElementById(quem)
}

function SomenteNumero(e){
    var tecla=(window.event)?event.keyCode:e.which;
    if((tecla > 47 && tecla < 58)) return true;
    else{
    if (tecla != 8) return false;
    else return true;
    }
}

function Esconde(div) {
	document.getElementById(div).style.visibility='hidden';
	document.getElementById(div).style.display='none';
	document.getElementById(div).style.top='-5000px';
	document.getElementById(div).style.left='-5000px';
}
function Mostra(div) {
	document.getElementById(div).style.visibility='visible';
	document.getElementById(div).style.display='block';
	document.getElementById(div).style.position='relative';
	document.getElementById(div).style.top='0px';
	document.getElementById(div).style.left='0px';	
}


function exibe(solic){
	  if (solic.style.display == 'none'){
    	solic.style.display = '';
  }else{
    solic.style.display = 'none';
  }
}