if (typeof Driebit == 'undefined') var Driebit = {};

Driebit.blockLink = new Class({
	initialize: function (element) {
		this._element = document.id(element);

		this._element.addEvents({
			'mouseover': this.onMouseOver.bind(this),
			'mouseout': this.onMouseOut.bind(this),
			'click': this.onClick.bind(this)
		});
	},

	onMouseOver: function () {
		this._element.addClass('blocklinkhover');
		window.status = this._element.getElement('a').get('href');
	},

	onMouseOut: function () {
		this._element.removeClass('blocklinkhover');
		window.status = '';
	},

	onClick: function () {
		if (this._element.getElement('a').get('rel') == 'external') {
			window.open(this._element.getElement('a').get('href'));
		} else {
			document.location.href = this._element.getElement('a').get('href');
		}
	}
});

window.addEvent('domready', function () {
	$$('.blocklink').each(function (el) {
		new Driebit.blockLink(el);
	});
});
