// JavaScript Document




function changeTab(id){
	$(".tabContent").css("display", "none");
	$("#" + id.replace("tab", "content")).css("display", "block");
	$("#subnav LI").removeClass("active");
	$("#" + id).parent().addClass("active");
	$("#en").attr("href", "../en/material.php?show=" + id.replace("tabMaterial", ""));
	$("#de").attr("href", "../de/material.php?show=" + id.replace("tabMaterial", ""));
	$("#ru").attr("href", "../ru/material.php?show=" + id.replace("tabMaterial", ""));	
}


jQuery().ready(function(){
	
	$("#subnav LI A, #contentMaterialOverview A").click( function(){ changeTab($(this).attr("id")); });
	if($("#tabActive").attr("value")){
		if($("#tabActive").attr("value") != "Overview"){ changeTab("tabMaterial" + $("#tabActive").attr("value")); }
	}

	$(".thumbnailsContainer DIV").click( function(){
	  
	  $(".thumbnailsContainer DIV").removeClass("active");
	  $(this).addClass("active");

	  var objShow = $(this).attr("id").replace("thumb", "pic");

	  $("#stage .active").fadeOut("fast", function(){
	    $(this).removeClass("active");
	    $("#stage #" + objShow).fadeIn("fast");
      $("#" + objShow).addClass("active");
	  });  
	});
	
	$("#thumbs DIV").click( function() {
		$("#thumbs .active").removeClass("active");
		$(this).addClass("active");
		$("#images DIV").removeClass("active").hide();
		
		$("#images .active").fadeOut("medium");
		$("#img" + $(this).attr("id").replace("thumb", "")).fadeIn("medium");
	});
	
	$(".info").hover(
		function(){ $(this).children("IMG").show(); },
		function(){ $(this).children("IMG").hide(); }
	);	
								 
});


