<!--
var dt = new Date();
var y  = dt.getYear();
var msg = " © " + y +"  ABC WebHouse Tecnologia Ltda.";
var timer;
window.defautlStatus = msg;
window.status = msg;
//scrollMe();
//function scrollMe() {window.status = msg; timer = setTimeout("scrollMe()", 80);}
//--|Carrega imagen no local indicado|---------------------------->
browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);
ns3up = (browserName == "Netscape" && browserVer >= 3);
ie4up = (browserName.indexOf("Microsoft") >= 0 && browserVer >= 4);
function doPic(imgName) {
if (ns3up || ie4up) {
imgOn = ("" + imgName.value);
document.mainpic.src = imgOn;
   }
}
function popup(theURL,winName,nWidht,nHeight) { //pop up Alcides, muito bom recodificado
	var popup = null	
	popup = window.open(theURL,winName,'toolbar=no,menubar=no,resizable=yes,status=yes,scrollbars=yes,width='+nWidht+',height='+nHeight+'');
    if (popup != null) {
        popup.location.href=''+theURL
    }
  popup.focus( );
}
function popup_vdo(theURL,winName,nWidht,nHeight) { //pop up Alcides, muito bom recodificado
	var popup_vdo = null	
	popup_vdo = window.open(theURL,winName,'toolbar=no,menubar=no,resizable=no,status=no,scrollbars=no,width='+nWidht+',height='+nHeight+'');
    if (popup_vdo != null) {
        popup_vdo.location.href=''+theURL
    }
  popup_vdo.focus( );
}

function popupAzusatv(theURL,winName,nWidht,nHeight) { //pop up Alcides, muito bom recodificado
	var popup = null	
	popup = window.open(theURL,winName,'toolbar=yes,menubar=yes,resizable=yes,status=yes,scrollbars=yes,width='+nWidht+',height='+nHeight+'');
    if (popup != null) {
        popup.location.href=''+theURL
    }
  popup.focus( );
}

//--------------------------------------------|Forms Functions |--------------------------------
function trim(str)
{
   return str.replace(/^\s*|\s*$/g,"");
}

function r_virgula(str)
{
   return str.toString().replace(",",".");
}

function r_ponto(str)
{
   return str.toString().replace(".",",");
}

function Limpa_Cadastro()
{
   document.cadastro.reset();
}
function round(number,X)
{
 X = (!X ? 2 : X);
 Y = Math.round(number*Math.pow(10,X))/Math.pow(10,X);
 return Y.toFixed(X)
}
//---------------------| Formatar da Re |----------------------------------->
function Formatar(campo,e)
{
var cod="";
if(document.all) {cod=event.keyCode;} else {cod=e.which;}
if(cod == 08) return;
if (cod < 48 || cod > 57)
{
if (cod < 45 || cod > 57) alert("Digite somente Caracteres Numéricos!");
cod=0;
campo.focus(); return false;
}
tam=campo.value.length; 
if(tam > 9) return false; 
var caract = String.fromCharCode(cod); 
if(tam == 2 || tam == 5) {campo.value+="/"+caract; return false;} 
campo.value+=caract; return false; 
}
document.onKeyPress=Formatar;

function FormatarHora(campo,e)
{
var cod="";
if(document.all) {cod=event.keyCode;} else {cod=e.which;}
if(cod == 08) return;
if (cod < 48 || cod > 57)
{
if (cod < 45 || cod > 57) alert("Digite somente Caracteres Numéricos!");
cod=0;
campo.focus(); return false;
}
tam=campo.value.length; 
if(tam > 4) return false; 
var caract = String.fromCharCode(cod); 
if(tam == 2) {campo.value+=":"+caract; return false;} 
campo.value+=caract; return false; 
}
document.onKeyPress=FormatarHora;
// no campo do formulario
// OnKeyPress="javascript:return(Formatar(this,event));"

function NumericVL(campo,e)
{
var cod="";
if(document.all) {cod=event.keyCode;} else {cod=e.which;}
if(cod == 08) return;
if (cod < 44 || cod > 57)
{
if (cod < 44 || cod > 57) alert("Digite somente Caracteres Numéricos!");
cod=0;
campo.focus(); return false;
}
//tam=campo.value.length; 
//if(tam > 15) return false; 
//var caract = String.fromCharCode(cod); 
//if(tam == 2 || tam == 5) {campo.value+="/"+caract; return false;} 
//campo.value+=caract; return false; 
}
document.onKeyPress=NumericVL;


//--| teste data e hora:--------------------do Edilson------------->
function Mascara(formato, objeto){
campo = eval (objeto);
// CEP
if (formato=='CEP'){
separador = '-'; 
conjunto1 = 5;
if (campo.value.length == conjunto1){
campo.value = campo.value + separador;
}
}

// DATA
if (formato=='DATA'){
separador = '/'; 
conjunto1 = 2;
conjunto2 = 5;
if (campo.value.length == conjunto1){
campo.value = campo.value + separador;
}
if (campo.value.length == conjunto2){
campo.value = campo.value + separador;
}
}

// DATA & HORA
if (formato=='DATAHORA'){
    separador1 = '/'; 
    separador2 = ' ';
    separador3 = ':'; 
    conjunto1 = 2;
    conjunto2 = 5;
    conjunto3 = 10;
    conjunto4 = 13;
    if (campo.value.length == conjunto1){
    	campo.value = campo.value + separador1;
    }
    if (campo.value.length == conjunto2){
    	campo.value = campo.value + separador1;
    }
    if (campo.value.length == conjunto3){
    	campo.value = campo.value + separador2;
    }
    if (campo.value.length == conjunto4){
    	campo.value = campo.value + separador3;
    }
}

// TELEFONE
if (formato=='TELEFONE'){
separador = '-'; 
conjunto1 = 4;
if (campo.value.length == conjunto1){
campo.value = campo.value + separador;
}
}

}
//chamada:
//onKeyPress="Mascara('DATA', this);"

//------------------| meu Alcides |-------------------------->

function VerificaData(valor)
{
	var tam, descricao ,i;
	var grupo1, grupo2, grupo3, grupodv;
	var obj = valor.value;
	tam = parseInt(obj.length,10);
	for(i=0;i<tam;i++)
	{	
		descricao = obj.charAt(i)
		if((descricao >= '0' && descricao <= '9')||(i==1&&descricao=='/')||(i==2&&descricao=='/')||(i==4&&descricao=='/')||(i==5&&descricao=='/'))
		{
			//inclusao das barras.
			if((i==1)&&(tam==2)||(i==4)&&(tam==5))
			{
				valor.value = obj.substring(0,i+1) + '/';
				i = i + 1;
			}

		}
			else
		{
			alert("Data - Preenchimento inválido.");
			valor.value = obj.substring(0,tam-1)
			valor.focus();
			return false;		
		}		
	}
	return true;
}
//----------------------------
function ValidaDataMesAno(data)
{
	var dia,mes,ano,i;
	var varauxbissexto;
	var obj;
	var tam;
	obj = data.value;
	tam = parseInt(obj.length,10);
	for(i=0;i<tam;i++)
	{
		if((tam==8)||(tam!=8)&&((i!=2) && (i!=5)))
		{
			if(!(obj.charAt(i) >= '0' && obj.charAt(i) <= '9'))
			{
				alert("CAMPO DATA - Data Inválida.");
				//data.focus();
				return false;			
			}
			
		}
	}
	
	if(obj.length==8)
	{
		dia = parseInt(obj.substring(0,2),10);
		mes = parseInt(obj.substring(2,4),10);
		ano = parseInt(obj.substring(4,8),10)
	}
	else
	{
		dia = parseInt(obj.substring(0,2),10);
		mes = parseInt(obj.substring(3,5),10);
		ano = parseInt(obj.substring(6,10),10)
		
		if((obj.charAt(2)!='/')||(obj.charAt(5)!='/'))
		{
			if(obj!="")
			{			
				alert("CAMPO DATA - Data Invalida.\nDigite pausadamente o campo Data.");
				//data.focus();
				return false;
			}
		}
	}	

	//critica data
	if((dia > 31) || (dia == 0))
	{
		alert("DATA NASCIMENTO - Dia Inválido.");
		//data.focus();
		return false;		
	}
	if ((mes > 12) || (mes == 0))
	{
		alert("CAMPO DATA - Męs Inválido.");
		//data.focus();
		return false;		
	}
  	//Observar data que cadidatos abaixo de 18 anos. Atualmente 1987 abaixo.
	if ((ano < 1998) || (ano > 2006))
	{
		alert("CAMPO DATA - Ano Inválido.");
		//data.focus();
		return false;		
	}
	if(ano%4 == 0)
		varauxbissexto = 1;
	else
		varauxbissexto = 0;
	if(((mes == 2) && (dia > (28 + parseInt(varauxbissexto,10)))) || (mes == 4 || mes == 6 || mes == 9 || mes == 11) && (dia > 30))
	{
		alert("CAMPO DATA  - Preenchimento inválido.");
		//data.focus();
		return false;
	}	
	return true;
}


//--| Usando o campo data, preenche com as (/) automatico.
//OnKeyPress="javascript:return(NumericVL(this,event));"
//OnKeyUp="VerificaData(this);" OnBlur="ValidaDataMesAno(this);"
//-->
