var favorites = {
	title: document.title,
	url: window.location.href,
	init: function(){
		if ($.browser.msie) {
			this.isIE();
		} else if (window.sidebar) {
			this.isMozilla();
		} else if (window.opera && window.print) {
			this.isOpera();
		} else {
			this.isOther();
		}
	},
	isIE: function(){
		window.external.AddFavorite(this.url, this.title);
	},
	isMozilla: function(){
		window.sidebar.addPanel(this.title, this.url, "");
	},
	isOpera: function(){
		var elem = document.createElement('a');
		elem.setAttribute('href', this.url);
		elem.setAttribute('title', this.title);
		elem.setAttribute('rel', 'sidebar');
		elem.click();
	},
	isOther: function(){
		//Safari and Chrome are not supported yet due to browser limitations
		alert('Press "Ctrl + D" or "CMD + D" for MAC, to add this page to your bookmarks.');
	}
}

$("document").ready(function(){
	$(".fav").click(function(){
		favorites.init();
	});
});
