	var loaded=[0,0,0,0,0,0,0,0,0];
	
	function myswitch(caller, myitem)
	{
		
		$('.myswitch_item').hide();
		$("#myswitch_item_" + myitem).show();

		$('.myswitch_button').addClass('tlo_myswitchbutton_p');
	    	$("#myswitch_button_" + myitem).removeClass('tlo_myswitchbutton_p');

		$('.myswitch_button').removeClass('tlo_myswitchbutton_a');
	    	$("#myswitch_button_" + myitem).addClass('tlo_myswitchbutton_a');

		if (myitem=='chat') $("#chat_read").animate({ scrollTop: $("#chat_read").attr("scrollHeight") }, 1000);

	}

	function game_switch(caller, myitem)
	{
		
		$('.game_item').hide();
		$("#game_item_" + myitem).show();

		$("#game_button_img_dziennik").attr('src','gfx/game/buttons/button_dziennik.png');
		$("#game_button_img_warsztat").attr('src','gfx/game/buttons/button_warsztat.png');
		$("#game_button_img_budynki").attr('src','gfx/game/buttons/button_budynki.png');
		$("#game_button_img_paczki").attr('src','gfx/game/buttons/button_paczki.png');
		$("#game_button_img_ogrod").attr('src','gfx/game/buttons/button_ogrod.png');
		$("#game_button_img_billboard").attr('src','gfx/game/buttons/button_billboard.png');
		$("#game_button_img_bazar").attr('src','gfx/game/buttons/button_bazar.png');
		$("#game_button_img_domek_komandosa").attr('src','gfx/game/buttons/button_domek_komandosa.png');

	    	$("#game_button_img_" + myitem).attr('src','gfx/game/buttons/button_'+myitem+'_c.png');

	}

	function konto_switch(caller, myitem)
	{
		
		$('.konto_item').hide();
		$("#konto_item_" + myitem).show();

		$('.konto_button').addClass('tlo_game_button_p');
	    	$("#konto_button_" + myitem).removeClass('tlo_game_button_p');

		$('.konto_button').removeClass('tlo_game_button_a');
	    	$("#konto_button_" + myitem).addClass('tlo_game_button_a');

	}

	function jak_switch(caller, myitem)
	{
		
		$('.jak_item').hide();
		$("#jak_item_" + myitem).show();

		$('.jak_button').addClass('tlo_jak_button_p');
	    	$("#jak_button_" + myitem).removeClass('tlo_jak_button_p');

		$('.jak_button').removeClass('tlo_jak_button_a');
	    	$("#jak_button_" + myitem).addClass('tlo_jak_button_a');

	}

	function refresh_part(refresh_item, with_item)
	{

		$(refresh_item).fadeOut('slow');
		$(refresh_item).load(with_item);
		$(refresh_item).delay(1500).fadeIn('slow');

	}


	function refresh_part_instant(refresh_item, with_item)
	{

		$(refresh_item).load(with_item);

	}


	function refresh_part_once(refresh_item, with_item)
	{
		var i;
		if (refresh_item==document.getElementById('piramida_load')) 	i=1;
		if (refresh_item==document.getElementById('katalog_load')) 	i=2;
		if (refresh_item==document.getElementById('wiadomosci_load')) 	i=3;
		if (refresh_item==document.getElementById('wydarzenia_load')) 	i=4;
		if (refresh_item==document.getElementById('kabel_load'))	i=5;
		if (refresh_item==document.getElementById('reklamy_load')) 	i=6;
		
		if (loaded[i]!=1)
		{
			$(refresh_item).load(with_item);
			loaded[i]=1;
		}
	}

    	function appear(e)
    	{
    		$(e).delay(10000).fadeIn("slow");
	}


    	function opis_appear(e)
    	{

		$('.opis_surowiec').hide();
    		$(e).fadeIn(500);
	}

    	function opis_disappear(e)
    	{
    		$(e).fadeOut(500);
	}

	function trimAll(sString)
	{
		while (sString.substring(0,1) == ' ')
		{
			sString = sString.substring(1, sString.length);
		}

		while (sString.substring(sString.length-1, sString.length) == ' ')
		{
			sString = sString.substring(0,sString.length-1);
		}
		return sString;
	} 





