﻿function initPersonen() {
	$(".teammitglied .person").each(function (index,element) {
		$(element).attr("id","person_" +index);
		$(element).find("h1").attr("id","h1_" +index);
		$(element).hide();
	});

	// Create list of persons
	$(".person h1, .person h2, .person h3").each(function(i) {
    	var current = $(this);
	    current.attr("id", "title_" + i);
	    $(".container").append("<li id='link" + i + "'>" + current.html() + "</li>");
		});
		// Loop over each element.
		$( ".container li" ).each(
	 	// For each link, run this code. The "indIndex" is the
		// loop iteration index on the current element.
		function( intIndex ){
			// Bind the onclick event to simply alert the
			// iteration index value.
				$( this ).bind (
				"mouseover",
					function(){
						$(".person").hide();
						$("#person_"+intIndex).show();
					}); // mouseoverfunction
				}); // bind

				
				
			// Show the first element by default
			$("#person_0").show();
}