/*************************************************************
* Window Onload Manager (WOM) v1.0
* Author: Justin Barlow - www.netlobo.com
**************************************************************/

function windowOnLoad(){
	window.onload = windowOnLoadGo;
}

function windowOnLoadGo(){
	for(var i = 0;i < windowOnLoadFunctions.length;i++)
		eval(windowOnLoadFunctions[i]);
}

function windowOnLoadAdd(func){
	windowOnLoadFunctions[windowOnLoadFunctions.length] = func;
}

var windowOnLoadFunctions = new Array();

/*************************************************************
* Mendix scripts
**************************************************************/

var newsTabs = new Array();
var newsContent = new Array();

function initTabs() {
	newsTabs[0] = document.getElementById('newsmenutab_posts');
	newsTabs[1] = document.getElementById('newsmenutab_press');
	newsTabs[2] = document.getElementById('newsmenutab_events');
	newsTabs[3] = document.getElementById('newsmenutab_downloads');
	
	newsContent[0] = document.getElementById('tab_posts');
	newsContent[1] = document.getElementById('tab_press');
	newsContent[2] = document.getElementById('tab_events');
	newsContent[3] = document.getElementById('tab_downloads');
}

function switchTab(tabNumber, tabLink) {
	if (newsTabs.length && newsContent.length) {
		for (var i=0; i<newsTabs.length; i++) {
			if (i == tabNumber) {
				newsTabs[i].className = 'current_page';
				newsContent[i].style.display = 'block';
			} else {
				newsTabs[i].className = '';
				newsContent[i].style.display = 'none';
			}
		}
	}
}

windowOnLoadAdd('initTabs()');
windowOnLoad();