function setImg(nr) {
	var ex = new Date();
	ex = new Date(ex.getTime() + 1000 * 60 * 2); /*milisec x sec x min */
	setCookie('wtd-img-ekokom', nr, ex, '/');
	document.location.reload();
	}

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 getCookie(cookieName) {
	var cookieValue = null;
	if (document.cookie) {
		var posName = document.cookie.indexOf(escape(cookieName) + '=');
		if (posName!=-1) {
			var posValue = posName + (escape(cookieName) + '=').length;
			var endPos = document.cookie.indexOf(';', posValue);
			if (endPos!=-1) cookieValue = unescape(document.cookie.substring(posValue,endPos));
			else cookieValue = unescape(document.cookie.substring(posValue));
			}
		}
	return cookieValue;
	}

var theImages = new Array() 

theImages[0] = 'top-bg_2.png'
theImages[1] = 'top-bg_3.png'
theImages[2] = 'top-bg_4.png'
theImages[3] = 'top-bg_5.png'
theImages[4] = 'top-bg_9.png'
theImages[5] = 'top-bg_16.png'
theImages[6] = 'top-bg_18.png'
theImages[7] = 'top-bg_19.png'
theImages[8] = 'top-bg_20.png'
theImages[9] = 'top-bg_21.png'
theImages[10] = 'top-bg_22.png'
theImages[11] = 'top-bg_23.png'
theImages[12] = 'top-bg_24.png'
theImages[13] = 'top-bg_25.png'


var p = theImages.length;
var imgNr = getCookie('wtd-img-ekokom');
var whichImage = Math.round(Math.random()*(p-1)); 
if (imgNr != null) whichImage = imgNr;
if (imgNr == null) setImg(whichImage);

function showImage(){
/*if (imgNr != 1)*/ 

document.write('<style type="text/css">#zahlavi-bg {background-image: url(/images/backgrounds/'+theImages[whichImage]+');}</style>'); 
}
