/******************************************************************************\

  This function is taken from http://www.tigir.com/addbookmark.htm
  (c) Tigirlas Igor
  Minor modifications by ThyBzi

\******************************************************************************/

function addBookmark(url, title) {
	if (!url) {
		url = location.href;
	}
	if (!title) {
		title = document.title;
	}

	if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) { // Gecko
		window.sidebar.addPanel (title, url, "");
	}
	else if (typeof window.external == "object") { // IE 4+
		window.external.AddFavorite(url, title);
	}
	else if (window.opera && document.createElement) { // Opera 7+
		var a = document.createElement('a');
		if (!a) { // Opera 6-
			return false;
		}
		a.setAttribute('rel', 'sidebar');
		a.setAttribute('href', url);
		a.setAttribute('title', title);
		a.click();
	}
	else { // can't add bookmark
		return false;
	}

	return true;
}
