// JavaScript Document

/*
 * Calculates the height of the content div
 */
	function SET_CONTENT_HEIGHT(pageHeader) {
		var windowHeight = jQuery(window).height();
		var contentHeight = jQuery('#contentOuterWrapper').height();
		var menuHeight = jQuery("#menuWrapper").height();
		var newContentHeight = windowHeight - 226;
		
		if (jQuery("#contentInnerWrapper").height() > jQuery("#menuWrapper").height()) {
			if (contentHeight < windowHeight) {
				jQuery('#contentOuterWrapper').height(newContentHeight);
			}
			else {
				jQuery('#contentOuterWrapper').height('auto');		
			}
		
			var newMenuHeight = jQuery('#contentOuterWrapper').height();
			// Set Menu Height To Match Content
			jQuery('#menuWrapper').height(newMenuHeight);
			jQuery('#firstgaragedoorsblog').height(newMenuHeight - 50);
			
		}
		else {
			if (menuHeight < newContentHeight) {
				jQuery('#contentOuterWrapper').height(newContentHeight);
				
				var newMenuHeight = jQuery('#contentOuterWrapper').height();
				// Set Menu Height To Match Content
				jQuery('#menuWrapper').height(newMenuHeight);
				jQuery('#firstgaragedoorsblog').height(newMenuHeight - 50);
			}
			else {
				jQuery('#contentOuterWrapper').height(menuHeight);
				var newMenuHeight = jQuery('#contentOuterWrapper').height();
				jQuery('#firstgaragedoorsblog').height(newMenuHeight - 50);	
			}
		}
		
		// Set Page Header Height
		jQuery('#pageHeaderContainer').height(jQuery('#' + pageHeader).height() + 223);
	}
	
	
/*
 * Menu Animation
 */
	function MENU_ANIMATION(){
	jQuery('.menuLinkHover a')
		.css( {backgroundPosition: "-220px 0"} )
		.mouseover(function(){
			jQuery(this).stop().animate({backgroundPosition:"(0 0)"}, {duration:500})
		})
		.mouseout(function(){
			jQuery(this).stop().animate({backgroundPosition:"(-220px 0)"}, {duration:500, complete:function(){
				jQuery(this).css({backgroundPosition: "-220px 0"})
			}})
		})
	}


/*
 * Calculates the height of the shadow down the side
 */
	function SHADOW_HEIGHT(){
		var shadowHeight = jQuery('#contentOuterWrapper').height() + jQuery('#headerWrapper').height() + jQuery('#footerWrapper').height() + 53;
		
		jQuery('#shadowLeft, #shadowRight').height(shadowHeight);
	}
	
/*
 * Removes margins
 */
 	function MARGINS(){	
		jQuery('.productAnimationHome:last').css({'margin-right' : '0px'});
		jQuery('.serviceWrapper:last').css({'margin-right' : '0px'});
	}
	
/*
 * Product Accordion
 */	
	function ACCORDION(){	
		jQuery('#accordionMenu').easyAccordion({ 
		   autoStart: true,
		   slideInterval: 4000,
		   slideNum: false
		});
	}
