var arrayCofigBton = new Array();
var ArrMessageTips = new Array();
var imgOut = new Image;
var imgOver = new Image;
var imgDown = new Image;
var Img1 = new Image;
var Img2 = new Image;
var idxColumn = 0;

var Rutav = '';
var Rutac = '';
var swOnMouseMove = false;
var trgCurrent = '';
var newWindowFind = null;
var newWindowReport = null;
var newWindow = null;

<!-- ============================================================================== -->
<!-- ============	 Metodo llenado de Combos Dependientes	     ============== -->
<!-- ============================================================================== -->
function llenarCboDependiente(arrayData,codigo,objSelect){ 
  var i = 0;
  var j = 0; 

  objSelect.length = 0;
  for ( i = 0; i < arrayData.length; i++){ 
    if(codigo == arrayData[i][0]){
      objSelect.options[j] = new Option(arrayData[i][2],arrayData[i][1]);
	    j++;
		}// End If
  }// End For
}
<!-- ============================================================================== -->
<!-- ============		          Elimina Espacios	        	     ============== -->
<!-- ============================================================================== -->
function TrimRight( str ) {
	var resultStr = "";
	var i = 0;

	// Return immediately if an invalid value was passed in
	if (str+"" == "undefined" || str == null)	
		return null;

	// Make sure the argument is a string
	str += "";
	
	if (str.length == 0) 
		resultStr = "";
	else {
  	// Loop through string starting at the end as long as there
  	// are spaces.
  	i = str.length - 1;
  	while ((i >= 0) && (str.charAt(i) == " ")) i--;
			
 		// When the loop is done, we're sitting at the last non-space char,
 		// so return that char plus all previous chars of the string.
  	resultStr = str.substring(0, i + 1);
	}
  	
  return resultStr;  	
}

function TrimLeft( str ) {
	var resultStr = "";
	var i = len = 0;

	// Return immediately if an invalid value was passed in
	if (str+"" == "undefined" || str == null)	
		return null;

	// Make sure the argument is a string
	str += "";

	if (str.length == 0) 
		resultStr = "";
	else {	
 		// Loop through string starting at the beginning as long as there
 		// are spaces.
    //len = str.length - 1;
		len = str.length;
		
 		while ((i <= len) && (str.charAt(i) == " ")) i++;
   	// When the loop is done, we're sitting at the first non-space char,
 		// so return that char plus the remaining chars of the string.
 		resultStr = str.substring(i, len);
	}

 	return resultStr;
}

function Trim( str ) {
	var resultStr = "";
	
	resultStr = TrimLeft(str);
	resultStr = TrimRight(resultStr);
	
	return resultStr;
}

<!-- ***************************************************************************** -->
<!-- ******  Funciones de Validacion de campos requridos en un formularios ******* -->
<!-- ***************************************************************************** -->
function validRequiredFields(form,fields){
  var i = 0, j = 0, sw = false, valor = '';
  var ArrayCamposReq = fields.split('|');
  
  for (i = 0; i < form.elements.length; i++) {
		if (form.elements[i].type == 'select-one' ||
				form.elements[i].type == 'text'       ||
				form.elements[i].type == 'password'   ||
				form.elements[i].type == 'textarea'   ||
				form.elements[i].type == 'file'       ||
				form.elements[i].type == 'radio'){  
	  	sw = false;
	  	for(j = 0; j < ArrayCamposReq.length; j++){
				if(form.elements[i].name == ArrayCamposReq[j] || 
					 form.elements[i].name == (ArrayCamposReq[j] + 'Shw')){
		  		sw = true;
		  		break;
				}
			}// end for	

	  /*if (!sw && form.elements[i].type == 'radio'){
	    if (!form.elements[i].checked){
 	      alert('Por favor complete informacion.'+ '\n' + 'Ingrese ' + form.elements[i].title);
		  try{
		    form.elements[i].focus();
		  }catch(theException){}
		  return false;
		}
	  }*/

      valor = Trim(form.elements[i].value);		
	  	if((!sw) && ((valor == '') || (valor.length == 0))){
 	    	alert('Por favor complete informacion.'+ '\n' + 'Ingrese ' + form.elements[i].title);
				try{
		  		form.elements[i].focus();
		 		}catch(theException){}
		 		return false;
			}// end if
	  	// Valido E mail - Fechas - Horas
      if ((!sw) && (form.elements[i].type == 'text')){
				sw = true;  
        if(form.elements[i].alt == "E.mail") sw = valEmail(form.elements[i].value);
        if(form.elements[i].alt == "Date") sw = valFecha(form.elements[i].value);
        if(form.elements[i].alt == "Hour") sw = valHour(form.elements[i].value);
        if (!sw){
          try{
		    		form.elements[i].focus();
		  		}catch(theException){}
		  		return sw;
				}
			}
		}// end if
	}// end for
  return true;
}
<!-- ***************************************************************************** -->
<!-- ********  Funcion que retorna el ancho en pixeles de la ventana actual ****** -->
<!-- ***************************************************************************** -->
function getWidthWin(){
  var xMax = 0;
  if (document.all) 
    xMax = document.body.clientWidth;
  else if (document.layers) 
    xMax = window.innerWidth;

  return xMax;
}
<!-- ***************************************************************************** -->
<!-- ********  Funcion que retorna el alto en pixeles de la ventana actual ****** -->
<!-- ***************************************************************************** -->
function getHeightWin(){
  var yMax = 0;
  if (document.all)
    yMax = document.body.clientHeight;
  else if (document.layers)
    yMax = window.innerHeight;

  return yMax;
}
<!-- ***************************************************************************** -->
<!-- ***************  Funciones utilizada para la carga previa de imagenes ******* -->
<!-- ***************************************************************************** -->
function loadImages(){
  Img1.src = Rutav + '/vista/img/Img1.gif';
  Img2.src = Rutav + '/vista/img/Img2.gif';
  imgOut.src = Rutav + '/vista/img/botones/btonOut.gif';
  imgOver.src = Rutav + '/vista/img/botones/btonOver.gif';
  imgDown.src = Rutav + '/vista/img/botones/btonDown.gif';
}
<!-- ***************************************************************************************** -->
<!-- **  Funciones utilizada para el efecto cambio de imagenes el las columnas de una tabla ** -->
<!-- ***************************************************************************************** -->
function ChangeImage(state,nameImg){
	if(state == "On")
		document.getElementById(nameImg).background = Img2.src;
  else if(state == "Off")
		document.getElementById(nameImg).background = Img1.src;
}
<!-- ============================================================================== -->
<!-- ============	    Modifica la url de un Form en una pagina     ============== -->
<!-- ============================================================================== -->
function sendForm(nameForm,url,validFields){
  var sw = true;
  var newUrl = Trim(url);
  
  if (validFields){
    sw = validRequiredFields(document.forms[nameForm],validFields);
  }
  if (sw){
		if (newUrl != ''){
      if (newUrl.substring(0,1) == 'C')
	  	  newUrl = Rutac + newUrl.substring(1);
		  else
		    newUrl = Rutav + newUrl.substring(1);
      document.forms[nameForm].action = newUrl;
		}
		document.forms[nameForm].submit();
	}
}
<!-- ============================================================================== -->
<!-- ============	      Actualizar un valor del objeto Select      ============== -->
<!-- ============================================================================== -->
function updateDataSelect(name,valor){
  if (document.getElementById(name))
    document.getElementById(name).value = valor;
}
<!-- ============================================================================== -->
<!-- ============	       Funcion para redireccionar paginas        ============== -->
<!-- ============================================================================== -->
function reDirect(url){
  var newUrl = Trim(url);

  if (newUrl.substring(0,1) == 'C')
    newUrl = Rutac + newUrl.substring(1);
  else if (newUrl.substring(0,1) == 'V')
		newUrl = Rutav + newUrl.substring(1);
  location.href = newUrl;
}
<!-- ============================================================================== -->
<!-- ============	       Funcion para efecto de las imagenes       ============== -->
<!-- ============================================================================== -->
function makeVisible(name,which){
  strength = (which == 0) ? 1 : 0.5;
  var cur = document.getElementById(name);

  if (cur.style.MozOpacity)
    cur.style.MozOpacity = strength;
  else if (cur.filters)
    cur.filters.alpha.opacity = strength * 100;
}
<!-- ***************************************************************************** -->
<!-- ********* Cambia el formato de una fecha dd-mm-yyyy to mm-dd-yyyy      ****** -->
<!-- ***************************************************************************** -->
function getFechaStringDMA(fecha) {
  var anno = fecha.substring(0,4);
  var mes = fecha.substring(6,8);
  var dia = fecha.substring(9);
  return (dia + '/' + mes + '/' + anno);
}
<!-- ***************************************************************************** -->
<!-- *************     Dibuja el boton para cerrar las ventanas      ************* -->
<!-- ***************************************************************************** -->
function makeBarInformation(wth,ptitle){
  var output = '', title = '';
  var wTable = getWidthWin();
  var wResto = wTable - (wth - 24);

  if (!ptitle)
    title = '&nbsp;';
  else	
    title = ptitle;

  try{
	  //output += '<br>';
    output += '<table width="'+wTable+'" border="0" cellpadding="0"cellspacing="0">';
    output += '  <tr>';
    output += '    <td width="2"><img src="'+Rutav+'/vista/img/br.gif" width="2" height="26" ></td>';
    output += '    <td width="10" background="'+Rutav+'/vista/img/brclr.gif">&nbsp;</td>';
    output += '    <td width="'+wth+'" align="center" background="'+Rutav+'/vista/img/brclr.gif" class="title">'+title+'</td>';
    output += '    <td width="10" background="'+Rutav+'/vista/img/brclr.gif">&nbsp;</td>';
    output += '    <td width="2"><img src="'+Rutav+'/vista/img/br.gif" width="2" height="26" ></td>';
    output += '    <td width="'+wResto+'" background="'+Rutav+'/vista/img/brclr.gif">&nbsp;</td>';
    output += '  </tr>';
    output += '</table>';  
      
	  document.write(output);	
	}catch(theException){
		alert('Error [makeBarInformation] ' + theException);    
  }
}
<!-- ***************************************************************************** -->
<!-- ************************** Path para las vista y controladores*************** -->
<!-- ***************************************************************************** -->
function setPath(url){
  Rutav = url;
  Rutac = Rutav + '/servlet';
}
<!-- ***************************************************************************** -->
<!-- ************************** Funcion para eliminar registros******************* -->
<!-- ***************************************************************************** -->
function deleteRecord(url,nameForm){
  var sw = false;
  
  sw = confirm('Esta seguro que desea eliminar este registro?');
  if(sw){
    if (nameForm){
		  var form = document.forms[nameForm];
      if (form.state){ 
		    form.state.value = 'Delete';
				form.submit();
			}
		}else{
      reDirect(url);  
		}
  }else{
    return; 
  }
}
<!-- ***************************************************************************** -->
<!-- ****************** Dibuja la barra de titulos de las ventanas *************** -->
<!-- ***************************************************************************** -->
function makeTitleBar(wh,title){
  var str = '';	
  var widthCenter = wh - 180;
  try{
    str+='<table width="'+wh+'" align="center" border="0" cellspacing="0" cellpadding="0">';
		str+='  <tr>';
		str+='    <td width="90" height="27" background="'+Rutav+'/vista/img/esqizq.gif">&nbsp;</td>';
		str+='    <td width="'+widthCenter+'" height="27" background="'+Rutav+'/vista/img/censup.gif" align="center">';
    str+='    <table width="'+widthCenter+'" border="0" cellspacing="0" cellpadding="3"><tr>';
		str+='      <td width="'+widthCenter+'" height="27" background="'+Rutav+'/vista/img/censup.gif" align="center" valign="bottom" class="letraDisplayII">'+title+'</td>';
    str+='    </tr></table>';  
    str+='    </td>';
    str+='    <td width="90" height="27" background="'+Rutav+'/vista/img/esqder.gif">&nbsp;</td>';
		str+='  </tr>';
		str+='</table>';	
    document.write(str);
  }catch(theException){
		alert('Error [makeTitleBar] ' + theException);    
  }
}
<!-- ***************************************************************************** -->
<!-- ****************** Dibuja la barra de inferior de las ventanas *************** -->
<!-- ***************************************************************************** -->
function makeBarBottom(wh){
  var str = '';	
  var widthCenter = wh - 89;
  try{
    str+='<table width="'+wh+'" align="center" border="0" cellspacing="0" cellpadding="0">';
		str+='  <tr>';
		str+='    <td><img src="'+Rutav+'/vista/img/esqizqinf.gif" width="44" height="13"></td>';
		str+='    <td><img src="'+Rutav+'/vista/img/ceninf.gif" width="'+widthCenter+'" height="13"></td>';
		str+='    <td><img src="'+Rutav+'/vista/img/esqderinf.gif" width="45" height="13"></td>';
		str+='  </tr>';
		str+='</table>';	
    document.write(str);
  }catch(theException){
		alert('Error [makeBarBottom] ' + theException);    
  }
}
<!-- ***************************************************************************** -->
<!-- ********* Dibuja la barra de titulos de las ventanas (Simple) *************** -->
<!-- ***************************************************************************** -->
function makeTitleBarII(wh,title){
  var str = '';	
  var widthCenter = 0;
  if (wh != 'NaN')
    widthCenter = wh - 180; 
  else	
		widthCenter = 0; 
	
  try{
    str+='<table width="'+wh+'" align="center" border="0" cellspacing="0" cellpadding="0">';
		str+='  <tr>';
		str+='    <td width="9" height="21" background="'+Rutav+'/vista/img/barlineizq.gif">&nbsp;</td>';
		str+='    <td width="71" height="21" background="'+Rutav+'/vista/img/barlinecen.gif">&nbsp;</td>';
    str+='    <td width="10" height="21" background="'+Rutav+'/vista/img/barlineder.gif">&nbsp;</td>';
    str+='    <td width="'+widthCenter+'" height="21" background="'+Rutav+'/vista/img/barcenter.gif" align="center" valign="middle" class="title">'+title+'</td>';
		str+='    <td width="9" height="21" background="'+Rutav+'/vista/img/barlineizq.gif">&nbsp;</td>';
		str+='    <td width="71" height="21" background="'+Rutav+'/vista/img/barlinecen.gif">&nbsp;</td>';
    str+='    <td width="10" height="21" background="'+Rutav+'/vista/img/barlineder.gif">&nbsp;</td>';
    str+='  </tr>';
		str+='</table>';	
    document.write(str);
  }catch(theException){
		alert('Error [makeTitleBarII] ' + theException);
  }
}
<!-- ***************************************************************************** -->
<!-- ****************** Dibuja la barra de inferior de las ventanas *************** -->
<!-- ***************************************************************************** -->
function makeBarBottomII(wh){
  var str = '';	
  try{
    str+='<table width="'+wh+'" align="center" border="0" cellspacing="0" cellpadding="0">';
		str+='  <tr>';
		str+='    <td><img src="'+Rutav+'/vista/img/barlineinf.gif" width="'+wh+'" height="12"></td>';
		str+='  </tr>';
		str+='</table>';	
    document.write(str);
  }catch(theException){
		alert('Error [makeBarBottomII] ' + theException);    
  }
}

<!-- ***************************************************************************** -->
<!-- ****************** Anula el boton derecho del Mouse             ************* -->
<!-- ***************************************************************************** -->
function nullMouse() {
  if (document.layers){
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown = clickNS;
  }else{
    document.onmouseup = clickNS;document.oncontextmenu = clickIE;
  }
  document.oncontextmenu = new Function("return false");
}

function clickIE(){
  var message = '';
  if (document.all){
    (message);
		 return false;
  }
}

function clickNS(e){
  var message = '';
  if (document.layers || (document.getElementById&&!document.all)){
    if (e.which==2||e.which==3){
		  (message);
		  return false;
		}
  }
}
<!-- ***************************************************************************** -->
<!-- ******************          Anula el teclado                    ************* -->
<!-- ***************************************************************************** -->
function nullKeyBoard() {
  return false;
}
<!-- ***************************************************************************** -->
<!-- **********              Dibuja los Botones de Comandos             ********** -->
<!-- ***************************************************************************** -->
function drawCommandBotton(){
  var str = '';	
  var i = 0;
  var w = 0;
  try{

    if (arrayCofigBton.length > 0){
		  loadImages();
		  w = 93 * arrayCofigBton.length;
      str += '<table align="center" width="'+w+'" border="0" cellpadding="0" cellspacing="2">';
      str += '  <tr>';
      for (i = 0; i < arrayCofigBton.length; i++){
		    str += '<td width="93" height="20" background = "'+ imgOut.src +'" onMouseOver="javascript:this.background=\'' + imgOver.src + '\'" onMouseOut="javascript:this.background=\'' + imgOut.src + '\'" onMouseDown="javascript:this.background=\'' + imgDown.src + '\'" onMouseUp="javascript:this.background=\'' + imgOver.src + '\'" class="drag" align="center"><a class="hypbtn" href="javascript:' + arrayCofigBton[i][1] + '" onMouseOver="window.status=\'' + arrayCofigBton[i][0] + '\';return true">' + arrayCofigBton[i][0] + '</a></td>\n';
			}
      str += '  </tr>';
		  str += '</table>';
		}else{
	  	str += '&nbsp;';
		}
    document.write(str);

  }catch(theException){
		alert('Error [drawCommandBotton] ' + theException);    
  }
}
<!-- ***************************************************************************** -->
<!-- **********  Funcion q crea el efecto en la barra de herramientas   ********** -->
<!-- ***************************************************************************** -->
function efect(id,op){
  if (op == 'On'){
    document.getElementById(id).borderColorDark = '#FFFFFF';
    document.getElementById(id).borderColorLight = '#000000';	
  }
  if (op == 'Off')
    document.getElementById(id).borderColorDark = '#000000';
  if (op == 'Down'){
    document.getElementById(id).borderColorDark = '#000000';
    document.getElementById(id).borderColorLight = '#FFFFFF';
  }
}
<!-- ***************************************************************************** -->
<!-- **********              Dibuja los Botones de Comandos             ********** -->
<!-- ***************************************************************************** -->
function drawCommandBottonII(arrCmd,caption){
  var str = '';	
  var i = 0;
  var w = 0;
  var nameImg = '';
  var strCaption = '';
  var idxLocal = idxColumn++;
  try{

    if (arrCmd.length > 0){
		  if (caption)	
		    w = 100 * arrCmd.length;
		  else	
		    w = 35 * arrCmd.length;
	  
      str += '<table width="'+w+'" cellpadding="0" cellspacing="0" class="tablas">';	
		  str += '  <tr>\n<td>';	
      str += '<table width="'+w+'" bordercolor="#000000" border="1" cellpadding="1" cellspacing="1" class="tablas">';
      str += '  <tr>';
      for (i = 0; i < arrCmd.length; i++){
				if (arrCmd[i][0] == 'Nuevo')
				  nameImg = 'newII.gif';
				else if (arrCmd[i][0] == 'Guardar')
				  nameImg = 'save.gif';
				else if (arrCmd[i][0] == 'Eliminar')
				  nameImg = 'deleteIII.gif';		
				else if (arrCmd[i][0] == 'Buscar')
				  nameImg = 'search.gif';		
				else if (arrCmd[i][0] == 'Imprimir')
				  nameImg = 'print.gif';		
				else if (arrCmd[i][0] == 'Salir')
				  nameImg = 'close.gif';		
				else if (arrCmd[i][0] == 'Regresar')
				  nameImg = 'back.gif';		
				else if (arrCmd[i][0] == 'Aceptar')
				  nameImg = 'okII.gif';		
		  
				if (caption)
				  strCaption = '&nbsp;' + arrCmd[i][0];

        str += '<td id="Column'+idxLocal+''+i+'" width="100" bordercolor="#000000" align="center" onMouseOver="efect(this.id,\'On\')" onMouseOut="efect(this.id,\'Off\')" onMouseDown="efect(this.id,\'Down\')" onMouseUp="efect(this.id,\'On\')"><a class="hypbtn" href="javascript:' + arrCmd[i][1] + '" onMouseOver="window.status=\'' + arrCmd[i][0] + '\';return true"><img src="'+Rutav+'/vista/img/'+nameImg+'" border="0">' + strCaption + '</a></td>\n';
			}
      str += '  </tr>';
		  str += '</table>';
		  str += '</td>\n</tr>\n</table>';	  
		}else{
		  str += '&nbsp;';
		}
    document.write(str);

  }catch(theException){
		alert('Error [drawCommandBottonII] ' + theException);    
  }
}
<!-- ***************************************************************************** -->
<!-- ******        Funcion para limpiar los campos de un formularios       ******* -->
<!-- ***************************************************************************** -->
function clearFields(args,op){
  var i = 0, j = 0, varAccess = '', sw = false;
  var arrAgrs = args.split(',');
  var form = document.forms[arrAgrs[0]];
  
  if (op){
    if (form.state)
      form.state.value = 'New';
    form.submit();
		return;
  }
  
  if (form.varAccess)
    varAccess = form.varAccess.value;
  if (varAccess != ''){
    if (form.btnSearch){
		  if(varAccess.charAt(0) == '1')
		    form.btnSearch.disabled = 0;
	  	else	
        form.btnSearch.disabled = 1;
		}

    if (form.btnSave){
	  	if(varAccess.charAt(1) == '1')
	    	form.btnSave.disabled = 0;
		  else	
        form.btnSave.disabled = 1;

      if(varAccess.charAt(2) == '1')
		    if (form.btnSearch)
		      form.btnSearch.disabled = 0;
		}

    if (form.btnDelete)
		  form.btnDelete.disabled = 1;
	}

  for (i = 0; i < form.elements.length; i++) {
		if (form.elements[i].type == 'text'
      ||form.elements[i].type == 'password'
		  ||form.elements[i].type == 'textarea'
	  	||form.elements[i].type == 'file'
		  ||form.elements[i].type == 'hidden') {
      sw = false;
      for (j = 1; j < arrAgrs.length; j++){
        if (form.elements[i].name == arrAgrs[j]){
				  sw = true;	
				  break;
				}
			}
		  if (!sw)
		    form.elements[i].value = ''; 
		}
	}// end for
  if (form.state)
    form.state.value = 'Insert';
}
<!-- ***************************************************************************** -->
<!-- ******           Funcion actualizar la seleccion de un checkbox       ******* -->
<!-- ***************************************************************************** -->
function updateCheckBox(name,op){
  document.getElementById(name).checked  = op;	
}
<!-- ***************************************************************************** -->
<!-- ******           Funcion actualizar el valor de un checkbox           ******* -->
<!-- ***************************************************************************** -->
function updateValueCheckBox(obj){
  if (obj.checked)
    obj.value = '1';
  else	
    obj.value = '0';  
}
<!-- ============================================================================== -->
<!-- ============		            Validar Fecha		     	     ============== -->
<!-- ============================================================================== -->
function esDigito(sChr){
	var sCod = sChr.charCodeAt(0);
	return ((sCod > 47) && (sCod < 58));
}

function valSep(strValor){
 	var bOk = false;
	bOk = bOk || ((strValor.charAt(2) == "-") && (strValor.charAt(5) == "-"));
	bOk = bOk || ((strValor.charAt(2) == "/") && (strValor.charAt(5) == "/"));
	return bOk;
}

function finMes(strValor){
	var nMes = parseInt(strValor.substr(3, 2), 10);
	var nAno = parseInt(strValor.substr(6));
	var nRes = 0;
	switch (nMes){
		case 1: nRes = 31; break;
		case 2: { if ((nAno%4)==0) nRes = 29; else nRes= 28; break;}
		case 3: nRes = 31; break;
		case 4: nRes = 30; break;
		case 5: nRes = 31; break;
		case 6: nRes = 30; break;
		case 7: nRes = 31; break;
		case 8: nRes = 31; break;
		case 9: nRes = 30; break;
		case 10: nRes = 31; break;
		case 11: nRes = 30; break;
		case 12: nRes = 31; break;
	}	
	return nRes;
}

function valDia(strValor){
	var bOk = false;
	var nDia = parseInt(strValor.substr(0, 2), 10);
	bOk = bOk || ((nDia >= 1) && (nDia <= finMes(strValor)));
	return bOk;
}

function valMes(strValor){
	var bOk = false;
	var nMes = parseInt(strValor.substr(3, 2), 10);
	bOk = bOk || ((nMes >= 1) && (nMes <= 12));
	return bOk;
}

function valAno(strValor){
	var bOk = true;
	var nAno = strValor.substr(6);
	// (nAno.length == 2) || 
	bOk = bOk && ((nAno.length == 4));
	if (bOk){
		for (var i = 0; i < nAno.length; i++){
			bOk = bOk && esDigito(nAno.charAt(i));
		}
	}
	return bOk;
}

function valFecha(strValor){
	var bOk = true;
	var sw = true
	if (Trim(strValor) != ''){
		bOk = bOk && (valAno(strValor));
		bOk = bOk && (valMes(strValor));
		bOk = bOk && (valDia(strValor));
		bOk = bOk && (valSep(strValor));
		if (!bOk){
			sw = false;
		}
	}else{
		sw = false;
	}  
  if (!sw){
    alert('Fecha invalida, verifique!\nFormato [dd/mm/aaaa]');
  }
  return sw;
}
<!-- ============================================================================== -->
<!-- ============		            Validar Hora		     	     ============== -->
<!-- ============================================================================== -->
function valHour(strValor){
  var bOk = true;
  var valor = Trim(strValor);
  var nHour = '', nMin = '';

  if (valor.length != 5)
    bOk = false;
  else{
    nHour = valor.substring(0,2);
	 	nMin = valor.substring(3);
		if (nHour.substring(0,1) == '0') nHour = nHour.substring(1,2);
		if (nMin.substring(3,4) == '0') nMin = nMin.substring(4);
    if (parseInt(nHour) > 23 || parseInt(nMin) > 59) bOk = false;
  }
  if (!bOk){
    alert('Hora invalida, verifique!');
  }
  return bOk;
}
<!-- ============================================================================== -->
<!-- ============		            Validar E.mail		     	     ============== -->
<!-- ============================================================================== -->
function valEmail(strValor){
  var bOk = true;
  var valor = Trim(strValor);

  if (valor.indexOf('@',0) == -1 || valor.indexOf('.',0) == -1){
    alert('Direcci?n de e-mail inv?lida');
    bOk = false;
  }
  return bOk; 
}
<!-- ============================================================================== -->
<!-- ============		       Valida cualquier tipo de formato	     ============== -->
<!-- ============================================================================== -->
function validFormat(field,event,format,exeCommad){
  var key,keychar,cYear;
  var strValid = '';
  var valor = Trim(field.value);

  if (window.event)
		key = window.event.keyCode;
  else if (event)
		key = event.which;
  else
		return true;
  
  keychar = String.fromCharCode(key);
  
  if (format){
    if (format == 'Date') strValid = '0123456789/';
    if (format == 'Int') strValid = '0123456789';
    if (format == 'Decimal') strValid = '-0123456789.';
    if (format == 'Hour') strValid = '0123456789:';
    if (format == 'All' || format == 'Mayus') strValid = '';
  }
	 
  // Comprobar caracteres especiales como espacio atras
  // Luego comprobar numeros
  if ((key==null)|| (key==0)||(key==8)||(key==9)||(key==27)){
    return true;
  }else if (key == 13){
    if (exeCommad){
		  if (format){
		    if (format == 'Date'){ // Formato de fecha
          if (valor.length >= 8){
	        	cYear = valor.substring(6);
            if(cYear.length == 2){
              if(parseInt(cYear.substring(0,1)) >= 6)
		            cYear = '19' + cYear;
  	          else
		            cYear = '20' + cYear;	   
	          	field.value = valor.substring(0,6) + cYear
						}
					}
          if(!valFecha(field.value)){
						return true;
					}
				}
			}
	  	eval(exeCommad);
		}else{
		  return true;
		}
	}else if (strValid == ''){
    if ((format)&&(format == 'Mayus')){
		  if((key>=97)&&(key<=122)){
		    key = key - 32;
		    window.event.keyCode = key;
      }
		}
    return true;
	}else if (((strValid).indexOf(keychar)>-1)){
    if ((format)&&(format == 'Date')){
      if (keychar == '/'){
        if (valor.length == 1) valor = '0' + valor;
        if (valor.length == 2 || valor.length == 3) window.event.keyCode = null;
        if (valor.length == 4) valor = valor.substring(0,3) + '0' + valor.substring(3);
        if (valor.length == 5) window.event.keyCode = null;
		    if (valor.lastIndexOf('/') >= 5) return false; 
			}

      if (valor.length == 2 || valor.length == 5) valor = valor + '/';
      if (valor.length >= 10) return false;

      field.value = valor;
		}

    if ((format)&&(format == 'Hour')){
      if (keychar == ':'){
        if (valor.length == 0) return false;
        if (valor.length == 1) valor = '0' + valor;
		    if (valor.lastIndexOf(':') >= 2) return false; 
			}else{
        if (valor.length == 2) valor = valor + ':';
			}
		  if (valor.length >= 5) return false;
  	    field.value = valor;
		}

    if ((format)&&(format == 'Decimal')){	
      if (keychar == '.'){
		    if (valor.indexOf('.')!=-1) return false;  
			}
		}
    return true;		  	
	}else 		 	
    return false;	 
}
<!-- ============================================================================== -->
<!-- ============		       Coloca el focus() de un Objeto	     ============== -->
<!-- ============================================================================== -->
function nextFocus(name,valor){
  document.getElementById(name).disabled = false;
  if (valor)
    document.getElementById(name).value = valor;
  document.getElementById(name).focus();
}
<!-- ============================================================================== -->
<!-- ============		       Muetra la ventana de Busqueda	     ============== -->
<!-- ============================================================================== -->
function showWindowFind(fields,table,where,titles,trg,titwin){
  var x = (screen.Width - 200) / 2;
  var props = 'scrollbars=no,resizable=no,toolbar=no,menubar=no,status=yes,location=no,directories=no,width=200,height=100,top=200,left='+x;
  var url = Rutac + '/Build/Search';
  var param = '', output = '', field = '', macro = '', newWhere = '', i = 0;

  if (newWindowFind != null){
    newWindowFind.close();
    newWindowFind = null;
  }

	if (Trim(where) != ''){
    while(where.indexOf('&') != -1){
		  field = where.substring(where.indexOf('&') + 1);
		  field = field.substring(0,field.indexOf('&'));
      where = where.replace('&'+field+'&',getValue(field));
		}
	}

  trgCurrent = trg;
  if (fields != '') param = '?fields=' + fields;
  if (table != '') param += '&table=' + table;
  if (where != '') param += '&where=' + where;
  if (titles != '') param += '&titles=' + titles;
  if (titwin != '') param += '&titwin=' + titwin;
  url += param;

  output += '<html>';
  output += '<head>';
  output += '<title>Generando Datos...</title>';
  output += '<link rel="stylesheet" href="'+Rutav+'/vista/css/estilos.css">';
  output += '<script language="JavaScript" type="text/JavaScript" src="'+Rutav+'/vista/script/Funciones.js">';
  output += '</script>';
  output += '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">';
  output += '</head>';
  output += '<body rightmargin="0" leftMargin="0" topMargin="0" marginheight="0" marginwidth="0" onLoad="reDirect(\''+url+'\')">';
  output += '<table width="220" align="center" cellpadding="0" cellspacing="0">';
  output += '  <tr valign="middle" height="100">';
  output += '    <td class="caption" align="center">Cargando, espere for favor...</td>';
  output += '  </tr>';
  output += '</table>';
  output += '</body>';
  output += '</html>';

  newWindowFind = window.open('','newWindowFind', props);
  newWindowFind.document.open();
  newWindowFind.document.write(output);
  newWindowFind.document.close();
  newWindowFind.focus();
}
<!-- ============================================================================== -->
<!-- Actualiza variables globales con datos selecionados en la ventana de busqueda  -->
<!-- ============================================================================== -->
function updateDataControl(values){
  if (values){
    var i = 0;
    var arrValues = values.split('#');
    var arrTrg = trgCurrent.split('#');
	
    for (i = 0; i < arrTrg.length; i++){
      if (document.getElementById(arrTrg[i])){
        if (arrValues.length > 1)
           document.getElementById(arrTrg[i]).value = arrValues[i];
        else
		   document.getElementById(arrTrg[i]).value = arrValues[0];

        if (i == 0){
		  if (document.getElementById(arrTrg[i]).type != 'hidden')
            document.getElementById(arrTrg[i]).focus();
        }
	  }
	}
  }

  if (newWindowFind != null){
    newWindowFind.close();
    newWindowFind = null;
    window.focus();
  }
}
<!-- ============================================================================== -->
<!-- ==========	  Muetra la ventana de espera (Con cualquier destino)	 ============ -->
<!-- ============================================================================== -->
function showWindowWait(w,h,r,texto,url,prm,s){
  var output = '', pscroll = 'no';
  var x = (screen.Width - w) / 2;
	var y = (screen.Height - h) / 2;
  if (s) pscroll = 'yes';
  var props = 'scrollbars='+pscroll+',resizable='+r+',toolbar=no,menubar=no,status=yes,location=no,directories=no,width='+w+',height='+h+',top='+y+',left='+x;

  if (url.substring(0,1) == 'C')
    url = Rutac + url.substring(1);
  else if (url.substring(0,1) == 'V')
		url = Rutav + url.substring(1);

  if (prm != '') url += prm;

  output += '<html>';
  output += '<head>';
  output += '<title>'+texto+'</title>';
  output += '<link rel="stylesheet" href="'+Rutav+'/vista/css/estilos.css">';
  output += '<script language="JavaScript" type="text/JavaScript" src="'+Rutav+'/vista/script/Funciones.js"></script>';
  output += '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">';
  output += '</head>';
  output += '<body rightmargin="0" leftMargin="0" topMargin="0" marginheight="0" marginwidth="0" onBlur="window.focus()" onLoad="reDirect(\''+url+'\')">';
  output += '<table width="100%" height="100%" align="center" cellpadding="0" cellspacing="0" class="tablas">';
  output += '  <tr valign="middle">';
  output += '    <td class="caption" align="center">'+texto+'</td>';
  output += '  </tr>';
  output += '</table>';
  output += '</body>';
  output += '</html>';

  newWindowReport = window.open('','newWindowWait', props);
  newWindowReport.document.open();
  newWindowReport.document.write(output);
  newWindowReport.document.close();
  newWindowReport.focus();
}
<!-- ============================================================================== -->
<!--               Actualiza los parametros que se envian por una url               -->
<!-- ============================================================================== -->
function getParametersValues(prm){
  var i = 0, count = 0;
  var prmValues = '', value = '';
  var arrNamePrm = prm.split('#');

  for (i = 0; i < arrNamePrm.length; i++){
		value = getValue(arrNamePrm[i]);
    if (value != ''){
      if (count == 0)
        prmValues += '?' + arrNamePrm[i] + '=' + value;
		  else
        prmValues += '&' + arrNamePrm[i] + '=' + value;
			count ++;
		}
	}
  return prmValues;
}
<!-- ============================================================================== -->
<!--               Obtener valores de elementos del documento                       -->
<!-- ============================================================================== -->
function getValue(name){
  var value = '';
  if (document.getElementById(name))
    value = Trim(document.getElementById(name).value);
  return value;
}
<!-- ***************************************************************************** -->
<!-- *********** Dibuja el layer para los Tool Tips en cualquier pagina ********** -->
<!-- ***************************************************************************** -->
function makeLayerToolTips(){
  var str = '';	
  try{
    Init();
    str += '<div id="layToolTips" class="layercss">';
	  str += '</div>';
    document.write(str);
  }catch(theException){
	  alert('Error [makeLayerToolTips] ' + theException);    
  }
}
<!-- ***************************************************************************** -->
<!-- **********     Dibuja el layer de la hora en cualquier pagina      ********** -->
<!-- ***************************************************************************** -->
function makeLayerHour(hormil){
  var str = '', valor = '';	
	var bgnidx = 0, endidx = 12;
  try{
    Init();
    str+='<div id="capaHora" style="position:absolute; left:0px; top:0px; width:220px; z-index:100; background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 1px none #000000; height: 59px; visibility: hidden;">';
		str+='<table width="220" border="0" align="center" cellpadding="1" cellspacing="1" class="tablas">';
		str+='  <tr class="rowtitle">';
		str+='    <td class="title"><div align="center">Escoger Hora</div></td>';
		str+='  </tr>';
		str+='  <tr>';
		str+='    <td>';
		str+='	  <div align="center">';

    if (hormil){
			bgnidx = -1;
			endidx = 23;
		}
    str+='        <select name="cmbHora" id="cmbHora" class="combo">';
    for (i = bgnidx; i < endidx; i++){
		  valor = '' + (i + 1);
		  if (valor.length == 1) valor = '0' + valor;
    	str+='          <option value="'+valor+'">'+valor+'</option>';             
		}
		str+='        </select> : ';

    str+='        <select name="cmbMin" id="cmbMin" class="combo">';
    for (i = 0; i < 60; i++){
      if ((i % 5) == 0){
        valor = '' + i;
	 	    if (valor.length == 1) valor = '0' + valor;
        str+='          <option value="'+valor+'">'+valor+'</option>';             
			}
		}
		str+='        </select>';

    if (!hormil){
      str+='        <select name="cmbMer" id="cmbMer" class="combo">';
		  str+='          <option value="AM">AM</option>';
		  str+='          <option value="PM">PM</option>';
 		  str+='        </select>';
		}

    str+='      </div>';
		str+='	</td>';
		str+='  </tr>';
		str+='  <tr> ';
		str+='    <td>';
		str+='	    <div align="center">';
		str+='        <input name="BotAceptar" type="button" id="BotAceptar" value="Aceptar" onClick="updateHour(1,\'\')" class="boton">';
		str+='        <input name="BotCancelar" type="button" id="BotCancelar" value="Cancelar" onClick="showHideLayers(\'capaHora\',\'hidden\')" class="boton">';
		str+='      </div>';
		str+='	  </td>';
		str+='  </tr>';
		str+='</table>';
		str+='</div>';
    document.write(str);

  }catch(theException){
		alert('Error [makeLayerHour] ' + theException);    
  }
}
<!-- ***************************************************************************** -->
<!-- **********  Dibuja el layer de escoger color en cualquier pagina    ********* -->
<!-- ***************************************************************************** -->
function makeLayerColor(){
  var str = '';	
	d = new Array();
	d[1] = "00";
	d[2] = "33";
	d[3] = "66";
	d[4] = "99";
	d[5] = "CC";
	d[6] = "FF";				

  try{
    Init();
    str+='<div id="capaColor" style="position:absolute; left:0px; top:0px; width:220px; z-index:100; background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 1px none #000000; height: 59px; visibility: hidden;">';
		str+='<table width="220" border="0" align="center" cellpadding="1" cellspacing="1" class="tablas" onMouseOver="highligthColor(true)" onMouseOut="highligthColor(false)" onClick="updateColor(1,\'\')">';
		str+='  <tr class="rowtitle">';
		str+='    <td class="title" align="center" colspan="18">Colores</td>';
		str+='  </tr>';
		str+='  <tr><td colspan="12" class="caption">&nbsp;</td><td id="showColor" colspan="6" rowspan="3">&nbsp;</td></tr>';
		str+='  <tr class="drag">';
		str+='    <td bgcolor="#000000" title="#000000" width="12" height="12">&nbsp;</td>';
		str+='    <td bgcolor="#333333" title="#333333" width="12" height="12">&nbsp;</td>';
		str+='    <td bgcolor="#666666" title="#666666" width="12" height="12">&nbsp;</td>';
		str+='    <td bgcolor="#999999" title="#999999" width="12" height="12">&nbsp;</td>';
    str+='    <td bgcolor="#CCCCCC" title="#CCCCCC" width="12" height="12">&nbsp;</td>';
		str+='    <td bgcolor="#FFFFFF" title="#FFFFFF" width="12" height="12">&nbsp;</td>';
		str+='    <td bgcolor="#FF0000" title="#FF0000" width="12" height="12">&nbsp;</td>';
		str+='    <td bgcolor="#00FF00" title="#00FF00" width="12" height="12">&nbsp;</td>';
		str+='    <td bgcolor="#0000FF" title="#0000FF" width="12" height="12">&nbsp;</td>';
		str+='    <td bgcolor="#FFFF00" title="#FFFF00" width="12" height="12">&nbsp;</td>';
		str+='    <td bgcolor="#00FFFF" title="#00FFFF" width="12" height="12">&nbsp;</td>';
		str+='    <td bgcolor="#FF00FF" title="#FF00FF" width="12" height="12">&nbsp;</td>';
		str+='  </tr>';
    str+='  <tr><td colspan="12">&nbsp;</td></tr>';
    str+='  <tr class="drag">';
		for (c = 1; c <= 6; c++){
		  for (a = 1; a <= 3; a++){					
				for (b = 1; b <= 6; b++){							
				  colour = d[a] + d[b] + d[c];
    			str+='    <td bgcolor="#'+colour+'" title="#'+colour+'" width="12" height="12">&nbsp;</td>';
			    if (a == 3 && b == 6) str+='</tr>\n<tr class="drag">';
			
				}
			}
		}
		for (c = 1; c <= 6; c++){
			for (a = 4; a <= 6; a++){					
				for (b = 1; b <= 6; b++){							
				  colour = d[a] + d[b] + d[c];
				  str+='    <td bgcolor="#'+colour+'" title="#'+colour+'" width="12" height="12">&nbsp;</td>';
			    if (a == 6 && b == 6) str+='</tr>\n<tr class="drag">';
				}
			}
		}
		str+='  </tr>';
		str+='  <tr> ';
		str+='    <td align="center" colspan="18">';
		str+='      <input name="BotCerrar" type="button" id="BotCerrar" value="Cerrar" onClick="showHideLayers(\'capaColor\',\'hidden\')" class="boton">';
		str+='	  </td>';
		str+='  </tr>';
		str+='</table>';
		str+='</div>';
    document.write(str);
		
  }catch(theException){
		alert('Error [makeLayerColor] ' + theException);    
  }
}
function highligthColor(on) {
  var el = window.event.srcElement;
  var disp = document.getElementById('showColor');
  if (el && el.nodeName == 'TD')
	  if (on) disp.bgColor = el.title;
}
<!-- ***************************************************************************** -->
<!-- ************************ Se obtienen posiciones del mouse ******************* -->
<!-- ***************************************************************************** -->
function mouseMove(e){
  xMouse = (document.layers)? e.pageX : event.x+document.body.scrollLeft
  yMouse = (document.layers)? e.pageY : event.y+document.body.scrollTop
  return true
}
<!-- ***************************************************************************** -->
<!-- ******* Inicializa en evento onmousemove con la funcion [mouseMove] ********* -->
<!-- ***************************************************************************** -->
function Init(){
  if (!swOnMouseMove){
    document.onmousemove = mouseMove;
    if (document.layers){
      document.captureEvents(Event.MOUSEMOVE);
    }
		swOnMouseMove = true;
  }
}
<!-- ***************************************************************************** -->
<!-- *****************       Actualiza un campo de tipo Hora      ***************** -->
<!-- ***************************************************************************** -->
function updateHour(op,nameField){
  var Hour = '';

  if (op == 0){
    currendField = nameField;
		showHideLayers('capaHora',1);  
  }else if (op ==	1){
   	Hour = getValue('cmbHora') + ':' + getValue('cmbMin');
    if (document.getElementById('cmbMer')) Hour += ' ' + getValue('cmbMer');
    document.getElementById(currendField).value = Hour;
    showHideLayers('capaHora',0);
  }  
}
<!-- ***************************************************************************** -->
<!-- *****************      Actualiza un campo de tipo Color     ***************** -->
<!-- ***************************************************************************** -->
function updateColor(op,nameField){
  var colorHex = '';
  if (op == 0){
    currendField = nameField;
		showHideLayers('capaColor',1);  
  }else if (op ==	1){
	  var el = window.event.srcElement;
	  if (el && el.nodeName == 'TD') {
			colorHex = el.title.substring(1);
			colorHex = colorHex.substring(4,6) + colorHex.substring(2,4) + colorHex.substring(0,2);
			document.getElementById(currendField).value = parseInt(colorHex,16);
			document.getElementById(currendField).style.backgroundColor = el.title;
			document.getElementById(currendField).style.color = el.title;
	  }
    showHideLayers('capaColor',0);
  }  
}
<!-- ***************************************************************************** -->
<!-- *****************   Muestra u Oculta un layer segun su id   ***************** -->
<!-- ***************************************************************************** -->
function showHideLayers(name,op,message){
  var opVisible = 'hidden';
  var output = '';  
  var urlImg = '';
  var xWidth = 0;

  if (op == 1){
    xMouse += 10;
    xWidth = xMouse + parseInt(document.getElementById(name).style.width);
    if (getWidthWin() < xWidth){
      xMouse = getWidthWin() - (xWidth - getWidthWin()) - parseInt(document.getElementById(name).style.width);
    }
    document.getElementById(name).style.top = yMouse;
    document.getElementById(name).style.left = xMouse;
	
		if (message){
		  urlImg = Rutav + '/vista/img/security.gif';
		  output += '<table width="100%" border="0" align="center" cellpadding="1" cellspacing="1">';
		  output += '  <tr style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;">';
	  	output += '    <td valign="top"><div align="left"><img src="'+urlImg+'"></div></td>';
		  output += '    <td><div align="justify">'+message+'</div></td>';
      output += '  </tr>';
		  output += '</table>';
      document.getElementById(name).innerHTML = output;
		}
		opVisible = 'visible';
	}
  document.getElementById(name).style.visibility = opVisible;
}
<!-- ***************************************************************************** -->
<!-- *****************       Marcar ? Desamarcar CheckBox        ***************** -->
<!-- ***************************************************************************** -->
function SelectCheck(sw,name){
  var i = 0;

  element = document.getElementsByTagName('INPUT');
  for(i = 0; i < element.length; i++){
    if (element[i].type == 'checkbox'){
      if (name){
		    if (element[i].name == name) element[i].checked = sw; 
			}else{
		    element[i].checked = sw;
			}
		}
  }	
}
<!-- ***************************************************************************** -->
<!-- *******       Muestra una nueva ventana con cualquier destino        ******** -->
<!-- ***************************************************************************** -->
function showWindow(name,t,l,w,h,r,url){
  if (t == -1) t = (screen.height - h) / 2;
  if (l == -1) l = (screen.width - w) / 2;
	
  if (url.substring(0,1) == 'C')
    url = Rutac + url.substring(1);
  else if (url.substring(0,1) == 'V')
		url = Rutav + url.substring(1);

  if (newWindow != null){
    newWindow.close();
    newWindow = null;
  }

  if (name == 'winPhoto'){
		if (url.substring(url.length - 1, url.length) == '='){
    	url = Rutav +	'/vista/formUploadFile.jsp' + getParametersValues('codpho#codprs#codbas#codprf#codtrc#codntd');
		}
	}

  var props = 'scrollbars=yes,resizable='+r+',toolbar=no,menubar=no,status=yes,location=no,directories=no,width='+w+',height='+h+',top='+t+',left='+l;
  newWindow = window.open(url,name, props);
  newWindow.focus();
}
<!-- ***************************************************************************** -->
<!-- ********* Funcion que valida si la fecha final es mayor que la inicial ****** -->
<!-- ***************************************************************************** -->
function validDateTime(dateBgn,dateEnd,condition,op){
  var nRes = 0,ndateBgn = 0,ndateEnd = 0;

  ndateBgn = stringToDateTime(dateBgn,op);
  ndateEnd = stringToDateTime(dateEnd,op);

  if (eval(ndateBgn+condition+ndateEnd)){
	  return true;
  }else{
    return false;	
  }	
}
<!-- ***************************************************************************** -->
<!-- **************    Funcion que convierte dato String -  Date        ********** -->
<!-- ***************************************************************************** -->
function stringToDateTime(mydate,op){
  var Fecha = new Date();
  var cHour = '', cMin = '', cMer = '', cRes = '';  
  var cDay = '', cMonth = '', cYear = '', cFecha = '';  
  var nRes = 0,nHour = 0;
  var arrFch = new Array();

  cFecha = mydate;
  if (op == 0){
    arrFch = cFecha.split('/');
    cDay   = arrFch[0];
    cMonth = arrFch[1];
    cYear  = arrFch[2];

    if(cMonth.substring(0,1) == '0') cMonth = cMonth.substring(1,cMonth.length);
    if(cDay.substring(0,1)   == '0') cDay   = cDay.substring(1,cDay.length);
    if(cYear.length == 2){
      if(cYear.substring(0,1) != '9')
	      cYear = '20' + cYear;
  	  else
	      cYear = '19' + cYear;	   
    }
    Fecha.setYear(parseInt(cYear));
    Fecha.setMonth((parseInt(cMonth)-1));
    Fecha.setDate(parseInt(cDay));
  }else{
    arrFch = cFecha.split(':');
    cHour  = arrFch[0];
    cMin   = arrFch[1];

    arrFch = cFecha.split(' ');
    if (arrFch.length == 2) cMer = arrFch[1];

    if(cHour.substring(0,1) == '0') cHour = cHour.substring(1,cHour.length);
    if(cMin.substring(0,1)  == '0') cMin = cMin.substring(1,cMin.length);

    if(cHour == '12' && cMer != '') cHour = '00';

    if (cMer == 'PM') 
	    nHour = parseInt(cHour) + 12;
	  else
	    nHour = parseInt(cHour);

    Fecha.setHours(nHour);
    Fecha.setMinutes(parseInt(cMin));
    Fecha.setSeconds(0);
  } 

  nRes = Fecha.getTime()/1000;
  cRes = '' + nRes;
  
  return (parseInt(cRes))
}
