diff -r 000000000000 -r 868dae1581ff otl.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/otl.js Fri Jul 24 07:39:57 2009 -0700 @@ -0,0 +1,109 @@ + +// otl_handler javascript functions + + +var scroll = new Array(); +var itemcount = 0; + +function init_page() +{ + if (! document.getElementById ) return false; + + var spans = document.getElementsByTagName('span'); + for (i = 0; i < spans.length; i++) { + var id = spans[i].getAttribute('id'); + if (id == null || id == "") continue; + if (id.indexOf("itemtoplevel_") == -1) continue; + + // ie doesn't support negative substr positions :\ + // var num = id.substr(-1, 1); + var num = id.substr(13, 1); + var itemtoplevel = spans[i]; + var itemgroup = document.getElementById("itemgroup_" + num); + if (! itemtoplevel || ! itemgroup) continue; + + itemcount++; + + itemgroup.style.display = 'none'; + itemgroup.style.overflow = 'hidden'; + itemtoplevel.onmouseover = function() { this.className = 'level0_over'; } + itemtoplevel.onmouseout = function() { this.className = 'level0'; } + itemtoplevel.onmouseup = function() { this.className = 'level0'; toggle(this); return false; } + itemtoplevel.onselectstart = function() { return false; } + + } + + return; +} + + +function toggle(i) +{ + var ig = document.getElementById( i.id.replace("toplevel", "group") ); + if (! ig ) return; + + var num = ig.id.substr(10,1); + + // show + if (ig.style.display == "" || + ig.style.display == "none") { + + ig.style.height = "0pt"; + ig.style.display = 'block'; + grow(num); + + // hide others + for (i = 0; i != itemcount; i++) { + if (i != num) shrink(i); + } + + } + // hide + else { + shrink(num); + } + + return; +} + +function grow(num) +{ + var ig = document.getElementById( "itemgroup_" + num ); + if (! ig ) return; + scroll[num] = 1; + + var curheight = parseInt(ig.style.height.replace("pt", "")); + if (curheight >= 250) { + ig.style.overflow = 'auto'; + scroll[num] = 0; + return; + } + + var newheight = curheight + 25 + "pt"; + ig.style.height = newheight; + + setTimeout("grow(" + num + ")", 30); + return; +} + +function shrink(num) +{ + var ig = document.getElementById( "itemgroup_" + num ); + if (! ig ) return; + if (scroll[num] == 1) return; + ig.style.overflow = 'hidden'; + + var curheight = parseInt(ig.style.height.replace("pt", "")); + if (curheight == 0) { + ig.style.display = 'none'; + return; + } + + var newheight = curheight - 50 + "pt"; + ig.style.height = newheight; + + setTimeout("shrink(" + num + ")", 30); + return; +} + +