/* Author: Chad Holden */

$(function(){

	/* menu effects */
	$('#page_menu > ul').superfish({
		autoArrows: false,
		animation: {height:'show'},
		speed: 300,
	});

	$('#banner h3').colorizefirstword();
	$('.page_title').colorizefirsttwoword();

	$('aside > nav > ul > li:has(> ul)').addClass('parent');

	$('#banner > ul').cycle({
		fx : 'scrollHorz',
		speed : 600,
		easing : 'easeOutElastic',
		timeout: 8000,
	});
	
});


$.fn.colorizefirstword = function(){					
	return this.each(function(){						
		if(typeof $(this).text != "undefined"){			
			var text 	= $(this).html();
			var wordarr	= text.split(" ");
			wordarr[0] 	= "<span class='green'>" + wordarr[0] + "</span>";
			$(this).html(wordarr.join(" "));
		}
	});									
}

$.fn.colorizefirsttwoword = function(){					
	return this.each(function(){					
		if(typeof $(this).text != "undefined"){			
			var text 	= $(this).html();
			var wordarr	= text.split(" ");
			wordarr[0] 	= "<span class='yellow'>" + wordarr[0] + "</span>";
			wordarr[1] 	= (wordarr[1] ? "<span class='yellow'>" + wordarr[1] + "</span>" : '');
			$(this).html(wordarr.join(" "));
		}
	});									
}

