function addEvent(o,e,f){

	if (o.addEventListener){ o.addEventListener(e,f,true); return true; }

	else if (o.attachEvent){ return o.attachEvent("on"+e,f); }

	else { return false; }

}



NewWindow=null;

function ShowItem(src, w, h, title){

	if(NewWindow){NewWindow.close();}

	if(NewWindow==null || NewWindow.closed){

	if (typeof(title)=="undefined") title="Galéria";

		var top = screen.height/2 - h/2;

		var left = screen.width/2 - w/2;

		settings=

			 "left=" + left + ","

			 +"top=" + top + ","

			 +"width=" + w + ","

			 +"height=" + h + ","

			 +"toolbar=no,"

			 +"location=no,"

			 +"directories=no,"

			 +"status=no,"

			 +"menubar=no,"

			 +"scrollbars=no,"

			 +"resizable=no";

		NewWindow = window.open("",'Klose',settings);

	}

	NewWindow.document.open();

	NewWindow.document.clear();

	NewWindow.document.write(

		"<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1250\">"

		+"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1250\"><title>"

		+ title +"</title></head>\n"

		+"<body topmargin=0 leftmargin=0 onclick=window.close(); onblur=\"window.close();\" bgcolor=#FFFFFF>\n"

		+"<table width=\"100%\" height=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=0><tr><td align=\"center\" valign=\"middle\"><img src=" + src + " border=0></td></tr></table>\n"

		+"</body>\n"

		+"</html>"

	);

	NewWindow.document.close();

	NewWindow.focus();

}



NewWindow1 = null;

function ShowWin(href, w, h){

	if(NewWindow1){ NewWindow1.close(); }

	if(NewWindow1==null || NewWindow1.closed){

		var top = screen.height/2 - h/2;

		var left = screen.width/2 - w/2;

		var settings =

	 		"left=" + left + ","

			+"top=" + top + ","

			+"width=" + w + ","

			+"height=" + h + ","

			+"toolbar=no,"

			+"location=no,"

			+"directories=no,"

			+"status=no,"

			+"menubar=no,"

			+"scrollbars=yes,"

			+"resizable=yes";

		NewWindow1 = window.open(href,'okno',settings);

	}

	NewWindow1.focus();

}



function zobraz(src,id,popis){

	document.getElementById(id).innerHTML = '<img src="'+src+'" style="border:1px solid black"><br><br>'+popis;

}



function setImg(idImg,id){

	switch(id){

		case 1:

			document.getElementById('im'+idImg).src = 'images/but'+idImg+'_over.gif';

			break;

		case 2:

			document.getElementById('im'+idImg).src = 'images/but'+idImg+'.gif';

			break;

	}

}



function OpenHide(id){

	var status = document.getElementById(id).style.display;

	switch(status){

		case "none":

			document.getElementById(id).style.display = 'block';

			break;

		case "block":

			document.getElementById(id).style.display = 'none';

			break;

	}

}



function tagExternalLinks() {

	var aTags = document.getElementsByTagName("A");

	var URLparts = new Array();

	for (var i=0; i < aTags.length; i++) {

		URLparts = aTags[i].href.split('/');

		if (

			URLparts[2] != window.location.host && 

			    aTags[i].href.substring(0,11) != 'javascript:' && 

                aTags[i].href.substring(0,7) != 'mailto:'

			) {

			aTags[i].onclick = doExternalClick;

            aTags[i].className += ' externalLink';

		}

	}

}

function doExternalClick() {

	window.open(this.href);

	return false;

}

addEvent(window,'load',tagExternalLinks);
