COMP.Dialogs=
{
	MESSAGEBOX : function(msg,title,fn)
	{
		if (title==undefined) title='';
		//Ext.MessageBox.alert(title,msg,fn);
		Ext.MessageBox.show(
		{
		   msg: msg
		   ,progressText: ''
		   ,cls:'alert'
		   ,height:400
		   ,width:300
		   ,buttons:Ext.Msg.OK
		   ,fn:fn
		   ,wait:false
	   });
	}
	,mWaiting : false
	,ShowWaitDialog : function(waitMsg,fn)
	{
		mWaiting = true;
		setTimeout(function() {
			// Delay this dialog for a half-second so it doesn't blip up for really short searches.
			if (!mWaiting) return;
			Ext.MessageBox.show(
			{
			   msg: waitMsg
			   ,progressText: ''
			   ,cls:'alert'
			   ,width:300
			   ,height:400
			   ,buttons:Ext.Msg.CANCEL
			   ,fn:fn ? fn : function() {}
			   ,wait:true
			   ,waitConfig: {interval:4000}
			   // For some reason, this icon doesn't show up...
			   ,icon:'/images/gear48.png' //custom class in msg-box.html
		   });
		}, 500);
	}
	,HideWaitDialog : function()
	{
		mWaiting = false;
		Ext.MessageBox.hide();
	}
};

// Group the functions logistically, but still make them easy to call.
for (var f in COMP.Dialogs)
	this[f] = COMP.Dialogs[f];

// Overide the stock alert message with our own.
this['oldAlert'] = this['alert'];
this['alert'] = COMP.Dialogs.MESSAGEBOX;
if (window.COMP) COMP.Broadcast('scriptLoaded_lib_dialogs');