ToolboxWP = Class.create();
Object.extend(ToolboxWP.prototype, 
{
	initialize: function(el, friendurl) {
		this.container = $(el);
		if (this.container == undefined) return 0;
		
		this.btnPrint = this.container.down("div#tbprint");
		this.btnSend = this.container.down("div#tbsend");
		this.btnBookmark = this.container.down("div#tbbook");	
		this.urlSend = friendurl;
		
		this.doPrint = function() {
			window.print();
		}
		
		this.doSend = function() {
			window.open(this.urlSend, "_blank");
		}
		
		this.doBookmark = function() {
			var title = document.title;
			var url =  window.location.href;
			if (window.sidebar) { // Mozilla Firefox Bookmark
				window.sidebar.addPanel(title, url, "");
				//alert("Premi CTRL+D per salavare questa pagina nei preferiti.");				
			} else if( window.external ) { // IE Favorite
				var check = parseInt(navigator.userAgent.substring (navigator.userAgent.indexOf("MSIE")+5))==6;
				if(check == false){
					alert("Premi CTRL+D per salavare questa pagina nei preferiti.");
				}else{
					self.external.AddFavorite(url,title);
				}
			} else if(window.opera && window.print) { // Opera Hotlist			
				alert("Premi CTRL+D per salavare questa pagina nei preferiti.");
			}
			
		}
		
		this.actPrint = this.doPrint.bind(this);
		this.actSend = this.doSend.bind(this);
		this.actBook = this.doBookmark.bind(this);
		
		this.btnPrint.observe("click", this.actPrint, false);
		this.btnSend.observe("click", this.actSend, false);
		this.btnBookmark.observe("click", this.actBook, false);
	}

});