//global variables window.CMenus=[]; //var BLANK_IMAGE = "pics/blue_black.png"; var BLANK_IMAGE = "http://www.hive.kiev.ua/js/b.gif"; //var BLANK_IMAGE = "/image/body/blue_line_golos2.gif"; //helper function function bw_check(){ this.dom=document.getElementById?1:0; this.opera=window.opera?1:0; this.ns4=(document.layers && !this.dom)?1:0; return this; } function none(){} function nn(val){return val != null;} function und(val){return typeof(val) == 'undefined';} //classes function COOLjsMenu(name, items){ this.bw=new bw_check(); this.bi = new Image(); this.bi.src=BLANK_IMAGE; window.CMenus[name]=this; window.CMenuHideTimers[name] = null; this.name = name; this.root = []; this.root.par = null; this.root.cd = []; this.root.fmt=items[0]; this.items=[]; this.root.lvl=new CMenuLevel(this, this.root); for (var q=1;q 0}; //has children? this.hac = function(){return this.hc()&&this.cd[0].vis}; //has active children? this.div=function(n){ return und(this.divs[n])?this.divs[n]=get_div(this.id+n):this.divs[n]; } this.draw = function (){ var b = this.style.border; var s = this.style.shadow; return (!this.style.shadow?"":adiv(this.menu.bw, this.id+"s", this.z, this.pos[0]+s, this.pos[1]+s, this.size[1], this.size[0], this.style.color.shadow, "", ""))+ (!this.style.border?"":adiv(this.menu.bw, this.id+"b", this.z, this.pos[0], this.pos[1], this.size[1], this.size[0], this.style.color.border, "", ""))+ adiv(this.menu.bw, this.id+"o", this.z, this.pos[0]+b, this.pos[1]+b, this.size[1]-b*2, this.size[0]-b*2, this.style.color.bgOVER, '
'+this.code+'
', "")+ adiv(this.menu.bw, this.id+"n", this.z, this.pos[0]+b, this.pos[1]+b, this.size[1]-b*2, this.size[0]-b*2, this.style.color.bgON, '
'+this.code+'
', "")+ adiv(this.menu.bw, this.id+"e", this.z, this.pos[0]+b, this.pos[1]+b, this.size[1]-b*2, this.size[0]-b*2, "", ''+'', "", ' onmouseover="mEvent(\''+this.menu.name+'\','+this.index+',\'o\');" onmouseout="mEvent(\''+this.menu.name+'\','+this.index+',\'t\');"' ); } this.vis = function(s){ if (this.style.shadow) this.visDiv("s",s); if (this.style.border) this.visDiv("b",s); if (!s) { this.visDiv("o",0); this.visDiv("n",0); this.state="n"; }else if (this.state=="n") this.visDiv("n",1) else this.visDiv("o",1) this.visDiv("e",s) } this.setVis = function (n){ if (this.state!=n) switch (n){ case "n": this.visDiv("n",1);this.visDiv("o",0); break; case "o": this.visDiv("n",0);this.visDiv("o",1); break; } this.state=n; } this.visDiv = this.bw.ns4? visDivNS:visDivDom; this.getf = function(obj, name){return !und(obj)?(und(obj.fmt[name])?this.getf(obj.par, name):obj.fmt[name]):null;} this.ioff = this.getf(this, "itemoff"); this.loff = this.getf(this, "leveloff"); this.style = this.getf(this, "style"); this.size = this.getf(this, "size"); this.prev = this.pindex==0? null : this.par.cd[this.pindex-1]; this.setPos = function(){ if (this.prev==null){ this.z = this.par == this.menu.root? 0: this.par.z+10; this.pos = und(this.fmt.pos)?(this.par == this.menu.root? this.fmt.pos : this.pos = [this.par.pos[0]+this.loff[1], this.par.pos[1]+this.loff[0]]):this.fmt.pos; }else{ this.prev.next = this; this.z = this.prev.z; this.pos = [this.prev.pos[0]+this.ioff[1], this.prev.pos[1]+this.ioff[0]]; } } this.setPos(); this.sub=item.sub; if (!und(this.sub) && !und(this.sub.length)&& this.sub.length>0){ this.lvl = new CMenuLevel(menu, this); for (var q=1;q'+code+'\n': '
'+code+'
'; } function get_div(name){ return new bw_check().ns4?document.layers[name]:document.all?document.all[name]:document.getElementById(name); } function visDivNS(d,s){ this.div(d).visibility = s?'show':'hide'; } function visDivDom(d,s){ this.div(d).style.visibility = s?'visible': 'hidden'; } function mEvent(m,i,e){ if (nn(window.CMenuHideTimers[m])) { window.clearTimeout(window.CMenuHideTimers[m]); window.CMenuHideTimers[m] = null } switch (e){ case "o": window.CMenus[m].items[i].par.lvl.setA(i,1); break; case "c": if (window.CMenus[m].items[i].hc()) window.CMenus[m].items[i].lvl.vis(!window.CMenus[m].items[i].lvl.v); else for (var q=0;q