Element.implement({

	idFromClass: function () {
		return this.className.match(/id-(\d+)/)[1];
	},

	idFromClassCustom: function (css_class) {
	    var re = css_class + '-(\\d+)';
	    return $defined(this.className.match(re)) ? this.className.match(re)[1] : 0;
	},

	idFromClassCustomReplace: function (css_class, id) {
	    var search = new RegExp(css_class + '-(\\d+)', 'g');
	    var replace = css_class + '-' + id;

	    if($defined(this.className.match(search))) {
	    	this.className = this.className.replace(search, replace);
	    }
	}

});

Number.implement({

	toCurrency: function () {
		var string = new String(this);
		return this + ',00';
	}

});

Array.implement({

	sum: function () {
		for (var i = 0, sum = 0; i < this.length; sum += this[i++].toInt());
   		return sum;
	},

	max: function () {
		return Math.max.apply({}, this);
	},

	min: function () {
		return Math.min.apply({}, this);
	}

});

$extend(Date, {
	$months: ['januar', 'februar', 'marts', 'april', 'maj', 'juni', 'juli', 'august', 'september', 'oktober', 'november', 'december'],
	$days: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag']
});