/** INITIALIZE ALL FUNCTIONS ON WINDOW.LOAD ******************************/
/* for Mozilla */
if (document.addEventListener) {
   	document.addEventListener("DOMContentLoaded", init, false);
   	
   	if (typeof window.addEventListener != 'undefined') {   
   		window.addEventListener("resize", init, false);
   	}
}

/* for Internet Explorer */
/*@cc_on @*/
/*@if (@_win32)
   document.write("<script defer=\"defer\" src=\"js/ie_init.js\"><"+"/script>");
/*@end @*/

/* for other browsers */
window.onload = init;
window.resize = init;

function init() {
	resizeElement("contentBackground");
};

/*************************************************************************/

function change(id, newClass) {
  document.getElementById(id).className=newClass;
}

function movepic(imgname, source) {
    document[imgname].src=source;
}

function clearTextBox (inputId) {
	if (document.getElementById(inputId).value == "- geen voorkeur -")
	    document.getElementById(inputId).value = "";
	if (document.getElementById(inputId).value == "gebruikersnaam")
	    document.getElementById(inputId).value = "";
}

function fillTextBox (inputId,fillText) {
	if (document.getElementById(inputId).value == "")
	    document.getElementById(inputId).value = fillText;
}

function clearPassBox (inputId) {
	if (document.getElementById(inputId).value == "wachtwoord") {
        document.getElementById(inputId).value = "";
        document.getElementById(inputId).type = "password";
    }
}

function fillPassBox(inputId,Pass) {
    if (document.getElementById(inputId).value == "") {
        document.getElementById(inputId).value = Pass;
        document.getElementById(inputId).type = "text";
    }
}

function toggle(definitionId) {
    if (document.getElementById(definitionId).style.display=="block") {
        document.getElementById(definitionId).style.display="none";
    }
    else {
        document.getElementById(definitionId).style.display="block";
    }
}

function Preload() {
    var arImages=new Array();
    var temp = Preload.arguments;
    for(x=0; x < temp.length; x++) {
        arImages[x]=new Image();
        arImages[x].src=Preload.arguments[x];
    }
}

function writeFlash(flashFile,flashWidth,flashHeight) {
    document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'");
    document.write("codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0'");
    document.write("width='" + flashWidth + "' height='" + flashHeight + "' id='top' align=''>");
    document.write("    <param name=movie value='" + flashFile + "' />");
    document.write("    <param name=quality value=high />");
    document.write("    <param name=bgcolor value=#FFFFFF />");
    document.write("    <embed src='" + flashFile + "' quality=high bgcolor=#FFFFFF width='" + flashWidth + "' height='" + flashHeight + "' name='top' align=''");
    document.write(" type='application/x-shockwave-flash' pluginspace='http://www.macromedia.com/go/getflashplayer'>");
    document.write("    </embed>");
    document.write("</object>");
}

function positieBepaler(id, direction) {
	var obj = document.getElementById(id);

	var links = obj.offsetLeft, boven = obj.offsetTop;

	if (direction == 'x') {
		while (obj.offsetParent) {
			obj = obj.offsetParent;
			links += obj.offsetLeft;
		};
		return links;
	}
	else if (direction == 'y') {
		while (obj.offsetParent) {
			obj = obj.offsetParent;
			boven += obj.offsetTop;
		};
		return boven;
	}
}

/* Change the height of an existing element, adapted to bottom of document */
function resizeElement(dstElement) {

	var ie5 = document.all&&document.getElementById;
	var windowBottom = ie5? document.documentElement.clientHeight : window.innerHeight;

	var documentBottom = document.body.offsetHeight;

	var bodyHeight = (windowBottom > documentBottom) ? windowBottom : documentBottom;

	/* Get the current top position and extract it from the body's height */
	if (bodyHeight-positieBepaler(dstElement, 'y') > document.getElementById(dstElement).offsetHeight) {
		/* Set the new height for dstElement */
		document.getElementById(dstElement).style.height = bodyHeight-positieBepaler(dstElement, 'y')+"px";
	}

}