list_domen = new Array();
list_domen["cz"] = "euro-portal";
list_domen["fr"] = "xxx";
list_domen["it"] = "info-portale";
list_domen["hu"] = "euro-portal";
list_domen["de"] = "euro-infoportal";
list_domen["pl"] = "info-portal";
list_domen["at"] = "euro-portal";
list_domen["ru"] = "euro-portal";
list_domen["sk"] = "info-portal";
list_domen["es"] = "xxx";
list_domen["uk"] = "euro-infoportal.co";

verze = (navigator.userAgent.indexOf("WebKit")>=0 ? "go" : (navigator.userAgent.indexOf("Opera")>=0 ? "op" : (navigator.userAgent.indexOf("MSIE")>=0 ? "ie" : (navigator.userAgent.indexOf("Netscape")>=0 ? "ns" : (navigator.userAgent.indexOf("Mozilla")>=0 ? "mo" : "xx")))));
if(verze=="ie") {verze += navigator.userAgent.substr(navigator.userAgent.indexOf("MSIE")+5, 4).replace(/\;/g, "")} else {
 if(verze=="op") {verze += navigator.userAgent.substr(navigator.userAgent.indexOf("Opera")+6, 4)} else {
  if(verze=="ns") {verze += navigator.userAgent.substr(navigator.userAgent.indexOf("Netscape")+9, 3)} else {
   if(verze=="mo") {verze += navigator.userAgent.substr(navigator.userAgent.indexOf("rv:")+3, 5)} else {
    if(verze=="go") {verze += navigator.userAgent.substr(navigator.userAgent.indexOf("WebKit")+7, 6)}
}}}}

kurzor = verze.substr(0,3)=="ie5" || verze.substr(0,3)=="ie4" ? "hand" : "pointer";
//if(verze=="ie5.01") {
	undefined = "undefined";
//}

// Test na podporu Flashe není ověřená na starích verzích IE !!!
minVer = 6;
aktVer = 0;
zavinac = "%40";
if(navigator.plugins && navigator.plugins["Shockwave Flash"]) {
 popis = navigator.plugins["Shockwave Flash"].description;
 aktVer = parseInt(popis.charAt(popis.indexOf(".") - 1));
}
isFlash = (aktVer >= minVer) || (verze.substr(0,2)=="ie");       // je nainstalovaná podpora Flashe

modal = -1;					                            // toto je identifikátor <modálního> okna
process = Math.round(1000000 * Math.random());	// toto je identifikátor procesu
isBlur = "";					                          // toto je identifikátor pro testování onBlur

// otevře nové okno daných parametrů
//function open_win(file, query, name, scroll, resize, mywidth, myheight, left, top, other, hard_set, add) {
function open_win(file, query, name, scroll, resize, mywidth, myheight, left, top, other, hard_set) {
// file     : soubor, který se otevře v novém okně
// query    : parametry, předané souboru <file> (k nim se automaticky přidá info o jazyce)
// name     : název nově otevřeného okna (default = "_blank")
// scroll   : okno bude mít scrolovací lity (default = "yes")
// resize   : okno bude mít proměnlivou velikost (default = "yes")
// mywidth  : ířka nově otevřeného okna (default = 600, je-li < 0, nastaví se maximální)
// myheight : výka nově otevřeného okna (default = 450, je-li < 0, nastaví se maximální)
// left     : horizontální umístění otevřeného okna (l - levý okraj, c - center (default), r - pravý okraj)
// top      : vertikální umístění otevřeného okna (t - horní okraj, c - center (default))
// other    : okno bude mít ostatní prvky [menubar, toolbar, location, status] (default = "yes")
// hard_set : nastavení prvků "natvrdo"
//            (co je zde uvedeno = "yes", ostatní beze změny. Např.: 'ts' znamená 'toolbar=yes,status=yes')
//            [menubar = m, toolbar = t, location = l, status = s, directories = d, copyhistory = c]
// add      : přidat systémové proměnné [lang, w, fi, ci] (default = "yes")
// POZOR - to add dělalo problém v IE6 !!! a navíc ho (asi) nepouívám, byl to jen pokus
 ie5 = verze.substr(0,3)=="ie5" ? 1 : 0;
 ie6 = verze.substr(0,3)=="ie6" ? 1 : 0;
 ie = verze.substr(0,2)=="ie" ? 1 : 0;
 ns = verze.substr(0,2)=="mo" || verze.substr(0,2)=="ns" ? 1 : 0;
 op = verze.substr(0,2)=="op" ? 1 : 0;
 zoomIndex = (file.indexOf("partner.php")<0 ? 1 : 0.9);
 zoom_x = (fi > 11 ? fi * 0.095 * zoomIndex : 1);
 zoom_y = (fi > 11 ? (fi - 1) * Math.pow(0.98, fi - 11) / 10 : 1);
// toto je tady proto, e kdy je <file> prázdný a <query> začíná <?>, potom indexOf("?") vrací 0 a vkládalo by to dalí <?> místo <&>
 mezera = " ";
 if(typeof(query)==undefined) {query = "";}
 if(query!="") {query = "?"+query;}
// if(typeof(add)==undefined || add=="") {add = "yes";}
// if(add=="yes") {
 if(file.indexOf("http://")==0) {
  lang = (typeof(lang)==undefined ? defa_lang : lang);
// lang = (opener && opener.lang ? opener.lang : (typeof(lang)==undefined ? "cz" : lang));
//  if(file.indexOf("http://")>0) {query += ((file+mezera+query).indexOf("?")>0 ? "&" : "?") + "lang="+lang;}
  if(file.substr(0,7)!="http://") {query += ((file+mezera+query).indexOf("?")>0 ? "&" : "?") + "lang="+lang;}
  w = (typeof(w)==undefined ? screen.availWidth : w);
// w = (opener && opener.w ? opener.w : (typeof(w)==undefined ? screen.availWidth : w));
  if(file.substr(0,7)!="http://") {query += ((file+mezera+query).indexOf("?")>0 ? "&" : "?") + "w="+w;}
  fi = (typeof(fi)==undefined ? 11 : fi);
// fi = (opener && opener.fi ? opener.fi : (typeof(fi)==undefined ? 11 : fi));
  if(file.substr(0,7)!="http://") {query += ((file+mezera+query).indexOf("?")>0 ? "&" : "?") + "fi="+fi;}
  ci = (typeof(ci)==undefined ? 0 : ci);
// ci = (opener && opener.ci ? opener.ci : (typeof(ci)==undefined ? 0 : ci));
  if(file.substr(0,7)!="http://") {query += ((file+mezera+query).indexOf("?")>0 ? "&" : "?") + "ci="+ci;}
//alert((opener && opener.ci ? ("Opener : " + opener.title + opener.ci) : (typeof(ci)==undefined ? 0 : ("ci : " + ci))));
//alert(typeof(ci)==undefined ? 0 : ("ci : " + ci));
// alert("Systém : " + file + " | " + query);
 }
 if(typeof(name)==undefined || name=="") {name = "_blank";}
 if(scroll!="no") {scroll = "yes";}
 if(resize!="no") {resize = "yes";}
 if(typeof(1*mywidth)!="number" || (1*mywidth==0)) {mywidth = op ? 634 : 640;} else {mywidth = zoom_x * mywidth}
 if(typeof(1*myheight)!="number" || (1*myheight==0)) {myheight = 450;} else {myheight = zoom_y * myheight}
 if(left!="l" && left!="r") {left = "c";}
 if(top!="t") {top = "c";}
 if(other!="no") {other = "yes";}
 if(typeof(hard_set)==undefined) {hard_set = "";}
 menub = hard_set.indexOf("m")>0 ? "yes" : other;
 toolb = hard_set.indexOf("t")>0 ? "yes" : other;
 locat = hard_set.indexOf("l")>0 ? "yes" : other;
 statu = hard_set.indexOf("s")>0 ? "yes" : other;
 direc = hard_set.indexOf("d")>0 ? "yes" : "no";
 copyh = hard_set.indexOf("c")>0 ? "yes" : "no";
// fscre = 1*mywidth<0 && 1*myheight<0 && !ie5 ? "yes" : "no";
 fscre = 1*mywidth<0 && 1*myheight<0 && !ie5 && !ie6 ? "yes" : "no";
 cela = 1*mywidth<0 && 1*myheight<0 && fscre=="no";
 okraj = 2;             // minimální okraj mezi oknem a krajem obrazovky, pokud není "fullscreen"
 korekce = (op || ns ? 36 : (ie5 ? 38 : (61 - 23*(statu=="no"))));
 resize_y = cela ? 38 + 20*(statu=="yes") + 44*(menub=="yes") + 28*(toolb=="yes") + 24*(locat=="yes") : korekce;
 resize_y += (cela && resize_y > 58) ? 5 : 0;
 korekce = (op ? 10 : (ns ? 8 : 12));
 resize_x = fscre=="yes" ? (ie5 ? 12 : (op ? 9 : 0)) : korekce;
 resize_x = fscre=="yes" ? 0 : korekce;
 posun_x = ns ? window.screenX + 6 : window.screenLeft + (ie ? 2 : -3);
 posun_y = op ? (window.screenTop + document.body.clientHeight + 20 < screen.availHeight, 0, -30) : (ie ? window.screenTop - 14 : window.screenY + 100);
 with(document.body) {
  if(clientWidth) {
   if(1*mywidth<0) {
	   if(op) {
		   mywidth = clientWidth;
		  } else {
     mywidth = screen.availWidth;
 	  }
	  }
   if(1*myheight<0) {myheight = screen.availHeight;}
  } else {
   if(1*mywidth<0) {mywidth = op ? 634 : 640;}
   if(1*myheight<0) {myheight = 450;}
 }}
 bod_nula_y = op ? Math.max(okraj, Math.min(window.screenTop - 133 + okraj, screen.availHeight - myheight - 168 - okraj)) : (ie && fscre=="yes" ? window.screenTop : okraj);
	my_left = cela ? 0 : Math.max(okraj, Math.min(screen.availWidth - mywidth + (ie ? (resize=="no" ? 2 : 0) : (op ? -2 : 4)) - okraj, posun_x + (document.body.clientWidth - mywidth) / 2));
	my_y = cela ? 0 : Math.max(bod_nula_y, Math.min(screen.availHeight - myheight - (ie ? 38 - (resize=="no" ? 2 : 0) : 36) - okraj, posun_y + (document.body.clientHeight - myheight) / 2 - okraj));
 korekce = ie && resize=="no" ? 2 : 0;
	my_y = cela ? 0 : Math.max(bod_nula_y, Math.min(screen.availHeight - myheight - okraj, posun_y + (document.body.clientHeight - myheight) / 2 - okraj) + korekce);

// Opera 8.02 otevírá okno jako fullscreen, pokud je jeho výka příli velká (> cca 600)
// (zatím to neřeím) - navíc nedělá scrolovací litu, je-li to třeba
//	if(op && fscre=="yes") {
//  okno = open(file+query,name,"fullscreen");
// } else {
  var new_okno = window.open(file+query,name,"fullscreen="+fscre+",menubar="+menub+",toolbar="+toolb+",location="+locat+",directories="+direc+",status="+statu+",scrollbars="+scroll+",resizable="+resize+",copyhistory="+copyh+",left="+my_left+",top="+my_y+",width="+(mywidth - resize_x)+",height="+(myheight - resize_y));
// }
 if(file.indexOf("ttps://")<1) {
  new_okno.resize = resize;
 }
 new_okno.focus();
 return new_okno;
}

// otevře novou stránku do okna
function to_win(page, mywidth, myheight, set_item, set_value, strpeni, radku_pred, radku_po, set_form, is_move) {
// page       : soubor, který se otevře v tomto okně
// mywidth    : nová ířka okna (default = 600, je-li < 0, nastaví se maximální)
// myheight   : nová výka okna (default = 450, je-li < 0, nastaví se maximální)
// set_item   : název proměnné, její hodnotu chci nastavit
// set_value  : hodnota, kterou přiřazuji proměnné <set_item>
// strpeni    : Počet <spanů>, které se budou mazat na stránce "Strpení, načítám stránku " (default = 0)
// radku_pred : pořet prázdných řádků, které se vloí před text "Strpení, ." (default = myheight / 45)
// radku_po   : pořet prázdných řádků, které se vloí za text "Strpení, ." (default = 0)
// set_form   : název formuláře, pro který se má provést submit() (default=0)
// is_move    : posouvat okno na nové souřadnice (default=1)
 ie5 = verze.substr(0,3)=="ie5" ? 1 : 0;
 ie = verze.substr(0,2)=="ie" ? 1 : 0;
 ns = verze.substr(0,2)=="mo" || verze.substr(0,2)=="ns" ? 1 : 0;
 op = verze.substr(0,2)=="op" ? 1 : 0;
 zoomIndex = (page.indexOf("partner.php")<0 ? 1 : 0.9);
 zoom_x = (fi > 11 ? fi * 0.095 * zoomIndex : 1);
 zoom_y = (fi > 11 ? (fi - 1) * Math.pow(0.98, fi - 11) / 10 : 1);
 if(page.indexOf("http://")==0) {
//alert("Původní : " + page);
  lang = (typeof(lang)==undefined ? defa_lang : lang);
//change_value(page, "lang", "ku");
// lang = (opener && opener.lang ? opener.lang : (typeof(lang)==undefined ? "cz" : lang));
  if(page.substr(0,7)!="http://") {page = change_value(page, "lang", lang);}
// if(page.substr(0,7)!="http://") {page += ((page).indexOf("?")>0 ? "&" : "?") + "lang="+lang;}
  w = (typeof(w)==undefined ? screen.availWidth : w);
// w = (opener && opener.w ? opener.w : (typeof(w)==undefined ? screen.availWidth : w));
  if(page.substr(0,7)!="http://") {page = change_value(page, "w", w);}
// if(page.substr(0,7)!="http://") {page += ((page).indexOf("?")>0 ? "&" : "?") + "w="+w;}
  fi = (typeof(fi)==undefined ? 11 : fi);
// fi = (opener && opener.fi ? opener.fi : (typeof(fi)==undefined ? 11 : fi));
  if(page.substr(0,7)!="http://") {page = change_value(page, "fi", fi);}
// if(page.substr(0,7)!="http://") {page += ((page).indexOf("?")>0 ? "&" : "?") + "fi="+fi;}
  ci = (typeof(ci)==undefined ? 0 : ci);
// ci = (opener && opener.ci ? opener.ci : (typeof(ci)==undefined ? 0 : ci));
  if(page.substr(0,7)!="http://") {page = change_value(page, "ci", ci);}
//alert("Nové : " + page);
// if(page.substr(0,7)!="http://") {page += ((page).indexOf("?")>0 ? "&" : "?") + "ci="+ci;}
 }
 if(typeof(1*mywidth)!="number" || (1*mywidth==0)) {mywidth = op ? 634 : 640;} else {mywidth = zoom_x * mywidth}
 if(typeof(1*myheight)!="number" || (1*myheight==0)) {myheight = 450;} else {myheight = zoom_y * myheight}
 if(typeof(strpeni)==undefined) {strpeni = 0;}
 if(typeof(radku_pred)==undefined) {radku_pred = myheight / 45;}
 if(typeof(radku_po)==undefined) {radku_po = 0;}
 if(typeof(set_form)==undefined) {set_form = 0;}
 if(typeof(is_move)==undefined) {is_move = 1;}
 cela = 1*mywidth<0 && 1*myheight<0;
 if(typeof(resize)==undefined) {resize = "yes";}
 okraj = 2;             // minimální okraj mezi oknem a krajem obrazovky, pokud není "fullscreen"
 posun_x = ns ? window.screenX + 6 : window.screenLeft + (ie ? 2 : -3);
 posun_y = op ? (window.screenTop + document.body.clientHeight + 20 < screen.availHeight, 0, -30) : (ie ? window.screenTop - 14 : window.screenY + 100);
 with(document.body) {
  if(clientWidth) {
   if(1*mywidth<0) {
	   if(op) {
		   mywidth = clientWidth;
		  } else {
     mywidth = screen.availWidth;
 	  }
	  }
   if(1*myheight<0) {myheight = screen.availHeight;}
  } else {
   if(1*mywidth<0) {mywidth = op ? 634 : 640;}
   if(1*myheight<0) {myheight = 450;}
 }}
 bod_nula_y = op ? Math.max(okraj, Math.min(window.screenTop - 133 + okraj, screen.availHeight - myheight - 168 - okraj)) : (cela ? window.screenTop : okraj);
 my_x = cela ? 0 : Math.max(okraj, Math.min(screen.availWidth - mywidth + (ie ? (resize=="no" ? 2 : 0) : (op ? -2 : 4)) - okraj, posun_x + (document.body.clientWidth - mywidth) / 2));
 my_y = cela ? 0 : Math.max(bod_nula_y, Math.min(screen.availHeight - myheight - (ie ? 38 - (resize=="no" ? 2 : 0) : 36) - okraj, posun_y + (document.body.clientHeight - myheight) / 2 - okraj));
 my_y = cela ? 0 : Math.max(bod_nula_y, Math.min(screen.availHeight - myheight + (ie ? (resize=="no" ? 2 : 0) : 0) - okraj, posun_y + (document.body.clientHeight - myheight) / 2 - okraj));
 if(strpeni) {
  posun_pred = posun_po = "";
  for(var index = 0; index<radku_pred; ++index) {posun_pred += "<br>";}
  for(var index = 0; index<radku_po; ++index) {posun_po += "<br>";}
  document.getElementById("nadpis").innerHTML = "<div style='position:absolute;left:0px;width: " + mywidth + "'>" + posun_pred + main_loading + posun_po + "</div>";
  if(strpeni>0) {
   document.getElementById("sp1").innerHTML = "";
   document.getElementById("cprght").innerHTML = "";
   if(strpeni>1) {
    document.getElementById("sp2").innerHTML = "";
    if(strpeni>2) {
     document.getElementById("sp3").innerHTML = "";
     if(strpeni>3) {
      document.getElementById("sp4").innerHTML = "";
      if(strpeni>4) {
       document.getElementById("sp5").innerHTML = "";
 }}}}}}
 if(is_move) {moveTo(my_x, my_y);}
 resizeTo(mywidth, myheight);
 if(typeof(document.forms[set_form])!=undefined) {
  with(document.forms[set_form]) {
	 action = page;
   setItem(set_item, set_value, set_form);
   submit();
}}}

// nastaví hodnotu proměnné <input type=hidden >
function setItem(set_item, set_value, set_form) {
// set_item  : název proměnné, její hodnotu chci nastavit
// set_value : hodnota, kterou přiřazuji proměnné <set_item>
// set_form  : název formuláře, který obsahuje přiřazovanou proměnnou (default=0)
 if(typeof(set_form)==undefined) {set_form = 0;}
 if(typeof(document.forms[set_form])!=undefined && typeof(document.forms[set_form].elements[set_item])!=undefined) {document.forms[set_form].elements[set_item].value = set_value;}
}

// klasická funkce trim
function trim(thisvalue) {
// thisvalue : hodnota, ze které se odstraňují úvodní a koncové mezery
 if(typeof(thisvalue)=="text" || typeof(thisvalue)=="string") {
  while(thisvalue.substr(0, 1)==" ") {thisvalue = thisvalue.substr(1);}
	 while(thisvalue.substr(thisvalue.length - 1, 1)==" ") {thisvalue = thisvalue.substr(0, thisvalue.length - 1);}
 }
 return thisvalue;
}

// klasická funkce trim, ale i pro &nbsp;
function trim_nbsp(thisvalue) {
// thisvalue : hodnota, ze které se odstraňují úvodní a koncové mezery
 if(typeof(thisvalue)=="text" || typeof(thisvalue)=="string") {
  while(thisvalue.charCodeAt(0)==160 || thisvalue.charCodeAt(0)==32) {thisvalue = thisvalue.substr(1);}
	 while(thisvalue.charCodeAt(thisvalue.length - 1, 1)==160 || thisvalue.charCodeAt(thisvalue.length - 1, 1)==32) {thisvalue = thisvalue.substr(0, thisvalue.length - 1);}
 }
 return thisvalue;
}

// vyjmutí vech úvodních a koncových mezer z poloky
function setTrim(thisitem) {
// thisitem : poloka, ze které se odstraňuje
 with(document.forms[0].elements[thisitem]) {
  if(type=="text") {
   while(value.substr(0, 1)==" ") {value = value.substr(1);}
	  while(value.substr(value.length - 1, 1)==" ") {value = value.substr(0, value.length - 1);}
}}}

// vyjmuti vsech uvodnich a koncovych mezer z poli
function all_trim() {
 for(var index = 0; index<=document.forms[0].elements.length - 1; ++index) {
	 with(document.forms[0].elements[index]) {
   if(type=="text") {
	   while(value.substr(0, 1)==" ") {value = value.substr(1);}
 	  while(value.substr(value.length - 1, 1)==" ") {value = value.substr(0, value.length - 1);}
}}}
}

// kontrola platnosti intervalu datumu
function check_datum(thisitem, minvalue, maxvalue) {
// thisitem : poloka, která se kontroluje
// minvalue : nejmení přípustné číslo (default = DNES)
// maxvalue : největí přípustné číslo (default = DNES)

// POZOR : v Mozille (i Firefoxu) je chyba při alertu (dochází k opakovanému volání této funkce při aktivaci jiného okna),
//         proto je test pro Mozillu vyřazen !!!
 if(verze.substr(0,2)!="mo") {
  if(isBlur=="" || isBlur==thisitem.name) {
	  itemOK = 1;
   setTrim(thisitem.name);
   if(thisitem.value.length>0 && RegExp) {
    check = new RegExp("^[0-3]?[0-9].[0-1]?[0-9].[0-9]{4}$");
    if(!check.test(trim(thisitem.value))) {
	    itemOK = 0;
     alert(main_dat_tvar);
     thisitem.focus();
    } else {
     pole = thisitem.value.split(".");
     myDate = new Date();
     myDate.setHours(0, 0, 0, 0);
     myDate.setFullYear(pole[2], pole[1] - 1, pole[0]);
     if(1*pole[0]!=myDate.getDate() || 1*pole[2]!=myDate.getFullYear()) {
	     itemOK = 0;
      alert(main_dat_plat);
      thisitem.focus();
     } else {
      minDate = (typeof(minvalue)==undefined ? new Date() : new Date(minvalue));
      minDate.setHours(0, 0, 0, 0);
      maxDate = (typeof(maxvalue)==undefined ? new Date() : new Date(maxvalue));
      maxDate.setHours(0, 0, 0, 0);
      if(maxDate<minDate) {maxDate = minDate;}
      if(minDate > myDate || maxDate < myDate) {
  	    itemOK = 0;
       alert(main_dat_rozsah1 + " <" + minDate.getDate() + "." + (minDate.getMonth() + 1) + "." + minDate.getFullYear() + ", " + maxDate.getDate() + "." + (maxDate.getMonth() + 1) + "." + maxDate.getFullYear() + ">" + main_dat_rozsah2);
       thisitem.focus();
   }}}}
   isBlur = (itemOK ? "" : thisitem.name);
}}}

// kontrola platnosti intervalu čísla
function check_interval(thisitem, minvalue, maxvalue) {
// thisitem : poloka, která se kontroluje
// minvalue : nejmení přípustné číslo (default = 0)
// maxvalue : největí přípustné číslo (default = 999999)

// POZOR : v Mozille (i Firefoxu) je chyba při alertu (dochází k opakovanému volání této funkce při aktivaci jiného okna),
//         proto je test pro Mozillu vyřazen !!!
 if(verze.substr(0,2)!="mo") {
  if(isBlur=="" || isBlur==thisitem.name) {
   setTrim(thisitem.name);
   if(typeof(minvalue)==undefined) {minvalue = 0;}
   if(typeof(maxvalue)==undefined) {maxvalue = 999999;}
   if(maxvalue<minvalue) {maxvalue = minvalue;}
   if(thisitem.value.length>0 && RegExp) {
    check = new RegExp("^[-+]?[0-9]*$");
    if(!check.test(trim(thisitem.value)) || 1*thisitem.value<minvalue || 1*thisitem.value>maxvalue) {
     isBlur = thisitem.name;
     alert(main_num_rozsah1 + " <" + minvalue + ", " + maxvalue + ">" + main_num_rozsah2);
     thisitem.focus();
    } else {
     thisitem.value = 1 * thisitem.value;
     isBlur = "";
    }
   } else {isBlur = "";}
}}}

// kontrola platnosti zadání pouze cifer
function check_number(thisitem, mincount, maxcount, pref, text2) {
// thisitem : poloka, která se kontroluje
// mincount : nejmení počet cifer (default = 0)
// maxcount : největí počet cifer (default = 256)
// pref     : moné nečíselné znaky nazačátku

// POZOR : v Mozille (i Firefoxu) je chyba při alertu (dochází k opakovanému volání této funkce při aktivaci jiného okna),
//         proto je test pro Mozillu vyřazen !!!
 if(verze.substr(0,2)!="mo") {
  if(isBlur=="" || isBlur==thisitem.name) {
   setTrim(thisitem.name);
   if(typeof(pref)==undefined) {pref = "";}
   if(typeof(defa_dic2)==undefined) {defa_dic2 = "";}
   if(typeof(text2)==undefined) {text2 = "";}
   posun = pref.length;
   if(posun>0) {posun = posun + defa_dic2.length;}
   if(typeof(mincount)==undefined || mincount<posun || mincount>255+posun) {mincount = posun;}
   if(typeof(maxcount)==undefined || maxcount<posun || maxcount>255+posun) {maxcount = 256+posun;}
   mincount = mincount - posun;
   maxcount = maxcount - posun;
   if(maxcount<mincount) {maxcount = mincount;}
   if(thisitem.value.length>0 && RegExp) {
    if(pref.length>0 && defa_dic2.length>0) {
     if(text2.length>0) {text2 = text2 + " (" + pref + defa_dic2 + ")";}
     pref = pref + "(" + defa_dic2 + ")?";
    }
    if(posun>0) {pref = "("+pref+")?";}
check = new RegExp("^" + pref + "[0-9]{" + mincount + "," + maxcount + "}$");
//    check = new RegExp("^[0-9]{" + mincount + "," + maxcount + "}$");
    if(!check.test(trim(thisitem.value).toUpperCase())) {
     isBlur = thisitem.name;
     text = main_num_only;
     text_min = text_max = spojka = "";
     if(mincount>0) {text_min = main_num_min + " " + mincount;}
     if(maxcount<256) {text_max = main_num_max + " " + maxcount;}
     if(mincount>0 && maxcount<256) {spojka = ", ";}
     if(mincount==maxcount) {text_min = spojka = ""; text_max = main_num_presne + " " + mincount;}
     if(mincount>0 || maxcount<256) {text = text + " (" + text_min + spojka + text_max + ")";}
     alert(text + text2);
     thisitem.focus();
    } else {isBlur = "";}
   } else {isBlur = "";}
}}}

// kontrola platnosti e-mailové adresy
function check_mail(thisitem, typ) {
// thisitem : poloka, která se kontroluje
// typ      : typ kontroly -> 1 = pouze část před "@"
//                            2 = celá adresa (default)

// POZOR : v Mozille (i Firefoxu) je chyba při alertu (dochází k opakovanému volání této funkce při aktivaci jiného okna),
//         proto je test pro Mozillu vyřazen !!!
 if(verze.substr(0,2)!="mo") {
  if(isBlur=="" || isBlur==thisitem.name) {
   setTrim(thisitem.name);
   if(thisitem.value.length>0 && RegExp) {
    if(typeof(typ)==undefined) {typ = 2;}
    if(typ==1) {
	    check = new RegExp("^[a-z]([_\.\-]?[a-z0-9]+)*$");
    } else {
     check = new RegExp("^[a-z]([_\.\-]?[a-z0-9]+)*@[a-z0-9]([_\.\-]?[a-z0-9]+)*[\.][a-z]{2,4}$");
    }
    if(!check.test(thisitem.value)) {
     isBlur = thisitem.name;
     alert(main_mail);
     thisitem.focus();
    } else {isBlur = "";}
   } else {isBlur = "";}
}}}

// kontrola platnosti www adresy
// POZOR : při dlouhé polozce to trva neunosne dlouho !!!
function check_www(thisitem) {
// thisitem : poloka, která se kontroluje

 if(typeof(is_check_www)==undefined) {is_check_www = 1;}
 if(is_check_www==1) {
// POZOR : v Mozille (i Firefoxu) je chyba při alertu (dochází k opakovanému volání této funkce při aktivaci jiného okna),
//         proto je test pro Mozillu vyřazen !!!
  if(verze.substr(0,2)!="mo") {
   if(isBlur=="" || isBlur==thisitem.name) {
    setTrim(thisitem.name);
    if(thisitem.value.length>0 && RegExp) {
//  check = new RegExp("^[a-z0-9]([_\.\-]?[a-z0-9]+)*[\.][a-z]{2,3}([/][a-z0-9]+[_\-]?[a-z0-9]+)?$");
     check = new RegExp("^[a-z0-9]([_\.\-]?[a-z0-9]+)*[\.][a-z]{2,4}(/_?[a-z0-9]+([_\-]?[a-z0-9]+)*_?)*$");
     if(!check.test(thisitem.value)) {
      isBlur = thisitem.name;
      alert(main_www);
      thisitem.focus();
     } else {isBlur = "";}
    } else {isBlur = "";}
}}}}

// kontrola platnosti telefonního čísla
function check_phone(thisitem, typ) {
// thisitem : poloka, která se kontroluje
// typ      : typ kontroly -> 1 = mezinárodní verze <+420 123 456 789>
//                            2 = národní verze <123 456 789>
//                            3 = obě dvě monosti (default)

// POZOR : v Mozille (i Firefoxu) je chyba při alertu (dochází k opakovanému volání této funkce při aktivaci jiného okna),
//         proto je test pro Mozillu vyřazen !!!
 if(verze.substr(0,2)!="mo") {
  if(isBlur=="" || isBlur==thisitem.name) {
   setTrim(thisitem.name);
   if(thisitem.value.length>0 && RegExp) {
    if(typeof(typ)==undefined) {typ = 3;}
    if(typ==1) {
     check = new RegExp("^[+]([0-9]{3}[ ]?){4}$");
     tvar = "+420 123 456 789";
    } else {
     if(typ==2) {
      check = new RegExp("^([0-9]{3}[ ]?){3}$");
      tvar = "123 456 789";
     } else {
      if(domena=="cz") {
//    $check = "^([+][0-9]{3}[ ]?)?([0-9]{3}[ ]?){3}$";
//    $tvar = "123 456 789> $func_nebo <+420 123 456 789";
//       check = new RegExp("^([+][0-9]{3}[ ]?)?([0-9]{3}[ ]?){3}$");
       check = new RegExp("^([+]420[ ]?)?([0-9]{3}[ ]?){3}$");
       tvar = "123 456 789> " + main_nebo + " <+420 123 456 789";
      }
      if(domena=="sk") {
       check = new RegExp("^([+]421([ ]?[(][0-9]{1,4}[)][ ]?|[- ][0-9]{1,4}[- ])|([(]0[0-9]{1,4}[)][ ]?|0[0-9]{1,4}[- ]))[0-9]{2,4}([- ]?[0-9]{2,4}){1,2}$");
       tvar = "0123 123 456> " + main_nebo + " <+421(123)123 456";
//       check = new RegExp("^([+]421[- ]?|0)[0-9]{1,4}[- ]?([0-9]{2,4}[ ]?){2,3}$");
//       tvar = "0123 456 789> " + main_nebo + " <+421 0123 456 789";
      }
// AT : odzkoueno
      if(domena=="at") {
// +43 xxxx XXXX XXXX XXXX nebo 0xxxx XXXX XXXX XXXX
//                $check = "^(\+43[- \.]?|0)[0-9]{1,4}[- \.]?([0-9]{2,4}[ ]?){2,3}$";
       check = new RegExp("^([+]43[- \.]?|0)[0-9]{1,4}[- \.]?([0-9]{2,4}[ ]?){2,3}$");
       tvar = "01234 5678 9012> " + main_nebo + " <+43 1234 5678 9012";
      }
      if(domena=="ru") {
       check = new RegExp("^([+]7[ ]?)?([(][0-9]{3,4}[)]|[0-9]{2,3})[ ]?[0-9]{2,3}[ -]?([0-9]{2}[ -]?){1,2}$");
       tvar = "123 456 78 90> " + main_nebo + " <+7 (123) 456 78 90";
      }
// toto dodělat !!!
      if(domena=="pl") {
       check = new RegExp("^([+]48([ ]?[(][0-9]{1,2}[)][ ]?|[- ][0-9]{1,2}[- ])|([(]0[0-9]{1,2}[)][ ]?|0[0-9]{1,2}[- ]))[0-9]{2,4}([- ]?[0-9]{2,3}){1,2}$");
       tvar = "0123 123 45 67> " + main_nebo + " <+48 (123) 123 45 67";
//       check = new RegExp("^([+]48[- ]?|0)[0-9]{0,2}[- ]?([0-9]{2,4}[ ]?){2,3}$");
//       tvar = "012 345 67 89> " + main_nebo + " <+48 12 345 67 89";
      }
// toto dodělat !!!
      if(domena=="it") {
       check = new RegExp("^([+]39[ ]?)?0?[0-9]{1,3}[ .]?([0-9]{2,4}[ ]?){2,3}$");
       tvar = "0123 4567 8901> " + main_nebo + " <+39 0123 4567 8901";
      }
// toto dodělat !!!
      if(domena=="de") {
       check = new RegExp("^([+]49[ ]?)?0?[0-9]{1,3}[ .]?([0-9]{2,4}[ ]?){2,3}$");
       tvar = "0123 4567 8901> " + main_nebo + " <+49 0123 4567 8901";
      }
// toto dodělat !!!
      if(domena=="hu") {
       check = new RegExp("^([+]36[ ]?)?0?[0-9]{1,3}[ .]?([0-9]{2,4}[ ]?){2,3}$");
       tvar = "0123 4567 8901> " + main_nebo + " <+36 0123 4567 8901";
      }
// toto dodělat !!!
      if(domena=="fr") {
       check = new RegExp("^([+]33[ ]?)?0?[0-9]{1,3}[ .]?([0-9]{2,4}[ ]?){2,3}$");
       tvar = "0123 4567 8901> " + main_nebo + " <+33 0123 4567 8901";
      }
// toto dodělat !!!
      if(domena=="es") {
       check = new RegExp("^([+]34[ ]?)?0?[0-9]{1,3}[ .]?([0-9]{2,4}[ ]?){2,3}$");
       tvar = "0123 4567 8901> " + main_nebo + " <+34 0123 4567 8901";
      }
    }}
    if(!check.test(thisitem.value)) {
     isBlur = thisitem.name;
     alert(main_item_form1 + " <" + tvar + ">" + main_item_form2);
     thisitem.focus();
//    document.forms[0].elements.ktl.focus();
    } else {isBlur = "";}
   } else {isBlur = "";}
}}}

// vymae údaje ve vech polokách
function clear_all(thisform, mimo1, mimo2) {
// thisform : vymazat vechny poloky formuláře <thisform>
// mimo     : nemazat poloku <mimo>
 for(var index = 0; index<=thisform.elements.length - 1; ++index) {
	 with(thisform.elements[index]) {
   if(type=="text" && name!=mimo1 && name!=mimo2) {value = "";}
   if(type=="select-one") {selectedIndex = -1;}
 }}
 if(typeof(thisform.idf)!=undefined) {
  thisform.idf.value = "";
  thisform.idd.value = "";
  thisform.ido.value = "";
 }
 return false;
}

//function CZ_filter(vstup, filter_on) {
// if(vstup.length>0 && RegExp && filter_on) {
//  if(filter_on==1) {				      // odstranění diakritiky
//   vstup = vstup.replace(/á/ig, "a").replace(/č/ig, "c").replace(/ď/ig, "d").replace(/é/ig, "e").replace(/ě/ig, "e").replace(/í/ig, "i").replace(/ň/ig, "n").replace(/ó/ig, "o").replace(/ř/ig, "r").replace(//ig, "s").replace(//ig, "t").replace(/ú/ig, "u").replace(/ů/ig, "u").replace(/ý/ig, "y").replace(//ig, "z");
//  } else {
//   if(filter_on==10) {			     // převod z Windows-1250 do ISO-8859-2
//    vstup = vstup.replace(//g, "š").replace(//g, "Š").replace(//g, "ť").replace(//g, "Ť").replace(//g, "ž").replace(//g, "Ž");
//   } else {                   // převod z Windows-1250 do UTF-8 (<č> musí být na konci, protoe se kóduje pomocí <> !!!)
//    vstup = vstup.replace(/á/ig, "ĂĄ").replace(/ď/ig, "Ä").replace(/é/ig, "ĂŠ").replace(/ě/ig, "Ä").replace(/í/ig, "Ă­").replace(/ň/ig, "Ĺ").replace(/ó/ig, "Ăł").replace(/ř/ig, "Ĺ").replace(//ig, "ĹĄ").replace(//ig, "ĹĽ").replace(/ú/ig, "Ăş").replace(/ů/ig, "ĹŻ").replace(/ý/ig, "Ă˝").replace(//ig, "Ĺž").replace(/č/ig, "Ä");
//á  č  ď  é  ě  í  ň  ó  ř      ú  ů  ý  
//ĂĄ Ä Ä ĂŠ Ä Ă­ Ĺ Ăł Ĺ ĹĄ ĹĽ Ăş ĹŻ Ă˝ Ĺž
//Ă Ä Ä Ă Ä Ă Ĺ Ă Ĺ Ĺ  Ĺ¤ Ă ĹŽ Ă Ĺ˝
// }}}
// return vstup;
//}


function myMouseOver(myItem, barva, border) {
 myItem.style.backgroundColor=(typeof(myAColor)==undefined ? barva : myAColor[ci]);
 myItem.style.cursor=kurzor;
 if(typeof(border)!=undefined) {myItem.style.borderColor="black";}
}

function myMouseOut(myItem) {
 myItem.style.backgroundColor='';
 myItem.style.cursor='default';
 myItem.style.borderColor='';
}

// otevře novou stránku a předá ji systémové parametry (lang, w, fi, ci)
function new_page(page) {
 lang = (typeof(lang)==undefined ? defa_lang : lang);
 if(page.substr(0,7)!="http://" && page.indexOf("lang=")==0) {page += ((page.indexOf("?")>0) ? "&" : "?") + "lang="+lang;}
 w = (typeof(w)==undefined ? screen.availWidth : w);
 if(page.substr(0,7)!="http://") {page += ((page).indexOf("?")>0 ? "&" : "?") + "w="+w;}
 fi = (typeof(fi)==undefined ? 11 : fi);
 if(page.substr(0,7)!="http://") {page += ((page).indexOf("?")>0 ? "&" : "?") + "fi="+fi;}
 ci = (typeof(ci)==undefined ? 0 : ci);
 if(page.substr(0,7)!="http://") {page += ((page).indexOf("?")>0 ? "&" : "?") + "ci="+ci;}
 location = page;
}

function change_value(adresa, promenna, hodnota) {
 if(!(zacatek = adresa.substr(0, adresa.indexOf(promenna + "=")))) { zacatek = adresa + ((adresa.indexOf("?")>0) ? "&" : "?"); }
 if(adresa.indexOf(promenna + "=")>0) {
  konec1 = adresa.substr(adresa.indexOf(promenna + "="));
  konec = konec1.substr(konec1.indexOf("&"));
 } else {konec = "";}
 return zacatek + promenna + "=" + hodnota + konec;
}

function setiny(input) {
 xxx = input + "";
 if(typeof(konv_zaokr)==undefined || konv_zaokr>0) {
  tecka = xxx.indexOf(".");
  desetin = xxx.length - 1 - tecka;
  if(tecka<1){xxx = xxx + ".00"} else {if(desetin==1){xxx = xxx + "0"}}
 } else {
  xxx = Math.round(xxx) + "";
  if(xxx>=1000) {
   y = Math.floor(xxx/1000) + "";
   if(y>=1000) {
    y = Math.floor(y/1000) + " " + y.substr(y.length-3,3);
   }
   xxx = y + " " + xxx.substr(xxx.length-3,3);
  }
 }
 return xxx;
}

function setMyDate(datum, zmena_dnu) {
 datum2 = new Date();
 if(typeof(datum)!=undefined) {
  pole = datum.split(".");
  datum2.setFullYear(pole[2], pole[1]-1, pole[0]);
  datum2.setTime(datum2.getTime() + zmena_dnu * 86400000);
 }
 d1 = datum2.getDate(); d2 = datum2.getMonth() + 1;
 d1 = (d1 < 10 ? "0" : "") + d1;
 d2 = (d2 < 10 ? "0" : "") + d2;
 datum = d1 + "." + d2 + "." + datum2.getFullYear();
 return datum;
}

function myref(nastav) {
 document.referer = document.referrer;
 my_ref = document.referer;
 if(my_ref.indexOf("utohits")>0) {
  if(typeof(nastav)==undefined) {
   document.referer = old_ref;
  } else {
   old_ref = my_ref;
   document.referer = "http://www." + list_domen[nastav] + "." + nastav;
//   document.referer = "http://www.google." + nastav + "/search?hl=cs&q=katalog+firem&btnG=Hledat&lr=lang_cs";
  }
 }
}
