//splash functions


	//these can be overwritten on a page by page basis
	var num_tabs = 4; //sets number of tabs
	var has_empty_tab = false; //sets whether the splash has a special tab when no tab is highlighted
	var starting_tab = 1; //sets which tab should start highlighted, if has empty tab should be set to zero
	var rotate = true; //sets whether splash rotates through each tab, if has empty tab should be set to false

	//these should not be modified
	var current_active;
	var t;


	$(document).ready(function() {

		//init
		current_active = starting_tab;

		$('.splashPanel'+current_active).show();
		if(current_active != 0)
			$('#splashTab'+current_active).addClass('active');
		
		if(rotate)
			t = setInterval("rotateTabs()",10000);

		$('.splashTabs a').mouseover(function() {
			var clickedOne = this.id.substr(9,1);
			
			if(rotate)
				clearInterval(t);

			if(clickedOne != current_active)
			{
				$('.splashPanel'+current_active).slideToggle("fast", function() {
					$('.splashPanel'+clickedOne).slideToggle("fast");
				});
				if(current_active != 0)
					$('#splashTab'+current_active).removeClass('active');
				current_active = clickedOne;
				$(this).addClass('active');
			}
		});

		$('.splashTabs a').mouseout(function() {
			if(rotate)
				t = setInterval("rotateTabs()",10000);
		});

		$('#splash').mouseleave(function() {
			
			if(!rotate)
			{
				if($('.splashTabs a').hasClass("active"))
					{
						$('.splashPanel'+current_active).slideToggle("fast", function() {
							$('.splashPanel'+starting_tab).slideToggle("fast");
						});
						$('#splashTab'+current_active).removeClass('active');
						if(!has_empty_tab)
							$('#splashTab'+starting_tab).addClass('active');
					}
					current_active = starting_tab;
			}
		});
	});
	
	//facilitates the rotation of the tabs
	function rotateTabs() {
		var newActive = current_active;

		if(++newActive > num_tabs)
			newActive = 1;
		//toggles the current active tab out
		$('.splashPanel'+current_active).slideToggle("fast", function() {
			//toggles the new active tab in
			$('.splashPanel'+newActive).slideToggle("fast");
		});
		//changes the highlighted link to the new current tab
		$('#splashTab'+current_active).removeClass('active');
		current_active = newActive;
		$('#splashTab'+newActive).addClass('active');
	}
