// JavaScript Document


$(document).ready(function(){

	$(document).pngFix();

	$(function() {
		$('a.lightbox').lightBox();
	});	

    $("#nav-one li").hover(
        function(){ $("ul", this).fadeIn("fast"); }, 
        function() { } 
    );
    if (document.all) {
        $("#nav-one li").hoverClass ("sfHover");
    }

});

$.fn.hoverClass = function(c) {
    return this.each(function(){
        $(this).hover( 
            function() { $(this).addClass(c);  },
            function() { $(this).removeClass(c); }
        );
    });
};  


function changeSlajd(i) {
	$('.buttonsLine a').removeClass();
	$('#changeSlajd_'+i).addClass("act");
	
	$('.slajdSwapper').hide();
	$('#slajd_'+i).fadeIn(200);
	
}

function slajdSwapper(ilosc) {
	var aktualny = $('.slajdSwapper:visible').attr("id");
	var id = aktualny.split('_');
	id = parseInt(id[1]);
	if(id+1>ilosc) {
		var next = 1;
	} else {
		var next = id+1;
	}
	//alert(id+' -> '+next);
	changeSlajd(next);
	
	setTimeout("slajdSwapper("+ilosc+")",10000);
	
}

function changeNews(i) {
	$('.buttonsLineNews a').removeClass();
	$('#changeNews_'+i).addClass("act");
	
	$('.newsSwapper').hide();
	$('#news_'+i).fadeIn(200);
	
}
function slajdSwapperNews(ilosc) {
	var aktualny = $('.newsSwapper:visible').attr("id");
	var id = aktualny.split('_');
	id = parseInt(id[1]);
	if(id+1>ilosc) {
		var next = 1;
	} else {
		var next = id+1;
	}
	//alert(id+' -> '+next);
	changeNews(next);
	
	setTimeout("slajdSwapperNews("+ilosc+")",15000);
	
}
