/**
 * IBE Bookmark script. compatible with Firefox, IE6, IE7, IE8, Safari and Opera.
 * 
 * @author  Bjorn Wikkeling | IBE-Hosting.nl <bjorn@ibe-hosting.nl>
 * @link    http://ibe-hosting.nl
 * @version 1.0 - 20081018
 */

/**
 *  add bookmark functionality to any HTML element in the page
 */
function init_ibe_bookmark(){
  var bookmark_class = 'bookmark'; // the css class to add bookmark functionality - change this to fit your needs
  var txt_add_bookmark = 'Gebruik %s% op uw toetsenbord om aan favorieten toe te voegen';
  $('.'+bookmark_class).bind('click', add_bookmark);
  
  function add_bookmark(e){
    var t = document.title || 'IBEbookmark';
    var u = window.location.href;

    if(window.sidebar){ // firefox
      window.sidebar.addPanel(t, u, '');
	  }
	  else if (window.external && jQuery.browser.msie) { // IE
      window.external.AddFavorite(u, t);
	  }
	  else if (window.opera && window.print) { // Opera
      $('<a/>').attr({rel: 'sidebar',target: '_search',title: t,href: u}).click();
    }
    else { // chrome, safari and the rest
      alert(txt_add_bookmark.replace('%s%', 'Ctrl+D'));
    }

	return false;
  }
  
}

/**
 * execute when document is ready. 
 */
$(document).ready(function(){
  init_ibe_bookmark();
});