var landing = function(){

	this.initHover();
	this.initTabs();
	this.initImgHover();

}

landing.prototype.initHover = function(){

	$('span.sprite').css({'opacity': '0'});

	$('.BigLEModule, .smallLEModule').bind('mouseenter', function(){
		$(this).find('span.sprite').animate({'opacity': '1'}, 'fast');

		//switch icon color
		var icon = $(this).find('img.square').attr("src");
		icon = icon.split('_')[0];
		icon += '_purple.gif';
		$(this).find('img.square').attr("src", icon);

	}).bind('mouseleave', function(){
		$(this).find('span.sprite').animate({'opacity': '0'}, 'fast');

		//switch icon color
		var icon = $(this).find('img.square').attr("src");
		icon = icon.split('_')[0];
		icon += '_gray.gif';
		$(this).find('img.square').attr("src", icon);
	});

}

landing.prototype.initTabs = function(){

	$('.smallTabs li.inactive').live('click', function(){
		var type = this.id.split('_')[0];
		var typeID = this.id.split('_')[1];

		if(type == 'fe'){
			$('#featuredEducation ul li').attr('class', 'inactive');
			$('#' + this.id).attr('class', 'active');

			$('#featuredEducation .featEventsDiv').attr('class', 'featEventsDiv tabOff');
			$('#div_fe_' + typeID).attr('class', 'featEventsDiv tabOn');

		}else if(type == 'il'){
			$('#interactiveLearning ul li').attr('class', 'inactive');
			$('#' + this.id).attr('class', 'active');

			$('#interactiveLearning .interactiveLearningDiv').attr('class', 'interactiveLearningDiv tabOff');
			$('#div_il_' + typeID).attr('class', 'interactiveLearningDiv tabOn');
		}
	})
}

landing.prototype.initImgHover = function(){

	$('div.imgHolder img').bind('mouseover', function(){
		console.log(this);
		$('div.sectionTitle').empty().html(this.title);
		$('p.sectionText').empty().html($(this).attr('text'));
	});

}

$(document).ready(function(){
	landingJS = new landing();
});