<!--

var cd;
function terminada(cd)
      {
	 if (confirm ("Deseja marcar esta tarefa como terminada?")) 
			{ 
			document.terminar.cd_tarefa.value=cd;
			//alert(document.terminar.cd_tarefa.value) 
			document.terminar.submit();
			} 
	 else 
			{ 
			alert("não confirmada") 
			} 
	  }


//*******************************conferencia de campos***************************
function tecla() 
  
  { 
  var BACKSPACE= 8; 
  var key; 
  var tecla; 
  CheckTAB=true; 
  if(navigator.appName.indexOf("Netscape")!= -1) 
  		tecla= event.which; 
  else 
  		tecla= event.keyCode; 
  key = String.fromCharCode( tecla); 
  if ( tecla == 13 ) 
		{
			say.submit();
		}
  } 





function isChar( caractere ) 
  
  { 
  var strValidos = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZçÇ" 
  if ( strValidos.indexOf( caractere ) == -1 ) 
  	return false; 
  return true; 
  } 

function isNumChar( caractere ) 
  
  { 
  var strValidos = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZçÇ" 
  if ( strValidos.indexOf( caractere ) == -1 ) 
  	return false; 
  return true; 
  } 
  
function isNum( caractere ) 
  
  { 
  var strValidos = "0123456789" 
  if ( strValidos.indexOf( caractere ) == -1 ) 
  	return false; 
  return true; 
  } 
 
function isc_esp( caractere ) 
  
  { 
  var strValidos = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZçÇªº®!@#$%*()_-=+áéíóúà`´AÉÍÓÚ[]}{~ãõâôÃÕ,.<>;/:?" 
  if ( strValidos.indexOf( caractere ) == -1 ) 
  	return false; 
  return true; 
  }   
 

  
  
function validaTecla_esp(campo, event) 
  
  { 
  var BACKSPACE= 8; 
  var key; 
  var tecla; 
  CheckTAB=true; 
  if(navigator.appName.indexOf("Netscape")!= -1) 
  		tecla= event.which; 
  else 
  		tecla= event.keyCode; 
  key = String.fromCharCode( tecla); 
  //alert( 'key: ' + tecla + ' -> campo: ' + campo.value); 
  if ( tecla == 13 ) 
		return true; 
  if (( tecla == BACKSPACE ) || (tecla == 32))
		return true; 
  return ( isc_esp(key)); 
  } 
  
    
   
function validaTeclaN(campo, event) 
  
  { 
  var BACKSPACE= 8; 
  var key; 
  var tecla; 
  CheckTAB=true; 
  if(navigator.appName.indexOf("Netscape")!= -1) 
  		tecla= event.which; 
  else 
  		tecla= event.keyCode; 
  key = String.fromCharCode( tecla); 
  //alert( 'key: ' + tecla + ' -> campo: ' + campo.value); 
  if ( tecla == 13 ) 
		return false; 
  if (( tecla == BACKSPACE ) || (tecla == 32))
		return true; 
  return ( isNum(key)); 
  } 

function validaTeclaC(campo, event) 
  
  { 
  var BACKSPACE= 8; 
  var key; 
  var tecla; 
  CheckTAB=true; 
  if(navigator.appName.indexOf("Netscape")!= -1) 
  		tecla= event.which; 
  else 
  		tecla= event.keyCode; 
  key = String.fromCharCode( tecla); 
  //alert( 'key: ' + tecla + ' -> campo: ' + campo.value); 
  if ( tecla == 13 ) 
		return false; 
  if (( tecla == BACKSPACE ) || (tecla == 32))
		return true; 
  return ( isChar(key)); 
  } 
  
function validaTeclaNC(campo, event) 
  
  { 
  var BACKSPACE= 8; 
  var key; 
  var tecla; 
  CheckTAB=true; 
  if(navigator.appName.indexOf("Netscape")!= -1) 
  		tecla= event.which; 
  else 
  		tecla= event.keyCode; 
  key = String.fromCharCode( tecla); 
  //alert( 'key: ' + tecla + ' -> campo: ' + campo.value); 
  if ( tecla == 13 ) 
		return false; 
  if ( tecla == BACKSPACE ) 
		return true; 
  return ( isNumChar(key)); 
  } 

//******************************************************************


function centraliza_janela(width, height) {
	var width_janela	= eval(width);
	var height_janela	= eval(height);
	var width_tela 		= self.screen.width;
	var height_tela 	= self.screen.height;
	var pos_esquerda 	= (width_tela - width_janela)/2;
	var pos_direita 	= (height_tela - height_janela)/2;

	self.moveTo(pos_esquerda,pos_direita); //centraliza
	self.resizeTo(width_janela, height_janela); //redimensiona
}	
				
var cd;
function vista(cd)
      {
	 if (confirm ("Deseja marcar esta tarefa como vistada?")) 
			{ 
			document.vistada.cd_tarefa.value=cd;
			//alert(document.vistada.cd_tarefa.value) 
			document.vistada.submit();
			} 
	 else 
			{ 
			alert("não confirmada") 
			} 
	  }
	  
	  
function salvar(nome){
if (document.execCommand){
frame1.document.execCommand("SaveAs",true,nome);
}else{
alert('Esta ação é suportada apenas pelo Internet Exlorer 4.0 ou superior.');
}
}




function formata_telefone(obj) {
	if ((event.keyCode<48)||(event.keyCode>57)){
		event.returnValue = false;
		}
	else{
		if(obj.value.length==0){
			obj.value = obj.value + "(";
		}
		if(obj.value.length==3) {
			obj.value = obj.value + ") ";
		}
		if(obj.value.length==9) {
			obj.value = obj.value + "-";
		}
	}
}

// **************************fim formata telefone

// **************************fim conta caracter do textarea funcionario


function salvar(nome){
if (document.execCommand){
document.execCommand("SaveAs",true,nome);
}else{
alert('Esta ação é suportada apenas pelo Internet Exlorer 4.0 ou superior.');
}
}


function SomenteNumeros(input)
	{
	if ((event.keyCode<48)||(event.keyCode>57))
		event.returnValue = false;
	}
//-------------------------------



//SCRIPT RECADOS



function confere_txt()
     {
	 
	 if ((recado.msg.value!="")&& (recado.msg.value.length>=5))
          {
	      return true; 
          }
     else
          {
          alert("Campo MENSAGEM deve ser preenchido corretamente!");
          return false;    
          }           
	     
	 }
	 

function verifica_marcacao(nform)
     {
	     if (confirm ("Deseja realmente marcar este item como visto??")) 
			{ 
			  document.msg_vista.submit();
			 } 
	     }
	     
	     
// SCRIPTS AGENDA
	     
	     
 function isDate(dateStr) {

  var datePat = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/;
  var matchArray = dateStr.match(datePat); // is format OK?

  
  // parse date into variables
  month = matchArray[3];
  day = matchArray[1];
  year = matchArray[5];

  if (month < 1 || month > 12) { // check month range
    alert("O mês tem que ser entre 1 e 12.");
    return false;
  }

  if (day < 1 || day > 31) {
    alert("O dia tem que ser entre 31.");
    return false;
  }

  if ((month==4 || month==6 || month==9 || month==11) && day==31) {
    alert("O mês " + month + " não tem 31 dias!")
    return false;
    
  }

  if (month == 2) { // check for february 29th
    var isleap = (year % 4 == 0 && (year % 100 != 0 || year % 400 == 0));
    if (day > 29 || (day==29 && !isleap)) {
      alert("Fevereiro de " + year + " não tem " + day + " dias!");
      return false;
    }
  }
  return true;  // date is valid
 
  
} 

//*****************************************CPF***************


				
function checacpf(cpf) 
{
if (cpf.length != 11 || cpf == "00000000000" || cpf == "11111111111" || cpf == "22222222222" || cpf == "33333333333" || cpf == "44444444444" || cpf == "55555555555" || cpf == "66666666666" || cpf == "77777777777" || cpf == "88888888888" || cpf == "99999999999")
return false;
soma = 0;
for (i=0; i < 9; i ++)
	soma += parseInt(cpf.charAt(i)) * (10 - i);
resto = 11 - (soma % 11);
if (resto == 10 || resto == 11)
	resto = 0;
if (resto != parseInt(cpf.charAt(9)))
	return false;
soma = 0;
for (i = 0; i < 10; i ++)
	soma += parseInt(cpf.charAt(i)) * (11 - i);
	resto = 11 - (soma % 11);
if (resto == 10 || resto == 11)
	resto = 0;
if (resto != parseInt(cpf.charAt(10)))
	return false;
return true;
}



//*********************** VALIDA EMAIL ************************************
var nform;
function valida_email(nform) 
{

if (nform.nm_email.value == "") {
		alert("Informe seu e-mail.");
		nform.nm_email.focus();
		nform.nm_email.select();
		return false;
	} else {
		prim = nform.nm_email.value.indexOf("@")
		if(prim < 2) {
			alert("O e-mail informado parece não estar correto.");
			nform.nm_email.focus();
			nform.nm_email.select();
			return false;
		}
		if(nform.nm_email.value.indexOf("@",prim + 1) != -1) {
			alert("O e-mail informado parece não estar correto.");
			nform.nm_email.focus();
			nform.nm_email.select();
			return false;
		}
		if(nform.nm_email.value.indexOf(".") < 1) {
			alert("O e-mail informado parece não estar correto.");
			nform.nm_email.focus();
			nform.nm_email.select();
			return false;
		}
		if(nform.nm_email.value.indexOf(" ") != -1) {
			alert("O e-mail informado parece não estar correto.");
			nform.nm_email.focus();
			nform.nm_email.select();
			return false;
		}
		if(nform.nm_email.value.indexOf("zipmeil.com") > 0) {
			alert("O e-mail informado parece não estar correto.");
			nform.nm_email.focus();
			nform.nm_email.select();
			return false;
		}
		if(nform.nm_email.value.indexOf("hotmeil.com") > 0) {
			alert("O e-mail informado parece não estar correto.");
			nform.nm_email.focus();
			nform.nm_email.select();
			return false;
		}
		if(nform.nm_email.value.indexOf(".@") > 0) {
			alert("O e-mail informado parece não estar correto.");
			nform.nm_email.focus();
			nform.nm_email.select();
			return false;
		}
		if(nform.nm_email.value.indexOf("@.") > 0) {
			alert("O e-mail informado parece não estar correto.");
			nform.nm_email.focus();
			nform.nm_email.select();
			return false;
		}
		if(nform.nm_email.value.indexOf(".com.br.") > 0) {
			alert("O e-mail informado parece não estar correto.");
			nform.nm_email.focus();
			nform.nm_email.select();
			return false;
		}
		if(nform.nm_email.value.indexOf("/") > 0) {
			alert("O e-mail informado parece não estar correto.");
			nform.nm_email.focus();
			nform.nm_email.select();
			return false;
		}
		if(nform.nm_email.value.indexOf("[") > 0) {
			alert("O e-mail informado parece não estar correto.");
			nform.nm_email.focus();
			nform.nm_email.select();
			return false;
		}
		if(nform.nm_email.value.indexOf("]") > 0) {
			alert("O e-mail informado parece não estar correto.");
			nform.nm_email.focus();
			nform.nm_email.select();
			return false;
		}
		if(nform.nm_email.value.indexOf("(") > 0) {
			alert("O e-mail informado parece não estar correto.");
			nform.nm_email.focus();
			nform.nm_email.select();
			return false;
		}
		if(nform.nm_email.value.indexOf(")") > 0) {
			alert("O e-mail informado parece não estar correto.");
			nform.nm_email.focus();
			nform.nm_email.select();
			return false;
		}
		if(nform.nm_email.value.indexOf("..") > 0) {
			alert("O e-mail informado parece não estar correto.");
			nform.nm_email.focus();
			nform.nm_email.select();
			return false;
		}
	}
		return true;



}



//*******************************conferencia de campos***************************
//*******************************conferencia de campos***************************
//*******************************conferencia de campos***************************





function ir_agenda()
  {
  if ((agenda.local.value=="")||(agenda.local.value.length<5))
        {
		alert("Informe um LOCAL válido.");
		agenda.local.focus();
		agenda.local.select();
		return false;
	    } 
	    else 
	      		{
		      	if ((agenda.evento.value=="")||(agenda.evento.value.length<5))
		      	    {
			      	  alert("Informe um EVENTO válido.");
					  agenda.evento.focus();
		              agenda.evento.select(); 
		              return false; 
			      	}
			     else
			            { 		
						var dt;
						dt=document.agenda.dia.value+'/'+document.agenda.mes.value+'/'+document.agenda.ano.value;
						return isDate(dt);
			             }
			    }  
		   
  }   
  
  
  
  
  
function check_date(field) 
{
var checkstr = "0123456789"; 
var DateField = field; 
var Datevalue = ""; 
var DateTemp = ""; 
var seperator = "/"; 
var day; 
var month; 
var year; 
var leap = 0; 
var err = 0; 
var i; 
err = 0; 
DateValue = field; 
/* Deletando todos os caracteres exceto o 0..9 */ 
for (i = 0; i < DateValue.length; i++) 
{ 
if (checkstr.indexOf(DateValue.substr(i,1)) >= 0) 
{ 
DateTemp = DateTemp + DateValue.substr(i,1); 
} 
} 
DateValue = DateTemp; 
/* Exectutando a data para 8 digitos - string*/ 
/* if entrada do ano com 2-digitos / exemplo 20xx */ 
if (DateValue.length == 6) 
{ 
DateValue = DateValue.substr(0,4) + '20' + DateValue.substr(4,2); 
} 
if (DateValue.length != 8) 
{ 
err = 19; 
} 
/* Se o ano for errado = 0000 */ 
year = DateValue.substr(4,4); 
if (year == 0) 
{ 
err = 20; 
} 
/* Validando o mês*/ 
month = DateValue.substr(2,2); 
if ((month < 1) || (month > 12)) 
{ 
err = 21; 
} 
/* Validando o dia*/ 
day = DateValue.substr(0,2); 
if (day < 1) 
{ 
err = 22; 
} 
/* Validando ano Bissexto / fevereiro / dia */ 
if ((year % 4 == 0) || (year % 100 == 0) || (year % 400 == 0)) 
{ 
leap = 1; 
} 
if ((month == 2) && (leap == 1) && (day > 29)) 
{ 
err = 23; 
} 
if ((month == 2) && (leap != 1) && (day > 28)) 
{ 
err = 24; 
} 
/* Validando o mês */ 
if ((day > 31) && ((month == "01") || (month == "03") || (month == "05") || (month == "07") || (month == "08") || (month == "10") || (month == "12"))) 
{ 
err = 25; 
} 
if ((day > 30) && ((month == "04") || (month == "06") || (month == "09") || (month == "11"))) 
{ 
err = 26; 
} 
/* if 00 houvendo entrada, sem erros */ 
if ((day == 0) && (month == 0) && (year == 00)) 
{ 
err = 0; day = ""; month = ""; year = ""; seperator = ""; 
} 
/* if sem erros, escrevo a data completa no Input-Field (e.x. 13/12/2001) */ 
if (err == 0) 
{ 
//DateField.value = day + seperator + month + seperator + year; 
return true;
} 
/* Mensagem de erro if err != 0 */ 
else 
{ 
return false;
} 
}
  
  
  
  
  
  
  
  

//*******************************conferencia de campos***************************
//*******************************add e update funcionario admin******************

var form
function submit_func(form)
		{
		if (check_date(document.adicionar.dia_nasc.value+'/'+document.adicionar.mes_nasc.value+'/'+document.adicionar.ano_nasc.value) != true )
			{
				alert('Campo Data de Nascimento Inválida.');
				document.adicionar.dia_nasc.focus();
				return false;		
			}

		if (check_date(document.adicionar.dia_contrato.value+'/'+document.adicionar.mes_contrato.value+'/'+document.adicionar.ano_contrato.value) != true )
			{
				alert('Campo Data de Contratação Inválida.');
				document.adicionar.dia_contrato.focus();
				return false;		
			}
		if (form.nm_func.value=="" || form.nm_func.value.length<=5 )
			{
				alert('Campo Nome Obrigatório  e deve ter mais de 5 letras .');
				form.nm_func.focus();
				return false;	
			}
		if 	(form.cd_cpf.value!="") 
			{
				if (checacpf(form.cd_cpf.value) != true )
					{
						alert('CPF invalido, por favor digite-o novamente ou deixe-o em branco.');
						form.cd_cpf.focus();
						return false;	
					}
			}

		if (valida_email(form) != true )
			{
				return false;	
			}			
		}









//*******************************conferencia de campos***************************
//*******************************conferencia de campos***************************
//*******************************conferencia de campos***************************
//*******************************conferencia de campos***************************
//*******************************conferencia de campos***************************
//*******************************conferencia de campos***************************
//*******************************conferencia de campos***************************
//*******************************conferencia de campos***************************
//*******************************conferencia de campos***************************
//*******************************conferencia de campos***************************
//*******************************conferencia de campos***************************



-->