function edita_hora(nCampo)
{
var sValor, sRetorno, iLen, iCharAt

sRetorno = '';
eval('sValor = document.all.'+nCampo+'.value');
if (sValor.length<=4)
{
	if (event.keyCode >= 48 && event.keyCode <= 57)
	{
		sValor = sValor + String.fromCharCode(event.keyCode);
		iLen = sValor.length 
		for (iCharAt = 0; iCharAt <= iLen; iCharAt++)
		{
			if (sValor.charAt(iCharAt)!=':')
			{
				switch(iCharAt)
				{
					case 0:
						if(sValor.charAt(iCharAt)<=2)
						{
							sRetorno = sRetorno + sValor.charAt(iCharAt);
						}
					break;
					
					case 2:
						sRetorno = sRetorno + ':';
					break;
					
					case 3:
						if(sValor.charAt(iCharAt)<=5)
						{
							sRetorno = sRetorno + sValor.charAt(iCharAt);
						}
					break;
					
					default:
						sRetorno = sRetorno + sValor.charAt(iCharAt);
					break;
				}
			}	
			else
			{
				if (iCharAt==2)
				{
					sRetorno = sRetorno + ':';
				}
				
			}
		}
	}
	else
	{
	sRetorno=sValor;
	}
}
else
{
sRetorno=sValor;
}
event.returnValue='';
eval('document.all.'+nCampo+'.value=sRetorno');
}


function edita_data(nCampo)
{
var sValor, sRetorno, iLen, iCharAt

sRetorno = '';
eval('sValor = document.all.'+nCampo+'.value');
if (sValor.length<=9)
{
	if (event.keyCode >= 48 && event.keyCode <= 57)
	{
		sValor = sValor + String.fromCharCode(event.keyCode);
		iLen = sValor.length 
		for (iCharAt = 0; iCharAt <= iLen; iCharAt++)
		{
			//alert(iCharAt+' - '+sValor.charAt(iCharAt))
			if (sValor.charAt(iCharAt)!='/')
			{
				switch(iCharAt)
				{
					case 0:
						if(sValor.charAt(iCharAt)<=3)
						{
							sRetorno = sRetorno + sValor.charAt(iCharAt);
						}
					break;
					
					case 2:
						sRetorno = sRetorno + '/';
					break;
					
					case 3:
						if(sValor.charAt(iCharAt)<=1)
						{
							sRetorno = sRetorno + sValor.charAt(iCharAt);
						}
					break;
					
					case 5:
						sRetorno = sRetorno + '/';
					break;
					
					case 6:
						if(sValor.charAt(iCharAt)<=2)
						{
							sRetorno = sRetorno + sValor.charAt(iCharAt);
						}
					break;
					
					default:
						sRetorno = sRetorno + sValor.charAt(iCharAt);
					break;
				}
			}	
			else
			{
			
				if (iCharAt==2)
				{
					sRetorno = sRetorno + '/';
				}
				
				if (iCharAt==5)
				{
					sRetorno = sRetorno + '/';
				}
			}
			//sRetorno = sRetorno + sValor.charAt(iCharAt);
		}
	}
	else
	{
	sRetorno=sValor;
	}
}
else
{
sRetorno=sValor;
}
event.returnValue='';
eval('document.all.'+nCampo+'.value=sRetorno');
}



var win = null;
function centerwin(mypage,myname,w,h,features) {
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  if (winl < 0) winl = 0;
  if (wint < 0) wint = 0;
  var settings = 'height=' + h + ',';
  settings += 'width=' + w + ',';
  settings += 'top=' + wint + ',';
  settings += 'left=' + winl + ',';
  settings += features;
  win = window.open(mypage,myname,settings);
  win.window.focus();
}