$(document).ready(function() {		
	// slideshow
	
	// video links:
	$(".videoSection .nextIsNowLinks").each(function(){										
		$(this).css({"display":"none"});	
		$(this).parent().css({"height":"28px"});		
    });
	$(".videoSection .nextIsNowLinks").eq(0).css({"display":"block"});	
	$(".videoSection").eq(0).css({"height":40+$(".videoSection .nextIsNowLinks").eq(0).height()});
	$(".videoSection").eq(0).find("img").attr("src","images/nextIsNow_header1_on.png")

	var activeSection = 0;
	$(".videoSection img").click(function() {
		$(".videoSection").eq(activeSection).find("img").attr("src",new String("images/nextIsNow_header"+Number(activeSection+1)+".png"));
		$(".videoSection").eq(activeSection).find(".nextIsNowLinks").css({"display":"none"});
		$(".videoSection").eq(activeSection).animate({ "height":"28px"}, 300);
		activeSection=$(".videoSection").index($(this).parent());
		$(".videoSection").eq(activeSection).find("img").attr("src",new String("images/nextIsNow_header"+Number(activeSection+1)+"_on.png"));
		$(".videoSection .nextIsNowLinks").eq(activeSection).delay(400).css({"display":"block"});	
		$(".videoSection").eq(activeSection).animate({"height":40+$(".videoSection .nextIsNowLinks").eq(activeSection).height()},300);		
	})
	
	
	var mySelectedVideoButton;
	// load nextIsNow Video-file:
	$(".nextVideoLink").hover(
		function() {
			$(this).css({"background-color":"#333"});
			},
		function(){
			if ($(this) == mySelectedVideoButton){
				$(this).css({"background-color":"#333"});
			}
			else {
				$(this).css({"background-color":"#666"});
			}
			if (mySelectedVideoButton!=undefined){
				mySelectedVideoButton.css({"background-color":"#333"});
			}
		}
	)
	$(".nextVideoLink").click(function() {		
		var myVideoHTML = $(this).attr("id");
		if (mySelectedVideoButton!=undefined){
			mySelectedVideoButton.css({"background-color":"#666"});
		}
		mySelectedVideoButton = $(this)
		$('.homeVideo').load(myVideoHTML);
	})
});
