﻿String.prototype.format = function()
{
	var replacements = arguments;
	return this.replace(/\{(\d+)\}/g,
		function(m)
		{
			// ie-fix, does not support RegExp.$1
			var index = ($.browser.msie) ? /\d+/g.exec(m) : RegExp.$1;
			return replacements[index];
		}
	);
};

function Cookie(name, expires)
{
	this.name = name;
	this.expires = expires;
}

Cookie.prototype.get = function()
{
	return $.cookie(this.name);
}

Cookie.prototype.set = function(value)
{
	$.cookie(this.name, value, { path: '/', expires: this.expires });
}

Cookie.prototype.remove = function()
{
	$.cookie(this.name, null, { path: '/' });
}

Cookie.prototype.setExpiration = function(expires)
{
	this.expires = expires;
	var value = this.get();
	this.set(value);
}