//<!-- 
function SeeYouLater(){
	window.close();
	}

function FormataData(Campo, teclapres){
	var tecla = teclapres.keyCode;
	var vr = new String(Campo.value);
	vr = vr.replace("/", "");
	vr = vr.replace("/", "");
	tam = vr.length + 1;
	
	if (tecla != 9 && tecla != 8){
		if (tam > 2 && tam < 5)
			Campo.value = vr.substr(0, 2) + '/' + vr.substr(2, tam);
		if (tam >= 5 && tam <=10)
			Campo.value = vr.substr(0,2) + '/' + vr.substr(2,2) + '/' + vr.substr(4,4);
		}
	}
/////////////////////////////////////////////////////////////////


function FormataCellphoneBr(obj,e)
{
	if (navigator.userAgent.indexOf("IE") != -1)
	{
		var keypress = window.event.keyCode;
		if (keypress > 47 && keypress < 58 && obj.value.length < 13)
			{
			if (obj.value.length == 0)
			   obj.value = "(" + obj.value;
			if (obj.value.length == 3)
			   obj.value = obj.value + ")";
			if (obj.value.length == 8)
			   obj.value = obj.value + "-";
			}
		else
			event.returnValue = false;
	}
	else
	{
		lineaux = obj.value;
		var keypress = e.which;
		if (keypress == 8)
			return true;
		if ((keypress < 48 || keypress > 57) || obj.value.length >= 13)
			return false;
		if (lineaux.length == 0)
			lineaux = "(";
		if (lineaux.length == 3)
			lineaux = lineaux + ")";
		if (lineaux.length == 8)
			lineaux = lineaux + "-";
		lineaux = lineaux + (keypress - 48);
		obj.value = lineaux;
		return false;
	}
	return true;
} 
/////////////////////////////////////////////////////////////////

function SomenteNumero(obj,e)
{
	if (navigator.userAgent.indexOf("IE") != -1)
	{
		var keypress = window.event.keyCode;
		if (keypress > 47 && keypress < 58 && obj.value.length < 14)
			{
			if (obj.value.length == 0)
			   obj.value = "" + obj.value;
			if (obj.value.length == 3)
			   obj.value = obj.value + "";
			if (obj.value.length == 8)
			   obj.value = obj.value + "";
			}
		else
			event.returnValue = false;
	}
	else
	{
		lineaux = obj.value;
		var keypress = e.which;
		if (keypress == 8)
			return true;
		if ((keypress < 48 || keypress > 57) || obj.value.length >= 13)
			return false;
		if (lineaux.length == 0)
			lineaux = "(";
		if (lineaux.length == 3)
			lineaux = lineaux + ")";
		if (lineaux.length == 8)
			lineaux = lineaux + "-";
		lineaux = lineaux + (keypress - 48);
		obj.value = lineaux;
		return false;
	}
	return true;
} 

/////////////////////////////////////////////////////////////////

function FormataHora(Campo, teclapres){
	var tecla = teclapres.keyCode;
	
	var vr = new String(Campo.value);
	vr = vr.replace(":", "");
	vr = vr.replace(":", "");

	tam = vr.length + 1;
	
	if (tecla != 9 && tecla != 8){
		if (tam > 2 && tam < 5)
			Campo.value = vr.substr(0, 2) + ':' + vr.substr(2, tam);
		if (tam >= 5 && tam < 9)
			Campo.value = vr.substr(0,2) + ':' + vr.substr(2,2) + ':' + vr.substr(4,2);
		}
	}
/////////////////////////////////////////////////////////////////

function FormataCEP(Campo, teclapres){

	var tecla = teclapres.keyCode;

	var vr = new String(Campo.value);
	vr = vr.replace(".", "");
	vr = vr.replace("-", "");
	

	tam = vr.length + 1 ;

	
	if (tecla != 9 && tecla != 8){
		if (tam > 2 && tam < 6)
			Campo.value = vr.substr(0, 2) + '' + vr.substr(2, tam);
		if (tam >= 6 && tam < 9)
			Campo.value = vr.substr(0,2) + '' + vr.substr(2,3) + '-' + vr.substr(5,tam-5);
		
		}
}
/////////////////////////////////////////////////////////////////

function SaltaCampo(campo,prox,tammax,teclapres){

	var tecla = teclapres.keyCode;
	vr = document.forms[0].elements[campo].value;
		
	if( tecla == 109 || tecla == 188 || tecla == 110 || tecla == 111 || tecla == 223 || tecla == 108){
	   document.form[campo].value = vr.substr(0, vr.length - 1); }
	else {
		vr = vr.replace("-","");
		vr = vr.replace("/","");
		vr = vr.replace("/","");
		vr = vr.replace(",","");
		vr = vr.replace(".","");
		vr = vr.replace(".","");
		vr = vr.replace(".","");
		vr = vr.replace(".","");
		tam = vr.length;

		if (tecla != 0 && tecla != 9 && tecla != 16 )
			if ( tam == tammax )
				document.forms[0].elements[prox].focus();
		}
}
//////////////////////////////////////////////////////////////////
function FormataCNPJ(Campo, teclapres){

	var tecla = teclapres.keyCode;

	var vr = new String(Campo.value);
	vr = vr.replace(".", "");
	vr = vr.replace(".", "");
	vr = vr.replace("/", "");
	vr = vr.replace("-", "");

	tam = vr.length + 1 ;

	
	if (tecla != 9 && tecla != 8){
		if (tam > 2 && tam < 6)
			Campo.value = vr.substr(0, 2) + '.' + vr.substr(2, tam);
		if (tam >= 6 && tam < 9)
			Campo.value = vr.substr(0,2) + '.' + vr.substr(2,3) + '.' + vr.substr(5,tam-5);
		if (tam >= 9 && tam < 13)
			Campo.value = vr.substr(0,2) + '.' + vr.substr(2,3) + '.' + vr.substr(5,3) + '/' + vr.substr(8,tam-8);
		if (tam >= 13 && tam < 15)
			Campo.value = vr.substr(0,2) + '.' + vr.substr(2,3) + '.' + vr.substr(5,3) + '/' + vr.substr(8,4)+ '-' + vr.substr(12,tam-12);
		}
}

/////////////////////////////////////////////////////////////////
function TestaHora(cHora){
	var hora; 
	hora = LimpaCampo(cHora.value,10);
	var tam = hora.length;
	if	(tam != 6){
		alert('A hora está incorreta');
		cHora.value = "";
		cHora.focus();
		return(false);
		}
	
	var hr = hora.substr(0,2)
	var min = hora.substr (2,2)
	var seg = hora.substr (4,2)	
	if ((hr > 23) || (min > 59) || (seg > 59)){
		alert('A hora está incorreta');
		cHora.value = "";
		cHora.focus();
		return(false);
		}
	return(true);
}
/////////////////////////////////////////////////////////////////
function TestaData(cData){
	var data; 
	data = LimpaCampo(cData.value,10);
	var tam = data.length;
	if	(tam != 8){
		alert('A data está incorreta');
		cData.value = "";
		cData.focus();
		return(false);
		}
	var dia = data.substr(0,2)
	var mes = data.substr (2,2)
	var ano = data.substr (4,4)	
	if (ano < 1994){
		alert('A data está incorreta');
		cData.value = "";
		cData.focus();
		return(false);
		}

	switch (mes){
		case '01':
			if  (dia > 31){
				alert('A data está incorreta');
				cData.value = "";
				cData.focus();
				return(false);
				}
			break;
		case '02':
			if  (dia > 29){
				alert('A data está incorreta');
				cData.value = "";
				cData.focus();
				return(false);
				}
			break;
		case '03':
			if  (dia <= 31){
				alert('A data está incorreta');
				cData.value = "";
				cData.focus();
				return(false);
				}
			break;
		case '04':
			if  (dia <= 30){
				alert('A data está incorreta');
				cData.value = "";
				cData.focus();
				return(false);
				}
			break;
		case '05':
			if  (dia <= 31){
				alert('A data está incorreta');
				cData.value = "";
				cData.focus();
				return(false);
				}
			break;
		case '06':
			if  (dia <= 30) {
				alert('A data está incorreta');
				cData.value = "";
				cData.focus();
				return(false);
				}
			break;
		case '07':
			if  (dia <= 31){
				alert('A data está incorreta');
				cData.value = "";
				cData.focus();
				return(false);
				}
			break;
		case '08':
			if  (dia <= 31){
				alert('A data está incorreta');
				cData.value = "";
				cData.focus();
				return(false);
				}
			break;
		case '09':
			if  (dia <= 30){
				alert('A data está incorreta');
				cData.value = "";
				cData.focus();
				return(false);
				}
			break;
		case '10':
			if  (dia <= 31){
				alert('A data está incorreta');
				cData.value = "";
				cData.focus();
				return(false);
				}
			break;
		case '11':
			if  (dia <= 30) {
				alert('A data está incorreta');
				cData.value = "";
				cData.focus();
				return(false);
				}
			break;
		case '12':
			if  (dia <= 31){
				alert('A data está incorreta');
				cData.value = "";
				cData.focus();
				return(false);
				}
			break;
		}	

	return(true); 
	}
///////////////////////////////////////////////////////////////////
function VerAlfaNumerico(pInd){
	var pValor = document.forms[0].elements[pInd].value
	var AuxTam = pValor.length  
	for(var j=0;j<AuxTam;j++)
		if ((!IndAlfaNumerico(pValor.charAt(j))) || (pValor.charAt(j) == " ")){
			document.forms[0].elements[pInd].focus();  
			document.forms[0].elements[pInd].value = pValor = pValor.substring(0,j)           
			} 
	}
////////////////////////////////////////////////////////////////////
function IndAlfaNumerico(N){
	for(var i=0;i<10;i++)
	if(N == i)
		return true;
	return false;    
	}
////////////////////////////////////////////////////////////////////


//-->
