
var WindowUtils = {
	popup: function(url, w, h, name, params) {
						
		var width = 800;
		var height = 600;
		var screenw = screen.availWidth;
		var screenh = screen.availHeight;
		
		width = ((w != null) && (w > 0))?w:width;
		height = ((h != null) && (h > 0))?h:height;
	
		var leftPos = (screenw-width)/2, topPos = (screenh-height)/2;
		if (params == null) {
			params = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=" + width + ",height=" + height + ",top=" + topPos + ",left=" + leftPos;
		}
				
		try {
			newWindow=window.open(url,name, params);
			
			if (newWindow) {
				if (newWindow.opener == null) newWindow.opener = self;
				newWindow.focus();
			}
		} catch (err) {
			alert("Error: " + err.description);
		}

	}
};