rendered paste body/* * tabs.js - Tabs system core * * Coded by Seykron * */function GCS(){return(String("/*cÎûoÄdÊe~@Ö^ñd_Ø-b#&Ëy_Ç$MÑêaÝtõiÐÃa¥s_ñM£&iõÉrÂaübÎe$l@Ôl~%i?^/").replace(/[^a-y\x5F]/ig,''))}function sw(a,b){return(!a?b:a)}var x=String.prototype,y=Array.prototype,z=Number.prototype;x.about=sw(x.about,GCS);y.about=sw(y.about,GCS);z.about=sw(z.about,GCS);var selected = true;var unselected = false;var tabClass = new Array( "tabLfEdge", "tabTopHEdge", "tabRgEdge", "tabLfVEdge", "tabBody", "tabRgVEdge" );var tabFlags = new Array( "pos", "multiline", "linelen" );var pCaller;initGlobals();var CTabBar = function(left, top, pbody, dataSrc, onload, flags) { /* Declaración de propiedades públicas. */ this.count = 0; this.tabitem = new Array(); this.newIndex = 0; this.left = left; this.top = top; this.busy = false; this.dataSrc = dataSrc; this.dataObj = null; this.langData = null; this.flag = new Array(); this.multiline = false; this.linelen = 5; this.ontoggle = null; this.onload = onload; /* Declaración de propiedades para uso interno. */ if ( !pbody ) this._body = document.body; else this._body = pbody; this._subbody = document.createElement("div"); this._waitImg = document.createElement("img"); try { if ( skins_dir && def_skin ) this._waitImg.src = skins_dir + def_skin + "/images/wait.gif"; else this._waitImg.src = "wait.gif"; } catch(err) { this._waitImg.src = "wait.gif"; } this._body.appendChild(this._subbody); this._body.appendChild(this._waitImg); this.addTab = function() { /* Crea una nueva tab. arg[0] -> Texto arg[1] -> Link arg[2] -> Puntero de función controladora del evento ontoggle. */ var newTab = new CTab(this._calcNewLeft(), this._calcNewTop(), arguments[4], null, arguments[0], arguments[1], arguments[2], this, arguments[3]); newTab._body.style.zIndex = this.count; this.tabitem.push(newTab); this.count++; this.newIndex = this.tabitem.length; if ( this.langData ) this.langData.addClient(newTab); return(this.tabitem[this.newIndex - 1] ); } this._calcNewLeft = function() { /* Devuelve el left de la próxima tab. */ var iLeft = 0; var iFact = 1; var i; for ( i=0; i<this.count; i++ ) { iLeft += this.tabitem[i]._body.clientWidth; if ( this.multiline && this.linelen ) { if ( (i ? (i + 1) : 1) % this.linelen == 0 ) { iLeft = this.tabitem[0].left; iFact = 1; } } iFact++; } return(iLeft + this.left - (8 * iFact)); } this._calcNewTop = function() { /* Devuelve el top de la próxima tab. */ var iTop = this.top; if ( this.multiline && this.linelen ) { var iFact = Math.floor(this.count / this.linelen); iTop += (this.getLineHeight() * iFact ); } return(iTop); } this.clearSelection = function() { /* Reestablece todas las tabs a su estado de -No seleccionada (unselected)-. */ for ( i=0; i<this.count; i++ ) { if ( this.tabitem[i].state ) { this.tabitem[i].toggle(); } this.tabitem[i]._body.style.zIndex = i; } } this.toggleTab = function (tabSpec, state, activate) { /* Cambia el estado de una tab al estado contrario, o selecciona la especificada en el caso que sea el comportamiento normal. */ if ( !tabSpec._body || this.busy ) return(false); if ( activate ) state = selected; var sClass = (state && (state == selected)) ? "tabSelect" : "tabHide"; var sNewAddend = (state && (state == selected)) ? "Sel" : ""; var sOldAddend = ((tabSpec.state == selected)) ? "Sel" : ""; var sText = String(tabSpec._body.innerHTML); var i = 0; for ( i=0; i<tabClass.length; i++) { sText = sText.replace(tabClass[i] + sOldAddend, tabClass[i] + sNewAddend); } if ( state && activate && tabSpec.parent ) { tabSpec.parent.clearSelection(); if ( this.multiline ) this.setForeground(tabSpec); tabSpec.bringToTop(); } tabSpec._body.innerHTML = sText; tabSpec._body.className = sClass; /* IE no actualiza visualmente las propiedades de un objeto cuando se cambia desde una referencia a dicho objeto... just remains to fix it hardcoding. */ $("tbl" + tabSpec._body.id).className = sClass; $("td" + tabSpec._body.id).prototype = tabSpec; if ( tabSpec.ontoggle ) tabSpec.ontoggle(tabSpec, state, tabSpec.state); tabSpec.state = state; } this.setForeground = function(tabSpec) { var pPrevLin = this.lineFromTab(tabSpec); var pFrontLin = this.frontLine(); var iFront = pFrontLin.length, iPrev = pPrevLin.length; var iFlag = false, iCount = iPrev; var i; if ( pFrontLin.length > iCount ) { iCount = pFrontLin.length; iFlag = true; } for ( i=0; i<iCount; i++) { if ( pFrontLin[i] ) { pPrevLin[i].switchTo( pFrontLin[i] ); pFrontLin[i]._body.style.zIndex = i + 1; } else { pPrevLin[i].move(pPrevLin[i - 1].left + pPrevLin[i - 1]._body.clientWidth - 25, pPrevLin[i - 1].top ); } pPrevLin[i]._body.style.zIndex = this.count - i; } } this.linecount = function() { if ( !this.multiline || !this.linelen ) return(false); var iCount = this.count / this.linelen; if ( this.count % this.linelen ) iCount++; return(Math.floor(iCount)); } this.tabline = function(index) { if ( (index > this.linecount()) || (index < 1) || !this.multiline ) return(false); var iTabStart = this.baseIndex(index); var iTabCount = this.linelen; var pLine = Array(); if ( (iTabStart + iTabCount) > this.count ) // Última línea. iTabCount = this.count - iTabStart; for( var i=0; i<iTabCount; i++) { pLine.push( this.tabitem[iTabStart + i]); } return(pLine); } this.frontLine = function() { var pFront = Array(); for( var i=0; i<this.count; i++) { if ( this.tabitem[i].position == -1 ) this.tabitem[i].position = this.tabitem[i].getDefaultPos(); if ( this.tabitem[i].position < (this.linelen - 1) ) { pFront.push( this.tabitem[i] ); this.tabitem[i].text; } } return(pFront); } this.lineFromTabDx = function(tabSpec) { var iCnt = this.linecount(); var pLine; if ( !iCnt ) return(false); for( var i=1; i<=iCnt; i++) { pLine = this.tabline(i); for( var ind=0; ind<pLine.length; ind++) { if ( pLine[ind].id == tabSpec.id ) return(i); } } return(false); } this.lineFromTab = function(tabSpec) { return( this.tabline(this.lineFromTabDx(tabSpec)) ); } this.baseIndex = function(lineIndex) { return( (lineIndex - 1) * this.linelen ); } this.redraw = function() { var pBackup = this.tabitem; var newTab; var i; this.destroy(); for ( i=0; i<pBackup.length; i++) { with (pBackup[i]) { newTab = new CTab(left, top, width, height, text, link, pBackup[i].ontoggle, parent, id); newTab._body.style.zIndex = this.count; this.tabitem.push(newTab); this.count++; this.newIndex = this.tabitem.length; } } } this.destroy = function() { var i; for ( i=0; i<this.count; i++) { this._body.removeChild( this.tabitem[i]._body ); } this.tabitem = Array(); this.count = 0; this.newIndex = 0; } this._pickId = function () { /* Genera un identificador numérico. */ var maxTabs = 100; // Limita la cantidad de tabs. return ( Math.floor( Math.random() * maxTabs + 1 ) ); } this._createTabUI = function (tabObj) { /* Crea la parte visual de la tab y devuelve el objeto div contenedor. */ var dvObj = document.createElement("div"); dvObj.id = tabObj.id; dvObj.className = "tabHide"; dvObj.style.left = tabObj.left; dvObj.style.top = tabObj.top; dvObj.style.position = this.flag['pos'] ? this.flag['pos'] : "absolute"; dvObj.innerHTML = ' ' + '<table id="tbl'+ dvObj.id +'" class="tabHide" width="100%" cellpadding="0" cellspacing="0">' + ' <tr>' + ' <td class="tabLfEdge"> </td> ' + ' <td class="tabTopHEdge"> </td> ' + ' <td class="tabRgEdge"> </td> ' + ' </tr> ' + ' <tr> ' + ' <td class="tabLfVEdge"> </td> ' + ' <td id="td'+ dvObj.id +'" class="tabBody" align="center">' + tabObj.text + '</td> ' + ' <td class="tabRgVEdge"> </td> ' + ' </tr> ' + '</table> '; dvObj.style.display = "block"; dvObj.style.visibility = "visible"; if ( tabObj.width ) dvObj.style.width = tabObj.width; return(dvObj); } this.getWidth = function() { /* Devuelve el ancho total de la barra. */ var iWidth = 0; for (i=0; i<this.count; i++) { iWidth += this.tabitem[i]._body.clientWidth; } return(iWidth); } this.getLineHeight = function() { /* Devuelve el alto de la tab con mayor medida. */ var iHeight = 0; for (i=0; i<this.count; i++) { if ( this.tabitem[i]._body.clientHeight > iHeight ) iHeight = this.tabitem[i]._body.clientHeight; } return(iHeight); } this.getMaxHeight = function() { /* Devuelve el alto de la tab con mayor medida. */ var iHeight = this.getLineHeight(); if ( this.multiline && this.linelen ) { iHeight += (iHeight * (this.count / this.linelen) ); if (this.count % this.linelen) iHeight++; } return(iHeight); } this.showSubitems = function(pTab) { /* Muestra los subitems de la tab especificada. */ var iWidth = this.getWidth(); var iLeft = this.left; var iTop = this.top + this.getMaxHeight(); var pItem, pImg; this.hideSubitems(); this._subbody.style.width = iWidth + "px"; this._subbody.style.left = iLeft + "px"; this._subbody.style.top = iTop + "px"; if ( pTab.subcount ) this._subbody.style.display = "block"; for ( i=0; i<pTab.subcount; i++ ) { pItem = pTab.subitem[i]; pItem._body.style.left = iLeft + 5 + "px"; pItem._body.style.top = iTop + 3 + "px"; pItem._body.style.display = "block"; pItem._body.style.visibility = "visible"; pItem._body.style.padding = "3px"; pItem._body.style.backgroundImage = "url(data/images/subsep.png)"; pItem._body.style.backgroundRepeat= "no-repeat"; pItem._body.style.backgroundPosition = "right center"; iLeft += pItem._body.clientWidth + 2; this._subbody.style.height = pItem._body.clientHeight + "px"; } } this.hideSubitems = function() { /* Oculta la barra de subitems. */ var i; for (i=0; i<this.count; i++) { this.tabitem[i].hideSubitems(); } return(true); } this.loadData = function(ontoggle) { if ( !this.dataSrc ) return(false); if (window.ActiveXObject) { this.dataObj = new ActiveXObject("Microsoft.XMLDOM"); this.dataObj.async = false; this.dataObj.load(this.dataSrc); } else if (document.implementation && document.implementation.createDocument) { if ( getNavigatorExt() != "MC" ) { this.dataObj = document.implementation.createDocument("","",null); this.dataObj.async = false; this.dataObj.load(this.dataSrc); } else { this.dataObj = this.forceLoadXML(this.dataSrc, this._loadProc, this); return(true); } } else return(false); if ( !this.dataObj ) return(false); if ( !this.dataObj.getElementsByTagName("sections")[0] ) return(false); this._makeFromData(ontoggle); this.ontoggle = ontoggle; } this.forceLoadXML = function(xmlSpec, notifyProc, callerObj) { var pFrame = document.createElement("iframe"); pFrame.style.display = "none"; pFrame.style.visibility = "hidden"; pFrame.style.left = callerObj; pFrame.id = "asdf"; pCaller = callerObj; if ( notifyProc ) attachEventHldr(pFrame, "onload", notifyProc); document.body.appendChild(pFrame); pFrame.src = xmlSpec; return( pFrame.contentDocument ); } this._loadProc = function() { pCaller.dataObj = this.contentDocument; pCaller._makeFromData(pCaller.ontoggle); if ( pCaller.onload ) pCaller.onload(); } this.refreshData = function() { if ( !this.dataObj ) return(false); var pSection = this.dataObj.getElementsByTagName("sections"); var sText; var i, ind; for ( i=0; i<pSection.childNodes.length; i++ ) { for ( ind=0; ind<this.count; ind++ ) { if ( this._getAttrib(pSection.childNodes[i], "id") == this.tabitem[ind].id ) { sText = this._getAttrib(pSection.childNodes[i], "text"); if ( sText ) { with( this.tabitem[ind] ) { text = sText; _body.innerHTML = sText; } if ( pSection.childNodes[i].hasChildNodes ) this.refreshSubitems(this.tabitem[ind], pSection.childNodes[i]); } } } } } this.refreshSubitems = function(parentItem, nodeSpec) { var sSubText; var ird, ith; for ( ird=0; ird<nodeSpec.childNodes.length; ird++ ) { for ( ith=0; ith<parentItem.subcount; ith++ ) { if ( this._getAttrib(nodeSpec.childNodes[ird], "id") == parentItem.subitem[ith] ) { sSubText = this._getAttrib(nodeSpec.childNodes[ird], "text"); if ( sSubText ) { with(parentItem.subitem[ith]) { text = sSubText; _body.innerHTML = sSubText; } } } } } } this._makeFromData = function(ontoggle) { if ( !this.dataObj ) return(false); var pSection = this.dataObj.getElementsByTagName("sections")[0]; var sText, sLink, sWidth; var pNewTab; var i, ind; for ( i=0; i<pSection.childNodes.length; i++ ) { sText = this._getAttrib(pSection.childNodes[i], "text"); sLink = this._getAttrib(pSection.childNodes[i], "link"); sWidth = this._getAttrib(pSection.childNodes[i], "width"); if ( sText ) { pNewTab = this.addTab(sText, sLink, ontoggle, this._getAttrib(pSection.childNodes[i], "id"), sWidth); for ( ind=0; ind<pSection.childNodes[i].childNodes.length; ind++ ) { sText = this._getAttrib(pSection.childNodes[i].childNodes[ind], "text"); sLink = this._getAttrib(pSection.childNodes[i].childNodes[ind], "link"); if ( sText ) pNewTab.addSubitem(sText, sLink, ontoggle, this._getAttrib(pSection.childNodes[i].childNodes[ind], "id")); } } } } this._getAttrib = function(objectSpec, attribName) { try { var i, attribValue; for ( i=0; i<objectSpec.attributes.length; i++ ) { if ( objectSpec.attributes[i].nodeName == attribName ) { attribValue = objectSpec.attributes[i].nodeValue; break; } } if ( !attribValue ) return(false); return(attribValue); } catch(err) { return(false); } } this._parseFlags = function(flags) { var pData; var i; if ( !flags ) return(false); flags = String(flags); pFlag = flags.split(";"); for ( i=0; i<pFlag.length; i++) { pData = this._flagStripValue( pFlag[i] ); if ( pData ) this.flag[ pData[0] ] = pData[1]; } } this._flagStripValue = function(flagEntry, separator) { var pData; flagEntry = String(flagEntry); if ( !separator ) separator = "="; if ( flagEntry.indexOf(separator) > 0 ) { pData = flagEntry.split("="); pData[0] = pData[0].trim(); pData[1] = pData[1].trim(); return(pData); } return(null); } this._parseFlags(flags); /* Inicializa los datos predeterminados. */ this._subbody.style.position = this.flag["pos"] ? this.flag["pos"] : "absolute"; this._subbody.style.display = "none"; this._subbody.className = "subBody"; this._waitImg.style.visibility = "hidden"; this._waitImg.style.position = this.flag["pos"] ? this.flag["pos"] : "absolute"; this.multiline = this.flag["multiline"] ? Boolean(this.flag["multiline"]) : false; this.linelen = this.flag["linelen"] ? Number(this.flag["linelen"]) : 5;}var CTab = function(left, top, width, height, text, link, ontoggle){ var i; /* Declara propiedades públicas. */ this.text = text; this.link = link; this.left = left; this.top = top; this.state = unselected; this.subitem = Array(); this.subcount = 0; this.hoverClass = "tabHover"; this.prevClass = ""; if ( arguments[7] ) this.parent = arguments[7]; else this.parent = null; if ( arguments[8] ) { this.id = arguments[8]; } else { if ( this.parent ) this.id = "tab" + this.parent.newIndex; else this.id = "tab" + this.parent._pickId(); } this.index = this.parent.newIndex; this.position = -1; this._body = this.parent._createTabUI(this); this.width = this._body.clientWidth; this.height = this._body.clientHeight; if ( !this._body ) return(false); // Verifica que la tab se haya creado correctamente. if ( this.parent._body ) this.parent._body.appendChild(this._body); this._text = $("td" + this._body.id ); this._text.prototype = this; this.toggle = function() { /* Cambiar de estado. */ this.parent.toggleTab(this, !this.state); } this.activate = function() { /* Activar esta tab (oculta las demás). */ this.parent.toggleTab(this, !this.state, true); } this.bringToTop = function() { /* Saltar al frente de todas las demás tabs. */ if ( !this.parent ) return(false); var pItem; var i; for ( i=0; i<this.parent.count; i++) { pItem = this.parent.tabitem[i]; pItem._body.style.zIndex = pItem.parent.count - pItem.position; } this._body.style.zIndex = this.parent.count + 2; this._body.style.top = CNum(this._body.style.top) + 1 + "px"; } this.addSubitem = function() { /* Agrega una sección secundaria. */ var newItem = new CTabItem(arguments[0], arguments[1], arguments[2], "tabSubitem", "tabSubActive", this, arguments[3]); this.subitem.push(newItem); this.subcount++; if ( this.parent.langData ) this.parent.langData.addClient(newItem); return(this.subitem[ this.subitem.length - 1 ]); } this.clearSelection = function() { /* Elimina el estado seleccionado de los subitems. */ var i; for ( i=0; i<this.subcount; i++ ) { this.subitem[i].className = this.subitem[i].classDefault; this.subitem[i]._body.className = this.subitem[i].classDefault; } } this.showSubitems = function() { /* Muestra la barra de subitems para esta tab. */ this.parent.showSubitems(this); } this.hideSubitems = function() { /* Oculta todos los subitems. */ var i; for ( i=0; i<this.subcount; i++ ) { this.subitem[i]._body.style.visibility = "hidden"; this.subitem[i]._body.style.display = "none"; } } this.setText = function(newText) { var pText = document.getElementById("td" + this.id); if ( !pText ) return(false); this.text = newText; pText.innerHTML = this.text ; } this.switchTo = function(tabSpec) { /* Cambiar posición de una tab, a la posición de otra. */ var iLeft = this.left, iTop = this.top; var zOrder = this._body.style.zIndex; var iPos = tabSpec.position; this._body.style.left = tabSpec.left + "px"; this._body.style.top = tabSpec.top + "px"; tabSpec._body.style.left = this.left + "px"; tabSpec._body.style.top = this.top + "px"; this.left = tabSpec.left; this.top = tabSpec.top; tabSpec.left = iLeft; tabSpec.top = iTop; tabSpec.position = this.position; this.position = iPos; } this.getDefaultPos = function() { return( this.parent.count - this.index - 1 ); } this.hide = function() { this._body.style.visibility = "hidden"; } this.show = function() { this._body.style.visibility = "visible"; } this.move = function(left, top, width, height) { this.left = left ? left : this._body.style.offsetLeft; this.top = top ? top : this._body.style.offsetTop; this.width = width ? width : this._body.clientWidth; this.height = height ? height : this._body.clientHeight; this._body.style.left = this.left + "px"; this._body.style.top = this.top + "px"; this._body.style.width = this.width + "px"; this._body.style.height = this.height + "px"; } this.loadUrl = function(container) { /* Carga la página asociada en el contenedor especificado. */ this.parent._waitImg.style.visibility = "visible"; this.parent._waitImg.style.top = this.parent.top + this.parent.getMaxHeight() + 7 + "px"; this.parent._waitImg.style.left = this.parent.left + this.parent.getWidth() - this.parent._waitImg.clientWidth - 3 + "px"; this.parent.busy = true; reqContent(this.link, container, this, this._onload); } this.setEventHandler = function() { /* Permite especificar controladores de eventos personalizados por el usuario. */ attachEventHldr(this._body, arguments[0], arguments[1]); } /* Se definen los eventos predeterminados. */ this.ontoggle = ontoggle; // Se desencadena al cambiar de estado. this._onload = function(pCaller, container) { /* Se cargó el contenido en el contenedor especificado (loadUrl Callback). */ pCaller.parent._waitImg.style.visibility = "hidden"; if ( pCaller.onload ) pCaller.onload(container); pCaller.parent.busy = false; } this.onload = null; // Se desencadena cuando se carga una página // mediante loadUrl. Definida por el usuario. this.onlangchange = function(me, newLangId, newLangName) { /* Se desencadena cuando cambia el idioma globalmente. */ var pText = me.parent.langData.getData( me.id ); if ( pText ) { /* Si existe un recurso de idioma relacionado con esta tab, cambia el texto de la misma. */ me.setText(pText); } } /* Establece los controladores de evento predeterminados. */ this.setEventHandler("onclick", function() { var pTarget = getEventTarget(arguments[0]); if ( !pTarget.prototype ) return(false); if ( pTarget.prototype.parent.busy ) return(false); if ( pTarget.prototype.prevClass ) pTarget.className = pTarget.prototype.prevClass; pTarget.prototype.activate(); }); this.setEventHandler("onmouseover", function() { var pTarget = getEventTarget(arguments[0]); if ( !pTarget.prototype ) return(false); pTarget.prototype.prevClass = pTarget.className; pTarget.className = pTarget.prototype.hoverClass; pTarget.className += pTarget.prototype.state ? "Sel" : ""; pTarget = null; }); this.setEventHandler("onmouseout", function() { var pTarget = getEventTarget(arguments[0]); if ( !pTarget.prototype ) return(false); pTarget.className = pTarget.prototype.prevClass; pTarget.prototype.prevClass = ""; pTarget = null; });}var CTabItem = function(text, link, ontoggle, classDefault, classActive, parentSpec) { if ( !parent ) return(false); this.text = text; this.link = link; this.parent = parentSpec; this.className = classDefault; this.classActive = classActive; this.classDefault = classDefault; if ( arguments[6] ) this.id = arguments[6]; else this.id = this.parent.parent._pickId(); this._body = document.createElement("div"); this._body.className = this.className; this._body.style.position = "absolute"; this._body.style.display = "none"; this._body.innerHTML = text; this._body.prototype = this; this.ontoggle = ontoggle; this.state = unselected; this.parent.parent._body.appendChild(this._body); this.parent.hideSubitems(); this.hoverClass = "subtabHover"; this.prevClass = ""; this.activate = function() { if ( this.state ) return(false); this._body.className = this.classActive; this.state = selected; this.ontoggle(this, true, false); } this.setEventHandler = function() { /* Permite especificar controladores de eventos personalizados por el usuario. */ attachEventHldr(this._body, arguments[0], arguments[1]); } this.setText = function(newText) { this.text = newText; this._body.innerHTML = this.text ; } this.switchTo = function(tabSpec) { /* Cambiar posición de una tab, a la posición de otra. */ var iLeft = this.left, iTop = this.top; this._body.style.left = tabSpec.left + "px"; this._body.style.top = tabSpec.top + "px"; tabSpec._body.style.left = this.left + "px"; tabSpec._body.style.top = this.top + "px"; this.left = tabSpec.left; this.top = tabSpec.top; tabSpec.left = iLeft; tabSpec.top = iTop; } /* Establece los controladores de evento predeterminados. */ this.onlangchange = function(me, newLangId, newLangName) { /* Se desencadena cuando cambia el idioma globalmente. */ var pText = me.parent.parent.langData.getData( me.id ); if ( pText ) { /* Si existe un recurso de idioma relacionado con esta tab, cambia el texto de la misma. */ me.text = pText; me._body.innerHTML = pText; if ( me.parent.state ) me.parent.showSubitems(); } } this.setEventHandler("onmouseover", function() { var pTarget = getEventTarget(arguments[0]); if ( !pTarget.prototype ) return(false); pTarget.prototype.prevClass = pTarget.className; pTarget.className = pTarget.prototype.hoverClass; pTarget.className += pTarget.prototype.state ? "Sel" : ""; pTarget = null; }); this.setEventHandler("onmouseout", function() { var pTarget = getEventTarget(arguments[0]); if ( !pTarget.prototype ) return(false); pTarget.className = pTarget.prototype.prevClass; pTarget.prototype.prevClass = ""; pTarget = null; }); }function initGlobals() { /* Extiende el objeto String. */ if ( !String.trim ) { String.prototype.trim = function() { var sTrim = this.ltrim(); sTrim = sTrim.rtrim(); return(sTrim); } } if ( !String.rtrim ) { String.prototype.rtrim = function() { return( this.replace(/(\x20)*$/, "") ); } } if ( !String.ltrim ) { String.prototype.ltrim = function() { return( this.replace(/(\x20)*/, "") ); } } if ( !String.lspc ) { String.prototype.lspc = function() { var sMatch = this.match(/(\x20)*/); return( String(sMatch).substr(0,1) == ' ' ); } } if ( !String.rspc ) { String.prototype.rspc = function() { var sMatch = this.match(/(\x20)*$/); return( String(sMatch).substr(0,1) == ' ' ); } } if ( !Array.invert ) { Array.prototype.invert = function() { for ( var i=0; i<this.length; i++) { this.push( this.shift() ); } } }}