$(document).ready(function() {
	//Wyświetla paging I aktywuje jego pierwszy link
$(".paging").show();
$(".paging a:first").addClass("active");
 
//Pobiera rozmiar obrazków oraz ich ilość i na tej podstawie definiuje rozmiar warstwy image_reel.
var imageWidth = $(".window").width();
var imageSum = $(".image_reel img").size();
var imageReelWidth = imageWidth * imageSum;
 
//Definiuje nowy rozmiar warstwy image_reel
$(".image_reel").css({'width' : imageReelWidth});
 
//Paging  and Slider Function
rotate = function(){
    var triggerID = $active.attr("rel") - 1; //Pobiera liczbę przesunięć
    var image_reelPosition = triggerID * imageWidth; //Definiuje odległość o jaką musi przesunąć się imege_reel 
 
    $(".paging a").removeClass('active'); //czyści wszystkie aktywne klasy
    $active.addClass('active'); 
    //Slider Animation
    $(".image_reel").animate({
        left: -image_reelPosition
    }, 500 );
 
}; 



//Rotation  and Timing Event
rotateSwitch = function(){
    play = setInterval(function(){ 
        $active = $('.paging a.active').next(); 
        if ( $active.length === 0) { 
            $active = $('.paging a:first');
        }
        rotate(); 
    }, 7000); //Czas pomiędzy przesunięciami (7 sekund)
};
 
rotateSwitch(); 
 
 
//Akcja po najechaniu kursorem na slider
$(".image_reel a").hover(function() {
    clearInterval(play); //Zatrzymuje rotacje
}, function() {
    rotateSwitch(); //Podejmuje na nowo liczenie czasu
});	
 
//Po kliknięciu
$(".paging a").click(function() {
    $active = $(this); 
    //Reset timera
    clearInterval(play); //Zatrzymuje rotacje
    rotate(); 
    rotateSwitch(); // Wznawia rotacje
    return false; 
});
 

	$('.blue').colorTip();










 
});
