var ExternalLink = Class.create({								
		container: null,
		hostname: null,
		cssClass: null,
		
		initialize: function(container, options) {
				// Nome dell'host corrente:
				var host = window.location.hostname;
				this.hostname = host.replace("www.","").toLowerCase();				
				this.container = $(container);
				this.cssClass = (options.cssClass != null) ? options.cssClass : null;
				
				// Tutti i link presenti all'interno del container:
				$A(this.container.select("a")).each(
					function(item) {
						this.checkLink(item);
					}.bind(this)
				)
		},
		
		checkLink: function (item) {
			var href = item.readAttribute("href");
			href = href.toLowerCase();
				
			if (href.indexOf("http://") != -1 && href.indexOf(this.hostname) == -1) {
				item.writeAttribute("target", "_blank");
				
				if (this.cssClass != null) {
					item.addClassName(this.cssClass);
				}
			}
		}
});