/**
 * @classDescription	Adds behavior logic for home page
 * @author				Kevin Sweeney
 * @version				1.0
 */

var Home = {};

// Methods _____________________________________________________________________

Home.registerEvents = function () {
	$(window).bind('scroll', Home.onWindowScroll);
	$('li', '#specialities').bind('click', Home.onSpecialtiesClick);
	$('a', '#latestProject').bind('click', Home.onFeaturedProjectClick);
};

// Event Handlers ______________________________________________________________

Home.onWindowScroll = function (e) {
	$(window).unbind('scroll', Home.onWindowScroll);
	try {
		_gaq.push(['_trackEvent', 'User Interaction', 'Scroll Page', 'Home']);
	}
	catch (e) {}
};

Home.onSpecialtiesClick = function (e) {
	
	if ($(this).hasClass('development')) {
		window.location = '/portfolio/ea/';
	}
	else if ($(this).hasClass('ux')) {
		window.location = '/portfolio/ngevents/';
	}
	else if ($(this).hasClass('design')) {
		window.location = '/portfolio/eamobile/';
	}
	
};

Home.onFeaturedProjectClick = function (e) {
	var clickSource = ($(this).find('img').length > 0) ? 'Image' : 'Link';
	try {
		_gaq.push(['_trackEvent', 'User Interaction', 'Featured Project Click', clickSource]);
	}
	catch (e) {}
};

// Initialization ______________________________________________________________

Home.initialize = function () {
	Home.registerEvents();
};

$(document).ready(Home.initialize);
