zoekboxVisited = false;
zoekboxInitText = "";

function zoekboxOnFocus () {
	if (!zoekboxVisited) {
		zoekboxInitText = document.getElementById ("INPUT_zoek").value;
		document.getElementById ("INPUT_zoek").value = "";
		document.getElementById ("INPUT_zoek").className = "input";
		zoekboxVisited = true;
	}
}
function zoekboxOnBlur () {
	if (document.getElementById ("INPUT_zoek").value == "") {
		document.getElementById ("INPUT_zoek").className = "inputleeg";
		document.getElementById ("INPUT_zoek").value = zoekboxInitText;
		zoekboxVisited = false;
	}	
}
function zoekboxOnSubmit () {
	if (zoekboxVisited) {
		document.getElementById ("FORM_zoek").submit ();
	} 
	return zoekboxVisited;
}

function getWindowHeight() {
    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;
}

function setElementen () {
    if (document.getElementById) {
		if (rubriek = document.getElementById ("DIV_rubriek")) {
			hoogteRubriek = parseInt (rubriek.offsetHeight);
		} else {
			hoogteRubriek = 0;
		}
		if (schaduwboven = document.getElementById ("IMG_schaduwboven")) {
			hoogteSchaduwboven = parseInt (schaduwboven.offsetHeight);
			schaduwboven.style.top = (parseInt (schaduwboven.style.top) + hoogteRubriek) + "px";
			schaduwboven.style.visibility = "visible";
		} else {
			hoogteSchaduwboven = 0;
		}
		if (tekst = document.getElementById ("DIV_tekst")) {
			topTekst = parseInt (tekst.style.top);
			hoogteTekst = parseInt (tekst.offsetHeight);				
		} else {
			topTekst = 0;
			hoogteTekst = 0;
		}
		if (schaduwonder = document.getElementById ("IMG_schaduwonder")) {
			hoogteSchaduwonder = parseInt (schaduwonder.offsetHeight);
			minHoogteTekst = hoogteSchaduwboven + hoogteSchaduwonder;
			if (minHoogteTekst > (topTekst + hoogteTekst)) {
				schaduwonder.style.top = (parseInt (schaduwonder.style.top) + minHoogteTekst - (topTekst + hoogteTekst)) + "px";
			}
			schaduwonder.style.visibility = "visible";
		} else {
			hoogteSchaduwonder = 0;
		}
		if (hoofdmenu = document.getElementById ("DIV_hoofdmenu")) {
			bottomHoofdmenu = parseInt (hoofdmenu.style.top) + parseInt (hoofdmenu.offsetHeight);
		} else {
			bottomHoofdmenu = 0;
		}
		if (etalage = document.getElementById ("DIV_etalage")) {
			bottomEtalage = parseInt (etalage.style.top) + parseInt (etalage.offsetHeight);
		} else {
			bottomEtalage = 0;
		}
		if (inhoud = document.getElementById ("DIV_inhoud")) {
			bottomInhoud = parseInt (inhoud.style.top) + hoogteRubriek + hoogteTekst + hoogteSchaduwonder + parseInt (schaduwonder.style.top);
		} else {
			bottomInhoud = 0;
		}
		if (footer = document.getElementById ("DIV_footer")) {
			footer.style.top = (Math.max (bottomHoofdmenu, bottomEtalage, bottomInhoud) + 71) + "px";
			hoogteFooter = parseInt (footer.offsetHeight);
	        hoogteWindow = getWindowHeight ();
			if (hoogteWindow > parseInt (footer.style.top) + hoogteFooter) {
				footer.style.top = (hoogteWindow - hoogteFooter) + "px";
			}
			footer.style.visibility = "visible";
		}
    }
}

function headerfotoSlideshow () {
	$(document).ready(function() {
	    $('#DIV_headerfotos').cycle({
			fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		});
	});
}

function bodyOnLoad () {
	setElementen ();
	if (elementExists ("DIV_headerfotos")) headerfotoSlideshow ();
}


