var Spirit_rules = {

	'a' : function(el) {
		el.onfocus = function() {
			this.blur();
			if (el.getAttribute('rel') == 'external') {
				el.setAttribute('target', '_blank');
		   }
		}
	}, 

	'a#mail' : function(el) {
		el.onclick = function() {
			safeEmail('info', 'cijferwerk');
			return false;
		}
	},

	'a#mail1' : function(el) {
		el.onclick = function() {
			safeEmail('info', 'cijferwerk');
			return false;
		}
	},

	'img' : function(el) {
		el.setAttribute('galleryimg', 'no');
	}
}

Behaviour.register(Spirit_rules);

function init() {
	viewport = getWindowHeight();
	totalcontent = $('canvas').getHeight();
	contenthoogte = $('content').getHeight();
	if (totalcontent < viewport) {
		setcontent = contenthoogte + viewport - totalcontent - 40;
		Element.setStyle('content', {height: setcontent + 'px'});		
	}
}

Behaviour.addLoadEvent(init);


function safeEmail(user, domain) { 
	var e = user + unescape("%40") + domain + '.nl'; 
	var s=''
	location = 'mailto:' + e + '?subject=' + s;
}

function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}


