
var objWindow = null

function imgPopUp(url,name,w,h,cb) {

	if (objWindow && !objWindow.closed) {
		if (objWindow.name == name) {
			objWindow.close();
			setTimeout("imgPopUp('"+url+"','"+name+"',"+w+","+h+",'"+cb+"')",100);
			return;
		}
	}

	if (cb) {
		openWindow('',name,'width='+w+',height='+(h+50)+',left=20,top=20,scrollbars=yes,location=no,menubar=no,resizable=yes,toolbar=no,status=yes');

		objWindow.document.open();
		objWindow.document.writeln('<html><head><title>'+decodeURIComponent(url)+'</title></head><body>');
		objWindow.document.writeln('<img src="'+url+'" border="0" alt=""/><br/><br/>');
		objWindow.document.writeln('<input type="button" value="'+decodeURIComponent(cb)+'" onclick="javascript:window.close();"/>');
		objWindow.document.writeln('</body></html>');
		objWindow.document.close();
	} else {
		openWindow(url,name,'width='+w+',height='+h+',left=20,top=20,scrollbars=yes,location=no,menubar=no,resizable=yes,toolbar=no,status=yes');
	}
}

function popUp(page,name,w,h,param) {

	if (!param) {
		param = 'left=20,top=20,scrollbars=yes,location=no,menubar=no,resizable=yes,toolbar=no,status=yes';
	}

	if (objWindow && !objWindow.closed) {
		if (objWindow.name == name) {
			objWindow.close();
			setTimeout("popUp('"+page+"','"+name+"',"+w+","+h+",'"+param+"')",100);
			return;
		}
	}

	openWindow(page,name,'width='+w+',height='+h+','+param);
}

function openWindow(page,name,pref) {
	return openWindow(page,name,pref,true);
}

function openWindow(page,name,pref,focus) {

	objWindow = window.open(page,name,pref);

	if (focus) {
		objWindow.focus();
	}

	return objWindow;
}

