function PrlI() {
	//ShowTime();
	for (i=1;i<=7;i++)
		PrlImage(lg+'/img/tm'+i+'b.gif')
}


var img = new Array()

function PrlImage(im) {
	if (document.images) {
		img[img.length] = new Image()
		img[img.length-1].src = im
	}
}


function TmOv(n,tx){
	window.status=tx;
	mnu=n
	document.images['tm'+mnu].src=lg+'/img/menu_b_0'+mnu+'.gif'
	return true;
}


function TmOu(n){
	mnu=n
	document.images['tm'+mnu].src=lg+'/img/menu_0'+mnu+'.gif'
	window.status='';
}


function ShowTime() {

		var message;
		var theTime = window.setTimeout("ShowTime()",1000);
		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;


		var min  = now.getMinutes();
		var sec  = now.getSeconds();
		message += "  " + now.getHours() + ":" + (min < 10 ? "0" + min : min) + ":" + (sec < 10 ? "0" + sec : sec);

		if (document.getElementById) {
			document.getElementById('time').innerHTML = '<nobr>' + message + '</nobr>';
		}
		else if (document.all) {
			document.all['time'].innerHTML = '<nobr>' + message + '</nobr>';
		}
	}

function ShCyc(sid,h) {
	window.open("img.php?id=1&lg="+lg+"&sid="+sid+"&w=650&h="+h,"m1_"+sid,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=673,height="+(h+25))
	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 ShRas(sid,h) {
	if (!h) h=130;
	window.open("popis.php?id=4&lg="+lg+"&sid="+sid+"&h="+h,"r1_"+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 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 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_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")
}

function Sh2() {
	//doprava
	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 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 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=430,height=530,top=1,left=1")
	return false
}
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");
}

//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-213)/2)-4;
	document.getElementById('idAgBan').style.visibility='visible';
	agBannHide=setTimeout('agBannerHide()',15100);

}

function agBannerHide(){
  if (!document.getElementById('idAgBan')) return;
  document.getElementById('idAgBan').style.visibility='hidden';
}

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")
	window.open("img.php?id="+id+"&lg="+lg+"&sid="+sid+"&w="+w+"&h="+h,"mM","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 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 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 openPage(id,subid) {
	window.location="index.php?act="+id+"&subid="+subid;
}

/**********************************************************************
** 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;
}

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")
}