function ajaxInit() {

  var xmlhttp;

  try {
     xmlhttp = new XMLHttpRequest();
  } catch(ee) {
     try {
        xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
     } catch(e) {
        try {
           xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        } catch(E) {
           xmlhttp = false;
        }
     }
  }

  return xmlhttp;

}


function closeDivGeral(nm_div){
var nm_div;

		document.getElementById(nm_div).style.visibility = "hidden";   
		document.getElementById(nm_div).innerHTML = "";
}

function verDetalhesReg(idReg){
var idReg,tpZoom;

 	location = "?pg=zoomMsgPC&idReg=" + idReg;

}


function cleanHIACESSO(){

	document.getElementById('INNERHTMLACESSO').innerHTML = "";
}

function ctrlAcesso(idReg,nm_fucao,action,keySendDados,nm_arq,ext_arq){
var idReg,nm_fucao,action,keySendDados,nm_arq,ext_arq;
			
	location  = "../arquivos/" + nm_arq;
				
	ajax = ajaxInit();
	  
		if (ajax) {
			ajax.open("POST", "adm/adm_getDados.php?idReg="+ idReg + "&nm_fucao=" + nm_fucao + "&action=" + action + "&keySendDados=" + keySendDados, true);
			ajax.onreadystatechange = function () {
				if (ajax.readyState == 4) {
					if (ajax.status == 200) {	
					//document.getElementById("CIDADE").style.visibility = "visible";   
					//alert(ajax.responseText);
					document.getElementById("INNERHTMLACESSO").innerHTML = ajax.responseText;
					window.setTimeout("cleanHIACESSO()",30000);
					//closeMenu("camadaInfoUser");
					} else {
							alert(ajax.statusText);
					}
				}
			}
		ajax.send(null);
	}
	
}

function setParamPesqZoom(cmp,vcmp,SubMenu,closeSubMenu,idReg){
var cmp,vcmp,vcmpNew,SubMenu,closeSubMenu,idReg;


	if (closeSubMenu == "true"){
	
		document.getElementById(SubMenu).innerHTML	=	"";
		return;
	
	}
	
	
	tcmp = vcmp.length;

	for(x=0; x<=tcmp;  x++){
	
		vcmp = vcmp.replace("*-*", " ");
	
	}


	document.getElementById(cmp).value				=	vcmp;
	document.getElementById("idReg").value			=	idReg;
	document.getElementById(SubMenu).innerHTML		=	"";
	
	
		if (cmp == "NOME_USER"){
			document.getElementById("idClie").value			=	idReg;
		}
	
	return;	
	

}




function checkPesqIntDt(){

	if (document.getElementById("indDt").checked){
	
		if((document.getElementById("paramPescDtI").value == "") || (document.getElementById("paramPescDtF").value == "")){
		
				document.getElementById("divAlert").style.visibility = "visible";
				document.getElementById("ESIS").innerHTML = "ATENCAO!!! Você optou por pesquisar por intervalos de data. Peencha os campos: Data Inicial e Data Final para prosseguir com a pesquisa!!!";
				return;
					
			}else{
					
				document.getElementById("divAlert").style.visibility = "hidden";
				document.getElementById("ESIS").innerHTML = "";
					
			}

	
	}


}


function mMenu(pg){
var pg;

	document.getElementById("pg").value = pg;
	document.formGeral.submit();

}
function getSubMenu(tpZoom,subMenu,filtro,cmp){
var tpZoom,subMenu,filtro,cmp;


	document.getElementById(subMenu).innerHTML = "Carregando...";

  ajax = ajaxInit();
  
  if (ajax) {
     ajax.open("POST", "../zoom/Gedzoom.php?tpZoom="+ tpZoom + "&subMenu=" + subMenu + "&filtro=" + filtro + "&cmp=" + cmp, true);
     ajax.onreadystatechange = function () {
        if (ajax.readyState == 4) {
           if (ajax.status == 200) {	
		   //document.getElementById("CIDADE").style.visibility = "visible";   
			
			//alert(ajax.responseText);
			document.getElementById(subMenu).innerHTML = ajax.responseText;
			
			//closeMenu("camadaInfoUser");
			} else {
              alert(ajax.statusText);
           }
        }
     }
     ajax.send(null);
  }
  
}



function edtMp(nCamp){
var x,nCamp,cpError,dados,retorno,Conta_user;
var reNumeros = /^\d+$/;
var reDate = /^((0[1-9]|[12]\d)\/(0[1-9]|1[0-2])|30\/(0[13-9]|1[0-2])|31\/(0[13578]|1[02]))\/\d{4}$/;
var reEmail = /^[\w!#$%&'*+\/=?^`{|}~-]+(\.[\w!#$%&'*+\/=?^`{|}~-]+)*@(([\w-]+\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;


	for(x=0; x<nCamp;  x++){
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		//cpObjeto = MyObject.name;
		
		
			if ((MyDate == "") && (MyObject.name != "CELULAR")){	
					
				document.getElementById("divAlert").style.visibility = "visible";
				document.getElementById("ESIS").innerHTML = "Peencha o campo obrigatorio baixo!!!";
				MyObject.focus();
				return;
					
			}else{
					
				document.getElementById("divAlert").style.visibility = "hidden";
				document.getElementById("ESIS").innerHTML = "";
					
			}


			
				switch (MyObject.name) {
				
					case "DDD":
					case "PESO":
					case "CPF_CNPJ_RG":
				
						eval("reNumeros");
						
							if (reNumeros.test(MyDate) == false) {
							
								document.getElementById("divAlert").style.visibility = "visible";
								document.getElementById("ESIS").innerHTML = "Peencha o campo obrigatorio apenas com números!!!";
								MyObject.focus();
								return;
								
							}else{
								
								document.getElementById("divAlert").style.visibility = "hidden";
								document.getElementById("ESIS").innerHTML = "";
								
							}
							
					break;
					
					
					case "EMAIL_USER":
					
						eval("reEmail");
						
								if (reEmail.test(MyDate) == false) {
									
									document.getElementById("divAlert").style.visibility = "visible";
									document.getElementById("ESIS").innerHTML = "Peencha o campo com formato de email válido ex: roger@copiaeciaweb.com.br [seuemail + @ + provedor + extenção - .com | .com.br | .net etc...]!!!";
									MyObject.focus();
									return;
									
								}else{
									
									document.getElementById("divAlert").style.visibility = "hidden";
									document.getElementById("ESIS").innerHTML = "";
									
							}

					
					break;

					
					case "DT_NASC":
					
							eval("reDate");
						
								if (reDate.test(MyDate) == false) {
									
									document.getElementById("divAlert").style.visibility = "visible";
									document.getElementById("ESIS").innerHTML = "Peencha o campo obrigatorio com formato ex: dia/mes/ano - 10/12/2009!!!";
									MyObject.focus();
									return;
									
								}else{
									
									document.getElementById("divAlert").style.visibility = "hidden";
									document.getElementById("ESIS").innerHTML = "";
									
							}

					
					break;
					


				
				}
			
			
			
			
	}
	

	sendDados();	
	
	
}

function confBck(nCamp){
var x,nCamp,cpError,dados,retorno,Conta_user;
var reDate = /^((0[1-9]|[12]\d)\/(0[1-9]|1[0-2])|30\/(0[13-9]|1[0-2])|31\/(0[13578]|1[02]))\/\d{4}$/;


	for(x=0; x<nCamp;  x++){
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		//cpObjeto = MyObject.name;
		
		
			if (MyDate == ""){	
					
				document.getElementById("divAlert").style.visibility = "visible";
				document.getElementById("ESIS").innerHTML = "Peencha o campo obrigatorio baixo!!!";
				MyObject.focus();
				return;
					
			}else{
					
				document.getElementById("divAlert").style.visibility = "hidden";
				document.getElementById("ESIS").innerHTML = "";
					
			}


			
				switch (MyObject.name) {
					
					case "DT_BCK":
					
							eval("reDate");
						
								if (reDate.test(MyDate) == false) {
									
									document.getElementById("divAlert").style.visibility = "visible";
									document.getElementById("ESIS").innerHTML = "Peencha o campo obrigatorio com formato ex: dia/mes/ano - 00/00/0000";
									MyObject.focus();
									return;
									
								}else{
									
									document.getElementById("divAlert").style.visibility = "hidden";
									document.getElementById("ESIS").innerHTML = "";
									
							}

					
					break;
					


				
				}
			
			
			
			
	}
	

	sendDados();	
	
	
}


function newCadPcOp(nCamp){
var x,nCamp,cpError,dados,retorno,Conta_user;
var reNumeros = /^\d+$/;
var reDate = /^((0[1-9]|[12]\d)\/(0[1-9]|1[0-2])|30\/(0[13-9]|1[0-2])|31\/(0[13578]|1[02]))\/\d{4}$/;
var reEmail = /^[\w!#$%&'*+\/=?^`{|}~-]+(\.[\w!#$%&'*+\/=?^`{|}~-]+)*@(([\w-]+\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;


	for(x=0; x<nCamp;  x++){
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		//cpObjeto = MyObject.name;
		
		
			if ((MyDate == "") && (MyObject.name != "CELULAR")){	
					
				document.getElementById("divAlert").style.visibility = "visible";
				document.getElementById("ESIS").innerHTML = "Peencha o campo obrigatorio baixo!!!";
				MyObject.focus();
				return;
					
			}else{
					
				document.getElementById("divAlert").style.visibility = "hidden";
				document.getElementById("ESIS").innerHTML = "";
					
			}


			
				switch (MyObject.name) {

					case "CPF_CNPJ_RG":
				
						eval("reNumeros");
						
							if (reNumeros.test(MyDate) == false) {
							
								document.getElementById("divAlert").style.visibility = "visible";
								document.getElementById("ESIS").innerHTML = "Peencha o campo obrigatorio apenas com números!!!";
								MyObject.focus();
								return;
								
							}else{
								
								document.getElementById("divAlert").style.visibility = "hidden";
								document.getElementById("ESIS").innerHTML = "";
								
							}
							
					break;
					
					case "EMAIL_USER":
					
						eval("reEmail");
						
								if (reEmail.test(MyDate) == false) {
									
									document.getElementById("divAlert").style.visibility = "visible";
									document.getElementById("ESIS").innerHTML = "Peencha o campo com formato de email válido ex: roger@copiaeciaweb.com.br [seuemail + @ + provedor + extenção - .com | .com.br | .net etc...]!!!";
									MyObject.focus();
									return;
									
								}else{
									
									document.getElementById("divAlert").style.visibility = "hidden";
									document.getElementById("ESIS").innerHTML = "";
									
							}

					
					break;

					
					case "DT_NASC":
					
							eval("reDate");
						
								if (reDate.test(MyDate) == false) {
									
									document.getElementById("divAlert").style.visibility = "visible";
									document.getElementById("ESIS").innerHTML = "Peencha o campo obrigatorio com formato ex: dia/mes/ano - 10/12/2009!!!";
									MyObject.focus();
									return;
									
								}else{
									
									document.getElementById("divAlert").style.visibility = "hidden";
									document.getElementById("ESIS").innerHTML = "";
									
							}

					
					break;
					
					case "SENHA_USER":
					case "CONF_SENHA_USER":
					
						validaSenha(MyObject);
					
					break;


				
				}
			
			
			
			
	}
	

	sendDados();	
	
	
}


function newCadSite(nCamp){
var x,nCamp,cpError,dados,retorno,Conta_user;
var reNumeros = /^\d+$/;
var reDate = /^((0[1-9]|[12]\d)\/(0[1-9]|1[0-2])|30\/(0[13-9]|1[0-2])|31\/(0[13578]|1[02]))\/\d{4}$/;
var reEmail = /^[\w!#$%&'*+\/=?^`{|}~-]+(\.[\w!#$%&'*+\/=?^`{|}~-]+)*@(([\w-]+\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;


	for(x=0; x<nCamp;  x++){
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		//cpObjeto = MyObject.name;
		
		
			if ((MyDate == "") && (MyObject.name != "FONE_USER")){	
					
				document.getElementById("divAlert").style.visibility = "visible";
				document.getElementById("ESIS").innerHTML = "Peencha o campo obrigatorio baixo!!!";
				MyObject.focus();
				return;
					
			}else{
					
				document.getElementById("divAlert").style.visibility = "hidden";
				document.getElementById("ESIS").innerHTML = "";
					
			}


			
				switch (MyObject.name) {

					
					case "SENHA_USER":
					case "CONF_SENHA_USER":
					
						validaSenha(MyObject);
					
					break;
					
					case "EMAIL_USER":
					
						eval("reEmail");
						
								if (reEmail.test(MyDate) == false) {
									
									document.getElementById("divAlert").style.visibility = "visible";
									document.getElementById("ESIS").innerHTML = "Peencha o campo com formato de email válido ex: roger@copiaeciaweb.com.br [seuemail + @ + provedor + extenção - .com | .com.br | .net etc...]!!!";
									MyObject.focus();
									return;
									
								}else{
									
									document.getElementById("divAlert").style.visibility = "hidden";
									document.getElementById("ESIS").innerHTML = "";
									
							}

					
					break;


				
				}
			
	}
	

	sendDados();	
	
	
}

function validaSenha(cpObjeto){
var cpError;

	cpError		= cpError;
	senha 		= document.getElementById("SENHA_USER").value;
	confSenha 	= document.getElementById("CONF_SENHA_USER").value;
	
	
	if ((senha.length < 6) || (confSenha.length < 6)){
		
			document.getElementById("divAlert").style.visibility = "visible";
			document.getElementById("ESIS").innerHTML = "Peencha o campo senha e confirmar senha com 6 ou mais dígitos!!!";
			cpObjeto.focus();
			return;
					
				
	
	}else{
					
			document.getElementById("divAlert").style.visibility = "hidden";
			document.getElementById("ESIS").innerHTML = "";
					
	}
	
	if (senha != confSenha){
			
			document.getElementById("divAlert").style.visibility = "visible";
			document.getElementById("ESIS").innerHTML = "Peencha o campo senha e confirmar senha com mesmo valor!!!";
			cpObjeto.focus();	
			return;
			
	}else{
					
			document.getElementById("divAlert").style.visibility = "hidden";
			document.getElementById("ESIS").innerHTML = "";
					
	}


				
}

function SelectCidadeDoEstado(){
var arrEstado,local,tipoCombo;

	arrDados 	= document.getElementById("arrEstado").options.value;
	
  ajax = ajaxInit();
  
  if (ajax) {
     ajax.open("GET", "adm/adm_selecaoCombos.php?arrDados="+ arrDados, true);
     ajax.onreadystatechange = function () {
        if (ajax.readyState == 4) {
           if (ajax.status == 200) {	
		   //document.getElementById("CIDADE").style.visibility = "visible";   
			
			//alert(ajax.responseText);
			HTMLCIDADE.innerHTML = ajax.responseText;
					
			
			//closeMenu("camadaInfoUser");
			} else {
              alert(ajax.statusText);
           }
        }
     }
     ajax.send(null);
  }
  
}
function sendDados(){
var x,nCamp,dados,retorno;
		
		form   = document.formGeral;
		dados = '';
		
		for (var i = 0; i < form.length; i++) {					
					
					if (i > 0) {
					 
					dados = dados + '&' + form[i].name + '=' + form[i].value;
					
					} else {
						
						dados = form[i].name + '=' + form[i].value;
					}
					
		}

		
		ajax = ajaxInit();
		if (ajax) {
	 
		//ajax.open("POST", "../adm/adm_getDados.php", true);
		ajax.open("POST", "adm/adm_getDados.php", true);
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				
			ajax.onreadystatechange = function () {
				
				if (ajax.readyState == 4) {
					if (ajax.status == 200) {
										
						retorno = ajax.responseText;
						//alert(retorno);
						
						switch (retorno) {
						
							case "001":
							case "002":
							case "003":
							case "004":
							case "005":
							case "006":
							case "007":
							case "008":
							
								location = "?pg=msgSis&idMsg="+retorno;
															
							break;


							//login nao aceito.......se for aceito pela classe login direciona para painel do usuario
							case "logFall":
								document.getElementById("errorLogin").innerHTML = "";
								document.getElementById("divAlert").style.visibility = "visible";
								document.getElementById("ESIS").innerHTML = "Login nao aceito. Entre em contato com o administrador atraves do menu CONTATO/SUPORTE para maiores informacoes!!!";
							break;

							
							case "1001"://
							
								location = "?pg=sendArq";
															
							break;
							
							case "pcAdm":
							
								location = "pcAdm/";
															
							break;
							
							case "cadDuplic":
							
								document.getElementById("divAlert").style.visibility = "visible";
								document.getElementById("ESIS").innerHTML = "ATENCAO!!! - Ja existe um usuario com a conta escolhida, de um outro valor para sua conta...";
								document.getElementById("CONTA_USER").focus();
							
							break;


							
						}
						
																
						} else {
								
								alert('Operacao nao realizada entre em contato com o administrador');
					}
				}
			}
							
			ajax.send(dados);
		}
	
}


function sendArqSite(){
var x,cpError,dados,retorno,ajax;

	
	for(x=0; x<2;  x++){
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;
		
			if (MyDate == ""){	
					
				document.getElementById("divAlert").style.visibility = "visible";
				document.getElementById("ESIS").innerHTML = "Peencha o campo obrigatorio baixo!!!";
				MyObject.focus();
				return;
					
			}else{
					
				document.getElementById("divAlert").style.visibility = "hidden";
				document.getElementById("ESIS").innerHTML = "";
			}


		
	}
	
	document.getElementById("msgCarregar").innerHTML = "Aguarde, enviando...";	
	document.formGeral.submit();
	

}

function sendCVSite(){
var x,cpError,dados,retorno,ajax;

	
	for(x=0; x<5;  x++){
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;
		
			if (MyDate == ""){	
					
				document.getElementById("divAlert").style.visibility = "visible";
				document.getElementById("ESIS").innerHTML = "Peencha o campo obrigatorio baixo!!!";
				MyObject.focus();
				return;
					
			}else{
					
				document.getElementById("divAlert").style.visibility = "hidden";
				document.getElementById("ESIS").innerHTML = "";
			}


		
	}
	
	document.getElementById("msgCarregar").innerHTML = "Aguarde, enviando...";	
	document.formGeral.submit();
	

}



function loginSistema(){
var x,cpError,dados,retorno,ajax;

	document.getElementById("errorLogin").innerHTML = "Aguarde, conectando...";

	
	for(x=0; x<2;  x++){
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;
		
			if (MyDate == ""){	
					
				document.getElementById("divAlert").style.visibility = "visible";
				document.getElementById("ESIS").innerHTML = "Peencha o campo obrigatorio baixo!!!";
				document.getElementById("errorLogin").innerHTML = "";
				MyObject.focus();
				return;
					
			}else{
					
				document.getElementById("divAlert").style.visibility = "hidden";
				document.getElementById("ESIS").innerHTML = "";
				document.getElementById("errorLogin").innerHTML = "";
			}


		
	}
	
	document.getElementById("errorLogin").innerHTML = "Aguarde, conectando...";
	
	sendDados();
	

}



function insertEditIndexArq(nCamp,action){
var x,cpError,dados,retorno,ajax,action;
var reNumeros = /^\d+$/;
							
	
	for(x=0; x<nCamp;  x++){
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;
		
			if (MyDate == ""){	
					
				document.getElementById("divAlert").style.visibility = "visible";
				document.getElementById("ESIS").innerHTML = "Peencha o campo obrigatorio baixo!!!";
				MyObject.focus();
				return;
					
			}else{
					
				document.getElementById("divAlert").style.visibility = "hidden";
				document.getElementById("ESIS").innerHTML = "";
					
			}
			
				switch (MyObject.name) {

					case "QTD_PG_ARQ":
				
						eval("reNumeros");
						
							if (reNumeros.test(MyDate) == false) {
							
								document.getElementById("divAlert").style.visibility = "visible";
								document.getElementById("ESIS").innerHTML = "Peencha o campo obrigatorio apenas com números!!!";
								MyObject.focus();
								return;
								
							}else{
								
								document.getElementById("divAlert").style.visibility = "hidden";
								document.getElementById("ESIS").innerHTML = "";
								
							}
				
				}

	
	}
	
				if (action == "insert"){
				
					document.getElementById("statusUpLoad").innerHTML = "<h3>Aguarde...<br>Indexando arquivo solicitado</h3>";
				
				}
				
				document.formGeral.submit();
	
	
}


function insertEditCad(nCamp){
var x,cpError,dados,retorno,ajax;
	
	for(x=0; x<nCamp;  x++){
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;
		
			if (MyDate == ""){	
					
				document.getElementById("divAlert").style.visibility = "visible";
				document.getElementById("ESIS").innerHTML = "Peencha o campo obrigatorio baixo!!!";
				MyObject.focus();
				return;
					
			}else{
					
				document.getElementById("divAlert").style.visibility = "hidden";
				document.getElementById("ESIS").innerHTML = "";
					
			}


		
	}
	
	sendDados();
	

}


function mudaPG(intPg,numPagina){
var intPg,numPagina;

	document.getElementById("intPg").value = intPg;
	document.getElementById("numPagina").value = numPagina;
	document.formGeral.submit();

}


function pesqGeral(){

	document.getElementById("numPagina").value = "";
	document.formGeral.submit();

}

function LimpaPesqGeral(){

	document.getElementById("numPagina").value = "";
	document.getElementById("paramPesc").value = "";
	document.getElementById("campPesq").value = "";
	document.formGeral.submit();

}

function selctAllChecks(){ 

	for (var i=0;i<document.formGeral.elements.length;i++) {
		
		 var objCheck = document.formGeral.elements[i];
		 
		 if (objCheck.name == 'idReg[]') { 
		 
			objCheck.checked = document.formGeral.selecAll.checked;
		} 
	}


}
function apagarMsg(action,delOk,pgEdt){
var action,idReg,msg,pgEdt;
var urlNav;

	urlNav = document.getElementById("urlNav").value


	if (delOk == "true"){
		
		
		document.getElementById("action").value = action;
		document.getElementById("keySendDados").value = "ok";
		
		
		document.formGeral.submit();
		
		
	}

	if (action == "delete"){
		
		
		msg = "Executar a acao no(s) registro(s) selecionado(s)? <a href=javascript:apagarMsg('delete','true','" + pgEdt+ "'); class='menuWhite'>Sim</a>  -  <a href='?pg="+urlNav+"' class='menuWhite'>Nao</a>";
							
			document.getElementById("divAlert").style.visibility = "visible";
			document.getElementById("ESIS").innerHTML = msg;
			//MyObject.focus();
			return;

		
		}else{
			
			document.getElementById("action").value = "";
			document.getElementById("pg").value = pgEdt;
			document.getElementById("keySendDados").value = "";

			document.formGeral.submit();

			
			}
	

}




function LimpaPesqGeralIndexAr(){

	document.getElementById("paramPescArq").value = "";
	document.getElementById("paramPescD").value = "";
	document.getElementById("paramPescC").value = "";
	document.getElementById("paramPescPer").value = "";
	document.getElementById("paramPescPast").value = "";
	document.getElementById("paramPescDtI").value = "";
	document.getElementById("paramPescDtF").value = "";
	document.getElementById("paramPescId").value = "";
	document.getElementById("paramPescTi").value = "";
	document.getElementById("indDt").value = "";
	document.getElementById("paramPescUser").value = "";
	
	document.formGeral.submit();

}

function delArq(action,delOk,pgEdt){
var action,idReg,msg,pgEdt;
var urlNav;


	if (delOk == "true"){
		
		
		document.getElementById("action").value = action;
		document.getElementById("keySendDados").value = "ok";
		
		
		document.formGeral.submit();
		
		
	}

	if (action == "delete"){
		
		
		msg = "Deletar o(s) registro(s) selecionado(s)? <a href=javascript:apagarMsg('delete','true','" + pgEdt+ "'); class='menuWhite'>Sim</a>  -  <a href='?pg="+urlNav+"' class='menuWhite'>Nao</a>";
							
			document.getElementById("divAlert").style.visibility = "visible";
			document.getElementById("ESIS").innerHTML = msg;
			//MyObject.focus();
			return;

		
		}else{
			
			document.getElementById("action").value = "";
			document.getElementById("pg").value = pgEdt;
			document.getElementById("keySendDados").value = "";

			document.formGeral.submit();

			
			}
	

}



function edtRegCad(idReg,action,delOk,pgEdt){
var action,idReg,msg,pgEdt;
var urlNav;

urlNav = document.getElementById("urlNav").value


	if (delOk == "true"){
		
		
		document.getElementById("action").value = action;
		document.getElementById("idReg").value = idReg;
		document.getElementById("keySendDados").value = "ok";
		
		
		sendDados();
		
		
	}

	if (action == "delete"){
		
		
		msg = "Deletar o registro:  (" + idReg+ ")     <a href=javascript:edtRegCad(" + idReg+ ",'delete','true','" + pgEdt+ "'); class='menuWhite'>Sim</a>  -  <a href='?pg="+urlNav+"' class='menuWhite'>Nao</a>";
							
			document.getElementById("divAlert").style.visibility = "visible";
			document.getElementById("ESIS").innerHTML = msg;
			//MyObject.focus();
			return;

		
		}else{
			
			document.getElementById("action").value = action;
			document.getElementById("idReg").value = idReg;
			document.getElementById("pg").value = pgEdt;
			document.formGeral.submit();

			
			}
	
	

}


function HistCredClie(idReg){
var idReg;
	
	document.getElementById("pg").value = "histCredClie";
	document.getElementById("idReg").value = idReg;
	
	document.formPesqGeral.submit();
		
	

}
function edtContaClie(idReg,tpConta,action){
var idReg,tpConta,action;
	
	document.getElementById("pg").value = "edtContaClie";
	document.getElementById("idReg").value = idReg;
	document.getElementById("action").value = action;
	document.getElementById("tpConta").value = tpConta;
	
	document.formPesqGeral.submit();
		
	

}

function LBCredClie(idReg,tpTrans,action,tpPG,tipoConta,idStatus,idClie,contaUser){
var ajax,tpTrans,action,idReg,CPHTML,tpTB,tpPG,action,idClie,contaUser;

	tpTB	=	"LibBloqCred";
	CPHTML 	= "RET"+ idReg;
	
	document.getElementById("idReg").value = idReg;
	document.getElementById("action").value = action;
	document.getElementById("tipoConta").value = tipoConta;
	document.getElementById("tpPG").value = tpPG;
	document.getElementById("idStatus").value = idStatus;
	document.getElementById("idClie").value = idClie;
	document.getElementById("contaUser").value = contaUser;
	
	
	
	
	ajax = ajaxInit();
  
	  if (ajax) {
		 ajax.open("GET", "../adm/adm_montaTbOpcoes.php?tpTrans="+ tpTrans + "&tpTB=" + tpTB + "&idReg=" + idReg, true);
		 ajax.onreadystatechange = function () {
			if (ajax.readyState == 4) {
			   if (ajax.status == 200) {	
			   //document.getElementById("CIDADE").style.visibility = "visible";   
				
				document.getElementById(CPHTML).innerHTML = ajax.responseText;
				document.getElementById(CPHTML).focus();
				//CPHTML.innerHTML = ajax.responseText;
						
				
				//closeMenu("camadaInfoUser");
				} else {
				  alert(ajax.statusText);
			   }
			}
		 }
		 ajax.send(null);
	  }

}

function insEditDelContaAtleta(nCamp,action){
var x,nCamp,cpError,dados,retorno,Conta_user,urlAction,action;
var reNumeros = /^\d+$/;
var reDate = /^((0[1-9]|[12]\d)\/(0[1-9]|1[0-2])|30\/(0[13-9]|1[0-2])|31\/(0[13578]|1[02]))\/\d{4}$/;


	for(x=1; x<nCamp;  x++){
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;

			if ((MyDate == "") && (MyObject.name != "DDD") && (MyObject.name != "CELULAR") && (MyObject.name != "FONE")){	
					
				document.getElementById(cpError).style.backgroundColor='#CC0000';
				document.getElementById(cpError).innerHTML = "Peencha o campo obrigatorio acima!!!";
				MyObject.focus();	
				return;
					
			}else{
					
				document.getElementById(cpError).style.backgroundColor='#FFFFFF';
				document.getElementById(cpError).innerHTML = "";

					
			}
			
				switch (MyObject.name) {
				
					case "DDD":
					case "FONE":
					case "CELULAR":
					case "PESO":
					case "CPF_CNPJ_RG":
				
						eval("reNumeros");
						
							if (reNumeros.test(MyDate) == false) {
							
								document.getElementById(cpError).style.backgroundColor='#CC0000';
								document.getElementById(cpError).innerHTML = "digite apenas nunmeros no campo acima!!!";
								MyObject.focus();
								return;	
							
							}else{
								
								document.getElementById(cpError).style.backgroundColor='#FFFFFF';
								document.getElementById(cpError).innerHTML = "";
								
							}
							
					break;
					
					case "SENHA_USER":
					case "CONF_SENHA_USER":
					
						//validaSenha(cpError);
					
					break;
					
					case "DT_NASC":
					
							eval("reDate");
						
								if (reDate.test(MyDate) == false) {
								
									document.getElementById(cpError).style.backgroundColor='#CC0000';
									document.getElementById(cpError).innerHTML = "Formato de data invalida ex: 00/00/0000";
									MyObject.focus();
									return;	
								
								}else{
									
									document.getElementById(cpError).style.backgroundColor='#FFFFFF';
									document.getElementById(cpError).innerHTML = "";
									
								}

					
					break;
					


				
				}//case
			
			
			
			
	}//looping for
	
		document.getElementById("action").value = "verifyDuplConta";

		form   = document.formGeral;
		dados = '';
		
		for (var i = 0; i < form.length; i++) {					
					
					if (i > 0) {
					 
					dados = dados + '&' + form[i].name + '=' + form[i].value;
					
					} else {
						
						dados = form[i].name + '=' + form[i].value;
					}
					
		}

		
		ajax = ajaxInit();
		if (ajax) {
	 
		ajax.open("POST", "adm/adm_perfil_atleta.php", true);
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				
			ajax.onreadystatechange = function () {
				
				if (ajax.readyState == 4) {
					if (ajax.status == 200) {
										
						retorno = ajax.responseText;
								//alert(retorno);
										
							if (retorno == "error001") {

								document.getElementById("ECONTA_USER").style.backgroundColor='#CC0000';
								document.getElementById("ECONTA_USER").innerHTML = "Essa conta já existe!!! altere algo nela...";
								document.getElementById("ECONTA_USER").focus();
								return;
								
							}else if (retorno == "ok001"){
									
								document.getElementById("action").value = action;
								document.formGeral.submit();
									
							}

									
						} else {
								
								alert('Operacao nao realizada entre em contato com o administrador');
					}
				}
			}
							
			ajax.send(dados);
		}

	
	
	
}

function editContaUser(nCamp){
var x,nCamp,cpError,dados,retorno,Conta_user,urlAction,action;
var reNumeros = /^\d+$/;
var reDate = /^((0[1-9]|[12]\d)\/(0[1-9]|1[0-2])|30\/(0[13-9]|1[0-2])|31\/(0[13578]|1[02]))\/\d{4}$/;


	for(x=0; x<nCamp;  x++){
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;
		

			if ((MyDate == "") && (MyObject.name != "SITE_USER") && (MyObject.name != "CELULAR")){	
					
				document.getElementById(cpError).style.backgroundColor='#CC0000';
				document.getElementById(cpError).innerHTML = "Peencha o campo obrigatorio acima!!!";
				MyObject.focus();	
				return;
					
			}else{
					
				document.getElementById(cpError).style.backgroundColor='#FFFFFF';
				document.getElementById(cpError).innerHTML = "";

					
			}
			
				switch (MyObject.name) {
				
					case "DDD":
					case "FONE":
					case "CELULAR":
					case "PESO":
					case "CPF_CNPJ_RG":
				
						eval("reNumeros");
						
							if (reNumeros.test(MyDate) == false) {
							
								document.getElementById(cpError).style.backgroundColor='#CC0000';
								document.getElementById(cpError).innerHTML = "digite apenas nunmeros no campo acima!!!";
								MyObject.focus();	
							
							}else{
								
								document.getElementById(cpError).style.backgroundColor='#FFFFFF';
								document.getElementById(cpError).innerHTML = "";
								
							}
							
					break;
					
					case "SENHA_USER":
					case "CONF_SENHA_USER":
					
						validaSenha(cpError);
					
					break;
					
					case "DT_NASC":
					
							eval("reDate");
						
								if (reDate.test(MyDate) == false) {
								
									document.getElementById(cpError).style.backgroundColor='#CC0000';
									document.getElementById(cpError).innerHTML = "Formato de data invalida ex: 00/00/0000";
									MyObject.focus();	
								
								}else{
									
									document.getElementById(cpError).style.backgroundColor='#FFFFFF';
									document.getElementById(cpError).innerHTML = "";
									
								}

					
					break;
					


				
				}
			
			
			
			
	}
	
		document.getElementById("action").value = "verifyDuplConta";

		form   = document.formGeral;
		dados = '';
		
		for (var i = 0; i < form.length; i++) {					
					
					if (i > 0) {
					 
					dados = dados + '&' + form[i].name + '=' + form[i].value;
					
					} else {
						
						dados = form[i].name + '=' + form[i].value;
					}
					
		}

		
		ajax = ajaxInit();
		if (ajax) {
	 
		ajax.open("POST", "adm/adm_perfil_user.php", true);
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				
			ajax.onreadystatechange = function () {
				
				if (ajax.readyState == 4) {
					if (ajax.status == 200) {
										
						retorno = ajax.responseText;	
										
							if (retorno == "error001") {

								document.getElementById("ECONTA_USER").style.backgroundColor='#CC0000';
								document.getElementById("ECONTA_USER").innerHTML = "Essa conta já existe!!! altere algo nela...";
								document.getElementById("ECONTA_USER").focus();
								return;
								
							}else if (retorno == "ok001"){
									
								document.getElementById("action").value = "Editar";
								document.formGeral.submit();
									
							}

									
						} else {
								
								alert('Operacao nao realizada entre em contato com o administrador');
					}
				}
			}
							
			ajax.send(dados);
		}

	
	
	
}

function InsEditDelImagem(nCamp){
	var x,nCamp,cpError,action,urlAction;
/*	
	for(x=0; x<nCamp;  x++){
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;
		
	
		if (MyDate == ""){	
					
				document.getElementById(cpError).style.backgroundColor='#CC0000';
				document.getElementById(cpError).innerHTML = "Peencha o campo obrigatorio acima!!!";
				MyObject.focus();	
				return;
					
			}else{
					
				document.getElementById(cpError).style.backgroundColor='#FFFFFF';
				document.getElementById(cpError).innerHTML = "";

					
			}
		
		
	}
	
	*/

	document.formGeral.submit();
		
	

}
function InsEditDelVideo(nCamp){
	var x,nCamp,cpError,action,urlAction;
/*	
		
	for(x=0; x<nCamp;  x++){
	

		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;
		
	
		if (MyDate == ""){	
					
				document.getElementById(cpError).style.backgroundColor='#CC0000';
				document.getElementById(cpError).innerHTML = "Peencha o campo obrigatorio acima!!!";
				MyObject.focus();	
				return;
					
			}else{
					
				document.getElementById(cpError).style.backgroundColor='#FFFFFF';
				document.getElementById(cpError).innerHTML = "";

					
			}
		
		
	}

	document.getElementById("msgCarregar").style.backgroundColor='#009900';
	document.getElementById("msgCarregar").innerHTML = "Aguarde, carregando...!!!";
*/
	document.formGeral.submit();

}

function InsEditDelEscClube(nCamp){
	var nCamp,cpError,action,urlAction;
	
		
	for(x=2; x<nCamp;  x++){
		
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;
		
	
		if (MyDate == ""){	
					
				document.getElementById(cpError).style.backgroundColor='#CC0000';
				document.getElementById(cpError).innerHTML = "Peencha o campo obrigatorio acima!!!";
				MyObject.focus();	
				return;
					
			}else{
					
				document.getElementById(cpError).style.backgroundColor='#FFFFFF';
				document.getElementById(cpError).innerHTML = "";

					
			}
		
		
	}

	document.formGeral.submit();

}

function msgSuportePJogador(nCamp){
	var nCamp,cpError,action,urlAction;
	
		
	for(x=1; x<nCamp;  x++){
		
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;
	
		if (MyDate == ""){	
					
				document.getElementById(cpError).style.backgroundColor='#CC0000';
				document.getElementById(cpError).innerHTML = "Peencha o campo obrigatorio acima!!!";
				MyObject.focus();	
				return;
					
			}else{
					
				document.getElementById(cpError).style.backgroundColor='#FFFFFF';
				document.getElementById(cpError).innerHTML = "";

					
			}
		
		
	}

	document.formGeral.submit();

}
function msgPrivadaJogSite(nCamp){
	var nCamp,cpError,action,urlAction;
	
		
	/*for(x=1; x<nCamp;  x++){
		
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;
	
		if (MyDate == ""){	
					
				document.getElementById(cpError).style.backgroundColor='#CC0000';
				document.getElementById(cpError).innerHTML = "Peencha o campo obrigatorio acima!!!";
				MyObject.focus();	
				return;
					
			}else{
					
				document.getElementById(cpError).style.backgroundColor='#FFFFFF';
				document.getElementById(cpError).innerHTML = "";

					
			}
		
		
	}*/

	document.formGeral.submit();

}
 

function iniProcCob(idReg,nm_arq){
var idReg,nm_arq,dados,retorno,fso;

		
		document.getElementById("keySendDados").value = "ok";
		document.getElementById("nm_fucao").value = "checkPermDownLoad";
		
			form   = document.formGeral;
			dados = '';
			
			for (var i = 0; i < form.length; i++) {					
						
						if (i > 0) {
						 
						dados = dados + '&' + form[i].name + '=' + form[i].value;
						
						} else {
							
							dados = form[i].name + '=' + form[i].value;
						}
						
			}
		
	
	
			ajax = ajaxInit();
			if (ajax) {
		 
			ajax.open("POST", "adm/adm_getDados.php", true);
			ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
					
				ajax.onreadystatechange = function () {
					
					if (ajax.readyState == 4) {
						if (ajax.status == 200) {
											
							retorno = ajax.responseText;
							
							if (retorno == "true"){
							
								document.getElementById("pg").value = "iniProceCob";
								document.getElementById("idReg").value = idReg;
								document.getElementById("nm_arq").value = nm_arq;
								document.formGeral.submit();
							
							}
	
										
							} else {
									
							alert('Operacao nao realizada entre em contato com o a ??1o???dministrador');
						}
					}
				}
								
				ajax.send(dados);
			}
			

}
function procCobFromAuto01(idReg){
var idReg,nm_arq,dados,retorno,fso;

		
		document.getElementById("keySendDados").value = "ok";
		document.getElementById("nm_fucao").value = "checkPermDownLoad";
		
			form   = document.formGeral;
			dados = '';
			
			for (var i = 0; i < form.length; i++) {					
						
						if (i > 0) {
						 
						dados = dados + '&' + form[i].name + '=' + form[i].value;
						
						} else {
							
							dados = form[i].name + '=' + form[i].value;
						}
						
			}
		
	
	
			ajax = ajaxInit();
			if (ajax) {
		 
			ajax.open("POST", "adm/adm_getDados.php", true);
			ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
					
				ajax.onreadystatechange = function () {
					
					if (ajax.readyState == 4) {
						if (ajax.status == 200) {
											
							retorno = ajax.responseText;
							
							if (retorno == "true"){
							
								document.getElementById("pg").value = "procCobFromAuto01";
								document.getElementById("idReg").value = idReg;
								document.formGeral.submit();
							
							}
	
										
							} else {
									
							alert('Operacao nao realizada entre em contato com administrador');
						}
					}
				}
								
				ajax.send(dados);
			}
			

}


function iniProcImp(idReg,nm_arq){
var idReg,nm_arq,dados,retorno;
	
	
	document.getElementById("keySendDados").value = "ok";
	document.getElementById("nm_fucao").value = "checkPermDownLoad";
	
		form   = document.formGeral;
		dados = '';
		
		for (var i = 0; i < form.length; i++) {					
					
					if (i > 0) {
					 
					dados = dados + '&' + form[i].name + '=' + form[i].value;
					
					} else {
						
						dados = form[i].name + '=' + form[i].value;
					}
					
		}
	


		ajax = ajaxInit();
		if (ajax) {
	 
		ajax.open("POST", "adm/adm_getDados.php", true);
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				
			ajax.onreadystatechange = function () {
				
				if (ajax.readyState == 4) {
					if (ajax.status == 200) {
										
						retorno = ajax.responseText;
						//alert(retorno);
						if (retorno == "true"){
						
							document.getElementById("pg").value = "iniProceImp";
							document.getElementById("idReg").value = idReg;
							document.getElementById("nm_arq").value = nm_arq;
							document.formGeral.submit();
						
						}

									
						} else {
								
						alert('Operacao nao realizada entre em contato com o administrador');
					}
				}
			}
							
			ajax.send(dados);
		}


}

function iniProcCob2(idReg,nm_arq,pg){
var idReg,nm_arq,pg;
	
	document.getElementById("iniProcCob").value = iniProcCob;
	document.getElementById("pg").value = pg;
	
}

function bArqAtendimento(nm_arq){
var nm_arq;
	location  = "../arquivos/" + nm_arq;
	
}	
	
function iniProcImp2(nCamp){
var nCamp,cpError,action,urlAction;
var reNumeros = /^\d+$/;
		
	for(x=0; x<nCamp;  x++){
		
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		//cpError = "E" + MyObject.name;
	
			if (MyDate == ""){	
					
				document.getElementById("divAlert").style.visibility = "visible";
				document.getElementById("ESIS").innerHTML = "Peencha o campo obrigatorio baixo!!!";
				MyObject.focus();
				return;
					
			}else{
					
				document.getElementById("divAlert").style.visibility = "hidden";
				document.getElementById("ESIS").innerHTML = "";
					
			}
			
				switch (MyObject.name) {
				
				case "CPF_CNPJ_RG":
			
					eval("reNumeros");

						
						if (reNumeros.test(MyDate) == false) {
							
							document.getElementById("divAlert").style.visibility = "visible";
							document.getElementById("ESIS").innerHTML = "digite apenas nunmeros no campo acima!!!";
							MyObject.focus();
							return;	
							
						}else{
								
							document.getElementById("divAlert").style.visibility = "hidden";
							document.getElementById("ESIS").innerHTML = "";
								
						}
		
				}
		
		}
	
			document.formGeral.submit();
	
}	


function vLgUser(nCamp,cp){
var nCamp,cpError,action,urlAction;
	
		
		MyObject = document.formGeral.elements[0];
		//alert(MyObject);
		MyDate	= MyObject.value;
		//cpError = "E" + MyObject.name;
	
			if (MyDate == ""){	
					
				document.getElementById("divAlert").style.visibility = "visible";
				document.getElementById("ESIS").innerHTML = "Peencha o campo obrigatorio baixo!!!";
				MyObject.focus();
				return;
					
			}else{
					
				document.getElementById("divAlert").style.visibility = "hidden";
				document.getElementById("ESIS").innerHTML = "";
					
			}


		document.getElementById("action").value = "verifySenhaAtual";

		form   = document.formGeral;
		dados = '';
		
		for (var i = 0; i < form.length; i++) {					
					
					if (i > 0) {
					 
					dados = dados + '&' + form[i].name + '=' + form[i].value;
					
					} else {
						
						dados = form[i].name + '=' + form[i].value;
					}
					
		}
		
		
		
		ajax = ajaxInit();
		if (ajax) {
	 
		ajax.open("POST", "adm/adm_getDados.php", true);
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				
			ajax.onreadystatechange = function () {
				
				if (ajax.readyState == 4) {
					if (ajax.status == 200) {
										
						retorno = ajax.responseText;
						
							if (retorno == "003"){	
					
								document.getElementById("divAlert").style.visibility = "visible";
								document.getElementById("ESIS").innerHTML = "Senha informada nao confere. Voce nao tem autorizacao para alterar o perfil do usuario atual!!!";
								MyObject.focus();
								return;
											
							}else{
											
								document.getElementById("divAlert").style.visibility = "hidden";
								document.getElementById("ESIS").innerHTML = "";
											
							}

								
							if (retorno == "004"){
									
								location = "../"+cp+"/?pg=mp";
									
							}

									
						} else {
								
								alert('Operacao nao realizada entre em contato com o a ??1o???dministrador');
					}
				}
			}
							
			ajax.send(dados);
		}



}

function tSenhaEtapa01(nCamp,cp){
	var nCamp,cpError,action,urlAction;
	
		
		MyObject = document.formGeral.elements[0];
		//alert(MyObject);
		MyDate	= MyObject.value;
		//cpError = "E" + MyObject.name;
	
			if (MyDate == ""){	
					
				document.getElementById("divAlert").style.visibility = "visible";
				document.getElementById("ESIS").innerHTML = "Peencha o campo obrigatorio baixo!!!";
				MyObject.focus();
				return;
					
			}else{
					
				document.getElementById("divAlert").style.visibility = "hidden";
				document.getElementById("ESIS").innerHTML = "";
					
			}


		document.getElementById("action").value = "verifySenhaAtual";

		form   = document.formGeral;
		dados = '';
		
		for (var i = 0; i < form.length; i++) {					
					
					if (i > 0) {
					 
					dados = dados + '&' + form[i].name + '=' + form[i].value;
					
					} else {
						
						dados = form[i].name + '=' + form[i].value;
					}
					
		}
		
		
		
		ajax = ajaxInit();
		if (ajax) {
	 
		ajax.open("POST", "adm/adm_getDados.php", true);
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				
			ajax.onreadystatechange = function () {
				
				if (ajax.readyState == 4) {
					if (ajax.status == 200) {
										
						retorno = ajax.responseText;
						
							if (retorno == "003"){	
					
								document.getElementById("divAlert").style.visibility = "visible";
								document.getElementById("ESIS").innerHTML = "Senha informada não confere. Você não tem autorização para alterar senha atual!!!";
								MyObject.focus();
								return;
											
							}else{
											
								document.getElementById("divAlert").style.visibility = "hidden";
								document.getElementById("ESIS").innerHTML = "";
											
							}

								
							if (retorno == "004"){
									
								location = "../"+cp+"/?pg=edtMpass02";
									
							}

									
						} else {
								
								alert('Operacao nao realizada entre em contato com o administrador');
					}
				}
			}
							
			ajax.send(dados);
		}



}


function tSenha(nCamp){
	var nCamp,cpError,action,urlAction;
	
		
	for(x=0; x<nCamp;  x++){
		
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		//cpError = "E" + MyObject.name;
	
			if (MyDate == ""){	
					
				document.getElementById("divAlert").style.visibility = "visible";
				document.getElementById("ESIS").innerHTML = "Peencha o campo obrigatorio baixo!!!";
				MyObject.focus();
				return;
					
			}else{
					
				document.getElementById("divAlert").style.visibility = "hidden";
				document.getElementById("ESIS").innerHTML = "";
					
			}
		
		
	}
	
	senha 		= document.getElementById("SENHA_USER").value;
	confSenha 	= document.getElementById("CONF_SENHA_USER").value;
	
	
	if ((senha.length < 6) || (confSenha.length < 6)){
					
			document.getElementById("divAlert").style.visibility = "visible";
			document.getElementById("ESIS").innerHTML = "Sua senha deve conter no mínimo 6 caracteres!!!";
			MyObject.focus();
			return;
	
	}else  if (senha != confSenha){
			
			document.getElementById("divAlert").style.visibility = "visible";
			document.getElementById("ESIS").innerHTML = "Sua confirmação de senha esta diferente da senha informada!!!";
			MyObject.focus();
			return;
			
	}else{

			document.getElementById("divAlert").style.visibility = "hidden";
			document.getElementById("ESIS").innerHTML = "";

			
			sendDados();
	
	}

}

function bioJogador(nCamp){
	var nCamp,cpError,action,urlAction;
	
		
	for(x=0; x<nCamp;  x++){
		
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;
	
		if (MyDate == ""){	
					
				document.getElementById(cpError).style.backgroundColor='#CC0000';
				document.getElementById(cpError).innerHTML = "Peencha o campo obrigatorio acima!!!";
				MyObject.focus();	
				return;
					
			}else{
					
				document.getElementById(cpError).style.backgroundColor='#FFFFFF';
				document.getElementById(cpError).innerHTML = "";

					
			}
		
		
	}

	document.formGeral.submit();

}
function editContaEscola(nCamp){
var x,nCamp,cpError,dados,retorno,Conta_user,urlAction;
var reNumeros = /^\d+$/;
var reDate = /^((0[1-9]|[12]\d)\/(0[1-9]|1[0-2])|30\/(0[13-9]|1[0-2])|31\/(0[13578]|1[02]))\/\d{4}$/;


	for(x=0; x<nCamp;  x++){
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;

			if (MyDate == ""){	
					
				document.getElementById(cpError).style.backgroundColor='#CC0000';
				document.getElementById(cpError).innerHTML = "Peencha o campo obrigatorio acima!!!";
				MyObject.focus();	
				return;
					
			}else{
					
				document.getElementById(cpError).style.backgroundColor='#FFFFFF';
				document.getElementById(cpError).innerHTML = "";

					
			}
			
				switch (MyObject.name) {
				
					case "DDD":
					case "FONE":
					case "CELULAR":
					case "CPF_CNPJ_RG":
					
			
				
						eval("reNumeros");
						
							if (reNumeros.test(MyDate) == false) {
							
								document.getElementById(cpError).style.backgroundColor='#CC0000';
								document.getElementById(cpError).innerHTML = "digite apenas nunmeros no campo acima!!!";
								MyObject.focus();
								break;	
							
							}else{
								
								document.getElementById(cpError).style.backgroundColor='#FFFFFF';
								document.getElementById(cpError).innerHTML = "";
								
							}
							
					break;
					
				
				}
			
			
	}
	
		document.getElementById("action").value = "verifyDuplConta";

		form   = document.formGeral;
		dados = '';
		
		for (var i = 0; i < form.length; i++) {					
					
					if (i > 0) {
					 
					dados = dados + '&' + form[i].name + '=' + form[i].value;
					
					} else {
						
						dados = form[i].name + '=' + form[i].value;
					}
					
		}

		
		ajax = ajaxInit();
		if (ajax) {
	 
		ajax.open("POST", "adm/adm_perfil_escola.php", true);
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				
			ajax.onreadystatechange = function () {
				
				if (ajax.readyState == 4) {
					if (ajax.status == 200) {
										
						retorno = ajax.responseText;
						
							if (retorno == 1) {

								document.getElementById("ECONTA_USER").style.backgroundColor='#CC0000';
								document.getElementById("ECONTA_USER").innerHTML = "Conta já pertence a um usuário!!! altere algo nela...";
								document.getElementById("ECONTA_USER").focus();
								return;
								
							}else{
									
								document.getElementById("action").value = "Editar";
								document.formGeral.submit();
									
							}

									
						} else {
								
								alert('Operacao nao realizada entre em contato com o administrador');
					}
				}
			}
							
			ajax.send(dados);
		}

	
	
	
}



function editContaEscola(nCamp){
var x,nCamp,cpError,dados,retorno,Conta_user,urlAction;
var reNumeros = /^\d+$/;
var reDate = /^((0[1-9]|[12]\d)\/(0[1-9]|1[0-2])|30\/(0[13-9]|1[0-2])|31\/(0[13578]|1[02]))\/\d{4}$/;


	for(x=0; x<nCamp;  x++){
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;

			if (MyDate == ""){	
					
				document.getElementById(cpError).style.backgroundColor='#CC0000';
				document.getElementById(cpError).innerHTML = "Peencha o campo obrigatorio acima!!!";
				MyObject.focus();	
				return;
					
			}else{
					
				document.getElementById(cpError).style.backgroundColor='#FFFFFF';
				document.getElementById(cpError).innerHTML = "";

					
			}
			
				switch (MyObject.name) {
				
					case "DDD":
					case "FONE":
					case "CELULAR":
					case "CPF_CNPJ_RG":
					
			
				
						eval("reNumeros");
						
							if (reNumeros.test(MyDate) == false) {
							
								document.getElementById(cpError).style.backgroundColor='#CC0000';
								document.getElementById(cpError).innerHTML = "digite apenas nunmeros no campo acima!!!";
								MyObject.focus();
								break;	
							
							}else{
								
								document.getElementById(cpError).style.backgroundColor='#FFFFFF';
								document.getElementById(cpError).innerHTML = "";
								
							}
							
					break;
					
				
				}
			
			
	}
	
		document.getElementById("action").value = "verifyDuplConta";

		form   = document.formGeral;
		dados = '';
		
		for (var i = 0; i < form.length; i++) {					
					
					if (i > 0) {
					 
					dados = dados + '&' + form[i].name + '=' + form[i].value;
					
					} else {
						
						dados = form[i].name + '=' + form[i].value;
					}
					
		}

		
		ajax = ajaxInit();
		if (ajax) {
	 
		ajax.open("POST", "adm/adm_perfil_escola.php", true);
		ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				
			ajax.onreadystatechange = function () {
				
				if (ajax.readyState == 4) {
					if (ajax.status == 200) {
										
						retorno = ajax.responseText;
						
							if (retorno == 1) {

								document.getElementById("ECONTA_USER").style.backgroundColor='#CC0000';
								document.getElementById("ECONTA_USER").innerHTML = "Conta já pertence a um usuário!!! altere algo nela...";
								document.getElementById("ECONTA_USER").focus();
								return;
								
							}else{
									
								document.getElementById("action").value = "Editar";
								document.formGeral.submit();
									
							}

									
						} else {
								
								alert('Operacao nao realizada entre em contato com o administrador');
					}
				}
			}
							
			ajax.send(dados);
		}
	
}



function emailContatoSIS(nCamp){
var x,nCamp,cpError;


for(x=0; x<nCamp;  x++){
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;

			if (MyDate == ""){	
					
				document.getElementById("divAlert").style.visibility = "visible";
				document.getElementById("ESIS").innerHTML = "Peencha o campo obrigatorio baixo!!!";
				MyObject.focus();
				return;
					
			}else{
					
				document.getElementById("divAlert").style.visibility = "hidden";
				document.getElementById("ESIS").innerHTML = "";
					
			}
			
			
		}
			
		sendDados();
			
}

function enviarOrc(nCamp){
var x,nCamp,cpError;
var reEmail = /^[\w!#$%&'*+\/=?^`{|}~-]+(\.[\w!#$%&'*+\/=?^`{|}~-]+)*@(([\w-]+\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;



for(x=0; x<nCamp;  x++){
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;

			if ((MyDate == "") && (MyObject.name != "FAX_USER")) {	
					
				document.getElementById("divAlert").style.visibility = "visible";
				document.getElementById("ESIS").innerHTML = "Peencha o campo obrigatorio baixo!!!";
				MyObject.focus();
				return;
					
			}else{
					
				document.getElementById("divAlert").style.visibility = "hidden";
				document.getElementById("ESIS").innerHTML = "";
					
			}
			
				switch (MyObject.name) {
				
					case "EMAIL_USER":
				
						eval("reEmail");
						
							if (reEmail.test(MyDate) == false) {
							
								document.getElementById("divAlert").style.visibility = "visible";
								document.getElementById("ESIS").innerHTML = "Email inválido. Seu formato deve ser: [seuemail@dominio + extenção ex: .com]";
								MyObject.focus();
								return;	
							
							}else{
								
								document.getElementById("divAlert").style.visibility = "hidden";
								document.getElementById("ESIS").innerHTML = "";
								
							}
							
				
				}
			
		}
			
		sendDados();
		
}

function emailSugContato(nCamp){
var x,nCamp,cpError;
var reEmail = /^[\w!#$%&'*+\/=?^`{|}~-]+(\.[\w!#$%&'*+\/=?^`{|}~-]+)*@(([\w-]+\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;



for(x=0; x<nCamp;  x++){
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;

			if (MyDate == ""){	
					
				document.getElementById("divAlert").style.visibility = "visible";
				document.getElementById("ESIS").innerHTML = "Peencha o campo obrigatorio baixo!!!";
				MyObject.focus();
				return;
					
			}else{
					
				document.getElementById("divAlert").style.visibility = "hidden";
				document.getElementById("ESIS").innerHTML = "";
					
			}
			
				switch (MyObject.name) {
				
					case "EMAIL_USER":
				
						eval("reEmail");
						
							if (reEmail.test(MyDate) == false) {
							
								document.getElementById("divAlert").style.visibility = "visible";
								document.getElementById("ESIS").innerHTML = "Email inválido. Seu formato deve ser: [seuemail@dominio + extenção ex: .com]";
								MyObject.focus();
								return;	
							
							}else{
								
								document.getElementById("divAlert").style.visibility = "hidden";
								document.getElementById("ESIS").innerHTML = "";
								
							}
							
				
				}
			
		}
			
		sendDados();
		
}
function emailContatoPCUser(nCamp){
var x,nCamp,cpError;

for(x=0; x<nCamp;  x++){
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;

			if (MyDate == ""){	
					
				document.getElementById("divAlert").style.visibility = "visible";
				document.getElementById("ESIS").innerHTML = "Peencha o campo obrigatorio baixo!!!";
				MyObject.focus();
				return;
					
			}else{
					
				document.getElementById("divAlert").style.visibility = "hidden";
				document.getElementById("ESIS").innerHTML = "";
					
			}
			
			
		}
			
		sendDados();
			
}

function playerVideo(video){
var video;
var cnt = document.getElementById("mediaspace");
var src = 'jwplayer/wmvplayer.xaml';
var cfg = {
			file:video,
			image:video,
			height:'240',
			width:'440'
			};
var ply = new jeroenwijering.Player(cnt,src,cfg);

}

function ePassoWord(nCamp){
var x,nCamp,cpError,dados,retorno;
var reNumeros = /^\d+$/;
var reEmail = /^[\w!#$%&'*+\/=?^`{|}~-]+(\.[\w!#$%&'*+\/=?^`{|}~-]+)*@(([\w-]+\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;


	for(x=0; x<nCamp;  x++){
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;

			if (MyDate == ""){	
					
				document.getElementById("divAlert").style.visibility = "visible";
				document.getElementById("ESIS").innerHTML = "Peencha o campo obrigatorio baixo!!!";
				MyObject.focus();
				return;
					
			}else{
					
				document.getElementById("divAlert").style.visibility = "hidden";
				document.getElementById("ESIS").innerHTML = "";
					
			}
			
				switch (MyObject.name) {
				
					case "CPF_CNPJ_RG":
				
						eval("reNumeros");
						
							if (reNumeros.test(MyDate) == false) {
							
								document.getElementById("divAlert").style.visibility = "visible";
								document.getElementById("ESIS").innerHTML = "Peencha o campo obrigatorio somente com números!!!";
								MyObject.focus();
								return;
							
							}else{
								
								document.getElementById("divAlert").style.visibility = "hidden";
								document.getElementById("ESIS").innerHTML = "";
								
							}
							
					break;
					
					case "EMAIL_USER":
				
						eval("reEmail");
						
							if (reEmail.test(MyDate) == false) {
							
								document.getElementById("divAlert").style.visibility = "visible";
								document.getElementById("ESIS").innerHTML = "Peencha o campo com formato de email válido ex: roger@copiaeciaweb.com.br [seuemail + @ + provedor + extenção - .com | .com.br | .net etc...]!!!";
								MyObject.focus();
								return;
							
							}else{
								
								document.getElementById("divAlert").style.visibility = "hidden";
								document.getElementById("ESIS").innerHTML = "";
								
							}
							
					break;				
				}
			
			
	}
	
	sendDados();
	
}
function calcImpressao(){
var qtd,vl,total,desc,arrInfoDesc;
var reNumeros = /^\d+$/;


	qtd 	=	document.getElementById("QTD_IMP").value;
	desc	=	document.getElementById("DESCRICAO").value;
	
		eval("reNumeros");
						
				if ((reNumeros.test(qtd) == false) || (qtd == "")){
				
					document.getElementById("divAlert").style.visibility = "visible";
					document.getElementById("ESIS").innerHTML = "Peencha o campo quantidade somente com numeros e valores inteiros!!!";
					document.getElementById("QTD_IMP").value = "";
					return;
				
				}else{
				
					document.getElementById("divAlert").style.visibility = "hidden";
					document.getElementById("ESIS").innerHTML = "";
	
					arrInfoDesc = desc.split("!#*");
					vl 			= arrInfoDesc[1];
					total 		= vl * qtd;
					
					document.getElementById("TOTAL_IMP").value = float2moeda(total);
	
	}
}

function roundNumber(rnum) {

	return Math.round(rnum*Math.pow(10,2))/Math.pow(10,2);

}

function float2moeda(num) {
var x;
	x = 0;

	if(num<0) {
		num = Math.abs(num);
		x = 1;
	} 
	
	if(isNaN(num)) num = "0";
		cents = Math.floor((num*100+0.5)%100);
		num = Math.floor((num*100+0.5)/100).toString();

		if(cents < 10) cents = "0" + cents;
		
		for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
		
			num = num.substring(0,num.length-(4*i+3))+'.'
			+num.substring(num.length-(4*i+3)); ret = num + ',' + cents; if (x == 1) ret = ' - ' + ret;return ret;

		}

		
/*Pega um valor formatado com virgula e separador de milha e o transforma em float*/
function moeda2float(moeda){

	moeda = moeda.replace(".","");
	moeda = moeda.replace(",",".");

	return parseFloat(moeda);

}

function proCob03(nCamp){
var x,nCamp,cpError,dados,retorno;

	for(x=0; x<nCamp;  x++){
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;

			if (MyDate == ""){	
					
				document.getElementById("divAlert").style.visibility = "visible";
				document.getElementById("ESIS").innerHTML = "Peencha o campo quantidade com no minimo o valor (1)!!!";
				MyObject.focus();
				return;
					
			}else{
					
				document.getElementById("divAlert").style.visibility = "hidden";
				document.getElementById("ESIS").innerHTML = "";
					
			}
			
			
	}
	
	sendDados();

}
function limpaCmpsCalcImp(){

	document.getElementById("QTD_IMP").value	=	"";
	document.getElementById("TOTAL_IMP").value	=	"";

}
function insEdtPort(nCamp){
var x,nCamp;

	for(x=0; x<nCamp;  x++){
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;

			if (MyDate == ""){	
					
				document.getElementById("divAlert").style.visibility = "visible";
				document.getElementById("ESIS").innerHTML = "Peencha todos os campos obrigatorios!!!";
				MyObject.focus();
				return;
					
			}else{
					
				document.getElementById("divAlert").style.visibility = "hidden";
				document.getElementById("ESIS").innerHTML = "";
					
			}
			
			
	}
	
	document.formGeral.submit();

}

function sendContHome(){
var x,nCamp;

	for(x=0; x<6;  x++){
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;

			if ((MyDate == "") && (MyObject.name != "DIR_ORIG_IMG_01") && (MyObject.name != "DIR_ORIG_IMG_02")){	
					
				document.getElementById("divAlert").style.visibility = "visible";
				document.getElementById("ESIS").innerHTML = "Peencha todos os campos obrigatorios!!!";
				MyObject.focus();
				return;
					
			}else{
					
				document.getElementById("divAlert").style.visibility = "hidden";
				document.getElementById("ESIS").innerHTML = "";
					
			}
			
			
	}
	
	document.formGeral.submit();

}

function sendContSugestoes(){
var x,nCamp;

	for(x=0; x<3;  x++){
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;

			if (MyDate == ""){	
					
				document.getElementById("divAlert").style.visibility = "visible";
				document.getElementById("ESIS").innerHTML = "Peencha todos os campos obrigatorios!!!";
				MyObject.focus();
				return;
					
			}else{
					
				document.getElementById("divAlert").style.visibility = "hidden";
				document.getElementById("ESIS").innerHTML = "";
					
			}
			
			
	}
	
	document.formGeral.submit();

}
function sendContVideos(){
var x,nCamp;

	for(x=0; x<3;  x++){
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;

			if (MyDate == ""){	
					
				document.getElementById("divAlert").style.visibility = "visible";
				document.getElementById("ESIS").innerHTML = "Peencha todos os campos obrigatorios!!!";
				MyObject.focus();
				return;
					
			}else{
					
				document.getElementById("divAlert").style.visibility = "hidden";
				document.getElementById("ESIS").innerHTML = "";
					
			}
			
			
	}
	
	document.formGeral.submit();

}


function sendContEmp(){
var x,nCamp;

	for(x=0; x<7;  x++){
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;

			if ((MyDate == "") && (MyObject.name != "DIR_ORIG_IMG_01") && (MyObject.name != "DIR_ORIG_IMG_02") && (MyObject.name != "DIR_ORIG_IMG_03")){	
					
				document.getElementById("divAlert").style.visibility = "visible";
				document.getElementById("ESIS").innerHTML = "Peencha todos os campos obrigatorios!!!";
				MyObject.focus();
				return;
					
			}else{
					
				document.getElementById("divAlert").style.visibility = "hidden";
				document.getElementById("ESIS").innerHTML = "";
					
			}
			
			
	}
	
	document.formGeral.submit();

}



function sendContDicas(){
var x,nCamp;
alert("teste");

	for(x=0; x<5;  x++){
		
		MyObject = document.formGeral.elements[x];
		//alert(MyObject);
		MyDate	= MyObject.value;
		cpError = "E" + MyObject.name;

			if ((MyDate == "") && (MyObject.name != "DIR_ORIG_IMG_01")){	
					
				document.getElementById("divAlert").style.visibility = "visible";
				document.getElementById("ESIS").innerHTML = "Peencha todos os campos obrigatorios!!!";
				MyObject.focus();
				return;
					
			}else{
					
				document.getElementById("divAlert").style.visibility = "hidden";
				document.getElementById("ESIS").innerHTML = "";
					
			}
			
			
	}
	
	document.formGeral.submit();

}

