Util = {
	windowRegistry: {},
	defaultWindowWidth: 400,
	defaultWindowHeight: 300,
	window: function(contentElementId, w, h) {

		if (contentElementId in Util.windowRegistry)
		{
			return Util.windowRegistry[contentElementId];
		}
		
		return Util.windowRegistry[contentElementId] = new Ext.Window({
			modal: true,
			width: w || Util.defaultWindowWidth,
			height: h || Util.defaultWindowHeight,
			contentEl: contentElementId,
			title: Ext.get(contentElementId).dom.getAttribute('title'),
			closeAction: 'hide'
		});
	},
	/* operations with cookies */
	getCookie: function(name) {
		var nameEQ = name + "=";
		var ca = document.cookie.split(';');
		for(var i=0;i < ca.length;i++) {
			var c = ca[i];
			while (c.charAt(0)==' ') c = c.substring(1,c.length);
			{
				if (c.indexOf(nameEQ) == 0) {
//					alert(c.substring(nameEQ.length,c.length))
					return decodeURIComponent(c.substring(nameEQ.length,c.length));
				}
			}
		}
		return null;
	},
	setCookie: function(name, value, days) {
		if (days) {
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
//		alert(name+"="+encodeURIComponent(value)+expires+"; path=/")
		document.cookie = name+"="+encodeURIComponent(value)+expires+"; path="+Rx.WWWDIR;
	},
	delCookie: function(name) {
		Util.setCookie(name, "", -1);
	}
}