// TODO: this needs to be refactored. There are TONS of functions to handle simple rollover and active states

function initializeBannerControls() {
	//Banner Scroll Controls (Rollover functions)
	$("a.about").mouseover(function () {$("a.about img").css("background-position","0px 0px");});
	$("a.about").mouseout(function () {
		//only remove the highlighted state if this is NOT the active tab
		if (!$("a.about img").hasClass("thisIsHighlighted")) {
			$("a.about img").css("background-position","0px -21px");
		}
	});
	$("a.contact").mouseover(function () {$("a.contact img").css("background-position","0px 0px");});
	$("a.contact").mouseout(function () {
		//only remove the highlighted state if this is NOT the active tab
		if (!$("a.contact img").hasClass("thisIsHighlighted")) {
			$("a.contact img").css("background-position","0px -21px");
		}
	});

	$("a.subscribe").mouseover(function () {$("a.subscribe img").css("background-position","0px 0px");});
	$("a.subscribe").mouseout(function () {
		//only remove the highlighted state if this is NOT the active tab
		if (!$("a.subscribe img").hasClass("thisIsHighlighted")) {
			$("a.subscribe img").css("background-position","0px -21px");
		}
	});

//Banner Scroll Controls (Click Functions)
	$("a.about").click(function () { 
		var api = $("div.banner:first").scrollable(); 
		if(api.getIndex() == 1) {
			api.begin();
			//remove class .selected
			$("a.about img").css("background-position","0px -21px");
			$("a.about img").removeClass("thisIsHighlighted");
		} else {
			api.seekTo(1);
			//add class .selected
			$("a.about img").css("background-position","0px 0px");
			$("a.about img").addClass("thisIsHighlighted");
			$("a.contact img").css("background-position","0px -21px"); $("a.contact img").removeClass("thisIsHighlighted");
			$("a.subscribe img").css("background-position","0px -21px"); $("a.subscribe img").removeClass("thisIsHighlighted");
		}
		return false;
	});
	$("a.contact").click(function () { 
		var api = $("div.banner:first").scrollable(); 
		if(api.getIndex() == 2) {
			api.begin()
			$("a.contact img").css("background-position","0px -21px");
			$("a.contact img").removeClass("thisIsHighlighted");
		} else {
			api.seekTo(2);
			$("a.contact img").css("background-position","0px 0px");
			$("a.contact img").addClass("thisIsHighlighted");
			$("a.about img").css("background-position","0px -21px"); $("a.about img").removeClass("thisIsHighlighted");
			$("a.subscribe img").css("background-position","0px -21px"); $("a.subscribe img").removeClass("thisIsHighlighted");
		}
		return false;
	});
	$("a.subscribe").click(function () { 
		var api = $("div.banner:first").scrollable(); 
		if(api.getIndex() == 3) {
			api.begin()
			$("a.subscribe img").css("background-position","0px -21px");
			$("a.subscribe img").removeClass("thisIsHighlighted");
		} else {
			api.seekTo(3);
			$("a.subscribe img").css("background-position","0px 0px");
			$("a.subscribe img").addClass("thisIsHighlighted");
			$("a.about img").css("background-position","0px -21px"); $("a.about img").removeClass("thisIsHighlighted");
			$("a.contact img").css("background-position","0px -21px"); $("a.contact img").removeClass("thisIsHighlighted");
		}
		return false;
	});
}//end function initializeBannerControls()