// JavaScript Document
function formataData(index,evento) {
		var tecla = evento.keyCode;
		var campo;
		
		vr = index.value;
		vr = vr.replace( ".", "" );
		vr = vr.replace( ".", "" );
		vr = vr.replace( "/", "" );
		vr = vr.replace( "/", "" );
		tam = vr.length + 1;
		if (((tecla >= 96) && (tecla <= 105)) || ((tecla >= 48) && (tecla <= 57)) || ((tecla == 9) || (tecla == 8))) {
			if ( tecla != 9 && tecla != 8){
				if ( tam == 3 )
					index.value = vr.substr( 0, tam - 1  ) + '/' + vr.substr( tam - 1, tam );
				if ( tam > 3 && tam < 5 )
					index.value = vr.substr( 0, tam - 2  ) + '/' + vr.substr( tam - 2, tam );
				if ( tam >= 5 && tam <= 10 )
					index.value = vr.substr( 0, 2 ) + '/' + vr.substr( 2, 2 ) + '/' + vr.substr( 4, 4 );
			}		
		}
		else{
			evento.returnValue = false;
		}
	}
function formataHora(index,evento) {
		var tecla = evento.keyCode;
		vr = index.value;
		
		vr = vr.replace( ".", "" );
		vr = vr.replace( ".", "" );
		vr = vr.replace( ":", "" );
		vr = vr.replace( ":", "" );
		tam = vr.length + 1;
		if (((tecla >= 96) && (tecla <= 105)) || ((tecla >= 48) && (tecla <= 57)) || ((tecla == 9) || (tecla == 8))){
			if ( tecla != 9 && tecla != 8 ){
				if ( tam == 3 )
					index.value = vr.substr( 0, tam - 1  ) + ':' + vr.substr( tam - 1, tam );
			}		
		}
		else{
			evento.returnValue = false;
		}
	}
function formataValor(index,evento) {
		var tecla = evento.keyCode;
		vr = index.value;
		
		vr = vr.replace( ".", "" );
		vr = vr.replace( ".", "" );
		vr = vr.replace( ":", "" );
		vr = vr.replace( ":", "" );
		tam = vr.length + 1;
		if (((tecla >= 96) && (tecla <= 105)) || ((tecla >= 48) && (tecla <= 57)) || ((tecla == 9) || (tecla == 8))){
			if ( tecla != 9 && tecla != 8 ){
				if ( tam == 3 )
					index.value = vr.substr( 0, tam - 1  ) + ',' + vr.substr( tam - 1, tam );
			}		
		}
		else{
			evento.returnValue = false;
		}
	}
function abrir(URL) {

   var width = 500;
   var height = 300;

   var left = 99;
   var top = 99;

   window.open(URL,'janela', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');

}

function abrirFoto(URL) {

   var width = 600;
   var height = 400;

   var left = 99;
   var top = 99;

   window.open(URL);

}
	
	/*Implementar
	
	onKeyDown="formataHora(this,event);"
	onKeyDown="formataData(this,event);"
	*/