Action = new Class({
    Implements: [Events],

    options: {        
        callBacks: null
    },

    initialize: function(options){
        window.addEvent('load', this.load.bind(this));
    },

    load : function (event){
    }

});

function createAction(obj)
{
    var o = new obj();
    if (!window.actions)
        window.actions = [];
    window.actions[o.options.name] = o;
}

function getAction(name)
{
	if (!window.actions[name])
		return null;
	return window.actions[name];
}

XmlParser = new Class({

    initialize: function(xml){
        this.xml = xml;
    },

    _parseNode : function (node, res)
    {
        for(var i=0; i < node.childNodes.length; i++)
            if (node.childNodes[i].nodeType == 1)
                if (node.childNodes[i].childNodes[0].nodeType == 4){
                    if (node.childNodes[i].tagName == "item")
                        var key = node.childNodes[i].getAttribute("key");
                    else 
                        var key = node.childNodes[i].tagName;
                    res[key] = node.childNodes[i].childNodes[0].data;
                } else {
                    if (node.childNodes[i].tagName == "item")
                        var key = node.childNodes[i].getAttribute("key");
                    else 
                        var key = node.childNodes[i].tagName;
                    res[key] = {};
                    this._parseNode(node.childNodes[i], res[key]);
                }
    },

    parseVar : function (name){
        var res = {};
        if (Browser.Engine.trident){
            for(var i=0; i < this.xml.childNodes[1].childNodes.length; i++){
                if (this.xml.childNodes[1].childNodes[i].tagName == name){
                    var element = this.xml.childNodes[1].childNodes[i];
                    break;
                }
            }
        } else {
            var element  = this.xml.childNodes[0].getElements(name)[0];
        }
        this._parseNode(element, res);
        return res;
    }
});



