function newImage(arg)
{
	if (document.images)
	{
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages(sender, newSource)
{
	if (preloadFlag = true)
	{
		document.getElementById(sender).src = newSource;
	}
}

var preloadFlag = false;

function preloadImages()
{
	if (document.images)
	{		
		topnav_06_over = newImage("/images/topnav/topnav_06-over.gif");
		topnav_07_over = newImage("/images/topnav/topnav_07-over.gif");
		tpbuttons_01_over = newImage("/images/topnav/tpbuttons_01-over.gif");
		tpbuttons_02_over = newImage("/images/topnav/tpbuttons_02-over.gif");
		tpbuttons_03_over = newImage("/images/topnav/tpbuttons_03-over.gif");
		tpbuttons_04_over = newImage("/images/topnav/tpbuttons_04-over.gif");
		tpbuttons_05_over = newImage("/images/topnav/tpbuttons_05-over.gif");
		tpbuttons_06_over = newImage("/images/topnav/tpbuttons_06-over.gif");

		preloadFlag = true;
	}
}


function changeOver(el)
{
	el.style.background='#E6E6F0';
	el.style.cursor='pointer';
}

function changeOut(el)
{
	el.style.background='#FFFFFF';
	el.style.cursor='default';
}


function popUp(url,varWidth,varHeight)
{
    if (url.indexOf("&openerLocation=") != -1)
    {
		urlSplit = url.split("&openerLocation=");
		url = urlSplit[0] + "&openerLocation=" + escape(urlSplit[urlSplit.length-1]);
    }
    varLook = "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes" + ",width=" + varWidth + ",height=" + varHeight + ",left=1,top=1";
    window.open(url,"FMpopUpWin", varLook);
}

function logOut()
{
    if (confirm("Weet u zeker dat u wilt uitloggen?"))
    {
        top.location.href= "/logout.asp";
    }
}


var labelOffsetX	= 15;
var labelOffsetY	= 10;
var labelLayerId	= "label";
var mouseX, mouseY, scrollX, scrollY;
		
function moveLabel(e) {
	if(document.getElementById) {
		if(navigator.userAgent.indexOf("MSIE") > 0) {
			// Internet Explorer
			scrollX 	= document.body.scrollLeft + document.documentElement.scrollLeft;
			scrollY		= document.body.scrollTop + document.documentElement.scrollTop;
			mouseX		= scrollX + event.clientX;
			mouseY		= scrollY + event.clientY;
			screenWidth	= document.body.clientWidth;
		} else {
			// Netscape & Safari
			mouseX		= e.pageX;
			mouseY		= e.pageY;
			screenWidth	= window.innerWidth;
		}
		
		labelObj			= document.getElementById(labelLayerId);
		labelObj.style.left	= (mouseX + labelOffsetX) + "px";
		labelObj.style.top	= (mouseY + labelOffsetY) + "px";
	}
}

function showLabel(caption) {
	if(document.getElementById) {
		labelObj	= document.getElementById(labelLayerId);
		textObj		= document.getElementById(labelLayerId + "-text");
		labelObj.style.display = "inline";
		textObj.innerHTML = caption;
	}
}

function hideLabel() {
	if(document.getElementById) {
		labelObj = document.getElementById(labelLayerId);
		labelObj.style.display = "none";
	}
}

/* START CODE FOR TABS */
var intCurrentTab, intMin, intMax, blnRunning, timer, timeOutTabs;

var intTabs = 4;
var intMin = 0;
intCurrentTab = 1;
timeOutTabs = 10000;

blnRunning = true;

function setTab(itemNumber, stopTimer)
{
	if(stopTimer == null)
	{
		doStopTabTimer();
	}
	deActivateAllTabs();
	
	var clickedTab = document.getElementById("tab" + itemNumber);
	var clickedContent = document.getElementById("tabcontent" + itemNumber);
	
	clickedTab.className = clickedTab.className="true";
	clickedContent.style.display = "block";
}

function deActivateAllTabs()
{
	for(i=1; i<=intTabs; i++)
	{
		var clickedTab = document.getElementById("tab" + i);
		var clickedContent = document.getElementById("tabcontent" + i);
		
		clickedTab.className = clickedTab.className="";
		clickedContent.style.display = "none";
	}
}

function initTabs()
{
	timer = setTimeout('loopTabs()', timeOutTabs);
}

function loopTabs()
{
	if (blnRunning==true)
	{
		if(intCurrentTab < intTabs)
		{
			intCurrentTab++;
			setTab(intCurrentTab, false);
		}
		else
		{
			intCurrentTab = 1;
			setTab(intCurrentTab, false);
		}
		clearTimeout(timer);
		timer = setTimeout('loopTabs()', timeOutTabs);
	}
}

function doStartTabTimer()
{
	if (blnRunning==false)
	{
		blnRunning = true;
		clearTimeout(timer);
		timer = setTimeout('loopTabs()', timeOutTabs);
	}
}

function doStopTabTimer()
{
	if (blnRunning==true)
	{
		blnRunning = false;
		clearTimeout(timer);
	}
}
/* END CODE FOR TABS */

/* START CODE FOR ADROTATOR */
var intCurrentAd, blnAdRotatorRunning, adRotatortimer, timeOutAds;

/*var intAds = 4;*/
intCurrentAd = 1;
timeOutAds = 4000;

blnAdRotatorRunning = true;

function doStartAdRotatorTimer()
{
	if (blnAdRotatorRunning==false)
	{
		blnAdRotatorRunning = true;
		clearTimeout(adRotatortimer);
		adRotatortimer = setTimeout('loopAdRotator()', timeOutAds);
	}
}

function doStopAdRotatorTimer()
{
	if (blnAdRotatorRunning==true)
	{
		blnAdRotatorRunning = false;
		clearTimeout(adRotatortimer);
	}
}

function loopAdRotator()
{
	if (blnAdRotatorRunning==true)
	{
		if(intCurrentAd < intAds)
		{
			intCurrentAd++;
			setAd(intCurrentAd, false);
		}
		else
		{
			intCurrentAd = 1;
			setAd(intCurrentAd, false);
		}
		clearTimeout(adRotatortimer);
		adRotatortimer = setTimeout('loopAdRotator()', timeOutAds);
	}
}

function setAd(itemNumber, stopTimer)
{
	if(stopTimer == null)
	{
		doStopAdRotatorTimer();
	}
	deActivateAllAds();

	var currentAd = document.getElementById("ad" + itemNumber);
	currentAd.style.display = "block";
}

function deActivateAllAds()
{
	for(i=1; i<=intAds; i++)
	{
		var currentAd = document.getElementById("ad" + i);
		
		currentAd.style.display = "none";
	}
}

function initAds()
{
	adRotatortimer = setTimeout('loopAdRotator()', timeOutAds);
}

function returnPage(elementId1,elementId2) 
{
	document.getElementById(elementId1).style.display = "none";
	document.getElementById(elementId2).style.display = "";																 
} 


/*START CODE FOR TURNPAGE*/
var blnAdRotatorRunning_Page, adRotatortimer_Page, timeOutAds_Page, intCurrentAd_Page

timeOutAds_Page = 8000;
intCurrentAd_Page = 1;

blnAdRotatorRunning_Page = true;

function doStopAdRotatorTimer_Page()
{
	if (blnAdRotatorRunning_Page==true)
	{
		blnAdRotatorRunning_Page = false;
		clearTimeout(adRotatortimer_Page);
	}
}

function loopAdRotator_Page()
{
	if (blnAdRotatorRunning_Page==true)
	{
		if(intCurrentAd_Page < intPage)
		{
			intCurrentAd_Page ++;
			setAd_Page(intCurrentAd_Page, false);
		}
		else
		{
			intCurrentAd_Page = 1;
			setAd_Page(intCurrentAd_Page, false);
		}
		clearTimeout(adRotatortimer_Page);
		adRotatortimer_Page = setTimeout('loopAdRotator_Page()', timeOutAds_Page);
	}
}

function setAd_Page(itemNumber, stopTimer)
{
	if(stopTimer == null)
	{
		doStopAdRotatorTimer_Page();
	}
	deActivateAllAds_Page();

	var currentAd = document.getElementById("CA" + itemNumber);
	currentAd.style.display = "block";
}

function deActivateAllAds_Page()
{
	for(i=1; i<=intPage; i++)
	{
		var currentAd = document.getElementById("CA" + i);
		
		currentAd.style.display = "none";
	}
}

function initPage()
{
	adRotatortimer_Page = setTimeout('loopAdRotator_Page()', timeOutAds_Page);
}

function returnPage(elementId1,elementId2) 
{
	document.getElementById(elementId1).style.display = "none";
	document.getElementById(elementId2).style.display = "";																 
} 

