(function ($) {
	$.fn.jFav = function (d) {
		var e = $.extend({},
		$.fn.jFav.defaults, d);
		var f = e.msg;
		this.each(function () {
			if (!$(this).attr('href') || $(this).attr('href') == "#") {
				$(this).attr('href', window.location.href)
			}
			if (!$(this).attr('title')) {
				$(this).attr('title', document.title)
			}
			if ($.browser.opera) {
				$(this).attr('link', $(this).attr('href')).attr('href', '').attr('href', 'javascript:void(0)').attr('onClick', '$.fn.jFav.OperaBookmark(this,"' + $(this).attr('title') + '","' + $(this).attr('link') + '")')
			} else {
				$(this).click(addToFavorites)
			}
		});
		function addToFavorites(a) {
			var b = $(this).attr('href');
			var c = $(this).attr('title');
			b = b.replace("file:///", "http://file/");
			if ($.browser.msie) {
				window.external.AddFavorite(b, c)
			} else if ($.browser.mozilla) {
				window.sidebar.addPanel(c, b, '')
			} else if (navigator.userAgent.toLowerCase().indexOf('chrome') > -1) {
				alert(f)
			} else if ($.browser.safari) {
				alert(f)
			}
			a.preventDefault()
		};
		return this
	};
	$.fn.jFav.defaults = {
		msg: 'Press "Ctrl + D" or "CMD + D" for MAC, to add this page to your bookmarks.'
	};
	$.fn.jFav.OperaBookmark = function (e, a, b) {
		e.rel = "sidebar";
		e.title = a;
		e.href = "";
		e.href = b;
		e.click();
		return false
	}
})(jQuery);
