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', 'officesjabloon');
			return false;
		}
	},

    '.nav' : function(el) {
		el.onclick = function() {
			id = this.id;
			el = 'box_' + id;
			elshow(el);
			return false;
		}
	},

    '.close_link' : function(el) {
		el.onclick = function() {
			id = this.id;
			el = 'box_' + id.replace('close_', '');
			elhide(el);
			return false;
		}
	},

	'img' : function(el) {
		el.setAttribute('galleryimg', 'no');
	}
}

Behaviour.register(Spirit_rules);

function init() {
	$('box_intro').hide();
	$('box_word').hide();
	$('box_excel').hide();
	$('box_powerpoint').hide();
	$('box_totaaloplossing').hide();
	$('box_bedrijf').hide();
	$('box_communicatiebureau').hide();
	$('box_info').hide();
	$('box_contact').hide();
	$('box_intro').setStyle({
		position: 'absolute',
	    top: '20px'
	});
	$('box_word').setStyle({
		position: 'absolute',
	    top: '20px'
	});
	$('box_excel').setStyle({
		position: 'absolute',
	    top: '20px'
	});
	$('box_powerpoint').setStyle({
		position: 'absolute',
	    top: '20px'
	});
	$('box_totaaloplossing').setStyle({
		position: 'absolute',
	    top: '20px'
	});
	$('box_bedrijf').setStyle({
		position: 'absolute',
	    top: '20px'
	});
	$('box_communicatiebureau').setStyle({
		position: 'absolute',
	    top: '20px'
	});
	$('box_info').setStyle({
		position: 'absolute',
	    top: '20px'
	});
	$('box_contact').setStyle({
		position: 'absolute',
	    top: '20px'
	});
	elshow('box_intro');
	sIFR();
}

Behaviour.addLoadEvent(init);


function elshow(obj){
	Effect.Appear(obj, { duration: 0.5 });
}
function elhide(obj){
	Effect.Fade(obj, { duration: 0.5 });
}
//<![CDATA[
/* Replacement calls. Please see documentation for more information. */

if(typeof sIFR == "function"){

sIFR.replaceElement(named({sSelector:"h2", sFlashSrc:"_files/sifr_Stramien.swf", sColor:"#ffffff", sWmode: "transparent"}));
};

//]]>

function safeEmail(user, domain) { 
	var e = user + unescape("%40") + domain + '.nl'; 
	var s='Vraag via officesjabloon.nl'
	location = 'mailto:' + e + '?subject=' + s;
}


