function loadRotatorData()
{
	$("#rotator-n1 img").attr("src", thumb[1]);	
	$("#rotator-n1 b").html(title[1]);	
	$("#rotator-n2 img").attr("src", thumb[2]);	
	$("#rotator-n2 b").html(title[2]);	
	$("#rotator-n3 img").attr("src", thumb[3]);	
	$("#rotator-n3 b").html(title[3]);	
	$("#rotator-n4 img").attr("src", thumb[4]);	
	$("#rotator-n4 b").html(title[4]);	
	$("#rotator-n5 img").attr("src", thumb[5]);	
	$("#rotator-n5 b").html(title[5]);		
}

// funkcja rotująca
function tickRotator(id){
	loadRotatorData();
	$("#rotator-right div").removeClass("rotator-active");
	$("#rotator-n" + id).addClass("rotator-active");
	$("#rotator-left").attr("href", link[id]);
	$("#rotator-left img").attr("src", pic[id]);
	$("#rotator-left div b").html(title[id]);
	$("#rotator-left div u").html(intro[id]);	
}
$(document).ready(function() {
// wysuwanie warstwy z zajawką
	$("#rotator-left").hover(function() {
		$("#rotator-left div").stop().animate({top: '75px'}, function() {
		});
	} , function() {
		$("#rotator-left div").stop().animate({top: '200px'});
	});
	
// przełączanie zakładki na hoverze
	$("#rotator-right div").hover(function() {
		var id = this.id.replace('rotator-n', "");
		$("#rotator-tab").val(id);		
		tickRotator(id);
	});
	
// pauzowanie rotatora na hoverze
	$("#rotator").hover(function() {
		$("#rotator-pause").val("1", function() {
		});
	} , function() {
		$("#rotator-pause").val("0");
	});
	
});

// automatyczne rotowanie
setInterval(function(){
	var tab = $("#rotator-tab").val();
	
	if ($("#rotator-pause").val() < 1)
	{
		if (tab < 5){
			tab = parseInt(tab) + 1;
		}
		else{
			tab = 0;
		}
		tickRotator(tab);
		$("#rotator-tab").val(tab);
	}
},7000); // timeout

