/* Author: 	brett ohland
			hello@brettohland.com
*/

$(document).ready(function() {
	// Activate waypoints!
	$('article').waypoint(function(event, direction){
		var current = (direction === 'up') ? $(this).prev() : $(this)
		colorChanger.changeColor($(current.children()[0]).css('color'))
	},{ offset:'25%' })
});
// Stop clutting up the global namespace
var colorChanger = {
	changeColor : function(rgbTarget){
		$('h1').find('a')
			.stop() // Stops a visual glitch with the Waypoint plugin
			.animate({color: rgbTarget}, 500)
	}
}
