var MFBlank = {
	initialize: function() {
		this.hostname = window.location.hostname;
		this.hostname = this.hostname.replace("www.","").toLowerCase();
		return this;
	},
	set: function(obj) {
		this.check(obj);
		if ( this.external ) {
			obj.target = "_blank";
			obj.className = obj.className + ' blank';
		}
		return this;
	},
	check: function(obj) {
		var href = obj.href.toLowerCase();
		this.external = (href.indexOf("http://")!=-1 && href.indexOf(this.hostname)==-1) ? true : false;
		return this;
	}
}

window.addEvent('domready', function() {
	MFBlank.initialize();
	
	$$('a').each(function(el) {
		MFBlank.set(el);
	});
});
