document.cookie = 'resolution=' + screen.width + 'x' + screen.height + '; expires=Fri, 1 January 2010 08:00:00 GTM;';

function col(id){ elem = document.getElementById(id); elem.style.background = "#666666"; }
function col2(id){ elem = document.getElementById(id); elem.style.background = "#999999"; }
function Active(what){ what.style.backgroundColor='#999999'; }
function NotActive(what){ what.style.backgroundColor=''; }


function char_counter(max)
{   		
	var count=0;
	var char_tmp='';
	var string_tmp_max='';
	
	form = count_form0;
	area = count_area0;
	info = count_info0;

	for (var i = 0; i < area.value.length; i++)
	{
		char_tmp = area.value.substring(i, i + 1);
		count++;
		if (count>max){ area.value=string_tmp_max; break; }
		string_tmp_max+=char_tmp;		
	}
	
	if (max-count>0)info.value=' '+(max-count);
	else info.value=' 0';
	setTimeout('char_counter('+max+')', 10);
}

function sun(form, area, info, max)
{
	count_form0 = eval(form);
	count_area0 = count_form0.elements[area];
	count_info0 = count_form0.elements[info];
	char_counter(max);
};

function set_on(id)
{
	var current_header = document.getElementById(id);
	current_header.style.color = "#990";
}

function set_off(id)
{
	var current_header = document.getElementById(id);
	var current_content = document.getElementById(id + '_content');

	if(current_content.style.display!='block'){ current_header.style.color = "#999"; }
}

function toggle(current_header_name)
{
	// tworzy obiekt ostatniego naglowka
	var last_header_inner_name = document.getElementById("last_header_name");
	
	// sprawdza czy wszystkie dzialy sa ukryte
	if(current_header_name == last_header_inner_name.innerHTML){ var close_all='TAK'; }
	else									 { var close_all=''; }
	
	// pobiera nazwe ostatniego naglowka i tworzy nazwe zawartosci
	if(last_header_inner_name.innerHTML!='')
	{ 
		var last_header_name = last_header_inner_name.innerHTML; 
		var last_content_name = last_header_inner_name.innerHTML + "_content"; 
	}
	else{ var last_header_name = "p0"; var last_content_name = "p0_content"; }
	
	// tworzy obiekty pozostalych elementow
	var last_content = document.getElementById(last_content_name);
	var last_header = document.getElementById(last_header_name);
	var current_header = document.getElementById(current_header_name);	
	var current_content = document.getElementById(current_header_name + "_content");

	// zwijanie / rozwijanie
	if(close_all!='TAK')		
	{		
		last_content.style.display = "none";
		last_header.style.color = "#999";
		
		current_content.style.display = "block";
		current_header.style.color = "#990";
	}
	else
	{
		if(last_content.style.display=="block"){ last_content.style.display = "none"; last_header.style.color = "#999"; }
		else{ last_content.style.display = "block"; last_header.style.color = "#990"; }
	}
	
	// zapisz aktualna nazwe naglowka
	last_header_inner_name.innerHTML = current_header_name;	
}


function get_users(nr,pages,sortowanie)
{
	num_val = "nr=" + nr + "&pages=" + pages + "&orderby=" + sortowanie;

	$.ajax({
		type: "POST",
		url: "USERZY/ajax_users.php",
		data: num_val,
		success: function(msg){
		//alert(msg);
		
		msg_box = document.getElementById('table');
		msg_box.innerHTML = msg;
		
		var nr_box = document.getElementById('hidden_nr');
		var nr_page =  nr_box.innerHTML;
		
		nr_page.className="active";
		}
	});
	
}


function play(id)
{
	alert('OK: ' + id);	
}