var newwindow;

function windowPopup(src,x,y)
{
	if(newwindow) newwindow.close();
	newwindow=window.open(src,'image','height='+y+',width='+x+',resizable=yes');
	if(window.focus)
		newwindow.focus();
}

// mouse position
function mouseXY(e)
{
	var pos = new Array(0,0);
	if (!e) var e = window.event;
	if (e.pageX || e.pageY)
	{
		pos[0] = e.pageX;
		pos[1] = e.pageY;
	}
	else if (e.clientX || e.clientY)
	{
		pos[0] = e.clientX + (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
		pos[1] = e.clientY + (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);
	}
	return pos;
}

function showThumb(e, id)
{
	pos = mouseXY(e);
	if(images.length)
		divShow(pos[0]+10,pos[1]+8,id);
}
		
// div country float
function divShow(x, y, id)
{	
	divClose();	
	var floatThumb = document.getElementById("floatThumb");
	if(floatThumb != null)
	{
		// umisteni
		floatThumb.style.left = x+"px";
		floatThumb.style.top = y+"px";
	
		img = floatThumb.getElementsByTagName("img");
		if(img[0])
			img[0].src = images[id].src;
	
		floatThumb.style.visibility = "visible";
		divCover(floatThumb);
	}
}

function divClose()
{
	var obj = document.getElementById("div_cover");
	if(obj != null)
		obj.style.visibility = "hidden";	
	var obj = document.getElementById("floatThumb");
	if(obj != null)
		obj.style.visibility = "hidden";
}


function divCover(copy)
{
	var cover = document.getElementById("div_cover");
	if(cover != null)
	{
		cover.style.position = "absolute";
		cover.style.height = copy.offsetHeight+"px";
		cover.style.width = copy.offsetWidth+"px";
		cover.style.top = copy.style.top;
		cover.style.left = copy.style.left;
		cover.style.visibility = "visible";
		copy.style.zIndex = "99";
		cover.style.zIndex = "98";		
	}	
}

// prevzate posX,Y funkce
function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}

function findPosY(obj)
{
	var curtop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

