jQuery(document).ready(function()
{
	//Suckerfish with JQuery twist
	jQuery("#mainMenu li").hover(
		function(){ 
			jQuery(this).addClass("sfhover");
		},
		function(){ 
			jQuery(this).removeClass("sfhover");
		}
	);
	
	//Suckerfish for main menu
	/*var sfEls = document.getElementById("mainMenu").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}*/
	
	// Home Page functions
	if(jQuery("body.home").length != 0){
		
		// Step Carousel
		stepcarousel.setup({
			galleryid: 'slider', //id of carousel DIV
			beltclass: 'sliderbelt', //class of inner "belt" DIV containing all the panel DIVs
			panelclass: 'textwidget', //class of panel DIVs each holding content
			autostep: {enable:true, moveby:1, pause:8000},
			panelbehavior: {speed:500, wraparound:true, persist:false},
			defaultbuttons: {enable: false},
			contenttype: ['inline'], //content setting ['inline'] or ['ajax', 'path_to_external_file']
			panelWidth: 873 // Hardcoding the width since sometimes the CSS isn't loaded in time for dynamic query and it messes up the carousel
		})
	}
	
	// Table formatting needed
	if(jQuery(".table-col-template div.supply").length != 0){
		// Add odd rows class
		jQuery("table tr:nth-child(odd)").addClass("oddRow");
		
		// Add even rows class
		jQuery("table tr:nth-child(even)").addClass("evenRow");
		
		// Add classes for 2nd and 3rd column cells
		jQuery("div.supply td:first-child").addClass("labelCol");
		jQuery("div.supply td:nth-child(2), div.supply td:nth-child(3)").addClass("entryCol");
	}
	
	// Remove top margin on page title
	if(jQuery(".storycontent h2").length != 0){
		// Add class to first h2
		jQuery(".storycontent h2:first").addClass("pageTitle");
	}
	
	// Remove right margin on last footer col
	jQuery("#footerCols li:last-child").addClass("lastitem");
	
	// FAQ
	if(jQuery(".question").length != 0){
		
		jQuery(".question").hover(
			function(){ 
				jQuery(this).addClass("hover");
			},
			function(){ 
				jQuery(this).removeClass("hover");
			}
		);
		
		jQuery(".question").click(
			function(){
				jQuery(this).next(".answer").slideToggle("def");
				jQuery(this).toggleClass("open");
			}
		);
	}
});
