jQuery.noConflict()var flexdropdownmenu={arrowpath:'js/arrow.gif',animspeed:300,showhidedelay:[150,150],startzindex:1000,builtflexmenuids:[],positionul:function($,$ul,e,$anchor){var istoplevel=$ul.hasClass('jqflexmenu')var docrightedge=$(document).scrollLeft()+$(window).width()-40 var docbottomedge=$(document).scrollTop()+$(window).height()-40 if(istoplevel){var offsets=$anchor.offset()var anchorsetting=$anchor.data('setting')var x=offsets.left+anchorsetting.useroffsets[0]+(anchorsetting.dir=="h"?$anchor.outerWidth():0)var y=offsets.top+anchorsetting.useroffsets[1]+(anchorsetting.dir=="h"?0:$anchor.outerHeight())x=(x+$ul.data('dimensions').w>docrightedge)?x-(anchorsetting.useroffsets[0]*2)-$ul.data('dimensions').w+$anchor.outerWidth()+(anchorsetting.dir=="h"?-($anchor.outerWidth()*2):0):x y=(y+$ul.data('dimensions').h>docbottomedge)?y-(anchorsetting.useroffsets[1]*2)-$ul.data('dimensions').h-$anchor.outerHeight()+(anchorsetting.dir=="h"?($anchor.outerHeight()*2):0):y}else{var $parentli=$ul.data('$parentliref')var parentlioffset=$parentli.offset()var x=$ul.data('dimensions').parentliw var y=0 x=(parentlioffset.left+x+$ul.data('dimensions').w>docrightedge)?x-$ul.data('dimensions').parentliw-$ul.data('dimensions').w:x y=(parentlioffset.top+$ul.data('dimensions').h>docbottomedge)?y-$ul.data('dimensions').h+$ul.data('dimensions').parentlih:y}$ul.css({left:x,top:y})},showbox:function($,$flexmenu,e){clearTimeout($flexmenu.data('timers').hidetimer)$flexmenu.data('timers').showtimer=setTimeout(function(){$flexmenu.show(flexdropdownmenu.animspeed)},this.showhidedelay[0])},hidebox:function($,$flexmenu){clearTimeout($flexmenu.data('timers').showtimer)$flexmenu.data('timers').hidetimer=setTimeout(function(){$flexmenu.hide(100)},this.showhidedelay[1])},buildflexmenu:function($,$menu,$target){$menu.css({display:'block',visibility:'hidden',zIndex:this.startzindex}).addClass('jqflexmenu').appendTo(document.body)$menu.bind('mouseenter',function(){clearTimeout($menu.data('timers').hidetimer)})$menu.bind('mouseleave',function(){flexdropdownmenu.hidebox($,$menu)})$menu.data('dimensions',{w:$menu.outerWidth(),h:$menu.outerHeight()})$menu.data('timers',{})var $lis=$menu.find("ul").parent()$lis.each(function(i){var $li=$(this).css({zIndex:1000+i})var $subul=$li.find('ul:eq(0)').css({display:'block'})$subul.data('dimensions',{w:$subul.outerWidth(),h:$subul.outerHeight(),parentliw:this.offsetWidth,parentlih:this.offsetHeight})$subul.data('$parentliref',$li)$subul.data('timers',{})$li.data('$subulref',$subul)$li.children("a:eq(0)").append('<img src="'+flexdropdownmenu.arrowpath+'" class="rightarrowclass" style="border:0;" />')$li.bind('mouseenter',function(e){var $targetul=$(this).css('zIndex',++flexdropdownmenu.startzindex).addClass("selected").data('$subulref')if($targetul.queue().length<=1){clearTimeout($targetul.data('timers').hidetimer)$targetul.data('timers').showtimer=setTimeout(function(){flexdropdownmenu.positionul($,$targetul,e)$targetul.show(flexdropdownmenu.animspeed)},flexdropdownmenu.showhidedelay[0])}})$li.bind('mouseleave',function(e){var $targetul=$(this).data('$subulref')clearTimeout($targetul.data('timers').showtimer)$targetul.data('timers').hidetimer=setTimeout(function(){$targetul.hide(100).data('$parentliref').removeClass('selected')},flexdropdownmenu.showhidedelay[1])})})$menu.find('ul').andSelf().css({display:'none',visibility:'visible'})this.builtflexmenuids.push($menu.get(0).id)},init:function($,$target,$flexmenu){if(this.builtflexmenuids.length==0){$(document).bind("click",function(e){if(e.button==0){$('.jqflexmenu').find('ul').andSelf().hide()}})}if(jQuery.inArray($flexmenu.get(0).id,this.builtflexmenuids)==-1)this.buildflexmenu($,$flexmenu,$target)if($target.parents().filter('ul.jqflexmenu').length>0)return var useroffsets=$target.attr('data-offsets')?$target.attr('data-offsets').split(','):[0,0]useroffsets=[parseInt(useroffsets[0]),parseInt(useroffsets[1])]$target.data('setting',{dir:$target.attr('data-dir'),useroffsets:useroffsets})$target.bind("mouseenter",function(e){$flexmenu.css('zIndex',++flexdropdownmenu.startzindex)flexdropdownmenu.positionul($,$flexmenu,e,$target)flexdropdownmenu.showbox($,$flexmenu,e)})$target.bind("mouseleave",function(e){flexdropdownmenu.hidebox($,$flexmenu)})}}jQuery.fn.addflexmenu=function(flexmenuid,direction){var $=jQuery return this.each(function(){var $target=$(this)flexdropdownmenu.init($,$target,$('#'+flexmenuid))})};jQuery(document).ready(function($){var $anchors=$('*[data-flexmenu]')$anchors.each(function(){$(this).addflexmenu(this.getAttribute('data-flexmenu'))})})
