<!--
// Eventy myši
defaultStatus = lng_DefStat;

function SetClass(id , nclass) {
document.getElementById(id).className = nclass;
}

// Modul NEWS
var cntid = "";

function showc(id) {
if (document.getElementById(id).style.display == "none"){
var cnt_load = document.getElementById("sf2id_" + id).innerHTML;
if (cnt_load == lng_Loading + "...") {
SF2_Loader('main.php?exec=' + sys_path_modules + '/news.php&show=com&c=' + id , 'common' , 'sf2id_' + id);
}
document.getElementById(id).style.display = "inline";
if (document.getElementById(id + "_cnt").innerHTML == lng_news_Komentare + " (0)") {
addcom(id);
}
}
else {
document.getElementById(id + "_2").style.display = "none";
document.getElementById(id + "_1").style.display = "inline";
document.getElementById(id).style.display = "none";
}
}

function addcom(id) {
cntid = id;
document.getElementById(id + "_1").style.display = "none";
document.getElementById(id + "_2").style.display = "inline";
document.getElementById("form_" + id + "_text").select();
document.getElementById("form_" + id + "_text").focus();
SF2_Hop("nc" + id);
}

function sendcom(id) {
if (document.getElementById("form_" + id + "_jmeno").value != "" && document.getElementById("form_" + id + "_text").value != "") {
SF2_AddToForm("news_id" , id);
document.getElementById("form_" + id + "_text").value = nl2br_12(document.getElementById("form_" + id + "_text").value);
SF2_SendForm("form_" + id , sys_path_modules + "/news.php" , "sendcomment" , "sf2id_main");
}
else {
SF2_Alert(lng_news_NelzePridat);
}
}

function SendComment(id) {
if (document.getElementById("form_" + id + "_jmeno").value != "" && document.getElementById("form_" + id + "_text").value != "") {
SF2_AddToForm("news_id" , id);
document.getElementById("form_" + id + "_text").value = nl2br_12(document.getElementById("form_" + id + "_text").value);
SF2_SendForm("form_" + id , sys_path_modules + "/news.php" , "sendcomment&show=" + id , "sf2id_main");
}
else {
SF2_Alert(lng_Msg);
}
}

// Modul MSG
function SendMsg() {
if (document.getElementById("msg_jmeno").value != "" && document.getElementById("msg_email").value != "" && document.getElementById("msg_predmet").value != "" && document.getElementById("msg_vzkaz").value != "") {
SF2_SendForm("msg" , sys_path_scripts + "/actions.php" , "sendmsg" , "");
}
else {
SF2_Alert(lng_Msg);
}
}

// Modul FINDER
function SearchDatabase() {
var s_text = document.getElementById("text").value;
var s_section = document.getElementById("search_section").value;
var s_subs = document.getElementById("subs").checked;
var s_cases = document.getElementById("cases").checked;
document.getElementById("sf2id_found").innerHTML = document.getElementById("string_hledam").innerHTML + "...";
SF2_Loader("main.php?exec=" + sys_path_modules + "/finder.php&show=res&text=" + s_text + "&search_section=" + s_section + "&subs=" + s_subs + "&cases=" + s_cases , "common" , "sf2id_found");
}

// Modul ARTICLES

function SelArticle(id , nclass) {
document.getElementById("art_" + id + "_1").className = nclass;
document.getElementById("art_" + id + "_2").className = nclass;
}

function RateThumbs(thumb , article , rate , tid) {
SF2_Loader("main.php?exec=" + sys_path_scripts + "/actions.php&action=rate_thumbs&thumb=" + thumb + "&article=" + article + "&rate=" + rate , "common" , "sf2id_" + tid);
}

function RateAnim(id , anim) {
document.getElementById(id).style.top = CFromPX(document.getElementById(id).style.top) + anim + "px";
}

function ResortArticles(sort) {
SF2_Loader("main.php?exec=" + sys_path_modules + "/articles.php&sc=" + sc + "&menu=" + menu + "&sort=" + sort , "common" , "sf2id_main");
}

// Modul DATABASE

function DtbChangeSection(dbsection) {
DtbChangeMenu("x");
document.getElementById("sf2id_db_odeslat").disabled = true;
SF2_Loader("main.php?exec=" + sys_path_modules + "/database.php&menu=add&db_load=menu&db_section=" + dbsection , "common" , "sf2id_db_menu");
}

function DtbChangeMenu(dbmenu) {
document.getElementById("sf2id_db_odeslat").disabled = false;
if (dbmenu == "*") {
document.getElementById("sf2id_db_nadpis").style.display = "inline";
}
else {
if (dbmenu == "x") {
document.getElementById("sf2id_db_odeslat").disabled = true;
}
document.getElementById("sf2id_db_nadpis").style.display = "none";
}
}

function DtbAttach(ch) {
if (ch) {
document.getElementById("sf2id_db_pripojit").style.display = "inline";
}
else {
document.getElementById("sf2id_db_pripojit").style.display = "none";
}
}

function DtbAdd() {
if (document.getElementById("dtb_form_obsah").value != "" && document.getElementById("dtb_form_autor").value != "" && document.getElementById("dtb_form_email").value != "") {
if (document.getElementById("dtb_form_dbmenu").value == "*" && document.getElementById("dtb_form_nadpis").value == "") {
SF2_Alert(lng_Msg);
}
else {
var i;
for (i = 0;i < document.getElementById("dtb_form_soubory").options.length;i++) {
if (document.getElementById("dtb_form_soubory").options[i].value != "*") {
document.getElementById("dtb_form_ids").value += document.getElementById("dtb_form_soubory").options[i].value + ",";
}
}
SF2_SendForm("dtb_form" , sys_path_scripts + "/actions.php" , "add_dtb" , "");
}
}
else {
SF2_Alert(lng_Msg);
}
}

function DtbNewFile(lng) {
var u_cnt = document.getElementById("sf2id_upload_iframe").contentWindow.document.getElementById("upload_count").value;
u_cnt--;
u_cnt++;
var n_cnt = u_cnt + 1;
document.getElementById("sf2id_upload_iframe").contentWindow.document.getElementById("upload_count").value = n_cnt;

var nbr = document.createElement("br");
document.getElementById("sf2id_upload_iframe").contentWindow.document.getElementById("upload_files").insertBefore(nbr , null);
nbr = document.createElement("br");
document.getElementById("sf2id_upload_iframe").contentWindow.document.getElementById("upload_files").insertBefore(nbr , null);
var nbox = document.createElement("input");
nbox.type = "checkbox";
nbox.name = "upload_check_" + n_cnt;
nbox.checked = true;
document.getElementById("sf2id_upload_iframe").contentWindow.document.getElementById("upload_files").insertBefore(nbox , null);
var ntext = document.createTextNode(" " + lng + " #" + n_cnt + ": ");
document.getElementById("sf2id_upload_iframe").contentWindow.document.getElementById("upload_files").insertBefore(ntext , null);
var nbox = document.createElement("input");
nbox.type = "file";
nbox.name = "upload_file_" + n_cnt;
nbox.size = "50";
document.getElementById("sf2id_upload_iframe").contentWindow.document.getElementById("upload_files").insertBefore(nbox , null);
var ntext = document.createTextNode(" ");
document.getElementById("sf2id_upload_iframe").contentWindow.document.getElementById("upload_files").insertBefore(ntext , null);
}

// Modul DOWNLOAD

function SelDownload(id , nclass) {
document.getElementById("art_" + id + "_1").className = nclass;
document.getElementById("art_" + id + "_2").className = nclass;
document.getElementById("art_" + id + "_3").className = nclass;
}

// Modul HOTNEWS

function ChangeDayHN(day) {
SF2_Loader("main.php?exec=" + sys_path_modules + "/hotnews.php&show=hn&d=" + day + "&m=" + document.getElementById("hn_mesic").value + "&r=" + document.getElementById("hn_rok").value , "common" , "sf2id_hn");
}

function ChangeMonthHN(month) {
document.getElementById("hn_den").value = 0;
SF2_Loader("main.php?exec=" + sys_path_modules + "/hotnews.php&show=hn&d=0&m=" + month + "&r=" + document.getElementById("hn_rok").value , "common" , "sf2id_hn");
}

function ChangeYearHN(year) {
document.getElementById("hn_den").value = 0;
document.getElementById("hn_mesic").value = 0;
SF2_Loader("main.php?exec=" + sys_path_modules + "/hotnews.php&show=hn&d=0&m=0&r=" + year , "common" , "sf2id_hn");
}

// Modul CHAT

var g_chat_str = 0;

function ChatSetZob(zob) {
SF2_Loader("main.php?exec=" + sys_path_modules + "/chat.php&part=chat&action=set_zob&chat_zob=" + zob , "common" , "sf2id_chat_box");
}

function ChatGoStr(str) {
g_chat_str = str;
SF2_Loader("main.php?exec=" + sys_path_modules + "/chat.php&part=chat&chat_str=" + str , "common" , "sf2id_chat_box");
}

function ChatAdd() {
if (document.getElementById("chat_text").value == "") {
document.getElementById("chat_text").value = "<i>*#trdlo#*</i>";
}
SF2_SendForm("chat" , sys_path_scripts + "/actions.php&chat=main" , "add_chat" , "");
document.getElementById("chat_text").value = "";
}

function ChatRefresh() {
if (g_chat_str == 0) {
ChatGoStr(0);
}
}

function ChatDeletePost(mess , id) {
if (confirm(lng_chat_SmazatOK) == true) {
document.getElementById("chat_text").value = mess;
document.getElementById("chat_post_id").value = id;
SF2_SendForm("chat" , sys_path_scripts + "/actions.php" , "delete_chat" , "");
document.getElementById("chat_text").value = "";
document.getElementById("chat_text").select();
document.getElementById("chat_text").focus();
}
}

function ChatEditPost(mess , id) {
document.getElementById("chat_post_id").value = id;
document.getElementById("chat_post_back").value = mess;
document.getElementById("chat_text").value = mess;
document.getElementById("chatbut_1").style.display = "none";
document.getElementById("chatbut_2").style.display = "inline";
document.getElementById("chat_text").select();
document.getElementById("chat_text").focus();
SF2_Hop("edit");
}

function ChatSave(mess , back , id) {
if (mess == "") {
SF2_Alert(lng_chat_UpravitOK);
}
else {
SF2_SendForm("chat" , sys_path_scripts + "/actions.php" , "edit_chat" , "");
document.getElementById("chatbut_2").style.display = "none";
document.getElementById("chatbut_1").style.display = "inline";
document.getElementById("chat_text").value = "";
document.getElementById("chat_text").select();
document.getElementById("chat_text").focus();
}
}

// Modul PICTURE

function SelPicture(id , onm) {
if (onm == 1) {
document.getElementById("pic_" + id).className = "picture_selected";
SetOpacity(document.getElementById("stin_" + id) , 100);
SetOpacity(document.getElementById("picture_" + id) , 100);
SetOpacity(document.getElementById("popisek_" + id) , 100);
var n_left = CFromPX(document.getElementById("picture_" + id).style.left) - 3;
document.getElementById("picture_" + id).style.left = n_left + "px";
var n_top = CFromPX(document.getElementById("picture_" + id).style.top) - 3;
document.getElementById("picture_" + id).style.top = n_top + "px";
}
if (onm == 0) {
document.getElementById("pic_" + id).className = "";
SetOpacity(document.getElementById("stin_" + id) , 20);
SetOpacity(document.getElementById("picture_" + id) , 20);
SetOpacity(document.getElementById("popisek_" + id) , 20);
document.getElementById("picture_" + id).style.left = "0px";
document.getElementById("picture_" + id).style.top = "0px";
}
}

// Modul SC

function SearchOver(text) {
SetClass("sf2id_sc_search" , "sc_vyhledavani_input_on");
if (document.getElementById("sf2id_sc_search").value == text) {
document.getElementById("sf2id_sc_search").value = "";
document.getElementById("sf2id_sc_search").select();
}
document.getElementById("sf2id_sc_search").focus();
}

function SearchOut(text) {
SetClass("sf2id_sc_search" , "sc_vyhledavani_input");
if (document.getElementById("sf2id_sc_search").value == "") {
document.getElementById("sf2id_sc_search").value = text;
}
document.getElementById("sf2id_sc_search").blur();
}

function SearchDB() {
SF2_LoadMenu("finder" , "finder");
SF2_AddToEval("SearchGo()");
}

function SearchGo() {
if (sf2_executer_main) {
document.getElementById("text").value = document.getElementById("sf2id_sc_search").value;
document.getElementById("search_btn").click();
SF2_RemoveFromEval("SearchGo()");
}
}

// Modul PANEL

function copyToClipboard(s) {
if (window.clipboardData && clipboardData.setData) {
clipboardData.setData("Text" , s);
}
/*else {
user_pref("signed.applets.codebase_principal_support" , true);
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');

var clip Components.classes['@mozilla.org/widget/clipboard;[[[[1]]]]'].createInstance(Components.interfaces.nsIClipboard);
if (!clip) return;

var trans = Components.classes['@mozilla.org/widget/transferable;[[[[1]]]]'].createInstance(Components.interfaces.nsITransferable);
if (!trans) return;

trans.addDataFlavor('text/unicode');

var str = new Object();
var len = new Object();

var str = Components.classes["@mozilla.org/supports-string;[[[[1]]]]"].createInstance(Components.interfaces.nsISupportsString);

var copytext = meintext;

str.data = copytext;

trans.setTransferData("text/unicode",str,copytext.length*[[[[2]]]]);

var clipid = Components.interfaces.nsIClipboard;

if (!clip) return false;

clip.setData(trans , null , clipid.kGlobalClipboard);	   
}*/
}

function SwitchURLPanel(state) {
document.getElementById("sf2id_url_panel").style.display = state;
}

// Modul MENU

function Menu_Set(id , pos) {
var src_data = document.getElementById(id).src;
if (pos == 1) {
document.getElementById(id).src = src_data.substr(0 , src_data.length - 5) + "1.gif";
SF2_PlaySound("system/mouseover.mp3");
}
else {
document.getElementById(id).src = src_data.substr(0 , src_data.length - 5) + "0.gif";
}
}

function ChangeLeftVSP(vsp) {
SF2_Loader("main.php?exec=" + sys_path_modules + "/menu_" + sys_layout + ".php&part=vsc&vsp=" + vsp , "common" , "sf2id_left_vsc");
}

function VSPSignIn(vsp , t) {
SF2_Loader("main.php?exec=" + sys_path_scripts + "/actions.php&action=vsy&vsp=" + vsp + "&time=" + t , "common" , "");
}

function VSPSignOff(vsp) {
SF2_Loader("main.php?exec=" + sys_path_scripts + "/actions.php&action=vsn&vsp=" + vsp , "common" , "");
}

// Modul REPORT

function BugReport() {
if (document.getElementById("bug_form_text").value != "") {
SF2_SendForm("bug_form" , sys_path_scripts + "/actions.php" , "bug_report" , "")
}
else {
SF2_Alert(lng_Msg);
}
}

// Modul SCAGE

function SCAGE_Odeslat() {
SF2_Loader("main.php?exec=" + sys_path_modules + "/scage.php&menu=test&action=apply&atext=" + document.getElementById("scage_uzitecny").value , "common" , "sf2id_main");
}

function SCAGE_Overit() {
if (confirm("Potvrzuji, že budu stažený software co nejpozorněji testovat a jakmile narazím na chyby, ihned je nahlásím a pokusím se najít jejich příčinu, abych programátorům ulehčil práci!\nSoftware nebudu nikde šířit a to jak v celku, tak po částech!")==true) {
SF2_Loader("main.php?exec=" + sys_path_modules + "/scage.php&menu=test&action=verify&vcode=" + document.getElementById("scage_code").value , "common" , "sf2id_main");
}
}

// Modul USERS

function UChangePassword(ch) {
if (ch) {
document.getElementById("zh_tr_1").style.display = "table-row";
document.getElementById("zh_tr_2").style.display = "table-row";
}
else {
document.getElementById("zh_tr_1").style.display = "none";
document.getElementById("zh_tr_2").style.display = "none";
}
}

function UChangeAvatar(ch) {
if (ch) {
document.getElementById("za_tr_1").style.display = "table-row";
}
else {
document.getElementById("za_tr_1").style.display = "none";
}
}

function UEnableSounds(ch) {
if (ch) {
document.getElementById("pz_span_1").style.display = "inline";
}
else {
document.getElementById("pz_span_1").style.display = "none";
}
}

function SelUser(id , nclass) {
document.getElementById("user_" + id + "_1").className = nclass;
document.getElementById("user_" + id + "_2").className = nclass;
document.getElementById("user_" + id + "_3").className = nclass;
}

function SortUsersBy(sort) {
SF2_LoadMenuParam("users" , "users" , "&sort_by=" + sort);
}

function UAddCom() {
if (document.getElementById("add_new_uc").style.display == "none") {
document.getElementById("add_new_uc").style.display = "inline";
document.getElementById("nuc_text").select();
document.getElementById("nuc_text").focus();
SF2_Hop("nuc");
}
else {
document.getElementById("add_new_uc").style.display = "none";
}
}

function USendCom(user) {
if (document.getElementById("nuc_text").value != "" && document.getElementById("nuc_samiku").value != "") {
document.getElementById("nuc_text").value = nl2br_12(document.getElementById("nuc_text").value);
SF2_SendForm("nuc" , sys_path_modules + "/users.php&user=" + user , "send_user_comment" , "sf2id_main");
}
else {
SF2_Alert(lng_Msg);
}
}

function SelMsg(id , nclass) {
document.getElementById("msg_" + id).className = nclass;
}

function UMsgSelectAll(ch , min , max) {
for (var i  = min;i > max;i--) {
if (document.getElementById("msg_ch_" + i)) {
document.getElementById("msg_ch_" + i).checked = ch;
}
}
}

function UMsgAction(action , min , max) {
var boxes = new Array();
var box_cnt = 0;
for (var i  = min;i > max;i--) {
if (document.getElementById("msg_ch_" + i)) {
if (document.getElementById("msg_ch_" + i).checked) {
boxes[box_cnt] = i;
box_cnt++;
}
}
}
document.getElementById("msg_form_msgs_data").value = boxes.join(";");
SF2_SendForm("msg_form" , sys_path_modules + "/users.php" , "msg_" + action , "sf2id_main");
}

function UOpenMsgFolder(folder) {
SF2_LoadMenuParam("imsg" , "users" , "&folder=" + folder);
}

function UDeleteMsg(msgid) {
if (msgid > 0) {
if (confirm(lng_users_SmazatMsgOK) == true) {
SF2_Loader("main.php?exec=" + sys_path_modules + "/users.php&action=msg_delete&msgs_data=" + msgid , "common" , "sf2id_main");
}
}
}

function UReplyMsg(user , msgid , quote) {
if (quote) {
SF2_LoadMenuParam("pmsg" , "users" , "&user=" + user + "&msg_id=" + msgid + "&quote=1");
}
else {
SF2_LoadMenuParam("pmsg" , "users" , "&user=" + user + "&msg_id=" + msgid + "&quote=0");
}
}

function USearchUser() {
for (var i = 0;i < document.getElementById("new_msg_prijemce").options.length;i++) {
if (document.getElementById("new_msg_prijemce").options[i].text == document.getElementById("new_msg_search").value) {
document.getElementById("new_msg_prijemce").selectedIndex = i;
}
}
}

/*function ShowChannel(ch) {
if (document.getElementById("frame_ch" + ch).style.display == "none") {
document.getElementById("sp_" + ch + "_1").style.display = "none";
document.getElementById("frame_ch" + ch).style.display = "inline";
var cnt_src = document.getElementById("frame_ch" + ch).src;
if (cnt_src.substr(cnt_src.length - 1 , 1) == "=") {
document.getElementById("sp_" + ch + "_0").style.display = "none";
document.getElementById("frame_ch" + ch).src = "moduls/channels.php?u=<?echo $uid?>&ch=" + ch;
}
}
else {
document.getElementById("frame_ch" + ch).style.display = "none";
document.getElementById("sp_" + ch + "_1").style.display = "inline";
}
}*/

function AvatarPreview(avatar , preview) {
document.getElementById("avatar_img").src = "img/avatars/" + avatar;
document.getElementById("avatar_div").style.left = mouse_x;
if (main_browser == "Gecko") {
document.getElementById("avatar_div").style.top = mouse_y;
}
else {
var tmp_y = document.body ? document.body.scrollTop : pageYOffset;
document.getElementById("avatar_div").style.top = mouse_y + tmp_y;
}
if (preview == 1) {
document.getElementById("avatar_div").style.display = "inline";
}
else {
document.getElementById("avatar_div").style.display = "none";
}
}

// Kurzor
function setCursorPosition(id , pos) {
var elem = document.getElementById(id);

if (elem != null) {
if (elem.createTextRange) {
var range = elem.createTextRange();
range.move('character' , pos);
range.select();
}
else {
if (elem.selectionStart) {
elem.focus();
elem.setSelectionRange(pos , pos);
}
else {
elem.focus();
}
}
}
}

function insertAtCursor(id , val) {
var elem = document.getElementById(id);
if (document.selection) {
elem.focus();
sel = document.selection.createRange();
sel.text = val;
var cnt;

if (elem.selectionStart) {
cnt = elem.selectionStart;
}
else {
cnt = elem.value.indexOf(val);
}

if (val.substring(0 , 7) != "[smile]") {
cnt -= 4;
}

if (val.substring(0 , 5) == "[img]") {
cnt -= 2;
}

setCursorPosition(id , cnt + val.length);
}
else if (elem.selectionStart || elem.selectionStart == "0") {
var startPos = elem.selectionStart;
var endPos = elem.selectionEnd;
elem.value = elem.value.substring(0 , startPos) + val + elem.value.substring(endPos , elem.value.length);
var cnt;
if (val.substring(0 , 7) == "[smile]") {
cnt = startPos;
}
else {
cnt = startPos - 4;
if (val.substring(0 , 5) == "[img]") {
cnt = startPos - 6;
}
}
setCursorPosition(id , cnt + val.length);
}
else {
elem.value += val;
}
}

// Vložení smajlíku
function AddSmile (id , smile) {
insertAtCursor(id , "[smile]" + smile + "[/smile]");
}

// Vložení tagu
function InsertTag(id , tag) {
var ret = "";
switch (tag) {
case "b": ret = "[b][/b]";
break;
case "i": ret = "[i][/i]";
break;
case "u": ret = "[u][/u]";
break;
case "s": ret = "[s][/s]";
break;
case "a": ret = "[a][/a]";
break;
case "img": ret = "[img][/img]";
break;
default: ret = "";
}
insertAtCursor(id , ret);
}

// Konvert pixelů
function CFromPX(str) {
str = str.substr(0 , str.length - 2);
str--;
str++;
return str;
}

// Otevření nového okna
function WOpen(path , width , height) {
var oleft = (screen.width - width) / 2;
var otop = (screen.height - height) / 2;
window.open(path , "Okno" , "left="+oleft+",top="+otop+",width="+width+",height="+height+",noresize,scrollbars=auto");
}

// Otevření obrázku
function PicOpen(picture , slideshow) {
SF2_Loader('main.php?exec=' + sys_path_modules + '/pic.php&picture=' + picture + '&position=0&slideshow=' + slideshow , 'common' , '');
}

// Zapnutí nočního vidění
function NV_Down() {
document.getElementById("main_body").style.filter = "gray(enabled=1)";
SF2_PlaySound("system/googles.mp3");
}

// Vypnutí nočního vidění
function NV_Up() {
document.getElementById("main_body").style.filter = "gray(enabled=0)";
/*for (var i = 0;i < document.all.length;i++) {
if (document.all[i].tagName.toLowerCase() == "iframe") {
if (document.all[i].src.substr(0 , 8) == "main.php") {
document.all[i].contentWindow.document.body.style.filter = "gray(enabled=0)";
}
}
}*/
SF2_PlaySound("system/googles.mp3");
}

// Nastavení průhlednosti
function SetOpacity(obj , opacity) {
obj.style.filter = "alpha(opacity:"+opacity+")";
obj.style.KHTMLopacity = opacity/100;
obj.style.Mozopacity = opacity/100;
obj.style.opacity = opacity/100;
}

// Odpočítávadlo
function SCC_Counter() {
var scc_cas = new Date(2010,4,30);
var norm_cas = new Date();
var zbyva_cas = (scc_cas.getTime() - norm_cas.getTime()) / 1000;
/*var c_months = Math.floor(zbyva_cas / (60 * 60 * 24 * 30));
zbyva_cas -= c_months * 60 * 60 * 24 * 30;
var c_days = Math.floor(zbyva_cas / (60 * 60 * 24));
zbyva_cas -= c_days * 60 * 60 * 24;*/
var c_hours = Math.floor(zbyva_cas / (60 * 60));
zbyva_cas -= c_hours * 60 * 60;
var c_minutes = Math.floor(zbyva_cas / 60);
zbyva_cas -= c_minutes * 60;
var c_seconds = Math.floor(zbyva_cas);
if (c_hours < 10) {
c_hours = "0" + c_hours;
}
if (c_minutes < 10) {
c_minutes = "0" + c_minutes;
}
if (c_seconds < 10) {
c_seconds = "0" + c_seconds;
}
//document.getElementById("sccc_months").innerHTML = c_months - 1;
//document.getElementById("sccc_days").innerHTML = c_days - 26;
document.getElementById("sccc_hours").innerHTML = c_hours - 30 * 24;
document.getElementById("sccc_minutes").innerHTML = c_minutes;
document.getElementById("sccc_seconds").innerHTML = c_seconds;
}

// Nahrazení enterů
function nl2br_12 (str) {
if (typeof (str) == "string") return str.replace(/(\r\n)|(\n\r)|\r|\n/g,"<br>");
else return str;
}

// Simulace tlačítka
function EnterButton(id) {
event_action_down = id;
}

// Kontrola verze IE
function CntIEVer(co) {
var dat;
dat = navigator.userAgent;
var text;
text = dat.indexOf(co);
return text;
}

// Přepínání spoilerů
function SwitchSpoilers() {
var i;
for (i = 0;i < document.all.length;i++) {
if (document.all[i].className) {

if (document.all[i].className == "spoiler_head") {
if (document.all[i].style.display == "none") {
document.all[i].style.display = "inline";
}
else {
document.all[i].style.display = "none";
}
}

if (document.all[i].className == "spoiler_line") {
if (document.all[i].style.display == "inline") {
document.all[i].style.display = "none";
}
else {
document.all[i].style.display = "inline";
}
}

if (document.all[i].className == "spoiler_block") {
if (document.all[i].style.display == "block") {
document.all[i].style.display = "none";
}
else {
document.all[i].style.display = "block";
}
}

}
}
}

// Zobrazování a skrývání odstavců
function ShowDiv(id) {
if (document.getElementById(id).style.display == "none") {
document.getElementById(id).style.display = "inline";
}
else {
document.getElementById(id).style.display = "none";
}
}

// Zobrazení podrobného online statusu
function show_online_more() {
if (document.getElementById("online_more_span").style.display == "none") {
document.getElementById("online_more").innerHTML = "^";
document.getElementById("online_more_span").style.display = "inline";
}
else {
document.getElementById("online_more_span").style.display = "none";
document.getElementById("online_more").innerHTML = "v";
}
}

// CHAT

var g_chat_id = 0;

function showchat(id) {
g_chat_id = id;
SF2_Loader("main.php?exec=" + sys_path_modules + "/side_" + sys_layout + ".php&part=chat&chat_id=" + id , "common" , "sf2id_side_chat");
}

function reloadchat() {
showchat(g_chat_id);
}

function show_chat_more() {
if (document.getElementById("side_chat_more_span").style.display == "none") {
document.getElementById("side_chat_more").innerHTML = "^";
document.getElementById("side_chat_more_span").style.display = "inline";
}
else {
document.getElementById("side_chat_more_span").style.display = "none";
document.getElementById("side_chat_more").innerHTML = "v";
}
}

function AddChat() {
if (document.getElementById("side_chat_text").value == "") {
document.getElementById("side_chat_text").value = "<i>*#trdlo#*</i>";
}
SF2_SendForm("side_chat" , sys_path_scripts + "/actions.php&chat=side" , "add_chat" , "");

document.getElementById("side_chat_text").value = "";
document.getElementById("side_chat_more_span").style.display = "none";
document.getElementById("side_chat_more").innerHTML = "v";
}

function GetAVSpace() {
var avspace;
if (main_browser == "IE") {
avspace = document.body.offsetWidth - 1;
}
else if (main_browser == "Gecko") {
avspace = window.outerWidth - 26;
}
else {
avspace = window.outerWidth - 11;
}
if (avspace < 1024) {
avspace = 1024;
}
return avspace;
}

function n2npx(n) {
var ret = n;
if (ret == "") {
ret = "0px";
}
return ret;
}

function BrowserRealign(id) {
var ret = new Array();
ret[0] = 0;
ret[1] = 0;
if (main_browser == "IE") {
var pad_main = CFromPX(n2npx(document.getElementById(id).style.padding));
var pad_left = CFromPX(n2npx(document.getElementById(id).style.paddingLeft));
var pad_right = CFromPX(n2npx(document.getElementById(id).style.paddingRight));
var pad_top = CFromPX(n2npx(document.getElementById(id).style.paddingTop));
var pad_bottom = CFromPX(n2npx(document.getElementById(id).style.paddingBottom));
if (pad_left == 0) {
pad_left = pad_main;
}
if (pad_right == 0) {
pad_right = pad_main;
}
if (pad_top == 0) {
pad_top = pad_main;
}
if (pad_bottom == 0) {
pad_bottom = pad_main;
}
ret[0] = pad_left + pad_right;
ret[1] = pad_top + pad_bottom;
}
return ret;
}

function PlusPad(pad) {
var ret = 0;
if (main_browser == "IE") {
ret = 2 * pad;
}
return ret;
}

function QN(id , z) {
var tmp = id + z;
SF2_Loader("main.php?exec=" + sys_path_modules + "/menu_" + sys_layout + ".php&part=qn&qn_id=" + tmp , "common" , "sf2id_left_qn");
}

function ThumbLNL(id , z) {
if (z == 1 && document.getElementById(id)) {
var my = mouse_y;
if (main_browser != "Gecko") {
my += document.body ? document.body.scrollTop : pageYOffset;
}
var th_data = new Array();
th_data = document.getElementById(id).innerHTML.split("|");
document.getElementById("sf2id_thumb_lc").innerHTML = th_data[0];
document.getElementById("sf2id_thumb_ls").innerHTML = th_data[2];
document.getElementById("sf2id_thumb_nc").innerHTML = th_data[1];
document.getElementById("sf2id_thumb_ns").innerHTML = th_data[3];
document.getElementById("sf2id_thumb_lnl").style.left = mouse_x;
document.getElementById("sf2id_thumb_lnl").style.top = my;
document.getElementById("sf2id_thumb_lnl").style.display = "inline";
}
else {
document.getElementById("sf2id_thumb_lnl").style.display = "none";
}
}

function AddTag(tag , id) {
var ntag = "";
if (tag == "nlink") {
ntag = '<a class="acommon" href="" target="_blank"></a>';
}
if (tag == "nimage") {
ntag = '<a class="acommon" href="javascript: PicOpen(\'.jpg\' , 0)"></a>';
}
document.getElementById(id).value += ntag;
}

function HN_Add() {
if (confirm("Opravdu jsi všecko dobře vyplnil?\n\nJestli ne tak...") == true) {
SF2_SendForm("nm_hn" , sys_path_modules + "/devs.php&menu=news" , "add_hotnew" , "sf2id_main");
}
}

function Newie_Add() {
if (confirm("Opravdu jsi všecko dobře vyplnil?\n\nJestli ne tak...") == true) {
SF2_SendForm("nm_main" , sys_path_modules + "/devs.php&menu=news" , "add_newie" , "sf2id_main");
}
}

function Clan_AddRecord() {
if (confirm("Opravdu jsi všecko dobře vyplnil?\n\nJestli ne tak...") == true) {
SF2_SendForm("clan1" , sys_path_modules + "/devs.php&menu=clan" , "clan_add_record" , "sf2id_main");
}
}

function Clan_NewMatch() {
SF2_SendForm("clan2" , sys_path_modules + "/devs.php&menu=clan" , "clan_new_match" , "sf2id_main");
}

function Clan_SaveMatch(m) {
SF2_AddToForm("mid" , m);
SF2_SendForm("clan3" , sys_path_modules + "/devs.php&menu=clan" , "clan_save_match" , "sf2id_main");
}

function Clan_DeleteMatch(m) {
if (confirm("Vymazat naplánovaný zápas?\n\nVčetně přihlášených hráčů...") == true) {
SF2_Loader("main.php?exec=" + sys_path_modules + "/devs.php&menu=clan&action=clan_delete_match&match=" + m , "common" , "sf2id_main");
}
}

function User_SelectAgent(agent) {
SF2_Loader("main.php?exec=" + sys_path_modules + "/devs.php&menu=user&uzivatele=" + agent , "common" , "sf2id_main");
}

function User_SaveAgent() {
SF2_SendForm("user" , sys_path_modules + "/devs.php&menu=user" , "user_save_agent" , "sf2id_main");
}

function User_ShowLog(log) {
SF2_LoadMenuParam("log" , "devs" , "&log=" + log);
}

function User_SendNews(newie) {
SF2_Loader("main.php?exec=" + sys_path_modules + "/devs.php&menu=user&action=user_send_news&newie=" + newie , "common" , "sf2id_main");
}

function User_SendEmails() {
SF2_SendForm("usersz" , sys_path_modules + "/devs.php&menu=user" , "user_send_emails" , "sf2id_main");
}

function User_SearchAgent(agent) {
if (event.keyCode == 13) {
var tmp = "";
for (var i = 0;i < document.getElementById("user_uzivatele").options.length;i++) {
tmp = document.getElementById("user_uzivatele").options[i].text;
if (tmp.substr(tmp.length - agent.length , agent.length) == agent) {
document.getElementById("user_uzivatele").selectedIndex = i;
User_SelectAgent(document.getElementById("user_uzivatele").value);
}
}
}
}

// Modul FORUM

function Forum_ShowStats() {
if (document.getElementById("sf2id_stat_box").style.display == "none") {
document.getElementById("sf2id_stat_box").style.display = "inline";
if (document.getElementById("sf2id_stat_box").innerHTML.toLowerCase().substr(0 , 3) == "<i>") {
SF2_Loader("main.php?exec=" + sys_path_modules + "/forum.php&part=statistics" , "common" , "sf2id_stat_box");
}
SF2_Hop("stats");
}
else {
document.getElementById("sf2id_stat_box").style.display = "none";
}
}

function Forum_ShowFind() {
if (document.getElementById("forum_find").style.display == "none") {
document.getElementById("forum_find").style.display = "inline";
document.getElementById("forum_search_text").select();
document.getElementById("forum_search_text").focus();
SF2_Hop("search");
}
else {
document.getElementById("forum_find").style.display = "none";
}
}

function Forum_SetZob(f) {
SF2_LoadMenuParam("forum" , "forum" , "&f=" + f + "&zob=" + document.getElementById("zob").value);
}

function Forum_Search(f) {
SF2_AddToForm("f" , f);
SF2_SendForm("forum_search" , sys_path_modules + "/forum.php&part=search" , "search_forum" , "sf2id_forum");
document.getElementById("sf2id_forum").innerHTML = '<font color="' + good_color + '"><i>' + lng_Hledam + '...</i></font>';
}

function Forum_ShowReply(f , post) {
document.getElementById("sf2id_reply_box_" + post.substr(0 , post.length - 4)).style.display = "inline";
SF2_Loader("main.php?exec=" + sys_path_modules + "/forum.php&part=reply&type=reply&f=" + f + "&post=" + post , "common" , "sf2id_reply_box_" + post.substr(0 , post.length - 4));
}

function Forum_ShowQuote(f , post) {
var sel_data;
if (document.getSelection) {
sel_data = document.getSelection();
}
else if (document.selection && document.selection.createRange) {
sel_data = document.selection.createRange().text;
}
else {
sel_data = "";
}
if (sel_data != "") {
document.getElementById("sf2id_reply_box_" + post.substr(0 , post.length - 4)).style.display = "inline";
SF2_Loader("main.php?exec=" + sys_path_modules + "/forum.php&part=reply&type=quote&f=" + f + "&post=" + post + "&quote=" + sel_data , "common" , "sf2id_reply_box_" + post.substr(0 , post.length - 4));
}
else {
document.getElementById("sf2id_reply_box_" + post.substr(0 , post.length - 4)).style.display = "inline";
SF2_Loader("main.php?exec=" + sys_path_modules + "/forum.php&part=reply&type=quote&f=" + f + "&post=" + post , "common" , "sf2id_reply_box_" + post.substr(0 , post.length - 4));
}
}

function Forum_HideReply(post) {
document.getElementById("sf2id_reply_box_" + post.substr(0 , post.length - 4)).style.display = "none";
}

function Forum_SendReply(f , post) {
var tmp_id = post.substr(0 , post.length - 4);
if (document.getElementById("forum_reply_" + tmp_id + "_jmeno").value != "" && document.getElementById("forum_reply_" + tmp_id + "_email").value != "" && document.getElementById("forum_reply_" + tmp_id + "_predmet").value != "" && document.getElementById("forum_reply_" + tmp_id + "_text").value != "") {
SF2_SendForm("forum_reply_" + tmp_id , sys_path_modules + "/forum.php&f=" + f , "send_reply" , "sf2id_main");
}
else {
SF2_Alert(lng_Msg);
}
}

function Forum_ReportPost(f , post) {
if (confirm(lng_forum_NahlasitPrispevek)) {
SF2_LoadMenuParam("forum" , "forum" , "&f=" + f + "&action=report_post&post=" + post);
}
}

function Forum_DeletePost(f , post) {
if (confirm(lng_forum_SmazatPrispevek)) {
SF2_LoadMenuParam("forum" , "forum" , "&f=" + f + "&action=delete_post&post=" + post);
}
}

function Forum_ShowEdit(f , post) {
document.getElementById("sf2id_reply_box_" + post.substr(0 , post.length - 4)).style.display = "inline";
SF2_Loader("main.php?exec=" + sys_path_modules + "/forum.php&part=reply&type=edit&f=" + f + "&post=" + post , "common" , "sf2id_reply_box_" + post.substr(0 , post.length - 4));
}

function Forum_SendEdit(f , post) {
var tmp_id = post.substr(0 , post.length - 4);
if (document.getElementById("forum_reply_" + tmp_id + "_jmeno").value != "" && document.getElementById("forum_reply_" + tmp_id + "_email").value != "" && document.getElementById("forum_reply_" + tmp_id + "_predmet").value != "" && document.getElementById("forum_reply_" + tmp_id + "_text").value != "") {
SF2_SendForm("forum_reply_" + tmp_id , sys_path_modules + "/forum.php&f=" + f + "&post=" + post , "send_edit" , "sf2id_main");
}
else {
SF2_Alert(lng_Msg);
}
}

function Forum_ShowNew(f) {
document.getElementById("sf2id_new_box").style.display = "inline";
SF2_Loader("main.php?exec=" + sys_path_modules + "/forum.php&part=new&f=" + f , "common" , "sf2id_new_box");
}

function Forum_HideNew() {
document.getElementById("sf2id_new_box").style.display = "none";
}

function Forum_ChangeType(t) {
if (t == 1) {
if (main_browser == "IE") {
document.getElementById("sf2id_forum_ntr1").style.display = "block";
}
else {
document.getElementById("sf2id_forum_ntr1").style.display = "table-row";
}
}
else {
document.getElementById("sf2id_forum_ntr1").style.display = "none";
}
}

function Forum_ChangePoll(p) {
if (p == 1) {
if (main_browser == "IE") {
document.getElementById("sf2id_forum_ntr2").style.display = "block";
document.getElementById("sf2id_forum_ntr3").style.display = "block";
}
else {
document.getElementById("sf2id_forum_ntr2").style.display = "table-row";
document.getElementById("sf2id_forum_ntr3").style.display = "table-row";
}
}
else {
document.getElementById("sf2id_forum_ntr2").style.display = "none";
document.getElementById("sf2id_forum_ntr3").style.display = "none";
}
}

function Forum_ShowImage(nim) {
var fobrazky = new Array();
var fobrazek = "";
var cnt = 0;
fobrazky = document.getElementById("forum_new_obrazky").value.split(";");
fobrazek = document.getElementById("forum_new_obrazek").value;
for (var i = 0;i < fobrazky.length;i++) {
if (fobrazky[i] == fobrazek) {
cnt = i;
}
}
cnt += nim;
if (cnt < 0) {
cnt = fobrazky.length - 1;
}
if (cnt >= fobrazky.length) {
cnt = 0;
}
document.getElementById("forum_new_obrazek").value = fobrazky[cnt];
document.getElementById("sf2id_forum_ntr4").style.backgroundImage = 'url("' + sys_path_folders + '/' + fobrazky[cnt] + '")';
}

function Forum_SendNew(f) {
var cnt = true;
if (document.getElementById("forum_new_jmeno").value == "" || document.getElementById("forum_new_email").value == "" || document.getElementById("forum_new_predmet").value == "" || document.getElementById("forum_new_text").value == "") {
cnt = false;
}
if (document.getElementById("forum_new_typ").value == "1" && document.getElementById("forum_new_popis").value == "") {
cnt = false;
}
if (document.getElementById("forum_new_hlasovani").value == "1" && (document.getElementById("forum_new_otazka").value == "" || document.getElementById("forum_new_odpovedi").value == "")) {
cnt = false;
}

if (cnt) {
SF2_SendForm("forum_new" , sys_path_modules + "/forum.php&f=" + f , "send_new" , "sf2id_main");
}
else {
SF2_Alert(lng_Msg);
}
}

function Forum_Poll(f , p) {
SF2_Loader("main.php?exec=" + sys_path_modules + "/forum.php&part=poll&f=" + f + "&poll=" + p , "common" , "sf2id_poll");
}

/*

function deleteThread(thread) {
if (confirm("<?echo $lng_moduls_forum_SmazatVlakno?>")) {
document.form.action.value = "deleteThread";
document.form.fdata1.value = "<?echo $d?>";
document.form.fdata2.value = thread;
document.form.submit();
}
}

function lockThread(thread , stat) {
document.form.action.value = "lockThread";
document.form.fdata1.value = "<?echo $d?>";
document.form.fdata2.value = thread;
document.form.fdata3.value = stat;
document.form.submit();
}

function Moderate() {
if (confirm("<?echo $lng_moduls_forum_ModerovatVlakno?>")) {
location.href = "main.php?sc=home&menu=debate&modul=debate&d=<?echo $d?>&m=move";
}
}

function Exempt() {
var tmp = "";
var i;
for (i = 0;i < document.all.length;i++) {
if (document.all[i].type) {
if (document.all[i].type == "checkbox") {
if (document.all[i].id.substr(0 , 2) == "p_") {
if (document.all[i].checked) {
tmp += document.all[i].id + ";";
}
}
}
}
}
if (tmp != "") {
document.form.action.value = "exemptPosts";
document.form.fdata1.value = "<?echo $d?>";
document.form.fdata2.value = tmp;
document.form.submit();
}
}

function Storno() {
location.href = "main.php?sc=home&menu=debate&modul=debate&d=<?echo $d?>";
}

function StornoPaste() {
document.form.action.value = "stornoPaste";
document.form.fdata1.value = "<?echo $d?>";
document.form.submit();
}

function Paste() {
if (confirm("<?echo $lng_moduls_forum_VlozitVlakno?>")) {
document.form.action.value = "pastePosts";
document.form.fdata1.value = "<?echo $d?>";
document.form.submit();
}
}
*/
//-->