/* Javascript Document for Brandlab - Maislinger Snoli */
/*
	created by: Klaus Hoermann <klaus@3b-solutions.net>
	created for: Brandlab - Werbeagentur
	Client: ÖVP Absam
	Description: JavaScript Code for the page team.htm
	Copyright: (C) 3B-Solutions Klaus Hoermann 2010
*/

/* when the document is ready */
jQuery(document).ready(function()
{	
	//-----------------------------------------------
	// DEFINITIONS
	var startImageNumber = "05";
	
	
	// SET CURRENT LINK
	// image
	var curImageId = "#img" + startImageNumber;
	// info div
	var curInfoDiv = "#p" + startImageNumber;
	// link
	var curLink = "link" + startImageNumber;
	
	//-----------------------------------------------
	// ON PAGE LOAD
	
	// Set selected class on start li a tag
	$("#contentteammenu ul li a#" + curLink).addClass("selected");

	// At Start load the start image
	$(curImageId).animate( { left:"0px" }, 1200);
	$(curInfoDiv).animate( { left:"0px" }, 1200);
	
	
	
	//-----------------------------------------------
	// ON CLICK ON A LINK IN THE MENU
	$("#contentteammenu li a").click(function()
	{		
		// Check if selected equals current
		if(curLink != $(this).attr("id"))
		{	
			var number = $(this).attr("id").substring(4);
			var selectedImageId = "#img" + number;
			var selectedInfoDiv = "#p" + number;
			
			//console.log($(selectedInfoDiv).css("display"));
		
			// Remove selected class
			$("#contentteammenu ul li a#" + curLink).removeClass("selected");
		
			// set class to current element (this)
			$(this).addClass("selected");
		
			// animate out selected image
			$(curImageId).animate( { left:"-300px" }, 300);
		
			// animate in new selected image
			$(selectedImageId).animate( { left:"0px" }, 1200);
					
			// hide info text
			$(curInfoDiv).animate( { left:"430px" }, 300);
		
			// show new info text
			$(selectedInfoDiv).animate( { left:"0px" }, 1200);
				
			// Set current stuff
			curImageId = selectedImageId;
			curInfoDiv = selectedInfoDiv;
			curLink = $(this).attr("id");
		}
	});
});







