String.prototype.format = function() {
	var s = this;
	for (var i = 0; i < arguments.length; i++) {
		var reg = new RegExp("\\{" + i + "\\}", "gm");
		s = s.replace(reg, arguments[i]);
	}
	return s;
}

this.createCookie = function(name, value, days) {
	var expiration = new Date();
	if (!days) {
		days = 365;
	}
	expiration.setTime(expiration.getTime() + (days * 24 * 60 * 60 * 1000));
	document.cookie = name + "=" + value + "; expires=" + expiration.toGMTString() + "; path=/";
}

this.readCookie = function(name) {
	var name = name + "=";
	var cookies = document.cookie.split(";");
	for (var idx = 0; idx < cookies.length; idx++) {
		var cookie = cookies[idx];
		while (cookie.charAt(0) == " ") {
			cookie = cookie.substring(1, cookie.length);
		}
		if (cookie.indexOf(name) == 0) {
			return cookie.substring(name.length, cookie.length);
		}
	}
	return null;
}

function ClearSSLCache() {
	if ($.browser.msie) {
		document.execCommand("ClearAuthenticationCache");
	}
}
