/* $Id: hc.js,v 1.1 2006/01/12 15:04:41 max Exp $ */ var hcShift = 200; var hcRowId = 'hcRow'; var hcLastItemId = 'hcLastItem'; var hcBtnId = 'hcBtn'; // "more" button id var hcMenuId = 'boxHC'; // div with menu id var hcMenuVisibleDelay = 1000; var hcHideFlag = false; var hcOpenId = 'hcOpen'; var hcCloseId = 'hcClose'; /* Check window width and show/hide horizintal categories */ function hcCheckCategories() { var l = 0; var windowWidth = 0; if (!document.getElementById) return; var tds = document.getElementById(hcRowId).getElementsByTagName('TD'); if (localBrowser == 'MSIE') { windowWidth = document.body.clientWidth; } else { windowWidth = window.innerWidth; for (var i = 0; i < tds.length; i++) { document.getElementById(hcRowId).getElementsByTagName('TD')[i].style.display = ''; } } for (var i = 0; i < tds.length; i++) { l += (localBrowser == 'MSIE' ? tds[i].clientWidth : tds[i].offsetWidth); if (l < windowWidth-hcShift && tds[i].id != '') { document.getElementById(hcRowId).getElementsByTagName('TD')[i].style.display=''; if (document.getElementById(tds[i].id+'x')) document.getElementById(tds[i].id+'x').style.display = 'none'; } else if (tds[i].id != hcBtnId && tds[i].id != '') { document.getElementById(hcRowId).getElementsByTagName('TD')[i].style.display = 'none'; if (document.getElementById(tds[i].id+'x')) document.getElementById(tds[i].id+'x').style.display = ''; } } if (localBrowser != 'MSIE') document.getElementById(hcMenuId).style.left = document.getElementById(hcBtnId).offsetLeft; if (document.getElementById(hcLastItemId)) document.getElementById(hcBtnId).style.display = (document.getElementById(hcLastItemId).style.display == '' ? 'none' : ''); } /* initiate horizontal menu hiding */ function hcInitiateHideMenu() { hcHideFlag = true; tm = setTimeout("hcHideMenu()", hcMenuVisibleDelay); } /* hide vertical menu */ function hcHideMenu() { if (!hcHideFlag) return; document.getElementById(hcMenuId).style.display = 'none'; document.getElementById(hcOpenId).style.display = 'none'; document.getElementById(hcCloseId).style.display = ''; } /* show vertical menu */ function hcShowMenu(elm) { if (elm) elm.style.cursor = 'pointer'; if (document.getElementById(hcMenuId).style.display == 'none') { document.getElementById(hcMenuId).style.display = ''; document.getElementById(hcOpenId).style.display = ''; document.getElementById(hcCloseId).style.display = 'none'; } hcHideFlag = false; }