// ************************************************************************ // * dropdown menus // * (C) 2003 propellerhead // * v0.2 // * // * History: // * 17.12.03 creation of file // * 28.12.03 making a php file to be able to serve different browsers // * // ************************************************************************ // getObj: get an html object using the browsers preferred method function getObj(objid) { if(document.all) { return "document.all."+objid; } return "document.getElementById(\""+objid+"\")"; } var DD_MAX_HEIGHT = new Array(); // dropdown menu heights (fix) var DD_HEIGHT = new Array(); // current dropdown heights var IRO = new Array(); // dropdown interrupts (open) var IRC = new Array(); // dropdown interrupts (close) var TIO = new Array(); // dropdown timeouts var IS_OPENABLE = new Array(); var DD_OPEN_SPEED = 1; // opening speed. higher=slower var DD_CLOSE_SPEED = 1; // opening speed. higher=slower var DD_OPEN_STEPS = 10; // opening speed. higher=slower var DD_CLOSE_STEPS = 10; // opening speed. higher=slower // colors and styles var DD_SM_BGCOLOR_HIGHLIGHT = "#92C4E5";// dropdown submenu background color (when highlighted) var DD_SM_BGCOLOR_NORMAL = "#82B4D5"; // dropdown submenu background color (when not highlighted) // initialize values at startup function init() { // dump("Init()"); // get number of menus while getting menu heights num_menus = 0; // get menu heights curr_menu_obj = eval(getObj("ddt"+(num_menus+1))); while(curr_menu_obj) { DD_MAX_HEIGHT[num_menus+1] = curr_menu_obj.offsetHeight; DD_HEIGHT[num_menus+1] = 0; IS_OPENABLE[num_menus+1] = 1; // curr_menu_obj.style.clip = "rect(0 0 0 0)"; // curr_menu_obj.style.visibility = "hidden"; // for Opera browsers. They can't do clips. curr_menu_obj.style.width = eval(getObj("hmp"+(num_menus+1))+".offsetWidth"); // this is just if the min. width of the ddmenu should be the width of its main menucolumn and is only neccessary for ns browsers ++num_menus; curr_menu_obj = eval(getObj("ddt"+(num_menus+1))); } } // activate menu entry function actME(obj) { obj.style.backgroundColor = DD_SM_BGCOLOR_HIGHLIGHT; } // deactivate menu entry function deactME(obj) { obj.style.backgroundColor = DD_SM_BGCOLOR_NORMAL; } function initOpenDd(ddnr) { window.clearTimeout(TIO[ddnr]); eval(getObj("dddiv"+ddnr)+".style.visibility=\"visible\""); eval(getObj("dddiv"+ddnr)+".style.clip=\"rect(0px auto auto 0px)\""); // NN workaround: de-clip the thing (why is it clipped at all?) // for opera: // eval("document.all.ddt"+ddnr+".style.visibility=\"visible\";"); } function procOpenDd(ddnr) { if(IS_OPENABLE[ddnr] == 0) { if(DD_HEIGHT[ddnr] < DD_MAX_HEIGHT[ddnr]) { DD_HEIGHT[ddnr] += DD_OPEN_STEPS; eval(getObj("dddiv"+ddnr)+".style.clip=\"rect(0px auto "+(DD_HEIGHT[ddnr])+"px 0px)\""); } else { window.clearInterval(IRO[ddnr]); } } } function initCloseDd(ddnr) { TIO[ddnr] = setTimeout('eval(getObj(\"dddiv'+ddnr+'\")+\".style.visibility=\\\"hidden\\\"\");',100); } function DoCloseDd(ddnr) { IS_OPENABLE[ddnr] = 1; IRC[ddnr] = window.setInterval("procCloseDd("+ddnr+")",DD_CLOSE_SPEED); } function procCloseDd(ddnr) { if(DD_HEIGHT[ddnr] > 0) { DD_HEIGHT[ddnr] -= DD_CLOSE_STEPS; if(DD_HEIGHT[ddnr] < 0) { DD_HEIGHT[ddnr] = 0; } //? eval(getObj("dddiv"+ddnr)+".style.clip=\"rect(0px auto "+(DD_HEIGHT[ddnr])+"px 0px)\""); } else { DD_HEIGHT[ddnr] = 0; //? window.clearInterval(IRC[ddnr]); // for opera: // eval("document.all.ddt"+ddnr+".style.visibility=\"hidden\""); } }