/*
 * jQuery client revealer
 * Copyright 2010 Bartosz Wrzask
 * Unauthorized copy &/or distribution prohibited.
 */
 
$(document).ready(function(){

		klientow=$("#cache-klient > b").size()-1;	
		wysokosc_max=550;
		wysokosc_now=0;
		klient_revealer("0");
	function klient_revealer(ident)
	{
			wysokosc_now+=$("#cache-klient > b:eq("+ident+")").attr("wys")*1;
			if(wysokosc_now>=wysokosc_max) 
				{
					$(".inner-wspolpraca > img").fadeOut(200);
					wysokosc_now=0;
					wysokosc_now+=$("#cache-klient > b:eq("+ident+")").attr("wys")*1;
					setTimeout(function(){
											$(".inner-wspolpraca > img").remove();
											$(".inner-wspolpraca").append("<img num='"+ident+"' src='"+$("#cache-klient > b:eq("+ident+")").attr("obraz")+"' style='display:none'>");
											$(".inner-wspolpraca > img[num="+ident+"]").fadeIn(500);
											setTimeout(function(){ 
																ident++;
																if(ident>klientow) ident=0;
																klient_revealer(ident); },1000);
											},200);
					
					return;
				}
				
				
			$(".inner-wspolpraca").append("<img num='"+ident+"' src='"+$("#cache-klient > b:eq("+ident+")").attr("obraz")+"' style='display:none'>");
			$(".inner-wspolpraca > img[num="+ident+"]").fadeIn(500);
			setTimeout(function(){ 
									ident++;
									if(ident>klientow) ident=0;
									klient_revealer(ident); },1000);
	}

}); //end jquery
