/* Otwieranie mierzonych okien */
function NewWindow(mypage,myname,w,h,scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+', width='+w+', top='+wint+', left='+winl+', scrollbars='+scroll+', resizable';
	win = window.open(mypage,myname,winprops);
	if (parseInt(navigator.appVersion) >= 4) {
		win.window.focus();
	}
}

/* posrancy */
var checkflag = 'false';
function check(field) {
	if(checkflag == 'false') {
		for(i = 0; i < field.length; i++) {
			field[i].checked = true;
		}
		checkflag = 'true';
	} else {
		for(i = 0; i < field.length; i++) {
			field[i].checked = false;
		}
		checkflag = 'false';
	}
}

/* czatka gawędziarza */
function shoutbox_update_online (towhat) {
	document.getElementById('onlinelist').innerHTML = towhat;
}

function shoutbox_add_message (what) {
	document.getElementById('msglist').innerHTML += what;
}

function shoutbox_send_message (msg) {
	clearTimeout(interv);
	document.getElementById('here').src = 'shoutbox.php?raw&after='+time+'&msg='+encodeURIComponent(msg);
	document.getElementById('msg').value = '';
}

function shoutbox_refresh () {
	clearTimeout(interv);
	document.getElementById('here').src = 'shoutbox.php?raw&after='+time;
}

function shoutbox_trigger_alert (alertmsg) {
	document.getElementById('alert').innerHTML = alertmsg + '<br />';
}

function shoutbox_update_time (time_n) {
	time = time_n;
}

/* odkoduj overliba */
function ovldc(str) { //js ssie -- musze mu dac wyrazenia regularne zeby zrozumial :/
	str = str.replace(/\[LT\]/g, '<');
	str = str.replace(/\[GT\]/g, '>');
	str = str.replace(/\[SQ\]/g, "'");
	str = str.replace(/\[DQ\]/g, "\"");
	str = str.replace(/\[NL\]/g, "\n");
	str = str.replace(/\[TB\]/g, "\t");
	str = str.replace(/\[BS\]/g, '\\');

	return overlib(str);
}
function doscreen(titlev, content) {
	win = document.getElementById('internalwin');
	win.style.visibility = 'visible';
	win.innerHTML = '<div class="iwtitle">'+titlev+'<a href="javascript:void(0)" onclick="rmscreen();" class="iwclick">X</a></div><div class="iwcontent">'+content+'</div>';
}
function rmscreen() {
	win = document.getElementById('internalwin');
	win.style.visibility = 'hidden';
	win.innerHTML = '';
}
