function popup(uri) {
	window.open(uri,'Magazzino51','height=550,width=500,menubar=0,location=0,status=0');
}

function conferma(message) {
	return window.confirm(message);
}

(function($) {

    $.fn.tooltip = function(params) {
        
        var defaults = {
            attr: 'rel',
            offset:5
        }
        
        var opts = $.extend(defaults, params);
        
        //preparo l'html necessario
        var tooltipBox = $('<div id="tooltipBox"><div id="tooltipArrow"></div><div id="tooltipContent"></div></div>');
        tooltipBox.css({
            position: 'absolute'
        });
        $('body').append(tooltipBox);
    
        return this.each(function() {
        
            var text = $(this).attr(opts.attr);
            $(this).attr(opts.attr,'');
                       
            $(this).hover(function(e) {
                var x = e.pageX;
                var y = e.pageY;
                $('#tooltipContent', tooltipBox).html(text);
                tooltipBox.css({left:x+opts.offset, top:y+opts.offset}).hide().fadeIn(200);
            }, function() {
                tooltipBox.hide();
            });
            
            $(this).mousemove(function(e) {
                var x = e.pageX;
                var y = e.pageY;
                tooltipBox.css({left:x+opts.offset, top:y+opts.offset});
            });
            
        });
    
    }

})(jQuery);

(function($){
	$.fn.clickable = function() {
		return this.each(function() {
			var $this = $(this);
			var $link = $this.find('a:first');
			var href = $link.attr('href');
			$this.click(function() {
				document.location.href = href;
				return false;
			});
			$this.css({cursor:'pointer'});	
			$this.hover(function() {
				$(this).addClass('hover');
			}, function() {
				$(this).removeClass('hover');
			});

		});
	}
})(jQuery);

(function($){
	$.fn.fadeslide = function(params) {
		return this.each(function() {
			$(this).click(function() {
				var sel = $(this).attr('href');
				$(sel).slideToggle('fast');
				return false;
			});
		});
	}
})(jQuery);