window.arivis = window.arivis || {};
window.arivis.website = window.arivis.website || {};

/**
 * @constructor Popup init
 */
arivis.website.Base = function() {

	this.init = function(){
		this.externalLink();
	};

	this.externalLink = function () {
		var elem = $$('a');
		var instance = this;
		for (var i=0; i < elem.length; i++){
			if (!elem[i].firstChild)
				continue;
			if (elem[i].firstChild.nodeType != 3 || elem[i].firstChild.nodeValue.match(/^\s*$/))
				continue;
			var href = elem[i].getAttribute('href');
			var noSearchString = eval("/^https?:\\/\\/"+window.location.host.replace(/\./, "\\.")+"/");
			var searchString = /^https?:\/\//;
			if (href && href.search(searchString) != -1 && href.search(noSearchString) == -1) {
				elem[i].addClassName('ext');
			}
		}
	};

};

// init Popup
arivis.website.base = new arivis.website.Base();
Event.observe(window, 'load', function(){ arivis.website.base.init(); });
