function next(w)
{
	if(w>4)
	{ 
		apear();
		w=1;
	}else{ 
		setTimeout("dissapear("+w+")",0);
		w++; 
	}
	if(w>5) setTimeout("next("+w+")",0);
	else setTimeout("next("+w+")",5000);
}
function dissapear(id) {
	$("ul#gallery li.news"+id).animate({ opacity: 1.0},10).animate({ opacity: 0.0},3000);
	$("#excerpt ul").animate({ top:"-=80"},3000);	
}

function apear() {
	$("#excerpt ul").animate({ top:"+=320"},1000);
	$("ul#gallery li.news1").animate({ opacity: 1.0},1000);		
	$("ul#gallery li.news2").animate({ opacity: 1.0},1000);		
	$("ul#gallery li.news3").animate({ opacity: 1.0},1000);		
	$("ul#gallery li.news4").animate({ opacity: 1.0},1000);		
	$("ul#gallery li.news5").animate({ opacity: 1.0},1000);		
}

$(document).ready(function() {
	initLightbox();
	setTimeout("napis()",5000);
	setTimeout("next("+1+")",5000);	
	
       	$('input, textarea').focus(function() {
       		$(this).addClass("focusinput");
    	});
    		$('input,textarea').blur(function() {
    			$(this).removeClass("focusinput");
				if(this.value != this.defaultValue){
	    			this.select();
	    		}
    			
		    if ($.trim(this.value) == ''){
			    	this.value = (this.defaultValue ? this.defaultValue : '');
				}
    		});	
					var i=0;
					var a=0;
					
							$('#bramkarz input[type="checkbox"]').click(function(){
									if ($(this).attr('checked')) 
										i++; else i--;
								
								if(i>=2) $('#bramkarz input[type="checkbox"]').attr('disabled', true);								
							});
							$('input[type="reset"]').click(function(){
								i=0;
								a=0;
								   $('input[type="checkbox"]').removeAttr('disabled');
							});			
							$('input[type="submit"]').click(function(){
								   $('input[type="checkbox"]').removeAttr('disabled');
							});								
							$('#zawodnik input[type="checkbox"]').click(function(){
									if ($(this).attr('checked')) 
										a++; else a--;
								if(a>=8) $('#zawodnik input[type="checkbox"]').attr('disabled', true);								
							});		    		
});


function napis(){
	$("#marque div").animate({left:"+=220px"},10000).animate({left:"-=220px"},10000);
	setTimeout("napis()",1000);
}		

	
