/*
$(document).ready(function() {
 	
	function megaHoverOver(){
		var $subDiv = $(this).find("#submenu");
		var $anchor = $(this).find('a').first();
		$subDiv.stop().fadeTo('fast', 1).show();
			
		//Calculate width of all ul's
		(function($) { 
			jQuery.fn.calcSubWidth = function() {
				rowWidth = 0;
				var menuWidth = $anchor.width();					
				rowWidth = $subDiv.width();
				if(rowWidth > 0){
					$subDiv.css({'border-top-left-radius':'0'});
					$anchor.css({'border-bottom-left-radius':'0','border-bottom-right-radius':'0','-moz-box-shadow':'0px 2px 3px 0px #6d6d6d', '-webkit-box-shadow':'0px 2px 3px 0px #6d6d6d', 'box-shadow':'0px 2px 3px 0px #6d6d6d'});
				}
				if(rowWidth < menuWidth){
					rowWidth = menuWidth + 24; //compensate for padding
					$subDiv.css({'border-top-right-radius':'0'});
				}				
			};
			jQuery.fn.calcLeft = function() {
				offset = $(this).offset().left + 5;
				header_offset = $('#header').offset().left;
				offset = offset - header_offset;				
			};
		})(jQuery); 
		
		$(this).calcSubWidth();
		$(this).calcLeft();
		//Set Width
		$anchor.first().animate({backgroundColor: "#82dc46", color: "#FFF"}, 300);
		$subDiv.css({'width':rowWidth,'left':offset});
	}
	
	function megaHoverOut(){ 
		var $subDiv = $(this).find("#submenu");
		var $anchor = $(this).find('a').first();
	  	$subDiv.stop().fadeTo('fast', 0, function() {
		 	$(this).hide(); 
	  	});
	  	$anchor.animate({backgroundColor: "#fff", color: "#5a5a59"}, 300)
	  	.css({'-moz-box-shadow':'0px 0px 0px 0px #fff', '-webkit-box-shadow':'0px 0px 0px 0px #fff', 'box-shadow':'0px 0px 0px 0px #fff'});
	}
 
 
	var config = {    
		 sensitivity: 50, // number = sensitivity threshold (must be 1 or higher)    
		 interval: 20, // number = milliseconds for onMouseOver polling interval    
		 over: megaHoverOver, // function = onMouseOver callback (REQUIRED)    
		 timeout: 150, // number = milliseconds delay before onMouseOut    
		 out: megaHoverOut // function = onMouseOut callback (REQUIRED)    
	};
 
	$("#nav ul li #submenu").css({'opacity':'0'});
	$("#nav ul li").hoverIntent(config);
	 
});
*/

$(function(){
	//Fadeup animation and nav slidedown animation in layout.js to place at the bottom of page for loading
	
	$("a.transition").click(function(event){
        event.preventDefault();
        linkLocation = this.href;
        if($(this).hasClass('slideNavUp')){
        	$('#dashed-line').fadeOut();
        	$('ul#submenu').slideUp(500, "easeOutCubic");
        }
        if($(this).hasClass('subPageItem')){
        	$('div#content, div#footer').animate({opacity:0}, 400, function(){
        		redirectPage();
        	});
        }else{
        	$('div#topContent, div#content, div#footer').animate({opacity:0}, 400, function(){
        		redirectPage();
       		});
        }
        
    });
 
    function redirectPage() {
        window.location = linkLocation;
    }
});
