////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Drop-down Menu // // Author : Deaconescu Christophe // // christophe@be.euro.net // // Version : 01 // // Browser : Ie4 & Ns4 // ////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Basic browser detection // ////////////////////////////////////////////////////////////////////////////////////////////////////////////// ns = (document.layers) ? 1:0; ie = (document.all) ? 1:0; if (ns) { //window.captureEvents(Event.RESIZE); //window.onResize = reSet; } function reSet(){ initialize() } ////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Variable initialisation // ////////////////////////////////////////////////////////////////////////////////////////////////////////////// var subsection; vis = "visible"; snum = -1; col = ""; function initialize(toshow){ if (ns) { if (document.layers.marquee0) scrollnews() } if (ie) { if (document.all.marquee0) scrollnews() } ////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Menu general style // ////////////////////////////////////////////////////////////////////////////////////////////////////////////// vleft = 6; vstop = 140; vtop = vstop; ////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Style of the big menu items // ////////////////////////////////////////////////////////////////////////////////////////////////////////////// vbspace = 0; vbwidth = 140; vbheight = 18; vbstylestart = "
"; vbstyleend = "
"; ////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Style of the litle menu items // ////////////////////////////////////////////////////////////////////////////////////////////////////////////// vwidth = 140; vheight = 18; vbgColor = ""; vbgColor2 = ""; vbgColor3 = ""; vstylestart = "
"; vstyleend = "
"; ////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Functions who create layers // ////////////////////////////////////////////////////////////////////////////////////////////////////////////// for (i=0;i" + menu[i][1] + "" + vbstyleend,vbwidth,vbheight,vbgColor3); if(ns) lay = document.layers["menu" + i + 0]; if(ie) lay = document.all["menu" + i + 0]; vtop = vtop + vbheight + vbspace; } else { for (j=0;j" + menu[i][(j*2)+1] + "" + vbstyleend,vbwidth,vbheight,vbgColor3); if(ns) lay = document.layers["menu" + i + j]; if(ie) lay = document.all["menu" + i + j]; vtop = vtop + vbheight + vbspace; } else { if (j == 1) { createLayer("menu" + i + j,vstylestart + "" + menu[i][j*2] + "" + vstyleend,vwidth,vheight,vbgColor3); } else { if (menu[i][j*2] != subsection) { createLayer("menu" + i + j,vstylestart + "" + menu[i][j*2] + "" + vstyleend,vwidth,vheight,vbgColor); if(ns) lay = document.layers["menu" + i + j]; if(ie) lay = document.all["menu" + i + j]; } else { createLayer("menu" + i + j,vstylestart + "" + menu[i][j*2] + "" + vstyleend,vwidth,vheight,vbgColor2); } } } vis = "hidden"; } } } if (toshow) { showhide(parseInt(toshow)); } } function createLayer(id,content,width,height,bg) { col = bg; if (ns) { var lyr = document.layers[id] = new Layer(vwidth); eval("document."+id+" = lyr"); lyr.name = id; lyr.left = vleft; lyr.top = vtop; lyr.height = height; lyr.width = width; lyr.clip.top = 0; lyr.clip.left = 0; lyr.clip.bottom = height; lyr.clip.right = width; lyr.visibility = vis; lyr.bgColor = col; lyr.document.open(); lyr.document.write(content); lyr.document.close(); } if (ie) { str = "
"+content+"
"; document.body.insertAdjacentHTML("BeforeEnd",str); } } ////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Functions who turn on and off the menu items // ////////////////////////////////////////////////////////////////////////////////////////////////////////////// function showhide(num){ vtop = vstop; for (i=0;i 4) { snum = num; for (i=num+1;i 0) { if (ns) { lay = document.layers["menu" + num + i]; lay1 = document.layers["menu" + num + (i - 1)]; } if (ie) { lay = document.all["menu" + num + i].style; lay1 = document.all["menu" + num + (i - 1)].style; } if (i == 1){ lay.top = parseInt(lay1.top) + vbheight + vbspace; } else { lay.top = parseInt(lay1.top) + vheight; } } if (ns) lay = document.layers["menu" + num + i]; if (ie) lay = document.all["menu" + num + i].style; lay.visibility = "visible"; } } } else snum = -1; } //