function validate_folio(theForm){

  if (isEmpty(theForm.folio1.value) || isEmpty(theForm.folio2.value) || isEmpty(theForm.folio3.value) || isEmpty(theForm.folio4.value)){
  	alert('Ingrese un folio valido.');
    return false;
  }

  if (theForm.folio1.value.length < 4 || theForm.folio2.value.length < 4 || theForm.folio3.value.length < 4 || theForm.folio4.value.length < 4){
  	alert('Ingrese un folio valido.');
    return false;
  } 
  
  if (!isHexadecimal(theForm.folio1.value) || !isHexadecimal(theForm.folio2.value) || !isHexadecimal(theForm.folio3.value) || !isHexadecimal(theForm.folio4.value)){
  	alert('Ingrese un folio valido.');
    return false;
  }
  
  if (isEmpty(theForm.digito_verificador_folio.value)){
  	alert('Ingrese el digito verificador');
    return false;
  }
  
  theForm.folio.value = theForm.folio1.value + '-' + theForm.folio2.value + '-' + theForm.folio3.value + '-' + theForm.folio4.value;
	//openWinSubmit(theForm,theForm.action,theForm.doAction,600,600);
  openWin("",600,600);
  theForm.target = "windows";
  theForm.submit();
}

function isHexadecimal(valor){
	var strValor,i;
  
  strValor = valor.toUpperCase();
  for (i = 0; i < strValor.length; i++)
    {   
        var c = strValor.charCodeAt(i);
        if ( c.valueOf() < 48 || 57 < c.valueOf() && c.valueOf() < 65 || c.valueOf() > 70 ) 
          	return false;
    }
   return true;
	
	
}

function validate_largo(theForm, object, campo_siguiente){
	var strValor 
  object.value = object.value.toUpperCase();
  strValor = object.value;
	if (strValor.length.valueOf() == 5){
  	theForm.elements[campo_siguiente].focus();
  }
  
}