	//////////////////////////////////////////////////////////////////////////////////////////////
	// SETTINGS
	//////////////////////////////////////////////////////////////////////////////////////////////
	var blockStyles 		= new Array();
   	var dynamicCalls		= new Array();
	var allCategoriesVisible	= false;
	var openSpeed			= 30;
	var closeSpeed			= 20;
	var closeTimeout		= 0;
	var closeAfterTimeout		= false;
	var agt				= navigator.userAgent.toLowerCase();
	var zm_search_active_state	= "aan";
	var selectedSearchEngine	= 0;

	///////////////////////////////////////////////
	// CACHE PROVINCIE IMAGES
	///////////////////////////////////////////////
	pbr = new Image();pbr.src="img/regionaal/brabant.gif";
	pze = new Image();pze.src="img/regionaal/zeeland.gif";
	pli = new Image();pli.src="img/regionaal/limburg.gif";
	pzh = new Image();pzh.src="img/regionaal/zholland.gif";
	pnh = new Image();pnh.src="img/regionaal/nholland.gif";
	pge = new Image();pge.src="img/regionaal/gelderland.gif";
	put = new Image();put.src="img/regionaal/utrecht.gif";
	pfl = new Image();pfl.src="img/regionaal/flevoland.gif";
	pov = new Image();pov.src="img/regionaal/overijssel.gif";
	pfr = new Image();pfr.src="img/regionaal/friesland.gif";
	pdr = new Image();pdr.src="img/regionaal/drenthe.gif";
	pgr = new Image();pgr.src="img/regionaal/groningen.gif";


	///////////////////////////////////////////////
	// INITDYNAMICCONTENT
	///////////////////////////////////////////////
	function initDynamicContent()
	{
		// create dynamic function-calls based on dynamic content blocks (dcb) array
		if(window.dcb)
		{
			for(var i=0; i<dcb.length; ++i)
			{
				// if feed enabled and timeout not 0
				if((dcb[i][3] == 1) && (dcb[i][0] != 0))
						dynamicCalls[dynamicCalls.length] = callLater(dynamicCalls.length, dcb[i][0], dcb[i][1], dcb[i][2]);
			}
		}

		// trigger dynamic function-calls for the first time
		if(window.dynamicCalls)
			for(var i=0; i<dynamicCalls.length; ++i)
				setTimeout(dynamicCalls[i], 5);		// execute first call (almost) immediately
	}


	///////////////////////////////////////////////
	// CALLLATER
	///////////////////////////////////////////////
	function callLater(number, timeout, id, type)
	{
	    return (function()
	    {
	    	// get the content
	        getContent(id, type);

	        // set dynamic function-call again
			setTimeout(dynamicCalls[number], timeout*1000);
	    });
	}


	///////////////////////////////////////////////
	// GETCONTENT
	///////////////////////////////////////////////
	function getContent(id, type)
	{
		requestHtml(getRequestObject(), id, type);
	}


	///////////////////////////////////////////////
	// ADDLOADEVENT
	///////////////////////////////////////////////
	function addLoadEvent(func)
	{
		var oldonload = window.onload;

		if(typeof window.onload != 'function')
		{
			window.onload = func;
		}
		else
		{
			window.onload = function()
			{
				if(oldonload)
					oldonload();

				func();
			}
		}
	}


	//////////////////////////////////////////////////////////////////////////////////////////////
	// GETOBJ - Cross-browser function that will return any object
	//
	// @param name	The name of the object to find.
	//////////////////////////////////////////////////////////////////////////////////////////////
	function getObj(name)
	{
		if(document.getElementById)
		{
			this.obj	= document.getElementById(name);
			this.style	= document.getElementById(name).style;
		}
		else if(document.all)
		{
			this.obj	= document.all[name];
			this.style	= document.all[name].style;
		}
		else if(document.layers)
		{
			this.obj	= document.layers[name];
			this.style	= document.layers[name];
		}
	}


	//////////////////////////////////////////////////////////////////////////////////////////////
	// GETREQUESTOBJECT - Cross-browser function that will return an XMLHttpRequest object
	//////////////////////////////////////////////////////////////////////////////////////////////
	function getRequestObject()
	{
		// variable for the xmlhttprequest
		var http_request = false;

		// create the httpxmlrequest object that will handle the communication with the server
		if(window.XMLHttpRequest)
		{
	    	http_request = new XMLHttpRequest();

			// override the mimetype to text/xml
			if(http_request.overrideMimeType)
				http_request.overrideMimeType("text/xml");
	    }
		else if(window.ActiveXObject)
		{
	    	http_request = new ActiveXObject("Microsoft.XMLHTTP");
	    }

	   	return http_request;
	}


	//////////////////////////////////////////////////////////////////////////////////////////////
	// RQUESTXML - Make the request and define the follow-up function.
	//
	// @param http_request	The XMLHttpRequest object that will make the call to the external resource
	// @param url			The url of the external resource
	// @param name			The name for the value in the global xml array
	// @param template		The xsl template existing in the global xsl array to use for transformation
	// @param target		The target to send the contents to
	//////////////////////////////////////////////////////////////////////////////////////////////
	function requestHtml(http_request, name, type)
	{
		url = "ssi/external/" + name + "_" + type + ".inc";

		// set function to call on ready state
		http_request.onreadystatechange = function()
		{
			processHtml(http_request, name);
		};

		// send the request to the server
		http_request.open("GET", url, true);													// send asynchronous GET request to url
		http_request.send(null);																// call send (optionally with parameters; "name=value&anothername=othervalue&so=on")
	}


	//////////////////////////////////////////////////////////////////////////////////////////////
	// PROCESSXML -	Process the recieved content.
	//				Transform the recieved content if template is set.
	//				Write the received, and optionally transformed, content to a target
	//
	// @param http_request	The XMLHttpRequest object that made the call to the external resource
	// @param name			The name for the value in the global xml array
	// @param template		The xsl template existing in the global xsl array to use for transformation
	// @param target		The target to send the contents to
	//////////////////////////////////////////////////////////////////////////////////////////////
	function processHtml(http_request, target)
	{
		// check readystate
		if(http_request.readyState == 4)
		{
			// check if server response requires a content update
			if(http_request.status == 200)
			{
				html = http_request.responseText;									// create xml object and add it to global xml array

				if(target)
					setContent(target, html);										// write the transformed content to target
			}
		}
	}


	//////////////////////////////////////////////////////////////////////////////////////////////
	// SETCONTENT - Set the content of any object using innerHTML property
	//
	// @param target 	The object to set the content for
	// @param content	The content to place in the object
	//////////////////////////////////////////////////////////////////////////////////////////////
	function setContent(target, content)
	{
		element = new getObj(target);

		element.obj.innerHTML = content;
	}


	///////////////////////////////////////////////
	// BLOKKEN INDEX
	///////////////////////////////////////////////
	function showAll(open)
	{
		if(open && !allCategoriesVisible)
		{
			document.getElementById("index_animated").style.top = '0px';

			setTimeout(hideZoeken, 350);
			setTimeout(showAnimated, 350);
		}
		else if(!open && allCategoriesVisible)
		{
			setTimeout(showZoeken, 150);
			setTimeout(hideAnimated, 200);
		}
		return false;
	}

	function autoClose()
	{
		--closeTimeout;

		if(closeTimeout <= 0)
		{
			if(closeAfterTimeout)
				showAll(false);
		}
		else setTimeout(autoClose, 1000);
	}

	function resetTimeout()
	{
		closeAfterTimeout = false;
		closeTimeout = 2;
	}

	function showAnimated()
	{
		allCategoriesVisible	= true;
		animated				= document.getElementById("index_animated").style;
		area					= document.getElementById("index_area").style;

		animated.display		= 'block';

		if(animated.top == '0px')
		{
			animated.top		= '7px';
			animated.width		= '101px';
			animated.height		= '10px';

			setTimeout(showAnimated, openSpeed);
		}
		else if(animated.top == '7px')
		{
			animated.top		= '10px';
			animated.width		= '160px';
			animated.height		= '42px';

			setTimeout(showAnimated, openSpeed);
		}
		else if(animated.top == '10px')
		{
			animated.top		= '13px';
			animated.width		= '250px';
			animated.height		= '70px';

			setTimeout(showAnimated, openSpeed);
		}
		else if(animated.top == '13px')
		{
			animated.top		= '20px';
			animated.width		= '410px';
			animated.height		= '106px';

			setTimeout(showAnimated, openSpeed);
		}
		else
		{
			animated.display	= 'none';
			area.display		= 'block';
		}
	}

	function hideAnimated(offset)
	{
		allCategoriesVisible 	= false;
		animated				= document.getElementById("index_animated").style;
		area					= document.getElementById("index_area").style;

		area.display			= 'none';
		animated.display		= 'block';

		if(animated.top == '20px')
		{
			animated.top		= '19px';
			animated.width		= '410px';
			animated.height		= '106px';

			setTimeout(hideAnimated, closeSpeed);
		}
		else if(animated.top == '19px')
		{
			animated.top		= '13px';
			animated.width		= '250px';
			animated.height		= '70px';

			setTimeout(hideAnimated, closeSpeed);
		}
		else if(animated.top == '13px')
		{
			animated.top		= '10px';
			animated.width		= '160px';
			animated.height		= '42px';

			setTimeout(hideAnimated, closeSpeed);
		}
		else if(animated.top == '10px')
		{
			animated.top		= '7px';
			animated.width		= '101px';
			animated.height		= '10px';

			setTimeout(hideAnimated, closeSpeed);
		}
		else
		{
			animated.top 		= '7px';
			animated.width		= '101px';
			animated.height		= '10px';

			animated.display 	= 'none';
		}
	}

	function hideZoeken()
	{
		if(document.getElementById("zm_select"))
				document.getElementById("zm_select").style.display = 'none';
	}

	function showZoeken()
	{
		if(document.getElementById("zm_select"))
				document.getElementById("zm_select").style.display = 'none';
	}


	///////////////////////////////////////////////
	// INITBLOCKSTYLES
	///////////////////////////////////////////////
	function initBlockStyles()
	{
		var count	= 0;
		var blocks	= document.getElementsByTagName('div');

		for(var i=0;i<blocks.length;i++)
		{
			if(blocks[i].getAttribute("id") != null)
			{
				if(blocks[i].getAttribute("id").indexOf("blok") == 0)
				{
					blockStyles[count]		= new Array();
					blockStyles[count][0]	= blocks[i].getAttribute("id");

					if(blocks[i].className != null)
						blockStyles[count][1] = blocks[i].className;

					count++;
				}
			}
		}
	}


	///////////////////////////////////////////////
	// RESETBLOCKSTYLES
	///////////////////////////////////////////////
	function resetBlockStyles()
	{
		if(blockStyles.length == 0)
			initBlockStyles();

		for(var i=0;i<blockStyles.length;i++)
			document.getElementById(blockStyles[i][0]).className = blockStyles[i][1];
	}


	///////////////////////////////////////////////
	// SETBLOCKSTYLE
	///////////////////////////////////////////////
	function setBlockStyle(block)
	{
		block = "blok_"+block;

		for(var i=0;i<blockStyles.length;i++)
		{
			if(blockStyles[i][0] == block)
			{
				document.getElementById(block).style.display	= "block";
				document.getElementById(block).className		= "blokactive";
			}
		}
	}


	// select searchengine in search dropdown (add it if not existing)
	function selectSearchEngine(se)
	{
		seFound		= false;
		zoekSelect	= document.getElementById("zm_select");
		imgZoek 	= document.getElementById("zoek_ico");
		var number = 0;

		for(i=0; i<zmu.length; i++)
		{
			if(se == zmu[i])
			{
				number=i;
			}
		}

		for(i=0; i<zoekSelect.options.length; i++)
		{
			if(se == zoekSelect.options[i].value)
			{
				zoekSelect.options[i].selected = true;

			} else {
				zoekSelect.options[i].selected = false;
			}
		}

		selectedSearchEngine = number;
		imgZoek.src = "http://static.startpagina.nl/img/2.0/se/"+zmi[selectedSearchEngine];
		document.getElementById("zm_query").focus();
		document.getElementById('zoek_options').style.display = "block";
	}

	// get the right search engine text
	function getSearchText()
	{
		return "zoeken "+zmw[selectedSearchEngine];
	}


	// show/ hide extra content and set cookie
	function setmorecontent(mode, naam)
	{
		morecontent(mode, naam);

		if(naam == "categorie")
			myspinstelling[1] = mode;

		setCookie("mysp", myspinstelling.join(";"));
	}


	// write a cookie named 'name' with 'value'
	function setCookie(name, value)
	{
		if((value != null) && (value != ""))
		{
			var today	= new Date();
			var expiry	= new Date(today.getTime()+31536000000);

			d.cookie	= name + "=" + escape(value) + ";expires=" + expiry.toGMTString() + ";path=/";
		}
	}


	// open een window met hierin de webradio player
	function webradio(naam, scrwidth, scrheight, stat, resiz, target_comm, vensternaam)
	{
		sd = new Date();

		if(scrwidth == 600)
			yon = "yes";
		else
			yon = "no";

		if(resiz == "yes")
			yon = "yes";

		spradio = window.open(naam, "spradio", "toolbar=no,location=no,resizable=" + yon + ",status=no,scrollbars=" + yon + ",menubar=no,width=" + scrwidth + ",height=" + scrheight + ",top=1,left=1");

		arnostat(escape(stat));

		// zlostat
		if(target_comm.substring(0, 1) == "c")
		{
			zlostat = target_comm;

			if(zlostat.indexOf("_") != -1)
				zlostat = zlostat.substring(0, zlostat.indexOf("_"));

			var ici = new Image();
			ici.src = "http://dispatch.ilse.nl/spc/?LINKID=" + eval(zlostat.substring(1, zlostat.length));
		}

		spradio.focus();
	}

	// open a link from the suggestbox
	function suggest_click(obj)
	{
		zoeksuggestie = 1;
		o(obj);
	}


	// open a link in a new window/tab using 'this' object
	function o(obj)
	{
		var naam	= "";
		var url		= "";
		var id		= "";
		
		naam		= obj.innerHTML;
		url		= obj.href;
		id		= obj.id;
		
		n(id, naam, url);
	}


	// open a link in a new window/tab
	function n(target_comm, naam, url)
	{		
		//exception horoscooplinks,schoolbank, receptvandedag links can't give same zlostat id
		exception=0;

		if (url)
		{
			if (url.substring(0,65)=="http://www.horoscooponline.nl/index.php?daghoroscoop-hol/uitvoer-")
			{
				temptargetcomm=target_comm;
				target_comm="c15956";
				naam="k4_horoscoop_gadget";
				url="";
				exception=1;
			}
		                                 
			if (url.substring(0,35)=="http://www.schoolbank.nl/klasgenoot")									 
			{
				temptargetcomm=target_comm;
				target_comm="c16154";
				naam="k4-scoolbank-gadget-result";
				url="";
				exception=1;
			}
		 
			if (url.substring(0,43)=="http://www.schoolbank.nl/person_search.html")
			{
				temptargetcomm=target_comm;
				target_comm="c16154";
				naam="k4-scoolbank-gadget-meer";
				url="";
				exception=1;
			}
										 
			if (url.substring(0,46)=="http://www.vrouwonline.nl/koken/recepten/?Url=")
			{
				temptargetcomm=target_comm;
				target_comm="c16322";
				naam="k4-receptvandedag-gadget";
				url="";
				exception=1;
			}
		}  
	
		
		// zlostat ook vermeld in function s
		if(target_comm.substring(0, 1) == "c")
		{
			zlostat = target_comm;
			
			if (target_comm.substring(0,8)=="czoekbox")
		     zlostat=target_comm.substring(8,target_comm.length);

		     
				if(zlostat.indexOf("_") != -1)
				zlostat = zlostat.substring(0, zlostat.indexOf("_"));

			// dubble meting voorkomen doordat ctrl-knop te vroeg wordt losgelaten bij een tab-klik
			if(muiswgo != "yes")
			{ 
				var ici = new Image();
				ici.src = "http://dispatch.ilse.nl/spc/?LINKID=" + eval(zlostat.substring(1, zlostat.length))+"&uni="+uniek();
			}

		}

		
		arnostat(escape(naam));
		
		// if url is undefined, url = naam
		if((url == null) || (url == ""))
			url = escape(naam);
		
		if((zoekopdracht == 1)||(zoeksuggestie == 1))
		{
			zoeksuggestie = 0;
			lc_click2(lc_site, lc_page, lc_pagevariant, lc_campaign, url, d.searchforit.query.value);
		}
		else
		{
			lc_click(lc_site, lc_page, lc_pagevariant, lc_campaign, url);
		}
        
		//exception horoscooplinks,schoolbanklinks,receptvandedaglinks can't give same id
		if (exception==1)
			target_comm=temptargetcomm;

		if(tab == "aan")
		{
			datnaam	= new Date();
			tellertargets	= datnaam.getTime();
			if (document.getElementById(target_comm))
			document.getElementById(target_comm).target = tellertargets;
		}

		if(tab != "aan")
		{
			datnaam	= new Date();
			tellertargets	= datnaam.getTime();

			if(zoekopdracht == 0)
				document.getElementById(target_comm).target = tellertargets;

			if(wi == 0)
			{
				if(parseInt(navigator.appVersion)>=4)
					tellertargets = window.open("", tellertargets, y+((screen.width/100)*80)+",height="+(((screen.height/100)*85)-200)+",left="+((screen.width/100)*9)+",top="+((screen.height/100)*14));
				else
					tellertargets = window.open("", target_comm, y+"600,height=280");
			}
			else if((wi == 1) && (zoekopdracht == 0))
			{
				document.getElementById(target_comm).target="_top"
			}
			else if(wi == 2)
			{
				if(parseInt(navigator.appVersion) >= 4)
					tellertargets = window.open("", tellertargets, y+((screen.width/100)*99)+",height="+(((screen.height/100)*107)-200)+",left=0,top=0");
				else
					tellertargets = window.open("", tellertargets, y+"600,height=280");
			}
			else if(wi == 3)
			{
				tellertargets = window.open("", tellertargets);
			}

			if((zoekopdracht == 1) && (wi == 1))
			{
				zoekopdracht	= 0;
				location.href	= site;
			}

			if((zoekopdracht == 1) && (wi != 1))
			{
				zoekopdracht	= 0;
				tellertargets.location = site;
			}
		}

		tab = "";
	}


	// open a window with specific settings
	function s(naam, scrwidth, scrheight, stat, resiz, target_comm, vensternaam)
	{
		sd = new Date();

		if(scrwidth == 600)
			yon = "yes";
		else
			yon = "no";

		if(resiz == "yes")
			yon = "yes";

		vensternaam = window.open(naam, vensternaam, "toolbar=no,location=no,resizable=" + yon + ",status=no,scrollbars=" + yon + ",menubar=no,width=" + scrwidth + ",height=" + scrheight + ",top=1,left=1");

		arnostat(escape(stat));
		stat = escape(stat);
		lc_click(lc_site, lc_page, lc_pagevariant, lc_campaign, stat);
		
		//zlostat
        if(target_comm.substring(0, 1) == "c")
		{
			zlostat = target_comm;
		
            if (target_comm.substring(0,8)=="czoekbox")
		     zlostat=target_comm.substring(8,target_comm.length);
		     
		     

			if(zlostat.indexOf("_") != -1)
				zlostat = zlostat.substring(0, zlostat.indexOf("_"));

			var ici = new Image();
			ici.src = "http://dispatch.ilse.nl/spc/?LINKID=" + eval(zlostat.substring(1, zlostat.length));
		}

		vensternaam.focus();
	}


	// onchange of the search dropdown go to the zoekenmachine instellingen page
	function wijz()
	{
		if(d.searchforit.service.options[d.searchforit.service.selectedIndex].value == "w")
			location.href = "zoeken.htm";
	}


	// open a new window and run the selected search query in it
	function doSearch()
	{
		zoekopdracht	= 1;
		dosearchcom		= "";
		wo				= d.searchforit.query.value;
		searchitems		= "";

		for(t=1; t <= wo.length; t++)
		{
			if(wo.substring(t-1, t) == " ")
			{
				searchitems += "+";
			}
			else
			{
				if(wo.substring(t-1, t) == "+")
					searchitems += "%2B";
				else
					searchitems += wo.substring(t-1, t);
			}
		}

		index		= d.searchforit.service.selectedIndex;
		site		= d.searchforit.service.options[index].value;
		dosearchcom	= site.substring(site.indexOf("(") + 1, site.indexOf(")"));
		site		= "http://" + site.substring(site.indexOf(")") + 1, site.length);
		//parameters vastplakken aan "technoratie" zoekmachine, voor ned resultaten
		if (site.substring(33,0)=="http://www.technorati.com/search/")
		{
			site		+= searchitems + "?language=nl&authority=n";
		}
		else
		{
			site		+= searchitems;
		}
		
		
		if((searchitems == "") || (searchitems == null))
		{
			alert("\nOm iets te kunnen vinden dient u minimaal een keyword in te typen ...");
			d.searchforit.query.focus();
		}
		else
		{
			zoekmachine = document.searchforit.service.options[index].text;
			n(dosearchcom, zoekmachine);
		}
	}


	// close or open a block
	doealles=""; 
	function p(id, close)
	{
		
		doealles="ja";
	
	if (close==1){
	var sluitblokkie= window.confirm("Wilt u dit blok sluiten en naar het onderste gedeelte van de pagina verplaatsen ?")
           if (sluitblokkie)
		   {doealles="ja";}
		   else{doealles="nee";}
		          
	              } 
		
		if (doealles=="ja")
	  {
		
		
		if((navigator.appName != "Microsoft Internet Explorer") || (parseInt(navigator.appVersion) >= 4))
		{
			var tmpBlocks = new Array();
			var blockFound = false;

			for(i=0; i < q.length; i++)
			{
				if((q[i] != id) || (close == 1))
					tmpBlocks[tmpBlocks.length] = q[i];

				if(q[i] == id)
					blockFound = true;
			}

			if(!blockFound && (close == 1))
				tmpBlocks[tmpBlocks.length] = id;

			if(close == 1)
			{
				//window.alert("Dit blok wordt gesloten en naar het onderste gedeelte van de pagina verplaatst!");
				arnostat("Inklappen" + id);
			}
			else
			{
				arnostat("Uitklappen" + id);
			}

			if(tmpBlocks.length > 0)
			{
				setCookie("blocks", tmpBlocks.join("-"));

				// convert to old id's and temporary update old cookie
				oldQ = new Array();
				for(i=0; i < tmpBlocks.length; i++)
				{
					for(j=0; j < oldIds.length; j++)
					{
						if(oldIds[j][1] == tmpBlocks[i])
							oldQ[oldIds[j][0]] = "Y";
					}
				}

				setCookie("blokken", oldQ.join(";"));
			}
			else
			{
				delCookie("blocks");
				delCookie("blokken");
			}

			top.location = "./";
		}
		else
			window.alert("Het sluiten van blokken is niet mogelijk met de versie van uw browser (3.0).");
	}}


     //blok vergelijk providers functions	
	
	function provider(providerzend)
{
if (providerzend=="adsl/kabel internet") bbformpje (" ");
if (providerzend=="digitale televisie")  bbformpje ("digitatv");
if (providerzend=="internet + telefonie")bbformpje ("&Filter=telefony=Ja");
if (providerzend=="internet + telefonie + TV") bbformpje("&Filter=television=Ja");
}
	
	
	// open new window and post query to breedbandshop.nl
	function bbformpje(provparm)
	{
		valid	= "0123456789";
		site	= "http://www.breedbandshop.nl";

		for(var ind = 0; ind < document.forms.adslformpje.huisnr.value.length; ind++)
		{
			temp = "" + document.forms.adslformpje.huisnr.value.substring(ind, ind + 1);

			if(valid.indexOf(temp) == "-1")
			{
				alert("Het huisnummer is niet compleet of niet juist, zo mogen er bijvoorbeeld geen toevoegingen worden ingetikt.");
				valid = "no";
				break;
			}
		}

		if(document.forms.adslformpje.postcode.value.length != 6)
		{
			alert("Verkeerde invoer van de postcode.");
		}
		else if(document.forms.adslformpje.huisnr.value.length == 0)
		{
			alert("Geen huisnummer ingevoerd.");
		}
		else if(valid != "no")
		{
			
			
			site			= "http://www.breedbandshop.nl/Default.aspx?Location=PCCheck&aff_id=109&SiteID=1&ZipNumbers=" + document.forms.adslformpje.postcode.value.substring(4, 0) + "&ZipLetters=" + document.forms.adslformpje.postcode.value.substring(6, 4) + "&HouseNumber=" + document.forms.adslformpje.huisnr.value+provparm;

if (provparm=="digitatv")
{
site="http://breedbandshop.digitaaltvkijken.nl/default.aspx?Location=PCCheck&aff_id=330&ZipNumbers="+document.forms.adslformpje.postcode.value.substring(4, 0) + "&ZipLetters=" + document.forms.adslformpje.postcode.value.substring(6, 4) + "&HouseNumber=" + document.forms.adslformpje.huisnr.value;
}


			zoekopdracht	= 1;

			n("c13522", "vergelijk-breedband-formulier");

			var pc			= 	new Image();
			pc.src			= 	"http://icons.ilse.nl/nli/storeuserinfo.gif?postcode=" + document.forms.adslformpje.postcode.value.substring(6, 0);
		}
	}
	
    //end blok vergelijk providers functions	
	
	
	
	// open new window and post query to breedbandshop.nl
	function bbform()
	{
		valid	= "0123456789";
		site	= "http://www.breedbandshop.nl";

		for(var ind = 0; ind < document.forms.adslform.huisnr.value.length; ind++)
		{
			temp = "" + document.forms.adslform.huisnr.value.substring(ind, ind + 1);

			if(valid.indexOf(temp) == "-1")
			{
				alert("Het huisnummer is niet compleet of niet juist, zo mogen er bijvoorbeeld geen toevoegingen worden ingetikt.");
				valid = "no";
				break;
			}
		}

		if(document.forms.adslform.postcode.value.length != 6)
		{
			alert("Verkeerde invoer van de postcode.");
		}
		else if(document.forms.adslform.huisnr.value.length == 0)
		{
			alert("Geen huisnummer ingevoerd.");
		}
		else if(valid != "no")
		{
			site			= "http://www.breedbandshop.nl/Default.aspx?Location=PCCheck&aff_id=109&SiteID=1&ZipNumbers=" + document.forms.adslform.postcode.value.substring(4, 0) + "&ZipLetters=" + document.forms.adslform.postcode.value.substring(6, 4) + "&HouseNumber=" + document.forms.adslform.huisnr.value;
			zoekopdracht	= 1;

			n("c13522", "vergelijk-breedband-formulier");

			var pc			= 	new Image();
			pc.src			= 	"http://icons.ilse.nl/nli/storeuserinfo.gif?postcode=" + document.forms.adslform.postcode.value.substring(6, 0);
		}
	}


	// open new window and post query to kieskeurig.nl
	function pzform()
	{   
		var query	= "";
		pz_form		= document.forms.prijszoekerForm;

		if(pz_form.wat.value.length == 0)
		{
			alert("Vul eerst Wat in om een prijs te zoeken.");
		}
		else
		{
			query = pz_form.wat.value;

			if(pz_form.merk.value.length != 0)
				query = query + "+and+" + pz_form.merk.value;

			if (pz_form.kurl[0].checked)
				qurl="queryprices";

			if (pz_form.kurl[1].checked)
				qurl="queryproducts0";

			if (pz_form.kurl[2].checked)
				qurl="queryreviews";

			site = "http://www.kieskeurig.nl/nl/product.nsf/"+qurl+"?readform&qcode=0&pcode=0&q=" + query;
			zoekopdracht = 1;
			n("c13521", "vergelijk-prijs-formulier");
		}
	}


	// open new window and post query to telefoongids.nl
	function tzform()
	{
		var query	= "";
		tz_form		= document.forms.nummerzoekerForm;
        
		if(tz_form.wie.value.length == 0)
		{   
			alert("Vul eerst een naam in om een nummer te zoeken.");
		}
		else if (tz_form.waar.value.length == 0)
		{  
			alert("Vul eerst een plaats in om een nummer te zoeken.")
		}  
		else
		{
			query = tz_form.wie.value;
			query2 = tz_form.waar.value;

			site = "http://dtgi.detelefoongids.nl/dtgi/ZoekInDeTelefoongids.do?locationType=LOCALITY&req_source=homepage&type=basic&x=39&y=0&edsacid=l-78278724462-8-2&wie=" + query +  "&waar=" + query2;
			zoekopdracht = 1;
			n("c15958", "k4-zoektelefoon-nrs");
		}
	}
	

	// open new window and post query to marktplaats.nl
	gomarktplaats="";
	function zwform()
	{
		var query	= "";var query2="";
		zw_form		= document.forms.zoekinwijkForm;

		//remove spaces
		zw_form.postcode.value=zw_form.postcode.value.replace(/\s/g, "");
		
		if(zw_form.wat.value.length == 0)
		{   
			alert('Voor een goed zoekresultaat moet je eerst het veld "wat" invullen');
		}
		else
		{
			query = zw_form.wat.value;
			gomarktplaats="yes";
		}
		
		query2 = zw_form.postcode.value;

		if (zw_form.postcode.value.length < 4 || zw_form.postcode.value.length >6)
		{ 		
			if (zw_form.postcode.value.length!=0)
			{
				alert("Om te zoeken met postcode  moet je correct je  postcode invullen");
				gomarktplaats="no";
			}
		}  

		if (gomarktplaats=="yes")
		{				
			site = "http://kopen.marktplaats.nl/search.php?from_advanced=1&q="+query+"&g=&u=&price_method=numeric&pmin=&pmax=&price_type=0&loc_type=zip&distance=&postcode="+query2+"&tb=&submit1=Zoek";
			zoekopdracht = 1;
			n("c16126", "k4-marktplaatszoeker-gadget");
		}
	}
	
	
	// schoolbank gadget
	function scform()
	{
		var query	= "";
		zw_form		= document.forms.schoolbankForm;
				
		if(zw_form.wie.value.length == 0)
		{   
			alert("Vul eerst Wie  in om in te vullen wie u zoekt.");
		}
		else
		{
			query = zw_form.wie.value;
			
			//arnostatmeting
			schoolval="k4-schoolbankzoeker-gadget";
			arnostat(escape(schoolval));
			lc_click(lc_site, lc_page, lc_pagevariant, lc_campaign, schoolval);

			schoolquery="active/gadgets/schoolbank/schoolbank_aggregator.php?start="+query;
			if(document.getElementById('schoolbank'))
			{
				document.getElementById('schoolbank').style.display = "block";
			}
			ajaxpage(schoolquery, 'schoolbank')
		}
	}


	function lastform()
	{ 
		var query	= "";
		last_form		= document.forms.lastfmForm;

		if(last_form.music.value.length == 0)
		{
			alert("Vul eerst een artiest of stijl in om een nummer te luisteren.");
		}
		else
		{
			query = last_form.music.value;
			
			site 			= "http://www.last.fm/webclient/popup/?radioURL=lastfm%3A%2F%2Fartist%2F"+query+"%2Fsimilarartists&resourceID=undefined&resourceType=undefined";
			
			s(site, 360, 200, 'k4_lastfm_gadget', 'no', '', 'k4_last_fmgadget'); 
		}
	}
	
	
	
	//ajax code voor php proxy zoals schoolbank
	function ajaxpage(url, containerid)
	{
		// melding bezig met zoeken
		document.getElementById(containerid).innerHTML="<span style='font-size:11.5px;'>Bezig met zoeken...</span>";

		var page_request = false;
		if (window.XMLHttpRequest)
		{
			// if Mozilla, Safari etc
			page_request = new XMLHttpRequest();
		}
		else if (window.ActiveXObject)
		{
			// if IE
			try {
				page_request = new ActiveXObject("Msxml2.XMLHTTP")
			} 
			catch (e)
			{
				try
				{
					page_request = new ActiveXObject("Microsoft.XMLHTTP")
				}
				catch (e){}
			}
		}
		else
		{
			return false;
		}

		page_request.onreadystatechange=function(){
			loadpage(page_request, containerid);
		}
		page_request.open('GET', url, true);
		page_request.send(null);
	}

	function loadpage(page_request, containerid)
	{
		if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
			document.getElementById(containerid).innerHTML=page_request.responseText;
	}
	
	//zoekbox suggestions code
	var suggest_stage = 0;
	var suggest_state = 'close';
	var suggest_last_query = "";
	var suggesta_last_query = "";

function suggest_open_step()
{
	s = document.getElementById("zm_suggest");
	if(suggest_stage==0)
		s.style.height='50px';
	if(suggest_stage==1)
		s.style.height='55px';
	if(suggest_stage==2)
		s.style.height='60px';
	if(suggest_stage==3)
		s.style.height='65px';
	if(suggest_stage==4)
		s.style.height='70px';
	if(suggest_stage==5)
		s.style.height='75px';
	if(suggest_stage==6)
		s.style.height='80px';
	if(suggest_stage==7)
		s.style.height='85px';
	if(suggest_stage==8)
		s.style.height='90px';
	if(suggest_stage==9)
		s.style.height='95px';
	if(suggest_stage==10)
		s.style.height='100px';
	
	suggest_stage++;
	if(suggest_stage < 11)
	{
		setTimeout(suggest_open_step,50);
	}
	else
	{
		s.style.overflow='auto';
		suggest_state = "open";
	}
}

function suggest_close_step()
{
	s = document.getElementById("zm_suggest");
	if(suggest_stage==0)
		s.style.height='0px';
	if(suggest_stage==1)
		s.style.height='50px';
	if(suggest_stage==2)
		s.style.height='75px';
	
	suggest_stage--;
	if(suggest_stage >= 0)
	{
		setTimeout(suggest_close_step,100);
	}
	else
	{
		suggest_state = "close";
	}
}

function suggest_open()
{
	suggest_state = "opening";
	s = document.getElementById("zm_suggest");
	s.style.overflow='hidden';	
	s.style.height='25px';
	suggest_stage = 0;
	setTimeout(suggest_open_step,10);
}

function suggest_close()
{
	suggest_state = "closing";
	s = document.getElementById("zm_suggest");
	s.style.overflow='hidden';
	suggest_stage = 3;

	if(readCookieZM('zm_search_active') == "aan")
	{
		document.getElementById('zm_pop_switch').style.display = "none";
	}
	else
	{
		document.getElementById('zm_pop_switch').style.display = "block";
	}
	setTimeout(suggest_close_step,10);
}

function suggest(o)
{
	var val = o.value;
	var t=setTimeout("doSuggest('"+o+"', '"+val+"')",750);
}

function doSuggest(o,value)
{
	var o = document.getElementById('zm_query');
	var currestSuggestState = readCookieZM('zm_search_active');
	if(o.value == value)
	{

		if(currestSuggestState)
		{
			zm_search_active_state = currestSuggestState;
		}
		else
		{
			activate();
		}
		
		document.getElementById('zm_pop_switch').style.display = "block";
	
		if(readCookieZM('zm_search_active') == "aan")
		{
			if(o.value == suggest_last_query) return false;
			suggest_last_query = o.value;
		
			s = document.getElementById("zm_suggest_content");
			if(s)
			{
				if(o.value.length>0)
				{
					if(suggest_state == "close")
					{
						suggest_open();
					}
				}
				else
				{
					s.innerHTML = "";
					if(suggest_state == "open")
						suggest_close();
					return false;
				}
				//
			}
			/*deBUG*/
	
			
			var url = "active/suggest.php?q="+o.value;
			ajaxpage(url, "zm_suggest_content");
		}
	}
}

function doSuggesties(o)
{
	var el = document.getElementById(o);
	var t=setTimeout("doSuggestiesAction('"+el.value+"')",750);
}

function doSuggestiesAction(value)
{
	var el = document.getElementById('suggesties_q');
	if(el.value == value)
	{
		document.getElementById('suggesties_content').style.display = "block";
//		var el = document.getElementById(id);
		
		if(el.value == suggesta_last_query) return false;
		suggesta_last_query = el.value;
	
		var url = "/active/searchdemo/suggesties.php?q="+el.value;
		ajaxpage(url, "suggesties_content");
	}
}

function goSuggesties()
{

	var el = document.getElementById('suggesties_q');
	if(el.value != "")
	{
		var query	= "";
		
		if(el.value.length == 0 || el.value == ".startpagina.nl")
		{
		 // do nothing
		}
		else
		{
	
			query = el.value;
			site			=	"http://alias.pagina.nl/redirect.php?q="+query;
			
			zoekopdracht=1;
			n("ndochterzoeksuggestieblok","k4-dochtersuggestie-gadget")
			
		
		}
	}
}


function createCookieZM(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookieZM(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookieZM(name)
{
	createCookie(name,"",-1);
}

function doSearchSuggestion(q)
{
	document.searchforit.zm_query.value = q;
	doSearch();
	void(0);
}

function hideCurrentSE(o)
{
	if(o.value.length==0)
	{
		o.value = getSearchText();
		o.style.color='gray';
	}
}

function showCurrentSE(o)
{
	if(o.style.color=='gray')
	{
		o.style.color='black';
		o.value='';
	}
}

function activate()
{
	var currentSuggestActiveState = readCookieZM('zm_search_active');
	var aanknop = document.getElementById('suggest_aan_knop');
	var uitknop = document.getElementById('suggest_uit_knop');

	if(currentSuggestActiveState != "aan")
	{
		aanknop.style.color = "#FF9000";
		aanknop.style.fontWeight = "bold";
		
		uitknop.style.color = "";
		uitknop.style.fontWeight = "";
		
		createCookieZM('zm_search_active', "aan", 360);
	}
	
}

function deactivate()
{
	var currentSuggestActiveState = readCookieZM('zm_search_active');
	var aanknop = document.getElementById('suggest_aan_knop');
	var uitknop = document.getElementById('suggest_uit_knop');

	if(currentSuggestActiveState != "uit")
	{
		uitknop.style.color = "#FF9000";
		uitknop.style.fontWeight = "bold";
		
		aanknop.style.color = "";
		aanknop.style.fontWeight = "";
		
		createCookieZM('zm_search_active', "uit", 360);
		if(suggest_state == "open")
		{
			suggest_close();
		}
	}
	
	
}

function zm_search_switch()
{
	var currentSuggestActiveState = readCookieZM('zm_search_active');
	var aanknop = document.getElementById('suggest_aan_knop');
	var uitknop = document.getElementById('suggest_uit_knop');

	if(currentSuggestActiveState != "null" && currentSuggestActiveState != null)
	{
		document.getElementById('zm_pop_switch').style.display = "block";	
	}
	if(currentSuggestActiveState == "uit")
	{
		uitknop.style.color = "#FF9000";
		uitknop.style.fontWeight = "bold";
		
		aanknop.style.color = "";
		aanknop.style.fontWeight = "";
	}
	
	if(currentSuggestActiveState == "aan")
	{
		aanknop.style.color = "#FF9000";
		aanknop.style.fontWeight = "bold";
		
		uitknop.style.color = "";
		uitknop.style.fontWeight = "";
	}
	
}

var zm_query_fill_var = "new";
function zm_query_fill() {
	
	if(document.getElementById('zm_query').value.length==0 || zm_query_fill_var == "new")
	{ 
		document.getElementById('zm_query').style.color='gray'; 
		
		document.getElementById('zm_query').value = getSearchText(); 
	}
	zm_query_fill_var = "old";
}

var selected = 0;
document.onkeyup = KeyNone;

function KeyNone(e)
{
	
}

function doKeyCheck(e)
{
	var number = 0;
	var KeyID = (window.event) ? event.keyCode : e.keyCode;
	var el = document.getElementById('zoek_options');
	var children = el.childNodes;
	var amount = 0;
	
	// Do count
	for(var i=0; i < children.length; i++) {
    	if(children[i].className == "keynot" || children[i].className == "keypressed")
    	{
    		amount++;
    	}
    }

    if(KeyID == 9) // Tab
    {
    	sh("zoek_options");    	
    }
    
    if(KeyID == 13) // Return
    {
    	for(var i=0; i < children.length; i++) {
	    	if(children[i].className == "keynot" || children[i].className == "keypressed")
	    	{
	    		if(number == (selected-1))
	    		{
	    			children[i].onclick();
	    			sh('zoek_options');
	    		}
	    		number++;
	    	}
	    }
    }
    	
	if(KeyID == 40) // DOWN
	{
		number = 0;
	    for(var i=0; i < children.length; i++) {
	    	if(children[i].className == "keynot" || children[i].className == "keypressed")
	    	{
	    		if(selected > (amount-1))
	    		{
	    			selected--;
	    		}
	    		
	    		if(number == selected)
	    		{
	    			children[i].className = "keypressed";
	    		} else {
	    			children[i].className = "keynot";
	    		}
	    		number++;
	    	}
	    }
	    
	    selected++;
	}
	
	if(KeyID == 38) // UP
	{
		
		selected--;
		if(selected <= 0)
		{
			selected++;
		}
		
		
		number = 0;
	    for(var i=0; i < children.length; i++) {
	    	if(children[i].className == "keynot" || children[i].className == "keypressed")
	    	{
	    		number++;
	    		if(number == selected)
	    		{
	    			children[i].className = "keypressed";
	    		} else {
	    			children[i].className = "keynot";
	    		}
	    		
	    	}
	    }
	    
	}
	return false;
	
}


var open_window ="false";

function sh(el_id)
{
	var el = document.getElementById(el_id);

	if(open_window == "true")
	{
		open_window = "false";
	} else {
		if(el.style.display == "block") 
		{
			el.style.display = "none";
			document.onkeydown = "";
		}
		else
		{
			el.style.display = "block";          
 			document.onkeydown = doKeyCheck;
 		}
	}
}

function sh_close(el_id)
{
     var el = document.getElementById(el_id);
     el.style.display = "none";
     document.onkeydown = "";
     open_window ="false"
}

function sh_open(el_id)
{
	if(open_window == "false")
	{
		var el = document.getElementById(el_id);
		el.style.display = "block";
		document.onkeydown = doKeyCheck;
		open_window ="true"
	}
}




//end zoekbox suggestion code


	///////////////////////////////////////////////
	// STATISTIC CODES
	///////////////////////////////////////////////


	///////////////////////////////////////////////
	// ARNOSTAT
	///////////////////////////////////////////////

	// arnostat breed
	function lc_void()
	{
		return true;
	}

	function lc_handle(url)
	{
		var url = 'http://stats.ilsemedia.nl/click.gif'+url;
		if(document.images)
		{
			var lc_img=new Image(1,1);
			lc_img.src=url;
			lc_img.onload=function (){lc_void();}
		}
		else
		{
			document.write('<img src="'+url+'" width="1" height="1" alt="">');
		}
	}

	function lc_click(lc_s, lc_p, lc_pv, lc_c, lc_l)
	{
		var lc_url='?a=c&s='+lc_s+'&p='+lc_p+'&pv='+lc_pv+'&c='+lc_c+'&l='+escape(lc_l)+'&t='+(new Date()).getTime();
		lc_handle(lc_url);
	}

	function lc_click2(lc_s, lc_p, lc_pv, lc_c, lc_l, lc_q)
	{
		var lc_url='?a=c&s='+lc_s+'&p='+lc_p+'&pv='+lc_pv+'&c='+lc_c+'&cp[q]='+escape(lc_q)+'&l='+escape(lc_l)+'&t='+(new Date()).getTime();
		lc_handle(lc_url);
	}

	function lc_visit(lc_s, lc_p, lc_pv, lc_c)
	{
		var lc_url='?a=v&s='+lc_s+'&p='+lc_p+'&pv='+lc_pv+'&c='+lc_c+'&t='+(new Date()).getTime();
		var ref=document.referrer;
		ref=(ref.lastIndexOf('/')==ref.length-1)?ref.substring(ref.lastIndexOf('/'),0):ref;
		if(ref.length>0)
			lc_url+='&r='+escape(ref);
		lc_handle(lc_url);
	}


function alias_focus()
{
	if(document.getElementById('suggesties_q').value == ".startpagina.nl")
	{
		document.getElementById('suggesties_q').style.color = "black";
		document.getElementById('suggesties_q').value = "";
	}	
}

function alias_blur()
{
	if(document.getElementById('suggesties_q').value == "")
	{
		document.getElementById('suggesties_q').style.color = "#969696";
		document.getElementById('suggesties_q').value = ".startpagina.nl";
	}
}



// initialize the dynamic content function calls
addLoadEvent(initDynamicContent);

// initialize the block styles array
addLoadEvent(initBlockStyles);
	
	


