// Tabbed editorial stories NewTab = new Array (); var ids; var TabNum = 0; var TabLength = NewTab.length - 1; var delay = 6000; var lock = false; var run; function assignTabs(ids) { myNewTab = ids.split('/'); NewTab = myNewTab; TabLength = NewTab.length - 1; } // Auto news panel rotating function autoTab(myids, newdelay) { ids = myids; if (newdelay) { delay = newdelay; } if (lock == true) { lock = false; window.clearInterval(run); } else if (lock == false) { lock = true; run = setInterval("chgTab(ids, 1)", delay); } } function chgTab(myids, direction) { if (myids) { assignTabs(myids); } var currpanel = document.getElementById(NewTab[TabNum]); TabNum = TabNum + direction; if (TabNum > TabLength) { TabNum = 0; } if (TabNum < 0) { TabNum = TabLength; } var nextpanel = document.getElementById(NewTab[TabNum]); nextpanel.style.zIndex = 2; currpanel.style.zIndex = 1; } // Show or hide id function swap(show, hide) { var showpanel = document.getElementById(show); var hidepanel = document.getElementById(hide); showpanel.className = 'hide'; hidepanel.className = 'show'; } /* Display tabbed panel's contents (using .tabpanel, .tab, .tabactive, tabpanelcontents) */ function selectTab(n, numDiv, panelID) { // iterate all tab-panels for (var i = 0; i < numDiv; i++) { var panel = window.document.getElementById(panelID + "panel" + i); var tab = document.getElementById(panelID + "tab" + i); z = panel.style.zIndex // if clicked and not front, move to front if (i == n && z != ((numDiv * 2) - 1)) { z = numDiv + 98; t = numDiv + 99; c = 'tabactive'; } else { z = (numDiv - i); t = z; c = 'tab'; } panel.style.zIndex = z; tab.style.zIndex = t; tab.className = c; } } /* Show particular tab -and panel replaces selectTab above */ function showPanel(panel,size,Id) { for (var i = 0; i <= size; i++) { panelId = panel + i; element = document.getElementById(panelId); elementP = document.getElementById(panelId+"body"); if (i == Id) { element.className = "tabsactive"; elementP.style.display = ""; } else { element.className = ""; elementP.style.display = "none"; } } } // Create a popup window // href defines the target url // size (optional) defines the popup window size. e.q. 350x250 function popuphelp(href,size) { var dim = 'width=350,height=250'; if (size) { var dims = size.split('x'); dim = 'width='+ dims[0] +',height='+ dims[1]; } if (href.indexOf("knowledgebase.iii") != -1){ href += "__popup"; } var popup = window.open(href, "popup", dim + ",scrollbars,resizable"); popup.focus(); return false; }