jQuery(document).ready(function(){
	
	//Fix Errors - http://www.learningjquery.com/2009/01/quick-tip-prevent-animation-queue-buildup/
	
	//Remove outline from links
	jQuery("a").click(function(){
		jQuery(this).blur();
	});
    // no spaces in the classname, and include the dot. it's used in the
    // mouseover and mouseout selector
    jQuery.each([".pubNav",".digiNav",".masterNav"], function () {
		
		var h = 0,
            cls = this + "";
        
		jQuery((cls + " ul li")).each(function () {
			h += (jQuery(this).height() || 0) + 2;
		});
		
		//When mouse rolls over
        jQuery(cls).mouseover(function(){
            jQuery("ul#networkNav li" + cls + " ul").stop().animate({height:(h + "px"), width:'140px'},{queue:false, duration:600, easing: 'easeOutBounce'});
        });
        
        //When mouse is removed
        jQuery(cls).mouseout(function(){
            jQuery("ul#networkNav li" + cls + " ul").stop().animate({height:'0px', width:'140px'},{queue:false, duration:600, easing: 'easeOutBounce'});
        }); 
	});       
	jQuery.each([".a",".b",".c",".d",".e",".f",".g",".h",".i",".j",".k",".l",".m",".n",".o",".p",".q",".r",".s",".t",".u",".v",".w",".x",".y",".z"], function () {

		var h = 0,
            cls = this + "";

		jQuery((cls + " ul li")).each(function () {
			h += (jQuery(this).height() || 0) + 2;
		});

		//When mouse rolls over
        jQuery(cls).mouseover(function(){
            jQuery("ul#catalogueNav li" + cls + " ul").stop().animate({height:(h + "px"), width:'240px'},{queue:false, duration:600, easing: 'easeOutBounce'});
        });

        //When mouse is removed
        jQuery(cls).mouseout(function(){
            jQuery("ul#catalogueNav li" + cls + " ul").stop().animate({height:'0px', width:'0px'},{queue:false, duration:300, easing: 'easeOutBounce'});
        }); 
	});
});