var tar = new Array(); var menuDepth = 0; var linkStack = new Array(); function dropTimeouts() { for (var i = 0; i < tar.length; i++) { //alert(ttar[i]); clearTimeout(tar[i]); } } $(document).ready(function(){ if(navigator.userAgent.indexOf('MSIE 7')<0) jqueryMenu(); }); function jqueryMenu() { buildMenu(); setMainMenuCSS(); setSubMenuCSS(); $('.submenu').hide(); $('#mainmenu_table td').mouseenter(function() { clog('main'); dropTimeouts(); //linkStack = new Array(); //linkStack.push($(this).attr('link')); //$('.submenu').hide(); var t = $(this); var u = t; while (u.attr('nodeName')!='BODY' && u.css('position')=='static') { u=u.parent(); } //var top = (t.offset().top - u.offset().top + submenuStyle.top_firstchild) //var left = (t.offset().left- u.offset().left + submenuStyle.left_firstchild); var top = (t.offset().top + submenuStyle.top_firstchild); var left = (t.offset().left + submenuStyle.left_firstchild); top = top - u.offset().top + parseInt(u.css('margin-top'),10); left = left - u.offset().left + parseInt(u.css('margin-left'),10); if(mainmenuStyle.horizontal) top = top - mainmenuStyle.margin_top - mainmenuStyle.margin_bottom; else left = left - mainmenuStyle.margin_left - mainmenuStyle.margin_right; //if (document.doctype!=null || !$.browser.mozilla) //{ //Perform for mozilla //} //alert(parseInt(t.css('padding-top'),10)); var e = $('> ul',this); var menuIndex = t.attr('menuIndex'); clog(menuIndex); $('#mainmenu_table td').each(function(o) { if ($(this).attr('menuIndex')!=menuIndex) $('.submenu',this).hide(); } ); e.css('position','absolute'); e.css('left',left+'px'); e.css('top',top+'px'); //e.show('blind',{direction: 'horizontal',mode: 'show'},4000); if (submenuStyle.sub_menu_effect=='fade') { var duration = submenuStyle.sub_menu_effect_duration; duration *= 1000; duration = Math.round(duration); e.fadeIn(duration); } else { e.show(); } }).mouseleave(function() { clog('main leave'); var ee = $('> ul',this); var t = setTimeout(function(){ ee.hide() },submenuStyle.mouseoff_delay); tar.push(t); }); $('.submenu > li').mouseenter(function() { //linkStack.push($(this).attr('link')); dropTimeouts(); var t = $(this); clog('sub enter ' + t.attr('depth')); //t.show(); $('> li > ul',t.parent()).hide(); var e = $('> ul',this); e.show(); e.css('position','absolute'); var left = t.position().left+submenuStyle.left; var top = t.position().top+submenuStyle.top; e.css('left',left+'px'); e.css('top',top+'px'); }).mouseleave(function() { clog('sub leave ' + $(this).attr('depth')); var ee = $('> ul',this); var t = setTimeout(function(){ ee.hide() },submenuStyle.mouseoff_delay); tar.push(t); //linkStack.pop(); }); } function moveLinkStack() { //clog(linkStack.length); window.eval(linkStack[linkStack.length-1]); } function buildMenu() { var mainmenu = $('#mainmenu_placeholder'); var table = $('