﻿jQuery.noConflict();var leftAdjust=20;var topAdjust=5;var jkmegamenu={effectduration:500,delaytimer:750,megamenulabels:[],megamenus:[],zIndexVal:1000,$shimobj:null,addshim:function(a){a(document.body).append('<IFRAME id="outlineiframeshim" src="'+(location.protocol=="https:"?"blank.htm":"about:blank")+'" style="display:none; left:0; top:0; z-index:999; position:absolute; filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)" frameBorder="0" scrolling="no"></IFRAME>');this.$shimobj=a("#outlineiframeshim")},alignmenu:function(d,g,a){var f=this.megamenus[a];var c=f.$anchorobj;var b=f.$menuobj;var i=(d(window).width()-(f.offsetx-d(document).scrollLeft())>f.actualwidth)?f.offsetx:f.offsetx-f.actualwidth+f.anchorwidth;var h=f.offsety+f.anchorheight+topAdjust;b.css({left:i-leftAdjust+"px",top:h+"px"});this.$shimobj.css({width:f.actualwidth+"px",height:f.actualheight+"px",left:i+"px",top:h+"px",display:"block"})},showmenu:function(f,a){var d=this.megamenus[a];var c=d.$menuobj;var b=d.$menuinner;if(c.css("display")=="none"){this.alignmenu(jQuery,f,a);c.css("z-index",++this.zIndexVal);c.stop(true,true).slideDown(this.effectduration,function(){b.css("visibility","visible")})}else{if(c.css("display")=="block"&&f.type=="click"){this.hidemenu(f,a)}}return false},hidemenu:function(f,a){var d=this.megamenus[a];var c=d.$menuobj;var b=d.$menuinner;b.css("visibility","hidden");this.$shimobj.css({display:"none",left:0,top:0});c.stop(true,true).hide()},definemenu:function(a,c,d,b){this.megamenulabels.push([a,c,d,b])},render:function(c){for(var b=0,e=this.megamenulabels[b];b<this.megamenulabels.length;b++,e=this.megamenulabels[b]){if(c("#"+e[0]).length!=1||c("#"+e[1]).length!=1){return}this.megamenus.push({$anchorobj:c("#"+e[0]),$menuobj:c("#"+e[1]),$menuinner:c("#"+e[1]).children("ul:first-child"),revealtype:e[2],hidetimer:null,$liObject:c("#"+e[3])});var d=this.megamenus[b];d.$liObject.add(d.$menuobj).attr("_megamenupos",b+"pos");d.$anchorobj.add(d.$menuobj).attr("_megamenupos",b+"pos");d.actualwidth=d.$menuobj.outerWidth();d.actualheight=d.$menuobj.outerHeight();d.offsetx=d.$anchorobj.offset().left;d.offsety=d.$anchorobj.offset().top;d.anchorwidth=d.$anchorobj.outerWidth();d.anchorheight=d.$anchorobj.outerHeight();c(document.body).append(d.$menuobj);d.$menuobj.css("z-index",++this.zIndexVal).hide();d.$menuinner.css("visibility","hidden");var a=false;d.$menuobj.mouseenter(function(){a=true});d.$menuobj.mouseleave(function(f){a=false;var g=jkmegamenu.megamenus[parseInt(this.getAttribute("_megamenupos"))];g.hidetimer=setTimeout(function(){jkmegamenu.hidemenu(f,parseInt(g.$menuobj.get(0).getAttribute("_megamenupos")))},jkmegamenu.delaytimer)});config={sensitivity:2,interval:250,over:function(f){var g=jkmegamenu.megamenus[parseInt(this.getAttribute("_megamenupos"))];jkmegamenu.showmenu(f,parseInt(g.$menuobj.get(0).getAttribute("_megamenupos")))},timeout:250,out:function(f){if(!a){var g=jkmegamenu.megamenus[parseInt(this.getAttribute("_megamenupos"))];g.hidetimer=setTimeout(function(){jkmegamenu.hidemenu(f,parseInt(g.$menuobj.get(0).getAttribute("_megamenupos")))},jkmegamenu.delaytimer)}else{return}}};d.$liObject.hoverIntent(config)}if(/Safari/i.test(navigator.userAgent)){c(window).bind("resize load",function(){for(var f=0;f<jkmegamenu.megamenus.length;f++){var h=jkmegamenu.megamenus[f];var g=(h.$anchorobj.children().length==1&&h.$anchorobj.children().eq(0).is("img"))?h.$anchorobj.children().eq(0):null;if(g){h.offsetx=g.offset().left;h.offsety=g.offset().top;h.anchorwidth=g.width();h.anchorheight=g.height()}}})}else{c(window).bind("resize",function(){for(var f=0;f<jkmegamenu.megamenus.length;f++){var g=jkmegamenu.megamenus[f];g.offsetx=g.$anchorobj.offset().left;g.offsety=g.$anchorobj.offset().top}})}jkmegamenu.addshim(c)}};jQuery(document).ready(function(a){jkmegamenu.render(a)});
