﻿// vyskakující okna:

function popUp(debug, s1, s2, dalsi, preview) {
 var f, w, h;
 if (s1=="archiv") {
  w=750; h=430;
  f="scrollbars=yes";
 }
 else if (s1=="sberatel") {
  w=750; h=430;
  f="scrollbars=yes";
 }
  else if (s1=="casteotazky") {
  w=750; h=430;
  f="scrollbars=yes";
 }
 else if (s1=="zajimavosti") {
  w=750; h=430;
  f="scrollbars=yes";
 }
 else if (s1=="zabava") {
  w=750; h=430;
  f="scrollbars=yes";
 }
 else if (s1=="napiste") {
  w=750; h=430;
  f="scrollbars=yes";
 }
 else if (s1=="soutez") {
  w=750; h=430;
  f="scrollbars=yes";
 }
 else if (s1=="manie") {
  w=550; h=500;
  f="scrollbars=yes";
 }
 else if (s1=="kinderiada") {
  w=770; h=460;
  f="scrollbars=yes";
 }
 else if (s1=="spionhra") {
  w=770; h=460;
  f="scrollbars=yes";
 }
 f += ", width=" + w + ", height=" + h;
 f += ", left=" + Math.round((screen.availWidth-w)/2) + ", top=" + Math.round((screen.availHeight-h)/2);
 f += ", location=no, menubar=no, resizable=no, status=no, toolbar=no";
 if (s1 == "manie") url = "manie.html";
 else if (s1 == "kinderiada") {
 	url = "kinderiada/index.php";
	if (s2 != null) url += "?sid=" + s2
 }
 else {
  url = "popup.php?s1=" + s1;
  if (s2) url += "&s2=" + s2;
  if (debug) url += "&debug=yes";
  if (dalsi != null) url += dalsi;
 }
 if (s1 == "spionhra") {
 	url = "http://www.kindersurprise.cz/spionhra/index.html";
	//if (s2 != null) url += "?sid=" + s2
 }
 if (document.preview=="yes" && s1!="kinderiada" && s1!="spionhra") url += "&preview=yes";
 okno = window.open(url, s1 + "_" + s2, f);
 okno.focus();
}

function archivHer() {
 var left = Math.round((screen.availWidth-750)/2);
 var top = Math.round((screen.availHeight-430)/2);
 var okno = window.open('hry/archiv.html', 'hryarchiv', 'location=no, menubar=no, resizable=no, status=no, toolbar=no, scrollbars=yes, width=750, height=430, left=' + left + ', top=' + top);
 okno.focus();
}

function hra(nazev, w, h) {
	var url = "/hry/" + nazev + "/index.html"; 
	var left = Math.round((screen.availWidth-w)/2);
	var top = Math.round((screen.availHeight-h)/2);
 	var okno = window.open(url, "hra" + nazev.substring(0, 3), 'location=no, menubar=no, resizable=no, status=no, toolbar=no, scrollbars=no, width=' + w + ', height=' + h + ', left=' + left + ', top=' + top);
	okno.focus();
}

function serie(nazev, hlas) {
	var w, h;
	if (nazev == "0109-vampirelli" || nazev == "0202-pirati") {w=760; h=460;}
	else if (nazev == "0209-lisky" || nazev == "0302-fantomini2") {w=770; h=500;}
	else if (nazev == "0309-cybertop") {w=760; h=400;}
	var url = "serie/" + nazev + "/index.php?hlas=" + hlas + "&lng=cz&standalone=no"; 
	var left = Math.round((screen.availWidth-w)/2);
	var top = Math.round((screen.availHeight-h)/2);
 	var okno = window.open(url, "serie" + nazev.substring(0, 3), 'location=no, menubar=no, resizable=no, status=no, toolbar=no, scrollbars=no, width='+w+', height='+h+', left=' + left + ', top=' + top);
	okno.focus();
}

function joy2004() {
	var left = Math.round((screen.availWidth-750)/2);
	var top = Math.round((screen.availHeight-420)/2);
 	var okno = window.open("monsterhotel/monsterhotel.html", "joy2004", 'location=no, menubar=no, resizable=no, status=no, toolbar=no, scrollbars=no, width=' + 750 + ', height=' + 420 + ', left=' + left + ', top=' + top);
	okno.focus();
}

function homepageEdit(nickname, sid) {
 var left = Math.round((screen.availWidth-750)/2);
 var top = Math.round((screen.availHeight-440)/2);
 var okno = window.open('users/homepage_edit.php?nickname=' + nickname + '&sid=' + sid, 'homepageEdit', 
 'location=no, menubar=no, resizable=no, status=no, toolbar=no, scrollbars=no, width=750, height=440, left=' + left + ', top=' + top);
 okno.focus();
}

function liskyKomiksHlasovani() {
	var url = "/hry/0211-lisky-comics/0211-lisky-comics-hlasovani.html"; 
	var left = Math.round((screen.availWidth-782)/2);
	var top = Math.round((screen.availHeight-500)/2);
 	var okno = window.open(url, "liskyKomiksHlasovani", 'location=no, menubar=no, resizable=no, status=no, toolbar=no, scrollbars=no, width=782, height=500, left=' + left + ', top=' + top);
	okno.focus();
}

function chat() {
	 var left = Math.round((screen.availWidth-700)/2);
	 var top = Math.round((screen.availHeight-420)/2);
	 var okno = window.open('chat/index.html', 'chat', 
	 'location=no, menubar=no, resizable=no, status=no, toolbar=no, scrollbars=no, width=700, height=420, left=' + left + ', top=' + top);
	 okno.focus();
}

// users:

function setCookie(cookieName, cookieValue, expires, path, domain, secure)
   {
      document.cookie = escape(cookieName) + '=' + escape(cookieValue)
         + (expires ? '; EXPIRES=' + expires.toGMTString() : '')
         + (path ? '; PATH=' + path : '')
         + (domain ? '; DOMAIN=' + domain : '')
         + (secure ? '; SECURE' : '');
}

function setCookieNickname(n) {
	setCookie("lastnickname", n, new Date(2100, 0, 0));
}
function soutez(){
	nw=window.open("/monsterhotelsoutez/cz.html","mhotelsoutez","width=600,height=400,scrollbars=yes,resizable=yes");
	nw.focus();
}
