Ext.form.MoneyField = Ext.extend(Ext.form.TextField,{
        
    initComponent:function() {
        Ext.form.Field.superclass.initComponent.call(this);
		this.addEvents(
			'modify'
		)  
    },

	initEvents : function(){
        Ext.form.MoneyField.superclass.initEvents.call(this);
		this.on("modify", this.onModify, this);
    },
    	
    getValue : function(){
        return this.value;
    },

    setValue : function(v){
		v = Number(v);
        this.value = v;
        if(this.rendered){
            this.el.dom.value = (v === null || v === undefined ? '' : Ext.util.Format.usMoney(v));
            this.validate();
        }
		
		this.fireEvent('modify', this);
    },
	
	addValue : function(v) {
		this.setValue (this.value + Number(v));
	},
	
	subValue : function(v) {
		this.setValue (this.value - Number(v));
	},
	
	onModify : function(field) {
	},
	
	onFocus : function(field) {
		if(!this.readOnly)
			this.setRawValue (this.getValue());
	},

	onBlur : function(field) {
		if(!this.readOnly) 
			this.setValue (this.getRawValue());
	}

});

Ext.ComponentMgr.registerType('moneyfield', Ext.form.MoneyField);