/* jQuery Mega Menu v1.02
* Last updated: June 29th, 2009. This notice must stay intact for usage
* Author: JavaScript Kit at http://www.javascriptkit.com/
* Visit http://www.javascriptkit.com/script/script2/jScale/ for full source code
*
* Modified by James C
* this should be in closure? Self-exec function
* re-expose if causes problems.
*/
// James: not needed. use closure instead
//jQuery.noConflict();
(function($){
var jkmegamenu={
effectduration: 500, //duration of animation, in milliseconds
delaytimer: 700, //delay after mouseout before menu should be hidden, in milliseconds
//No need to edit beyond here
megamenulabels: [],
megamenus: [], //array to contain each block menu instances
zIndexVal: 1000, //starting z-index value for drop down menu
$shimobj: null,
addshim:function($){
$(document.body).append('')
this.$shimobj=$("#outlineiframeshim")
},
alignmenu:function($, e, megamenu_pos){
var megamenu=this.megamenus[megamenu_pos]
var $anchor=megamenu.$anchorobj
var $menu=megamenu.$menuobj
var menuleft=($(window).width()-(megamenu.offsetx-$(document).scrollLeft())>megamenu.actualwidth)? megamenu.offsetx : megamenu.offsetx-megamenu.actualwidth+megamenu.anchorwidth //get x coord of menu
//var menutop=($(window).height()-(megamenu.offsety-$(document).scrollTop()+megamenu.anchorheight)>megamenu.actualheight)? megamenu.offsety+megamenu.anchorheight : megamenu.offsety-megamenu.actualheight
var menutop=megamenu.offsety+megamenu.anchorheight //get y coord of menu
/*menuleft = 254;*/
menutop = 135;
$menu.css({left:menuleft+"px", top:menutop+"px"})
this.$shimobj.css({width:megamenu.actualwidth+"px", height:megamenu.actualheight+"px", left:menuleft+"px", top:menutop+"px", display:"block"})
},
showmenu:function(e, megamenu_pos){
// hide all megamenus as well
for(var i in this.megamenus){
if(i!==megamenu_pos){
this.hidemenu(e, i);
}
}
var megamenu=this.megamenus[megamenu_pos],
$menu=megamenu.$menuobj,
$menuinner=megamenu.$menuinner,
$anchorobj = megamenu.$anchorobj;
$anchorobj.addClass('active');
if ($menu.css("display")=="none"){
this.alignmenu(jQuery, e, megamenu_pos)
$menu.css("z-index", ++this.zIndexVal)
// Removed by James
/*
$menu.show(this.effectduration, function(){
$menuinner.css('visibility', 'visible')
})
*/
// Added by James.
$menu.stop(1).fadeIn({
duration : this.effectduration,
complete : function(){
$menuinner.css('visibility', 'visible');
}
});
}
else if ($menu.css("display")=="block" && e.type=="click"){ //if menu is hidden and this is a "click" event (versus "mouseout")
this.hidemenu(e, megamenu_pos)
}
return false
},
hidemenu:function(e, megamenu_pos){
var megamenu=this.megamenus[megamenu_pos],
$menu=megamenu.$menuobj,
$menuinner=megamenu.$menuinner,
$anchorobj = megamenu.$anchorobj;
$anchorobj.removeClass('active');
$menuinner.css('visibility', 'hidden')
this.$shimobj.css({display:"none", left:0, top:0})
// Removed by James C
//$menu.hide(this.effectduration)
$menu.fadeOut({
duration : this.effectduration
});
},
definemenu:function(anchorid, menuid, revealtype){
this.megamenulabels.push([anchorid, menuid, revealtype])
},
render:function($){
for (var i=0, labels=this.megamenulabels[i]; i