/* *D.R. 2006 Instituto de Investigaciones Dr. José María Luis Mora *Se permite la redistribución y modificación de este código bajo los términos del GNU GPL * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.package org.nongnu.durito; */ // variables globales var selText = new Array; selText['m']=['seleccionado','seleccionados']; selText['f']=['seleccionada','seleccionadas'] var hideMenuDelay = 100; var hideMenu = {}; var imageDir = "images/"; /* funciones para eventos */ function menuBtnMOver(id) { } function menuBtnMOut(id) { } function menuCellMOver(id) { setMenu(id, 1); unscheduleHideMenu(id); } function menuCellMOut(id) { scheduleHideMenu(id); } function menuContMOver(id) { unscheduleHideMenu(id); } function menuContMOut(id) { scheduleHideMenu(id); } function controlBarLinkMOver(id) { hoverContrlBarLink(id, 1); } function controlBarLinkMOut(id) { hoverContrlBarLink(id, 0); } function inactTabLinkMOver(id) { hoverInactTabLink(id,1); } function inactTabLinkMOut(id) { hoverInactTabLink(id,0); } function selChkBoxClick(id) { if (selIndex[id] == 0) { selCounter++; rowSetSel(id, 1); selIndex[id] = 1; } else if (selIndex[id] == 1) { selCounter--; rowSetSel(id, 0); selIndex[id] = 0; } selInfoSet(); if ((selCounter == 1) || (selCounter == 0)) { selCtls(); } } function clearSelClick() { for (id in selIndex) { rowSetSel(id, 0); selIndex[id] = 0; } selCounter = 0; selInfoSet(); selCtls(); } function botTabClick(i) { if (i >= totalBotTabs) { i = totalBotTabs - 1 } activeBotTabSet(i, activeTab); activeAreaSet(i, activeTab); activeTab = i; } /* funciones que interactúan con el DOM */ function scheduleHideMenu(id) { clearTimeout(hideMenu[id]); hideMenu[id]=setTimeout('setMenu("' + id + '", 0)', hideMenuDelay); } function unscheduleHideMenu(id) { clearTimeout(hideMenu[id]); } function setMenu(id, value) { menuCell=menuCellObject(id); menuCont=menuContObject(id); shadow=menuContShadowObject(id); if (value==1) { menuCell.style.backgroundImage = 'url(imageDir + "controlBarMHover.gif")'; menuCell.style.backgroundPosition = 'bottom'; menuCell.style.backgroundRepeat = 'repeat-x'; menuCont.style.display='block'; shadow.style.height=(menuCont.offsetHeight+8)+'px'; shadow.style.width=(menuCont.offsetWidth)+'px'; shadow.style.display='block'; } else { menuCell.style.background='none'; menuCont.style.display='none'; shadow.style.display='none'; } } function hoverContrlBarLink(id, value) { cell=CBLinkCellObject(id); if (value==1) { cell.style.backgroundImage = 'url(imageDir + "controlBarMHover.gif")'; cell.style.backgroundPosition = 'bottom'; cell.style.backgroundRepeat = 'repeat-x'; } else { cell.style.background="none"; } } function hoverInactTabLink(id, value) { cellL=ITabCellLObject(id); cellM=ITabCellMObject(id); cellR=ITabCellRObject(id); if (value==1) { // setTabCellBkgnd(cellL,imageDir + "inactMainTabLHover.gif","top left"); // setTabCellBkgnd(cellM,imageDir + "inactMainTabMHover.gif","top"); // setTabCellBkgnd(cellR,imageDir + "inactMainTabRHover.gif","top right"); // setTabCellBkgnd(cellL,imageDir + "actMainTabL.jpg","top left"); // setTabCellBkgnd(cellM,imageDir + "actMainTabM.jpg","top"); // setTabCellBkgnd(cellR,imageDir + "actMainTabR.jpg","top right"); } else { // setTabCellBkgnd(cellL,imageDir + "inactMainTabL.gif","top left"); // setTabCellBkgnd(cellM,imageDir + "inactMainTabM.gif","top"); // setTabCellBkgnd(cellR,imageDir + "inactMainTabR.gif","top right"); } } function setTabCellBkgnd(cell, src, pos) { cell.style.backgroundImage='url("' + src + '")'; cell.style.backgroundPosition = pos; cell.style.backgroundRepeat = 'repeat-x'; } function eordContrlBarLink(id, value) { lnk=CBLinkObject(id); image=ctlImageObject(id); if (lnk==null) { alert('is null'); } if (value==1) { lnk.className = 'controlBarLink'; if (linkHrefs[id]) { lnk.href=linkHrefs[id]; } lnk.onmouseover = function onmouseover(event) { controlBarLinkMOver(id); } lnk.onmouseout = function onmouseout(event) { controlBarLinkMOut(id); } image.setAttribute('src', '/images/' + id + '.gif'); } else { hoverContrlBarLink(id, 0); lnk.className = 'controlBarLinkDisabled'; linkHrefs[id] = lnk.getAttribute('href'); lnk.removeAttribute('href'); lnk.onmouseover = null; lnk.onmouseout = null; lnk.removeAttribute('onmouseover'); lnk.removeAttribute('onmouseout'); image.setAttribute('src', '/images/' + id + 'Dis.gif'); } } function getSel(id, r) { return "selec=" + id + "&value=" + selIndex[id]; } function rowSetSel(id, state) { var row = listRowObject(id); var chkbox = selChkBoxObject(id); if (state==1) { row.className = 'listItemSelected'; chkbox.checked=true; } else { row.className ='listItem'; chkbox.checked=false; } } function selInfoSet() { var infoText=selInfoObject().lastChild; var newText = ' ' + selCounter + ' ' + selText[gender][ (selCounter == 1) ? 0 : 1 ] ; infoText.nodeValue = newText; } function selCtls() { if (selCounter > 0) { eordContrlBarLink("clearSel", 1); eordContrlBarLink("viewSel", 1); } else { eordContrlBarLink("clearSel", 0); eordContrlBarLink("viewSel", 0); } } function activeBotTabSet(i, oldI) { botTabSet(oldI, 0); botTabSet(i, 1); } function botTabSet(i, value) { tabL = botTabLObject(i); tabM = botTabMObject(i); tabR = botTabRObject(i); tabLnk = botTabLnkObject(i); if (value == 1) { tabL.className='actBotTabL'; tabM.className='actBotTabM'; tabR.className='actBotTabR'; tabLnk.removeAttribute('href'); botTabOnclicks[i] = tabLnk.onclick; tabLnk.onclick = null; } else { tabL.className='inactBotTabL'; tabM.className='inactBotTabM'; tabR.className='inactBotTabR'; tabLnk.href='#'; if (botTabOnclicks[i]) { tabLnk.onclick = botTabOnclicks[i]; } } } function activeAreaSet(i, oldI) { areaSet(oldI, 0); areaSet(i, 1); } function areaSet(i, value) { area=areaObject(i); if (value==1) { area.style.display='block'; } else { area.style.display='none'; } } /* funciones para obtener objetos DOM */ function menuBtnObject(id) { } function menuCellObject(id) { return document.getElementById(id+'MenuCell') } function menuContObject(id) { return document.getElementById(id+'MenuCont') } function menuContShadowObject(id) { return document.getElementById(id+'MenuContShadow') } function CBLinkCellObject(id) { return document.getElementById(id+'CBLinkCell'); } function CBLinkObject(id) { return document.getElementById(id+'ControlBarLink'); } function ctlImageObject(id) { return document.getElementById(id + 'CtlImage'); } function listRowObject(id) { return document.getElementById('row' + id); } function selChkBoxObject(id) { return document.getElementById('chk' + id); } function selInfoObject() { return document.getElementById('selInfo'); } function areaObject(i) { return document.getElementById('area'+i); } function botTabLObject(i) { return document.getElementById('botTabL'+i); } function botTabMObject(i) { return document.getElementById('botTabM'+i); } function botTabRObject(i) { return document.getElementById('botTabR'+i); } function botTabLnkObject(i) { return document.getElementById('botTabLnk'+i); } function ITabCellLObject(id) { return document.getElementById('inactTabL'+id); } function ITabCellMObject(id) { return document.getElementById('inactTabM'+id); } function ITabCellRObject(id) { return document.getElementById('inactTabR'+id); }