/**
 * get document element
 *
 * @param string e "element id"
 */
function getElement(e){
	if(document.all) return document.all[e];
	else return document.getElementById(e);
}


/**
 * replace image identified with id with image in desired location
 *
 * @param string dstImg "destination image id"
 * @param string sourceImgLocation "replacement image location" 
 */
function cImg(dstImg,rplImgLocation){
	getElement(dstImg).src = "pics/menu/"+rplImgLocation;
}


/**
 * function banner()
 */
function banner() {
	var width = 0;
	var height = 0;

	/**
	 * get window height
	 */
	if (typeof(window.innerWidth) == "number" ) {
		width = window.innerWidth;
		height = window.innerHeight;
	} else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
		width = document.documentElement.clientWidth;
		height = document.documentElement.clientHeight;
	} else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
		width = document.body.clientWidth;
		height = document.body.clientHeight;
	}

	/**
	 * create overlay above visible page area
	 */
	var overlay = document.createElement("div");
	if (navigator.userAgent.indexOf("MSIE 6") > 0) {
		overlay.style.position = "absolute";
	} else {
		overlay.style.position = "fixed";
	}
	overlay.style.width = width + "px";
	overlay.style.height = height + "px";
	overlay.style.top = "0";
	overlay.style.left = "0";
	overlay.style.backgroundColor = "#4d626f";
	overlay.style.opacity = "0.7";
	overlay.style.filter = "alpha(opacity=70)";
	document.body.appendChild(overlay);

	/**
	 * append banner image
	 */
	var top = (height - 722) / 2;
	var left = (width - 500) / 2;
	var banner = document.createElement("img");
	banner.src = "images/motoakce/2009/inv_small.jpg";
	if (navigator.userAgent.indexOf("MSIE 6") > 0) {
		banner.style.position = "absolute";
	} else {
		banner.style.position = "fixed";
	}
	banner.style.top = top + "px";
	banner.style.left = ((left >= 0) ? left : 0) + "px";
	banner.style.zIndex = "500";
	banner.style.cursor = "pointer";
	banner.style.border = "6px #fff solid";
	document.body.appendChild(banner);

	/**
	 * assign banner click action
	 */
	banner.onclick = function() {
		document.body.removeChild(banner);
		document.body.removeChild(overlay);
	}
}
/*
window.onload = function() {
	if (top.document.referrer.indexOf("hondamch.cz") < 0) banner();
}
*/