home *** CD-ROM | disk | FTP | other *** search
-
- var opened = ''
- var tm_hide=null
- var tm_show=null
- var interval_hide=300
- var interval_show=200
- // var shifting = 0
-
- function getobject(n) {
- var x;
- d=document;
- if(!(x=d[n])&&d.all) x=d.all[n];
- if(!x && d.getElementById) x=d.getElementById(n);
- return x;
- }
-
- function gomenu(address,frame){
- eval("var x="+frame+".location")
- x.href=address
- }
-
- function shiftmenu(pix) {
- shifting=pix
- }
-
- function createmenu(id,top) {
- eval("items_"+id+"=new Array()")
- }
-
- function additem() {
- id=arguments[0]
- eval("var tmp=items_"+id)
- var x=new Array()
- for (i=1;i<arguments.length;i++) {
- x[x.length]=arguments[i]
- }
- tmp[tmp.length]=x
- }
-
- function rendermenu(id,left,top,shifting) {
- var width=0
- document.writeln('<div unselectable="on" id="'+id+'" class=submenu style="left:'+left+'px; top: '+top+'px; width: '+width+'px" onmouseout="rollout()" onmouseover="rollon()">');
- document.writeln('<table id="'+id+'_tbl" cellspacing=0 cellpadding=0>')
- eval("var tmp=items_"+id)
- eval("tops_"+id+"="+top)
- eval("shifting_"+id+"="+(shifting+0))
- var item_cap = ''
- var item_cap2 = ''
- var item_sub = ''
- for (i=0; i<tmp.length; i++) {
- var item = tmp[i]
- if (item.length==1) {
- t=item[0].split('~');
- if (t.length>2) {
- item_sub = t[2]
- if (t[0] != item_cap) {
- item_cap = t[0]
- document.writeln('<tr><td><nobr><span unselectable="on" class=l0 onmouseover="rollon()">'+item_cap+'</span></nobr></td></tr>')
- }
- if (t[1] != item_cap2) {
- item_cap2 = t[1]
- document.writeln('<tr><td><nobr> <span unselectable="on" class=l1 onmouseover="rollon()">'+item_cap2+'</span></nobr></td></tr>')
- }
- document.writeln('<tr><td><nobr> - <span class=l2 unselectable="on" onmouseover="rollon()">'+item_sub+'</span></nobr></td></tr>')
- }
- else if (t.length>1) {
- item_sub = t[1]
- if (t[0] != item_cap) {
- item_cap = t[0]
- document.writeln('<tr><td><nobr><span unselectable="on" class=l0 onmouseover="rollon()">'+item_cap+'</span></nobr></td></tr>')
- }
- document.writeln('<tr><td><nobr> <span unselectable="on" class=l1 onmouseover="rollon()">'+item_sub+'</span></nobr></td></tr>')
- }
- else {
- item_cap = ''
- item_sub = t[0]
- document.writeln('<tr><td><nobr><span unselectable="on" onmouseover="rollon()">'+item_sub+'</span></nobr></td></tr>')
- }
- }
- else if (item.length==2) {
- t=item[0].split('~');
- if (t.length>2) {
- item_sub = t[2]
- if (t[0] != item_cap) {
- item_cap = t[0]
- document.writeln('<tr><td><nobr><span unselectable="on" class=l0 onmouseover="rollon()">'+item_cap+'</span></nobr></td></tr>')
- }
- if (t[1] != item_cap2) {
- item_cap2 = t[1]
- document.writeln('<tr><td><nobr> <span unselectable="on" class=l1 onmouseover="rollon()">'+item_cap2+'</span></nobr></td></tr>')
- }
- document.writeln('<tr><td><nobr> - <a href="" class=l2 unselectable="on" onclick="gomenu(\''+item[1]+'\',\'window\'); return false" onmouseover="rollon()">'+item_sub+'</a></nobr></td></tr>')
- }
- else if (t.length>1) {
- item_sub = t[1]
- if (t[0] != item_cap) {
- item_cap = t[0]
- document.writeln('<tr><td><nobr><span unselectable="on" class=l0 onmouseover="rollon()">'+item_cap+'</span></nobr></td></tr>')
- }
- document.writeln('<tr><td><nobr> <a href="" class=l1 unselectable="on" onclick="gomenu(\''+item[1]+'\',\'window\'); return false" onmouseover="rollon()">'+item_sub+'</a></nobr></td></tr>')
- }
- else {
- item_cap = ''
- item_sub = t[0]
- document.writeln('<tr><td><nobr><a href="" unselectable="on" onclick="gomenu(\''+item[1]+'\',\'window\'); return false" onmouseover="rollon()">'+item_sub+'</a></nobr></td></tr>')
- }
- }
- else {
- t=item[0].split('~');
- if (t.length>2) {
- item_sub = t[2]
- if (t[0] != item_cap) {
- item_cap = t[0]
- document.writeln('<tr><td><nobr><span unselectable="on" class=l0 onmouseover="rollon()">'+item_cap+'</span></nobr></td></tr>')
- }
- if (t[1] != item_cap2) {
- item_cap2 = t[1]
- document.writeln('<tr><td><nobr> <span class=l1 unselectable="on" class=caption onmouseover="rollon()">'+item_cap2+'</span></nobr></td></tr>')
- }
- document.writeln('<tr><td><nobr> - <a href="" class=l2 unselectable="on" onclick="gomenu(\''+item[1]+'\',\''+item[2]+'\'); return false" onmouseover="rollon()">'+item_sub+'</a></nobr></td></tr>')
- }
- else if (t.length>1) {
- item_sub = t[1]
- if (t[0] != item_cap) {
- item_cap = t[0]
- document.writeln('<tr><td><nobr><span unselectable="on" class=l0 onmouseover="rollon()">'+item_cap+'</span></nobr></td></tr>')
- }
- document.writeln('<tr><td><nobr> <a href="" class=l1 unselectable="on" onclick="gomenu(\''+item[1]+'\',\''+item[2]+'\'); return false" onmouseover="rollon()">'+item_sub+'</a></nobr></td></tr>')
- }
- else {
- item_cap = ''
- item_sub = t[0]
- document.writeln('<tr><td><nobr><a href="" unselectable="on" onclick="gomenu(\''+item[1]+'\',\''+item[2]+'\'); return false" onmouseover="rollon()">'+item_sub+'</a></nobr></td></tr>')
- }
- }
- }
- document.writeln('</table>')
- document.writeln('</div>')
- var tbl=gEBI(id)
- tbl.style.width=(gEBI(id+'_tbl').offsetWidth+30)+'px'
- // repoz(id)
- }
-
- function repoz(o) {
- // var posunuti = 255
- eval("var sh=shifting_"+o)
-
- var bh = document.body.offsetHeight
- var m = gEBI(o)
- eval("var mtop=tops_"+o)
- // var mtop = m.offsetTop
- // alert(mtop)
- var mhgh = m.offsetHeight
- // alert(mhgh)
- var total = mtop+mhgh
- // alert(total)
- var diff = total-bh+sh
- if (diff<0) diff=0
- // alert(document.body.scrollTop+'> '+sh+', '+mtop)
- if (document.body.scrollTop>(sh-15)) {
- // alert(document.body.scrollTop+'> '+sh+', '+mtop)
- //mtop=document.body.scrollTop-sh+15
- }
- else {
- /// mtop=mtop-diff
- mtop=mtop-diff
- //if (mtop<document.body.scrollTop) mtop=document.body.scrollTop
- if (mtop<-sh) { // kdyby horni hrana menu mela nahore presahnout obrazovku, pak menu umistit k hornimu okraji obrazovky
- mtop=-sh
- // if ((sh+mtop)<document.body.scrollTop) {
- //if (document.body.scrollTop>sh) {
- // mtop=document.body.scrollTop-sh
- // }
- // mtop=0
- }
- }
- // mtop = mtop+document.body.scrollTop
- // alert(mtop)
- m.style.top=mtop+'px'
- }
-
- function openmenu(id) {
- hidemenu()
- repoz(id)
- menuobj=getobject(id);
- menuobj.style.visibility='visible';
- opened=id
- }
-
- function hidemenu() {
- if (opened!='') {
- menuobj=getobject(opened);
- menuobj.style.visibility='hidden';
- }
- opened=''
- }
-
- function rollon(id) {
- clearTimeout(tm_hide);
- clearTimeout(tm_show);
- if (getobject(id)!=null) {
- tm_show=setTimeout("openmenu('"+id+"')",interval_show);
- }
- }
-
- function rollout() {
- clearTimeout(tm_hide);
- clearTimeout(tm_show);
- tm_hide=setTimeout('hidemenu()',interval_hide);
- }
-
- function rollonm0() {
- if (gEBI('m0')!=null) {
- if (gEBI('m0').style.visibility=='visible')
- rollon('m0')
- }
- }
-