function addEvent(object, event, func) {
	if (typeof(func) == 'string') {
		var funcStr = func;

		func = function(e) {
			object[funcStr](e);
		}
	}

	if (typeof(document.all) != 'undefined')
		object.attachEvent('on' + event, func);
	else
		object.addEventListener(event, func, true);
}

var popUpImg_img = new Image;

function popUpImg(url) {
	if (typeof(url) != 'undefined')
		popUpImg_img.src = url;

	if (popUpImg_img.height > 0) {
		this.popUpWin = null;
		this.close = popUp_close;

		this.popUpWin = window.open(popUpImg_img.src, 'popUpWin', 'top=50, left=500, height=' + (popUpImg_img.height + 20) + ', width=' + (popUpImg_img.width + 20) + ', resizable=1');
		this.popUpWin.focus();

		addEvent(this.popUpWin, 'blur', function() { self.close(); });

		popUpImg_img = new Image;
	}
	else
		window.setTimeout('popUpImg()', 50);
}

function popUp_close() {
	if (this.popUpWin != null && !this.popUpWin.closed)
		this.popUpWin.close();
}
