// ikonka v poste / zmena ikonky
function ChangePostIco()
{
		document.discussion.nickto.value = document.discussion.nickto.value.toUpperCase();
		document.getElementsByName("ico").item(0).src = "./img/ico/" + document.discussion.nickto.value.toLowerCase() + ".gif";
}

// zmena ikonky
function ChangeName(nick)
{
		document.discussion.nickto.value = nick;
		ChangePostIco();
}

// online - pritel
function gotopost(form)
{
		pozice = form.online.selectedIndex;
  	kam = "./main.php?goto=post&user=" + form.online[pozice].value;

		if (pozice > 1)
				window.open(kam, "_top");
}

// lista jako select
function gotolista(form)
{
  	pozice = form.lista.selectedIndex;
  	kam = form.lista[pozice].value;

		if (pozice > 1)
				window.open(kam, "_top");
}

// kluby v kategorii, new, live
function gotocategory(form, go)
{
  	pozice = form.category.selectedIndex;
  	kam = "./main.php?goto=" + go + "&idcategory=" + form.category[pozice].value;

		if (pozice > 0)
				window.open(kam, "_top");
}

// stat - user
function gotostatuser(form)
{
  	pozice = form.statuser.selectedIndex;
  	kam = "./main.php?goto=stat&stat=" + form.statuser[pozice].value;

		if (pozice > 1)
				window.open(kam, "_top");
}

// stat - discussion
function gotostatdiscussion(form)
{
  	pozice = form.statdiscussion.selectedIndex;
  	kam = "./main.php?goto=stat&stat=" + form.statdiscussion[pozice].value;

		if (pozice > 1)
				window.open(kam, "_top");
}

// stat - server
function gotostatserver(form)
{
  	pozice = form.statserver.selectedIndex;
  	kam = "./main.php?goto=stat&stat=" + form.statserver[pozice].value;

		if (pozice > 1)
				window.open(kam, "_top");
}

// CTRL + ENTER
function KeybControl(kl)
{
  	var klCtrl = false;
		var kodKl;

  	if (kl == false)
    		var kl = window.event;

  	if (kl.ctrlKey == true)
    		klCtrl = true;

  	if (kl.keyCode)
    		kodKl = kl.keyCode;
  	else
    		if (kl.which)
      		kodKl = kl.which;

  	if (kodKl == 10 || (klCtrl == true && kodKl == 13))
    		document.forms[1].send.click();
}

// zmena cesty k css
function skinchng()
{
  	var skin = document.forms[1].csslist.value;
  	document.forms[1].csslist.selectedIndex = 0;
  	document.forms[1].ncss.value = skin;
}

// odpoved na prispevek
function Reply(reply)
{
		document.discussion.msg.focus();
  	document.discussion.msg.value += reply;
}

// vlozi smailika
function Smile(xsmile)
{
		document.discussion.msg.focus();
		document.discussion.msg.value += xsmile;
}

// otevreni noveho okna browseru
function OpenNewWindow(zdroj, nazev)
{
  	Woknows = window.open(zdroj, nazev, 'toolbar=no, menubar=no, location=no, directories=no, scrollbars=yes, resizable=no, status=no, width=500, height=400, top=0, left=0');

		return false;
}

// otevreni odkazovane stranky internetu
function OpenNewPage(zdroj, nazev)
{
  	Podes = window.open(zdroj, nazev, 'toolbar=yes, menubar=yes, location=yes, directories=yes, scrollbars=yes, resizable=yes, status=yes, width=620, height=460, top=0, left=0');

		return false;
}

// clock
function Clock()
{
		var Hour = eval(document.getElementById("ClockHour").innerHTML);
		var Minute = eval(document.getElementById("ClockMinute").innerHTML);
		var Second = eval(document.getElementById("ClockSecond").innerHTML);

		Second += 1;

		if (Second == 60)
		{
				Second = 0;
				Minute += 1;

				if (Minute == 60)
				{
						Minute = 0;
						Hour += 1;

						if (Hour == 24)
								Hour = 0;

  					if (Hour < 10)
		      			Hour = "0" + Hour;

						document.getElementById("ClockHour").innerHTML = Hour;
				}

  			if (Minute < 10)
      			Minute = "0" + Minute;

				document.getElementById("ClockMinute").innerHTML = Minute;
		}

  	if (Second < 10)
	     	Second = "0" + Second;

		document.getElementById("ClockSecond").innerHTML = Second;

  	setTimeout(Clock, 1000);
}

function ClockStart()
{
  	setTimeout(Clock, 1000);
}

// piskvorky
////////////

// otevre okno s hrou
function Part(idpart)
{
		var add = 'directories=no, location=no, menubar=no, resizable=no, scrollbars=yes, status=no, toolbar=no, width=680, height=530';

		window.open('./games/piskvorky/part.php?goto=games&idpart=' + idpart, idpart, add);
}