/**
* Class that takes a cssText string and creates an array of the declarations for seting/getting.
* Can also perform actions (remove declarations, etc.)
**/
cssHash = Class.create(Hash, {
    initialize: function($super,object){
	if( Object.isString(object) ){
	    $super();
	    var ruleArray = object ? object.split(";") : new Array();
	    for( var i = 0; i<ruleArray.length; i++ ){
		var oneRule = ruleArray[i].match(/^([^:]+):(.*)$/);
		if( (oneRule) && (oneRule.length == 3) && (oneRule[1]) && (oneRule[2]) )
		    this.set(trim(oneRule[1]).toLowerCase(), trim(oneRule[2]));
	    }
	} else {
	    this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
	}
    },
    toString: function(newLines){
	var cssText = '';
	this.each(function(pair){
	    if( (pair.value !== undefined) && (pair.value != '') ){
		cssText += pair.key + ': ' + pair.value +';';
		if( newLines )
		    cssText += '\n';
	    }
	});
	return cssText;
    },
    update : function(object) {
	return new cssHash(object).inject(this, function(result, pair) {
            result.set(pair.key, pair.value);
            return result;
	});
    },
    get: function($super, key){
	var value = $super(key);
	if( value === undefined )
	    return '';
	return value;
    }
});