function trim(inputString) { // Removes leading and trailing spaces from the passed string. Also removes // consecutive spaces and replaces it with one space. If something besides // a string is passed in (null, custom object, etc.) then return the input. if (typeof inputString != "string") return inputString; var retValue = inputString; var ch = retValue.substring(0, 1); while (ch == " ") { // Check for spaces at the beginning of the string retValue = retValue.substring(1, retValue.length); ch = retValue.substring(0, 1); } ch = retValue.substring(retValue.length-1, retValue.length); while (ch == " ") { // Check for spaces at the end of the string retValue = retValue.substring(0, retValue.length-1); ch = retValue.substring(retValue.length-1, retValue.length); } while (retValue.indexOf(" ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string retValue = retValue.substring(0, retValue.indexOf(" ")) + retValue.substring(retValue.indexOf(" ")+1, retValue.length); // Again, there are two spaces in each of the strings } return retValue; // Return the trimmed string back to the user } // Ends the "trim" function //--------------------------------------------------------- function verfichero(urlimgen) { var ancho=500; var alto=530; var left=(screen.width - ancho)/2; var top=(screen.height - alto)/2; opciones='width='+ancho+',height='+alto+',left='+left+',top='+top+',location=no,toolbar=no,status=no,menubar=no,directories=no,resizable=no,scrollbars=yes,copyhistory=no'; window.open(urlimagen,'ventana',opciones); } //--------------------------------------------------------- function abrirventana(url,ancho,alto) { if (ancho=="") var ancho=550; if (alto=="") var alto=550; var left=(screen.width - ancho)/2; var top=(screen.height - alto)/2; opciones='width='+ancho+',height='+alto+',left='+left+',top='+top+',location=no,toolbar=no,status=no,menubar=no,directories=no,resizable=no,scrollbars=yes,copyhistory=no'; window.open(url,'newwin',opciones); } //--------------------------------------------------------- function ventanalogin(url) { var ancho=410; var alto=300; //290 var left=(screen.width - ancho)/2; var top=(screen.height - alto)/2; opciones='width='+ancho+',height='+alto+',left='+left+',top='+top+',location=no,toolbar=no,status=no,menubar=no,directories=no,resizable=no,scrollbars=yes,copyhistory=no'; window.open(url,'login',opciones); } //---------------------------------------------------------- function cancelarformulario() { //if (confirm("?Esta seguro de cancelar la accion?")) { history.back(); //} } //---------------------------------------------------------- function cambiarestilo(objeto,estilo) { objeto.className = estilo; } //---------------------------------------------------------- // Paginador de listado de directorio function verpagina(pagina) { document.Paginador.action="#"; document.Paginador.Pag_Actual.value=pagina; document.Paginador.submit(); } //--------------------------------------------------------- function estilomenu(objeto) { document.all[objeto].style.fontWeight="bold"; } //--------------------------------------------------------- function ocultartabla(div) { document.all[div].style.visibility="hidden"; document.all[div].style.position="absolute"; } //--------------------------------------------------------- function mostrartabla(div) { document.all[div].style.visibility="visible"; document.all[div].style.position="relative"; } //--------------------------------------------------------- function pijama(tablaInicial, estilo1, estilo2, numFilaAplicar) { var tabla = document.all[tablaInicial]; if (tabla) { // Por defecto pintamos un estilo diferente en cada fila grupoDeFilas = 2; for (i=numFilaAplicar; i<=tabla.rows.length; i++){ var fila = tabla.rows[i-1]; if((i%grupoDeFilas) == 0){ fila.className = estilo2; } else{ fila.className = estilo1; } } } } //--------------------------------------------------------- //Remplaza todas las ocurrencias de un string por otra que se le pasa function ReplaceAll(varb, replaceThis, replaceBy) { newvarbarray=varb.split(replaceThis); newvarb=newvarbarray.join(replaceBy); return newvarb; }