/*funcion reloj*/
function runClock() { 
theTime = window.setTimeout("runClock()", 1000); 
var today = new Date(); 
var display= today.toLocaleString(); 
status=display; 
} 
/*funcion reloj*/
function runClock() { 
theTime = window.setTimeout("runClock()", 1000); 
var today = new Date(); 
var display= today.toLocaleString(); 
status=display; 
} 

/*funcion para deshabilitar la tecla enter y habilitar el tab*/
function fn(form,field){
var next=0, found=false
var f=form
if(event.keyCode!=13) return;
for(var i=0;i<f.length;i++)	{
	if(field.name==f.item(i).name){
		next=i+1;
		found=true
		break;
	}
}
while(found){
	if( f.item(next).disabled==false &&  f.item(next).type!='hidden'){
		f.item(next).focus();
		break;
	}
	else{
		if(next<f.length-1)
			next=next+1;
		else
			break;
	}
}
}


/*No permite ingresar un dato de texto en la edad*/
function LP_data()
{
	var key=window.event.keyCode;//codigo de tecla.
	if (key < 48 || key > 57)
		{//si no es numero 
			window.event.keyCode=0;//anula la entrada de texto.
		}
}


/*funcion para poner la primer letra en mayuscula*/
function changeCase(frmObj) {
	var index;
	var tmpStr;
	var tmpChar;
	var preString;
	var postString;
	var strlen;
	tmpStr = frmObj.value.toLowerCase();
	strLen = tmpStr.length;
	if (strLen > 0)  {
	for (index = 0; index < strLen; index++)  {
	if (index == 0)  {
	tmpChar = tmpStr.substring(0,1).toUpperCase();
	postString = tmpStr.substring(1,strLen);
	tmpStr = tmpChar + postString;
}
	else {
	tmpChar = tmpStr.substring(index, index+1);
	if (tmpChar == " " && index < (strLen-1))  {
	tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
	preString = tmpStr.substring(0, index+1);
	postString = tmpStr.substring(index+2,strLen);
	tmpStr = preString + tmpChar + postString;
         }
      }
   }
}
	frmObj.value = tmpStr;

}

/*funcion para validar el ingreso correcto del email*/

function FechaValida(Fecha){
/* Esta función valida un campo de texto para que contenga una fecha en formato dd/mm/aaaa
   y para que además esa fecha sea una fecha válida.  El formato del día puede ser de un caracter
   al igual que el del mes, pero es necesario que el del año sea aaaa. */
var result=true;
var elems=Fecha.split("/");/* Se divide el campo en valores delimitados por:/.*/
 	result = (elems.length == 3); /* Deben haber 3 componentes de fecha.*/	
	if (result){
 		var dia = parseInt(elems[0],10);
  		var mes = parseInt(elems[1],10);
 		var anio = parseInt(elems[2],10);
		result = (!isNaN(elems[0]) && (dia > 0) && (dia < 32) && !isNaN(elems[1]) && (mes > 0) && (mes < 13) && !isNaN(elems[2]) && (elems[2].length == 4) );
		if (result){/*Se procede a la vallidación de la fecha ingresada*/
			if(anio < 1800 || anio > 2100)
			{
				return false;
			}	
			switch(mes){
			case 1:
			case 3:
			case 5:
			case 7:
			case 8:
			case 10:
			case 12: /* Meses de 31 días.*/ 
					result = dia<32;
			break;
			case 11:
			case 4:
			case 6:
			case 9: /* Meses de 30 días.*/ 
					result = (dia<31);
			break;
			case 2 : /* Febrero. */
						if (((anio%4==0)&&(anio%100!=0))||((anio%100==0)&&(anio%400==0))){
						/* Es año bisiesto. */
							result = (dia<30);
						}
						else{
						/* No es un año bisiesto */
							result = (dia<29);
						}
			break;
		    }
		}
	}
	return result;
}

function Validar(form)
{ 
   if (form.email.value == "") 
   { 
	  /* */
   }
	else  
   { 
   	if (form.email.value.indexOf('@', 0) == -1 || form.email.value.indexOf('.', 0) == -1)
   	{ 
 	 alert("La direción de e-mail \n debe ser del tipo \n xxx@xxx.com o xxx@xxx.com.ar "); 
	 form.email.focus();
	 return; 
    }
   }
  form.submit();
}  

/*Valida que el campo dni para buscar no este vacío*/
function Vacio(form)
{
  if (form.dni.value == "")
  { 
	alert("Por favor ingrese un dni a buscar"); 
	form.dni.focus();
	return; 
  }
  form.submit();
}  

function VacioPatente(form)
{
  if (form.patente.value == "")
  { 
	alert("Por favor ingrese una patente a buscar"); 
	form.patente.focus();
	return; 
  }
  form.submit();
}  

function VacioKm(form)
{
  if (form.kmactual.value == "")
  { 
	alert("Por favor ingrese el Kilometraje actual"); 
	form.kmactual.focus();
	return; 
  }
  form.submit();
}  

<!-- Begin
function NewWindow(mypage, myname, w, h, scroll, resize) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable='+resize+',statusbar'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
//  End -->
