function rcmswitch(nr)
{
	for (n = 0; n < 4; n++)
	{
		if (n == nr)
		{
			document.getElementById('rcmbox'+n).style.display = "block";

			document.getElementById('rcmlink'+n).className = "on";

			document.getElementById('rcmlink'+n).blur();
			
		}
		else
		{
			document.getElementById('rcmbox'+n).style.display = "none";

			document.getElementById('rcmlink'+n).className = "off";

		}
	}
}

		function ConfirmLink ( url )
		{
			if ( confirm('Czy jesteś pewien ?') )
			{
				window.location.href = url;
			}
		}
		
		function CancelEdit ( id )
		{
			var form = document.getElementById( 'komentarz_form_' + id );
			var obj = document.getElementById( 'komentarz_' + id );
			
			form.parentNode.removeChild(form);
			obj.style.display = 'block';
		}
		
		function vote ()
		{
			var obj = document.getElementById( 'vote_panel' );
			
			if ( obj.style.display == 'none' )
			{
				obj.style.display = 'block';
			}
			else
			{
				obj.style.display = 'none';
			}
		}
		
		function ShowEditor ( wiesc , id , page )
		{
			var obj = document.getElementById( 'komentarz_' + id );
			var obj_x = document.getElementById( 'komentarz_unparsed_' + id );
			
			// Sprawdzamy czy edytor czasem nie jest otwarty
			if ( document.getElementById( 'komentarz_form_' + id ) == null )
			{
				// Tworzymy formularz
				var form = document.createElement('form');
				var area = document.createElement('textarea');
				var submit = document.createElement('input');
				var cancel = document.createElement('input');
				var br = document.createElement('br');
				
				obj.style.display = 'none';
				
				form.id     = 'komentarz_form_' + id;
				form.method = 'POST';
	
				form.action = '?page=' + page + '&act=save&id=' + wiesc + '&koment_id=' + id;
				
				submit.type = 'submit';
				submit.value = 'Zapisz Komentarz';
	
				cancel.type = 'button';
				cancel.value = 'Anuluj';
				
				cancel.onclick = function()
					{
						CancelEdit ( id );
					}
				
				area.name  = 'komentarz';
				area.value = obj_x.innerHTML;
				area.cols  = '50';
				area.rows  = '10';
				
				// Dolaczamy elementy do formularza
				form.appendChild ( area );
				form.appendChild ( br );
				form.appendChild ( submit );
				form.appendChild ( cancel );
				
				// i formularz do strony			
				obj.parentNode.appendChild ( form );
			}
		}

		function obrazek(adres)
		{
		 	var Win = window.open ('gallery.php?obrazek=' + adres + '&b=1', Math.round(Math.random()*100), 'scrollbars=yes, menubar=no');
		}
		
		function chat()
		{
			var Win = window.open ('old/dokumenty/chat.php', "ChatBox", 'width=645, height=540, resizable=0, scrollbars=no, menubar=no, left=130, top=7');
		}
