var img = new Array()

function PrlI() {
	ShowTime()
  for (i=1;i<10;i++) PrlImage(lg+'/img/bt'+i+'b.gif');
}
function PrlImage(im) {
	if (document.images) {
		img[img.length] = new Image()
		img[img.length-1].src = im
	}
}
  function MnOv(n){
		mnu='bt'+n
		document.images[mnu].src=lg+'/img/'+mnu+'b.gif'
	}

  function MnOu(n){
		mnu='bt'+n
		document.images[mnu].src=lg+'/img/'+mnu+'.gif'
	}

function checkEmail(checkString) {
    var newstr = "";
    var at = false;
    var dot = false;

    if (checkString.indexOf("@") != -1) {
      at = true;
    } else if (checkString.indexOf(".") != -1) {
      dot = true;
    }
    for (var i = 0; i < checkString.length; i++) {
        ch = checkString.substring(i, i + 1)
        if ((ch >= "A" && ch <= "Z") || (ch >= "a" && ch <= "z")
                || (ch == "@") || (ch == ".") || (ch == "_")
                || (ch == "-") || (ch >= "0" && ch <= "9")) {
                newstr += ch;
                if (ch == "@") {
                    at=true;
                }
                if (ch == ".") {
                    dot=true;
                }
        }
    }
    if ((at == true) && (dot == true)) {
        return true;
    }
    else {
      return false;
    }
}

function checkInteger(checkString) {
    newString = "";
    count = 0;
    for (i = 0; i < checkString.length; i++) {
        ch = checkString.substring(i, i+1);
        if (ch >= "0" && ch <= "9") {
            newString += ch;
        }
    }
    if ((checkString != newString) || (checkString == "")) {
				return false;
    }
    return true;
}

function Sh1() {
	window.open("img.php?id=1&lg="+lg,"m1","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=820,height=570,top=1,left=1")
	return false
}
function Sh2() {
	//doprava
	//window.open("img.php?id=2&lg="+lg,"m2","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=440,height=446,top=1,left=1")
	window.open("doprava.html","m2","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=530,height=454,top=1,left=1")
	return false
}
function Sh3() {
	window.open("img.php?id=3&lg="+lg,"m3","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=600,height=390,top=1,left=1")
	return false
}
function Sh4(sid) {
	window.open("img.php?id=4&lg="+lg+"&sid="+sid,"m4_"+sid,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=400,height=400,top=1,left=1")
	return false
}

function Sh5(sid,w,h) {
	window.open("img.php?id=5&lg="+lg+"&sid="+sid+"&w="+w+"&h="+h,"m5_"+sid,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width="+(w+23)+",height="+(h+23)+",top=1,left=1")
	return false
}

function Sh6(sid) {
	window.open("img.php?id=6&lg="+lg+"&sid="+sid,"m6_"+sid,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=610,height=415,top=1,left=1")
	return false
}
function Sh7(sid) {
	window.open("img.php?id=7&lg="+lg+"&sid="+sid,"m7_"+sid,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=410,height=615,top=1,left=1")
	return false
}

function Sh8(sid) {
	window.open("img.php?id=8&lg="+lg+"&sid="+sid,"m8_"+sid,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=435,height=297,top=1,left=1")
	return false
}

function Sh9(sid,horiz) {
	if (horiz) {	h=465;w=620; }
	else {	w=465;h=620; }
	window.open("img.php?id=9&lg="+lg+"&sid="+sid+"&w="+w+"&h="+h,"m9_"+sid,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width="+(w+20)+",height="+(h+15)+",top=1,left=1")
	return false
}

function Sh9x(sid,w,h) {
	window.open("img.php?id=9&lg="+lg+"&sid="+sid+"&w="+w+"&h="+h,"m9_"+sid,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width="+(w+20)+",height="+(h+15)+",top=1,left=1")
	return false
}

function Sh10(sid,horiz) {
	if (horiz) {h=285;w=425;}
	else {w=285;h=425;}
	window.open("img.php?id=10&lg="+lg+"&sid="+sid+"&w="+w+"&h="+h,"m10_"+sid,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width="+(w+20)+",height="+(h+15)+",top=1,left=1")
	return false
}

function Sh11(sid,horiz) {
	if (horiz) {w=620;h=465;}
	else {h=620;w=465;}
	window.open("img.php?id=11&lg="+lg+"&sid="+sid+"&w="+w+"&h="+h,"m11_"+sid,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width="+(w+20)+",height="+(h+15)+",top=1,left=1")
	return false
}

function Sh12(sid,horiz) {
	if (horiz) {w=620;h=415;}
	else {w=415;h=620;}
	window.open("img.php?id=12&lg="+lg+"&sid="+sid+"&w="+w+"&h="+h,"m10_"+sid,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width="+(w+20)+",height="+(h+15)+",top=1,left=1")
	return false
}
function ShFoto(sid,w,h,id) {
	window.open("img.php?id="+id+"&lg="+lg+"&sid="+sid+"&w="+w+"&h="+h,"m10_"+sid,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width="+(w+20)+",height="+(h+15)+",top=1,left=1")
	return false
}
function ShFotoNoRet(sid,w,h,id) {
	window.open("img.php?id="+id+"&lg="+lg+"&sid="+sid+"&w="+w+"&h="+h,"m10_"+sid,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width="+(w+20)+",height="+(h+15)+",top=1,left=1")
}

function ShSb(sid,horiz) {
	if (horiz) {w=620;h=415;}
	else {w=415;h=620;}
	window.open("img.php?id=13&lg="+lg+"&sid="+sid+"&w="+w+"&h="+h,"m10_"+sid,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width="+(w+20)+",height="+(h+15)+",top=1,left=1")
	return false
}

function ShWC(id) {
	window.open("webcam.php?act=cam&lg="+lg+"&id="+id,"m5_"+id,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=540,height=540,top=1,left=1")
	//return false
}

function ShN() {
	setTimeout("ShN_X()",3000)
	return false
}
function ShN_X() {
	window.open("news.php?lg="+lg,"mN","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=474,height=300,top=1,left=1")
}

function ShCam(id) {
	window.open("webcam2.php?act=cam&lg="+lg+"&id="+id,'cam'+id,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=540,height=540,top=1,left=1")
	//return false;
}

function showUbytWnd(id) {
	window.open("ubyt_detail.php?act=uby&lg="+lg+"&id="+id,"ub"+id,"dependent,width=530,height=510,resizable=yes,scrollbars=yes");
}

function ChckChat() {
	var f=document.f_chat
	var g=document.f_chatok
	var h=document.f_chatadr
	if (! f.txt.value) {alert(chaterr); f.txt.focus(); return false;}
	var t=f.time
	g.txt.value=f.txt.value
	g.time.value=(t[0].checked ? 30 : (t[1].checked ? 15 : (t[2].checked ? 10 : (t[3].checked ? 5 : 10 ))))
	t=h.adr
	g.adr.value=(t[0].checked ? 0 : t[1].value)
	g.colr.value=f.colr.value
	g.fil.value=h.fil[h.fil.selectedIndex].value
	f.txt.value=''
	return true
}

function SndChat() {
	if (ChckChat()) document.f_chatok.submit();
}

function SetCookie(name, value) {
	var argv = SetCookie.arguments;
	var argc = SetCookie.arguments.length;
	//var expires = (argc > 2) ? argv[2] : null;
	var expires = new Date();
	expires.setTime(expires.getTime()+86400*30*1000);
	var path = (argc > 3) ? argv[3] : null;
	var domain = (argc > 4) ? argv[4] : null;
	var secure = (argc > 5) ? argv[5] : false;
	document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : "");
}

function SaveNick(idc) {
	var d = new Date ();
	d.setTime(d.getTime() + 24*3600*31);
	SetCookie('chat_id',idc);
}

function Priv(name,id) {
	var f=window.top.document.f_chatadr
	f.adrx.value=name
	//f.adr[1].value=f.fil[1].value=id
	f.adr[1].value=id
	f.adr[1].checked=true
	window.top.document.f_chat.txt.focus()
	return false
}

function  ReChat(v) {
	document.ifr.location='chatin.php?'+ v
}

function Smajl(s) {
	var f=document.f_chat.txt
	f.value+=' '+s+' '
	f.focus()
	return false;
}
function ShowTime() {
		var message;
		//var theTime = window.setTimeout("ShowTime()",1000);
		var theTime = window.setTimeout("ShowTime()",10000);
		var now     = new Date();

		isLoaded=1;



		var year = now.getYear();
		if (year < 1000) {
			year += 1900;
		}

		//message= now.getDate() + ". " + (now.getMonth() < 9 ? "0" + (now.getMonth()+1): (now.getMonth()+1)) + ". "+year;
		message= now.getDate() + "." + (now.getMonth() < 9 ? "0" + (now.getMonth()+1): (now.getMonth()+1)) + "."+year;



		var min  = now.getMinutes();
		var sec  = now.getSeconds();
		message += "  " + now.getHours() + ":" + (min < 10 ? "0" + min : min) + ":" + (sec < 10 ? "0" + sec : sec);

		if (document.getElementById('time')) {
			document.getElementById('time').innerHTML = '<nobr>' + message + '</nobr>';
		}
		else if (document.all['time']) {
			document.all['time'].innerHTML = '<nobr>' + message + '</nobr>';
		}
	}
function ShAutomMapa() {
	//doprava
	//window.open("img.php?id=2&lg="+lg,"m2","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=440,height=446,top=1,left=1")
	window.open("doprava.html","m2","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=530,height=454,top=1,left=1")
	return false
}
function ShZiv1(sid,h) {
	if (!h) h=130;
	window.open("popis.php?id=1lg="+lg+"&sid="+sid+"&h="+h,"s1_"+sid,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=500,height="+(h+20))
	return false
}

function ShZiv2(sid,h) {
	if (!h) h=130;
	window.open("popis.php?id=2&lg="+lg+"&sid="+sid+"&h="+h,"s2_"+sid,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=500,height="+(h+20))
	return false
}
function ShZiv3(sid,h) {
	if (!h) h=130;
	window.open("popis.php?id=3&lg="+lg+"&sid="+sid+"&h="+h,"s3_"+sid,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=500,height="+(h+20))
	return false
}
function openWin(url,nameW,widthW,heightW,top,left,properties,noret)
{
	winObj=window.open(url,nameW,"width="+widthW+",height="+heightW+",top="+top+",left="+left+",directories=no,menubar=no,toolbar=no,location=no,status=no,resizable=no,copyhistory=no,scrollbars=no"+properties);
  winObj.focus();
  if (!noret) return winObj;
  else return null;
}

function openWinEx(url,nameW)
{
  winObj=window.open(url, nameW);
  if (winObj) winObj.focus();
}

//agresivny baner
function agBanner(){
  if (!document.getElementById('idAgBan')) return;
	if (is.ie) 	{
		scrw=document.body.clientWidth
		scrh=document.body.clientHeight
	}	else {
		scrw=window.innerWidth
		scrh=window.innerHeight
	}
	document.getElementById('idAgBan').style.width=scrw;
	document.getElementById('idAgBan').style.height=scrh;
	document.getElementById('idAgBan').style.paddingTop=(scrh-200)/2;
	document.getElementById('idAgBan').style.left=-20;
	document.getElementById('idAgBan').style.visibility='visible';
	agBannHide=setTimeout('agBannerHide()',7050);
}
function agBannerHide(){
  if (!document.getElementById('idAgBan')) return;
  document.getElementById('idAgBan').style.visibility='hidden';
}
function flBanner(){
  if (!document.getElementById('idFl')) return
  document.getElementById('idFl').style.left=getX();
  document.getElementById('idFl').style.visibility='visible';
  //do BODY onclick="if (document.getElementById('idFl')){ document.getElementById('idFl').style.visibility='hidden';self.status=''; }"
  //do BODY onresize="if (document.getElementById('idFl')){ document.getElementById('idFl').style.left=getX(); }
}

function ShN_XP_(VarName) {
//	alert(VarName);
	window.open("comp_calendar.php"+VarName,"mN","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=500,height=600,top=1,left=1")
}

function ShN_XP(VarName, name) {
	obj = document.getElementById(name).value;
	window.open("comp_calendar.php"+VarName+obj,"mN","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=500,height=600,top=1,left=1")
}

function ShN_XPC(VarName, name) {
//	obj = document.getElementById(name).value;
	window.open("comp_calendar_mes.php"+VarName,"mN","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=250,height=210,top=1,left=1")
}

function ShN_XP_Ho(VarName) {
//		alert(VarName);
		window.open("rating.php"+VarName,"mN","toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=500,height=350,top=1,left=1")
}

/**********************************************************************
** NAME:       trim
** PURPOSE:    replace leading and trailing spaces with the empty string
**
** INPUT:	        s - string to trim
** RETURNED VALUE:  none
**
** CALLED BY:
** CALLS:
**
** LIMITATIONS:
** NOTES:
**********************************************************************/
function trim(s)
{
    return s.replace(/(^\s*)|(\s*$)/g, "");
}

/**********************************************************************
** NAME:       checkdate
** PURPOSE:    date validation
**
** INPUT:	        dtm - date to check
** RETURNED VALUE:  boolean - true, if date is correct
**
** CALLED BY:
** CALLS:
**
** LIMITATIONS:
** NOTES:
**********************************************************************/
function checkdate(dtm)
{
	var d,t,y;
	var dd,mm,yy,hh,min;
	var odd,omm,oyy,ohh,omin;
	// empty date is correct
    	if (dtm=="")
		return false;

	// trim the date
	dtm = trim(dtm);
    	{
		// date without time
		// parse date to yy,mm,dd
		// hh = 0, min = 0
		y = dtm.split(".");
		if (y.length != 3)
			return false;
		yy = y[2];
		mm = y[1];
		dd = y[0];
	}

	odd = new Number(dd);
	omm = new Number(mm);
	oyy = new Number(yy);

	// check is all given parts are numbers
	if (isNaN(odd)) return false;
	if (isNaN(omm)) return false;
	if (isNaN(oyy)) return false;

	// check limits for date (SQL - smalldate time)
	if (oyy<1970 || oyy>2079) return false;
	if (omm<1 || omm>12) return false;
	if (odd<1 || odd>31) return false;

	// check februar
	if (omm==2)
	{
		if (oyy % 4==0 && odd>29) return false;
		if (oyy % 4!=0 && odd>28) return false;
	}
	// check the day number
	if (omm==4 || omm==6 || omm==9 || omm==11)
	{
		if (odd==31) return false;
	}
	return true;
}

