Ext.QuickTips.init();
Ext.form.Field.prototype.msgTarget = 'side';
Ext.Updater.defaults.loadScripts = true;

function editWindow(title, url, x, y, animateTarget, handler)
{
	if (animateTarget == '' || animateTarget == null)
	{
		animateTarget = 'view';
	}

	var edit_window = new Ext.Window({
		id: 'edit_window',
		title: title,
		//autoLoad: url,
		autoScroll: true,
		modal: true,
		width: x,
		height: y,
		animateTarget: animateTarget,
		closable: true,
		resizable: false,
		draggable: false,
		bodyStyle: 'background-color: #FFF;',
		listeners: {
			show: function(c)
			{
				this.load({url: url});
			}
		}
	});

	if (handler != null)
	{
		edit_window.on('close', handler);
	}

	edit_window.show();
}

function doRemoteJsonAction(url, callback)
{
	var store = new Ext.data.JsonStore({
		url: url
	});

	if (callback != null)
	{
		store.on('success', callback);
	}
	else
	{
		store.on('success', new function(){
			window.location.reload();
		});
	}

	store.load();
}