window.defaultStatus = '© 2001-2004 Debsel';

// Sleight
if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) {
	document.writeln('<style type="text/css">img { visibility:hidden; } </style>');
	window.attachEvent("onload", fnLoadPngs);
}

function fnLoadPngs() {
	var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
	var itsAllGood = (rslt != null && Number(rslt[1]) >= 5.5);

	for (var i = document.images.length - 1, img = null; (img = document.images[i]); i--) {
		if (itsAllGood && img.src.match(/\.png$/i) != null) {
			var src = img.src;
			img.style.width = img.width + "px";
			img.style.height = img.height + "px";
			img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')"
			img.src = "/wordpress/wp-content/themes/debsel.nl-2/plaatjes/nixel.gif";
		}
		img.style.visibility = "visible";
	}
}
// end Sleight

// Hiveware Enkoder
function hiveware_enkoder(){var i,j,x,y,x=
"x=\"783d223154783d5c22372b3d3332636d323732293532783d30367b7932375c5c5c2236" +
"362b3d613436343636756e3539376636366573333436333737636134633635363370656435" +
"33643634282734643535363625273563326537362b783232343432372e7333643665373675" +
"6235313637373673746339363236327228656332393736692c653034343636322963343635" +
"3235293b6335363832327d795c22323732333b6a3d653336633676616c2835363132782e63" +
"6863353036617241746332383728302929323332363b783d78653435362e73756234363633" +
"737472283536643531293b79323763323d27273b33363236666f722835366436693d303b63" +
"333136693c782e633239366c656e676636633774683b69313334362b3d3429653266337b79" +
"2b3d32326136782e737539333436627374726233353628692c3230333237293b7d66625c5c" +
"5c22336f722869363b79353d323b69363d27633c782e6c34273b30656e677436666f34683b" +
"692b367228353d34297b36693d32792b3d7837303b332e73756236693c357374722836782e" +
"63692c3229326c65653b7d793d366e6765792e73753674686362737472333b6966286a293b" +
"223b6a3d6576616c28782e636861724174283029293b783d782e7375627374722831293b79" +
"3d27273b666f7228693d303b693c782e6c656e6774683b692b3d38297b792b3d782e737562" +
"73747228692c34293b7d666f7228693d343b693c782e6c656e6774683b692b3d38297b792b" +
"3d782e73756273747228692c34293b7d793d792e737562737472286a293b\";y='';for(i=" +
"0;i<x.length;i+=2){y+=unescape('%'+x.substr(i,2));}y";
while(x=eval(x));}
// End enkoder

// Livesearch
/*
// +----------------------------------------------------------------------+
// | Copyright (c) 2004 Bitflux GmbH                                      |
// +----------------------------------------------------------------------+
// | Licensed under the Apache License, Version 2.0 (the "License");      |
// | you may not use this file except in compliance with the License.     |
// | You may obtain a copy of the License at                              |
// | http://www.apache.org/licenses/LICENSE-2.0                           |
// | Unless required by applicable law or agreed to in writing, software  |
// | distributed under the License is distributed on an "AS IS" BASIS,    |
// | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or      |
// | implied. See the License for the specific language governing         |
// | permissions and limitations under the License.                       |
// +----------------------------------------------------------------------+
// | Author: Bitflux GmbH <devel@bitflux.ch>                              |
// +----------------------------------------------------------------------+

*/
var liveSearchReq = false;
var t = null;
var liveSearchLast = "";
	
var isIE = false;
// on !IE we only have to initialize it once
if (window.XMLHttpRequest) {
	liveSearchReq = new XMLHttpRequest();
}

function liveSearchInit() {
	
	//if ( !document.getElementById( 'livesearch' ) ) return false;
	
	if (navigator.userAgent.indexOf("Safari") > 0) {
		document.getElementById('livesearch').addEventListener("keydown",liveSearchKeyPress,false);
//		document.getElementById('livesearch').addEventListener("blur",liveSearchHide,false);
	} else if (navigator.product == "Gecko") {
		
		document.getElementById('livesearch').addEventListener("keypress",liveSearchKeyPress,false);
		document.getElementById('livesearch').addEventListener("blur",liveSearchHideDelayed,false);
		
	} else {
		document.getElementById('livesearch').attachEvent('onkeydown',liveSearchKeyPress);
//		document.getElementById('livesearch').attachEvent("onblur",liveSearchHide,false);
		isIE = true;
	}
	
	document.getElementById('livesearch').setAttribute("autocomplete","off");

}

function liveSearchHideDelayed() {
	window.setTimeout("liveSearchHide()",400);
}
	
function liveSearchHide() {
	document.getElementById("LSResult").style.display = "none";
	var highlight = document.getElementById("LSHighlight");
	if (highlight) {
		highlight.removeAttribute("id");
	}
}

function liveSearchKeyPress(event) {
	
	if (event.keyCode == 40 )
	//KEY DOWN
	{
		highlight = document.getElementById("LSHighlight");
		if (!highlight) {
			highlight = document.getElementById("LSShadow").firstChild.firstChild;
		} else {
			highlight.removeAttribute("id");
			highlight = highlight.nextSibling;
		}
		if (highlight) {
			highlight.setAttribute("id","LSHighlight");
		} 
		if (!isIE) { event.preventDefault(); }
	} 
	//KEY UP
	else if (event.keyCode == 38 ) {
		highlight = document.getElementById("LSHighlight");
		if (!highlight) {
			highlight = document.getElementById("LSResult").firstChild.firstChild.lastChild;
		} 
		else {
			highlight.removeAttribute("id");
			highlight = highlight.previousSibling;
		}
		if (highlight) {
				highlight.setAttribute("id","LSHighlight");
		}
		if (!isIE) { event.preventDefault(); }
	} 
	//ESC
	else if (event.keyCode == 27) {
		highlight = document.getElementById("LSHighlight");
		if (highlight) {
			highlight.removeAttribute("id");
		}
		document.getElementById("LSResult").style.display = "none";
	} 
}
function liveSearchStart() {
	if (t) {
		window.clearTimeout(t);
	}
	t = window.setTimeout("liveSearchDoSearch()",200);
}

function liveSearchDoSearch() {

	if (typeof liveSearchRoot == "undefined") {
		liveSearchRoot = "";
	}
	if (typeof liveSearchRootSubDir == "undefined") {
		liveSearchRootSubDir = "";
	}
	if (typeof liveSearchParams == "undefined") {
		liveSearchParams = "";
	}
	if (liveSearchLast != document.forms.searchform.s.value) {
	if (liveSearchReq && liveSearchReq.readyState < 4) {
		liveSearchReq.abort();
	}
	if ( document.forms.searchform.s.value == "") {
		liveSearchHide();
		return false;
	}
	if (window.XMLHttpRequest) {
	// branch for IE/Windows ActiveX version
	} else if (window.ActiveXObject) {
		liveSearchReq = new ActiveXObject("Microsoft.XMLHTTP");
	}
	liveSearchReq.onreadystatechange= liveSearchProcessReqChange;
	liveSearchReq.open("GET", liveSearchRoot + "livesearch.php?q=" + document.forms.searchform.s.value + liveSearchParams);
	liveSearchLast = document.forms.searchform.s.value;
	liveSearchReq.send(null);
	}
}

function liveSearchProcessReqChange() {
	
	if (liveSearchReq.readyState == 4) {
		var  res = document.getElementById("LSResult");
		res.style.display = "block";
		var  sh = document.getElementById("LSShadow");
		
		sh.innerHTML = liveSearchReq.responseText;
		 
	}
}

function liveSearchSubmit() {
	var highlight = document.getElementById("LSHighlight");
	if (highlight && highlight.firstChild) {
		window.location = liveSearchRoot + liveSearchRootSubDir + highlight.firstChild.nextSibling.getAttribute("href");
		return false;
	} 
	else {
		return true;
	}
}
// End Livesearch

function doSubmit() {
	var err = 0;
	var foutstr = ' optie';
	var d = document.forms[0];
	if (d.toon.value == '') {
		err++;
	}
	if (d.soort.value == '') {
		err++;
	}
	if (d.verkrijgbaarheid.value == '') {
		err++;
	}
	
	if (err > 0) {
		if (err > 1) {
			foutstr += 's';
		}
		alert('U heeft bij ' + err + foutstr + ' van de eerste drie geen keuze gemaakt.');
	} else {
		d.submit();
	}
	
}

function expandCollapse() {
	for (var i=0; i<expandCollapse.arguments.length; i++) {
		var element = document.getElementById(expandCollapse.arguments[i]);
		element.style.display = (element.style.display != "block") ? "block" : "none";
	}
}

function toggleSmileys() {
	theWidth = ( theWidth == '500' ) ? '340' : '500';
	expandCollapse( 'wp-grins' );
	// document.getElementById('comment').style.width = theWidth + 'px';
}

function SchuifDieHap( hetId ) {
	var dePlaatjes = document.images;
	for ( var i = 0; i < dePlaatjes.length; i++ ) {
		if ( dePlaatjes[i].id == 'img'+hetId ) {
			var deBreedte = dePlaatjes[i].offsetWidth;
			var deOffset = Math.ceil( ( 200 - 40 - deBreedte ) / 2 );
		}
	}
	if ( navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" ) deOffset -= 10;
	document.getElementById( 'div'+hetId ).style.left = deOffset + "px"; 
}

function SchuifDieGroteHap () {
	var dePlaat = document.getElementById('image').offsetWidth;
	var deOffset = Math.ceil( ( 500 - dePlaat ) / 2 );
	if ( navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" ) deOffset -= 10;
	document.getElementById( 'fotodiv' ).style.left = deOffset + "px";
}

function WisselDieHap ( nieuwePlaat ) {
	var Plaat = document.getElementById('image');
	Plaat.style.visibility = 'hidden';
	Plaat.src = nieuwePlaat;
	SchuifDieGroteHap();
	Plaat.style.visibility = 'visible';
}