/**
 * Ext JS Library 2.2.1
 * Copyright(c) 2006-2009, Ext JS, LLC.
 * licensing@extjs.com
 * 
 * http://extjs.com/license
 *
 * This is an extension derived from the extjs form
 * widget.  We will use this architecture throughout
 * this application to keep all error messages
 * consistent.
 */

Ext.onReady(function(){

    Ext.QuickTips.init();

    // turn on validation errors beside the field globally
    Ext.form.Field.prototype.msgTarget = 'side';

});

/**
 * This XML Reader handles all errors in this
 * architecture.  It isn't necessary to implement
 * different error readers for each
 */
Ext.form.XmlErrorReader = function(){
    Ext.form.XmlErrorReader.superclass.constructor.call(this, {
            record : 'field',
            success: '@success'
        }, [
            'id', 'msg'
        ]
    );
};
Ext.extend(Ext.form.XmlErrorReader, Ext.data.XmlReader);

/**
 * Opens a standard dialog box with the given
 * parameters.
 */
openExtDialog = function(applyto, title, html, width, height){
	document.getElementById(applyto).innerHTML = "";

    // create the window on the first click and reuse on subsequent clicks
    var FormWindow = new Ext.Window({
		applyTo     : applyto,
		layout      : 'anchor',
		width       : width,
		height      : height,
		closeAction :'hide',
		plain       : false,
		html       : html,
	    modal	    : true,
	    title		: title	   
    });
        
    FormWindow.show();
    FormWindow.doLayout();
}
