
function PopupWindow()
{
	// Opens popup window. If url is not specified then reads element href attribute.
	this.Open = function(elementObj, url) {
		if (elementObj != null) {
			// read element href attribute
			if (url == null)
				url = $(elementObj).readAttribute('href');
		}
		
		// add 'isPopupWindow' parameter to querystring
		var urlTool = new Url(url);
		url = urlTool.UpdateParam('isPopupWindow', '1').ToString();
		
		// open popup window
		var width, height;
		var tt = 0;
		var proc = 40;
		var w = screen.width;
		var h = screen.height;
		if( w <= 1024 )tt = 20;

		height = parseInt( h / 100 * proc );
		width = 800;

		var l = ( w - width )/2 -15;
		var t = ( h - height )/2 - tt;
		if (popup_width){
			width=popup_width;
		}
		if (popup_height) {
			height = popup_height;
		}
		window.open(url, "_blank", "toolbar=0,scrollbars=1,resizable=1,left="+l+",top="+t+",width="+width+",height="+height);
	}
	
	this.OpenUrl = function(url) {
		this.Open(null, url);
	}
}