function OpenPicture(imagepath, href) {
	// Usage: <a href="image.jpg" onclick="OpenPicture(this.href, this.href); return false;"><img src="image.thumbnail.jpg" /></a>
	var imagepath = imagepath;
	var bigimg = new Image();
	//this.getElementsByTagName("span").innerHTML = this.getElementsByTagName("span").innerHTML+"<br /><b>Načítám...</b>"
	bigimg.src = imagepath;
//	this.onmousemove = getCursorPosition;

	bigimg.onload = (function(bool){ OpenPicture_Window(bigimg, href);});
}

function OpenPicture_Window(bigimg, href) {
	var oheight = bigimg.height + 40;
	var owidth = bigimg.width + 30;
	if(oheight > screen.availHeight)
		oheight = screen.availHeight;
//	document.getElementById('ai_loading').style.display = none;
	window.open(href,"ai_image",'toolbar=0,location=0,width='+(owidth)+',height='+(oheight)+',resizable=1,left=10,top=10,scrollbars=1')
}

//function getCursorPosition(e){
//	//ie
//	if(document.all){
//		curX = event.clientX;
//		curY = event.clientY;
//	}
//
//	//netscape 4
//	if(document.layers){
//		curX = e.pageX;
//		curY = e.pageY;
//	}
//
//	//mozilla
//	if(document.getElementById){
//		curX = e.clientX;
//		curY = e.clientY;
//	}
//	document.body.innerHTML = "<div id=\"ai_loading\" style='position: absolute; top: "+(curY+document.body.scrollTop)+"px; left: "+(curX+document.body.scrollLeft)+"px; background-color: #fff; border: 1px dotted red; padding: 5px; display: block;'>Nacitam foto...</div>"+document.body.innerHTML;
//	this.onmousemove = "";
//}