function hidePopup() {
    obj = document.getElementById('popupImage');
    obj.innerHTML = '';
    obj.style.visibility = 'hidden';    
}

function setVisible(url, width, height) {
    var obj = document.getElementById('popupImage');
	obj.innerHTML = '';
    if(url != undefined && url != '') {
		var img = new Image();
		img.setAttribute('width', width);
		img.setAttribute('height', height);
		img.setAttribute('border', '0');
		img.src = url;
		
		var lnk = document.createElement("a");
		lnk.setAttribute('href','#');
		lnk.setAttribute('style','cursor: hand;');
		lnk.setAttribute('onclick','hidePopup();');
		lnk.appendChild(img);
		
		obj.appendChild(lnk);
	}
    else
        obj.innerHTML = '';

    placeIt('popupImage', width, height);
	obj.style.visibility = 'visible';
}

function placeIt(obj, imgWidth, imgHeight) {
	obj = document.getElementById('popupImage');
	if (document.documentElement)
		theLeft = document.documentElement.scrollLeft;
	else if (document.body)
		theLeft = document.body.scrollLeft;

	theLeft = theLeft + (screen.width-imgWidth)/2-12;
	theTop = 200;
	obj.style.left = theLeft + 'px';
	obj.style.top = theTop + 'px';
}