$(function() {
	$('#js li span').click(function(){
	
					if ($(this).attr('rel')=='rozwin')
						{
							//$('div[rel="program_'+$(this).attr('rel')+'"]').fadeIn(150);
							$('ul[name="'+$(this).attr('name')+'"]').animate({height: 'toggle'}, 600);

							$(this).attr('rel','zwin');
							$(this).parent().css('background','url(../img/ua.png) no-repeat bottom');
							//$('span[rel="program_'+$(this).attr('rel')+'"]').html('&#8743;');
						}
					else if ($(this).attr('rel')=='zwin')
						{
							//$('div[rel="program_'+$(this).attr('rel')+'"]').fadeIn(150);
							$('ul[name="'+$(this).attr('name')+'"]').animate({height: 'toggle'}, 600);

							$(this).attr('rel','rozwin');
							$(this).parent().css('background','url(../img/da.png) no-repeat bottom');
							//$('span[rel="program_'+$(this).attr('rel')+'"]').html('&#8743;');
						}	
						
				});



});

    $(function() {
        $('a[@rel*=lightbox]').lightBox();
    });
		
		
function get_partners(counter) {
	id = parseInt($('input[name="'+counter+'"]').val());
	//if (id<$('input[name="ile"]').val()) ids=id;
	//else ids=0;
	
	//$('#partnerzy').fadeOut(200);
	//$('#partnerzy').fadeIn(200, function(){ 
				laduj('#partnerzy','partnerzy','nr='+id);
	//		});
	//$('#partnerzy').fadeIn(200);

	
	
	if ((id+1)<$('input[name="ile"]').val()) $('input[name="'+counter+'"]').val(id+2);
	else $('input[name="'+counter+'"]').val(0);
}
function laduj(blok,plik,dane) {
	$.ajax({
	
		type: 'POST',
		url: plik+".php",
		cache: false,
		data: dane,
		beforeSend: function(html){
      $(blok).html('<br /><center><img src="../../img/loading.gif" /></center>');
		},
		error: function(html){
      $(blok).html('<div class="laduj_plik"> error </div>');
		},
		success: function(html){
      $(blok).html(html);
		}
	});
}
