//jQuery marquee init
$(function () {
	$('div#marquee p').text('Klub Sportowy Stal Pleszew realizuje ustawowe zadania samorządu gminnego w zakresie krzewienia kultury fizycznej i sportu wśród dzieci i młodzieży, dotowane przez Urząd Miasta i Gminy w Pleszewie.');
	$('div#marquee div').marquee();
});

//jQuery scrollable init
$(function() {
	$("#box_tabela").scrollable();
	$("#box_wyniki").scrollable();
});

//jQuery colorbox init
$(document).ready(function(){
	$("a[rel='cbox']").colorbox();
});

$(function(){
	$('div#top_menu input').click(function() {
		if($(this).attr('value')=="wpisz szukaną frazę") {
			$(this).attr('value',"");
		}
	});
});

function slideshow(zm) {
	var il = $("div#top_logo img.swf").length;
	if(zm >= il) zm = 0;
	$("img.swf").each(	function() {
		if(zm == $(this).index()-2) {
			$(this).fadeIn(2000);
		}
		else {
			$(this).fadeOut(2000);
		}
	});
	setTimeout("slideshow(" + (zm+1) + ");", 5000);
}

/* STALARY */
$(function(){
	$('#stalary_typowanie a').click(function() {
		var id=$(this).attr('rel');
		var typ=$(this).attr('href');
		var current = $('#stalary_typowanie input[name="typ['+id+']"]').attr('value');
		$('#stalary_typowanie a[rel="'+id+'"]').attr('class', '');
		if(current==typ) {
			$('#stalary_typowanie input[name="typ['+id+']"]').attr('value', -1);
		}	
		else {
			$('#stalary_typowanie input[name="typ['+id+']"]').attr('value', typ);
			$(this).attr('class', 'active');
		}	
		return false;
	});
});
