// 23.03.2011

function createDiv(filepath) {
	var obj_div = document.getElementById('div_large_image');
	if (obj_div!=null) {
		document.body.removeChild(obj_div);
	}
	
	var container = document.createElement('div');
	container.innerHTML = '<table cellpadding="0" cellspacing="10" id="div_large_image" style="background:#ffffff; border:1px solid #000000"><tr><td align="right"><img src="/js/hideimage.jpg" onclick="hideImage()" style="cursor:pointer; margin:0 0 10px 0"></td></tr><tr><td><img src="'+filepath+'" /></td></tr></table>';
	return container.firstChild;
}

function setposition(LargeImage,w) {
	LargeImage.style.position = 'absolute';
	LargeImage.style.zIndex=99999;
	LargeImage.style.padding='10px 10px 10px 10px';
	
	var scroll = document.documentElement.scrollTop || document.body.scrollTop;
	var width = document.documentElement.clientWidth || document.body.clientWidth;
	
	LargeImage.style.top = scroll + 50 + 'px';
	LargeImage.style.left = (width/2 - w/2) + 'px';
}

function hideImage() {
	var obj_div = document.getElementById('div_large_image');
	if (obj_div!=null) {
		document.body.removeChild(obj_div);
	}
}

function showimage(filepath,w) {
  var LargeImage = createDiv(filepath);
  setposition(LargeImage,w);
  document.body.appendChild(LargeImage);
}
