//datum 
		function makeArray(n){
		    this.length = n;
		    for (i=1;i<=n;i++){
		        this[i]=0;
		    }
		    return this;
		}
		function displayDate(lang) {
		
		  var this_month = new makeArray(12);
		    this_month[0]  = "ledna";
		    this_month[1]  = "února";
		    this_month[2]  = "března";
		    this_month[3]  = "dubna";
		    this_month[4]  = "května";
		    this_month[5]  = "června";
		    this_month[6]  = "července";
		    this_month[7]  = "srpna";
		    this_month[8]  = "září";
		    this_month[9]  = "října";
		    this_month[10] = "listopadu";
		    this_month[11] = "prosince";
		  var today = new Date();
		  var day   = today.getDate();
		  var month = today.getMonth();
		  var year  = today.getYear();
			if (year < 1900){
				year += 1900;
			}
		  if (lang=='' | lang=='cz') {
		     return(day+". "+this_month[month]+" "+year);
		  }
		  return(day+"."+(month+1)+"."+year);
		}


//ajax

var req;

function Click(link, tag) {
	loadXMLDoc("/click.asp?strURL=" + URLEncode(link.href) + "&strPage=" + URLEncode(location.href) + "&strTag=" + URLEncode(tag));
}

function loadXMLDoc(url) {
	var req = false;
	
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest) {
    	try {
			req = new XMLHttpRequest();
        } catch(e) {
			req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	req = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		req = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		req = false;
        	}
		}
    }
	if(req) {
		req.open("GET", url, false);
		req.send("");
		
		return req.responseText;
	}
}

function URLEncode(url)
{
	// The Javascript escape and unescape functions do not correspond
	// with what browsers actually do...
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";

	var plaintext = url;
	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
		if (ch == " ") {
			encoded += "+";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
			encoded += ch;
		} else {
			var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
				// Unicode Character cannot be encoded using standard URL encoding.
				// (URL encoding only supports 8-bit characters.)
				// A space (+) will be substituted.
				encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	} // for

	return encoded;
};


//okno s fotografii

function PgOpen(which)
{
open(which, "tg_facility_image","width=100,height=100,scrollbars=yes,toolbar=no,status=no,location=no,directories=no,alwaysRaised=1,dependent=1,titlebar=no,z-lock=1");
}

//lokalizace zarizeni - mala mapka na strance zarizeni


function MapZoomInOld()
{
    var getmapimg = document.getElementById('mapimg')
	var zoom = 1 * getmapimg.src.substring(getmapimg.src.length-1);
	if (!zoom >= 1) zoom = 1;
	document.getElementById('mapimg').src=LocalMapPosition + (zoom-1);
	document.getElementById('zoom-' + cZoom).src= LocalMapIndicatorSrc;
	document.getElementById('zoom-' + (zoom-1)).src= LocalMapIndicatorActiveSrc;
	cZoom = zoom-1;
	return false;
}
function MapZoomOutOld()
{
	var getmapimg = document.getElementById('mapimg')
	var zoom = 1 * getmapimg.src.substring(getmapimg.src.length-1);
	if (zoom > 5) zoom = 5;
	document.getElementById('mapimg').src=LocalMapPosition + (zoom+1)
	document.getElementById('zoom-' + cZoom).src= LocalMapIndicatorSrc;
	document.getElementById('zoom-' + (zoom+1)).src= LocalMapIndicatorActiveSrc;
	cZoom = zoom+1;
	return false;
}
function MapZoomOld(zoom)
{	
	document.getElementById('mapimg').src=LocalMapPosition + zoom;
	document.getElementById('zoom-' + cZoom).src= LocalMapIndicatorSrc;
	document.getElementById('zoom-' + zoom).src= LocalMapIndicatorActiveSrc;
	cZoom = zoom;
	return false;
}
var cZoom = 1;

function MapChange(command)
{	
	var now = new Date();
	document.getElementById('mapimg').src=LocalMapPosition + command + '&rand=' + now.getTime();
	return false;
}

function MapMove(direction)
{	
	MapChange('Move' + direction);
	return false;
}

function MapZoomIn()
{	
	MapChange('ZoomIn');
	return false;
}

function MapZoomOut()
{	
	MapChange('ZoomOut');
	return false;
}

function MapZoom(zoom)
{	
	MapChange('Zoom' + zoom);
	return false;
}

function MapSetCenterByScreen(X, Y)
{
	var now = new Date();
	document.getElementById('mapimg').src=LocalMapPosition + 'SetCenterByScreen' + '&lngScreenX=' + X + '&lngScreenY=' + Y + '&rand=' + now.getTime();
	return false;
}



//hover na tlačítkách posouvání mapy

function hoverMapOver(obj)
{
obj.style.backgroundColor=sectionDarkColor;
}
function hoverMapOut(obj)
{
obj.style.backgroundColor=sectionLightColor;
}

function GetBanner(seat, lang) {
	return loadXMLDoc("/banner.asp?strBannerSeatID=" + seat + "&strLanguageID=" + lang + "&strAction=view" + "&lngRandom=" + Math.floor(1000000*Math.random()));
}
