var flexdropdownmenu={arrowpath:"arrow.gif",animspeed:0,showhidedelay:[150,150],startzindex:1E3,builtflexmenuids:[],positionul:function(c,a,d,b){var e=a.hasClass("jqflexmenu"),d=c(document).scrollLeft()+c(window).width()-40,c=c(document).scrollTop()+c(window).height()-40;if(e)var f=b.offset(),g=b.data("setting"),e=f.left+g.useroffsets[0]+(g.dir=="h"?b.outerWidth():0),f=f.top+g.useroffsets[1]+(g.dir=="h"?0:b.outerHeight()),e=e+a.data("dimensions").w>d?e-g.useroffsets[0]*2-a.data("dimensions").w+b.outerWidth()+
(g.dir=="h"?-(b.outerWidth()*2):0):e,f=f+a.data("dimensions").h>c?f-g.useroffsets[1]*2-a.data("dimensions").h-b.outerHeight()+(g.dir=="h"?b.outerHeight()*2:0):f;else b=a.data("$parentliref").offset(),e=a.data("dimensions").parentliw,f=0,e=b.left+e+a.data("dimensions").w>d?e-a.data("dimensions").parentliw-a.data("dimensions").w:e,f=b.top+a.data("dimensions").h>c?f-a.data("dimensions").h+a.data("dimensions").parentlih:f;a.css({left:e,top:f})},showbox:function(c,a){clearTimeout(a.data("timers").hidetimer);
a.data("timers").showtimer=setTimeout(function(){a.show(flexdropdownmenu.animspeed)},this.showhidedelay[0])},hidebox:function(c,a){clearTimeout(a.data("timers").showtimer);a.data("timers").hidetimer=setTimeout(function(){a.hide(100)},this.showhidedelay[1])},buildflexmenu:function(c,a){a.css({display:"block",visibility:"hidden",zIndex:this.startzindex}).addClass("jqflexmenu").appendTo(document.body);a.bind("mouseenter",function(){clearTimeout(a.data("timers").hidetimer)});a.bind("mouseleave",function(){flexdropdownmenu.hidebox(c,
a)});a.data("dimensions",{w:a.outerWidth(),h:a.outerHeight()});a.data("timers",{});a.find("ul").parent().each(function(a){var a=c(this).css({zIndex:1E3+a}),b=a.find("ul:eq(0)").css({display:"block"});b.data("dimensions",{w:b.outerWidth(),h:b.outerHeight(),parentliw:this.offsetWidth,parentlih:this.offsetHeight});b.data("$parentliref",a);b.data("timers",{});a.data("$subulref",b);a.children("a:eq(0)").append('<img src="'+flexdropdownmenu.arrowpath+'" class="rightarrowclass" style="border:0;" />');a.bind("mouseenter",
function(a){var b=c(this).css("zIndex",++flexdropdownmenu.startzindex).addClass("selected").data("$subulref");if(b.queue().length<=1)clearTimeout(b.data("timers").hidetimer),b.data("timers").showtimer=setTimeout(function(){flexdropdownmenu.positionul(c,b,a);b.show(flexdropdownmenu.animspeed)},flexdropdownmenu.showhidedelay[0])});a.bind("mouseleave",function(){var a=c(this).data("$subulref");clearTimeout(a.data("timers").showtimer);a.data("timers").hidetimer=setTimeout(function(){a.hide(100).data("$parentliref").removeClass("selected")},
flexdropdownmenu.showhidedelay[1])})});a.find("ul").andSelf().css({display:"none",visibility:"visible"});this.builtflexmenuids.push(a.get(0).id)},init:function(c,a,d){this.builtflexmenuids.length==0&&c(document).bind("click",function(a){a.button==0&&c(".jqflexmenu").find("ul").andSelf().hide()});jQuery.inArray(d.get(0).id,this.builtflexmenuids)==-1&&this.buildflexmenu(c,d,a);if(!(a.parents().filter("ul.jqflexmenu").length>0)){var b=a.attr("data-offsets")?a.attr("data-offsets").split(","):[0,0],b=
[parseInt(b[0]),parseInt(b[1])];a.data("setting",{dir:a.attr("data-dir"),useroffsets:b});a.bind("mouseenter",function(b){d.css("zIndex",++flexdropdownmenu.startzindex);flexdropdownmenu.positionul(c,d,b,a);flexdropdownmenu.showbox(c,d,b)});a.bind("mouseleave",function(){flexdropdownmenu.hidebox(c,d)})}}};
jQuery.fn.addflexmenu=function(c,a){var d=jQuery;return this.each(function(){var b=d(this);typeof a=="object"&&(a.dir&&b.attr("data-dir",a.dir),a.offsets&&b.attr("data-offsets",a.offsets));d("#"+c).length==1&&flexdropdownmenu.init(d,b,d("#"+c))})};jQuery(document).ready(function(c){c("*[data-flexmenu]").each(function(){c(this).addflexmenu(this.getAttribute("data-flexmenu"))})});function ddlistmenu(c,a){var d=document.createElement("ul");if(c)d.id=c;if(a)d.className=a;this.menu=d}
ddlistmenu.prototype={addItem:function(c,a,d){var b=document.createElement("li");b.innerHTML='<a href="'+c+'" target="'+d+'">'+a+"</a>";this.menu.appendChild(b);this.li=b;return this},addSubMenu:function(){var c=new ddlistmenu(null,null);this.li.appendChild(c.menu);return c}};

