function suggestaaaa(o)
{
//	document.getElementById('zm_pop_switch').style.display = "block";

//	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();
				var el = document.getElementById('zm_suggest_blocks');
				el.style.display = "none";
			}
		}
		else
		{
			s.innerHTML = "";
			if(suggest_state == "open")
				suggest_close();
			return false;
		}
		//
	}
	/*deBUG*/

		
	var url = "/active/inc/suggest.php?q="+o.value;
	ajaxpage(url, "zm_suggest_content");
}

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_content");
	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_content");
	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()
{
	document.getElementById('zm_suggest_blocks').style.display = "none";
	suggest_state = "opening";
	s = document.getElementById("zm_suggest_content");
	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_content");
	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);
	
}

onthou="no";onthou2="no";
	function highlight(strID)
{
	var el = document.getElementById(strID);
	
	//eventueel gesloten blok weer terughalen
		el.style.display="block"
	    //ander blokkleur+linkleur
        n_divs_inblock = el.getElementsByTagName('div');
           n_divs_inblock[2].className= "direct";
		 n_divs_inblock[3].className= "direct";
		 

//oude blokkleur terug
if (onthou!="no")
		{
		 onthou.className= "block_content_normal";
		 onthou2.className= "block_content_meer";
		
		}
		
		 
onthou= n_divs_inblock[2]
onthou2= n_divs_inblock[3]
		return onthou
		return onthou2 
}


function oc_regio()
{
	var el = document.getElementById('zm_suggest_blocks');
	var field = document.getElementById('zm_suggest_query');
	if(el.style.display == "block")
	{
		el.style.display = "none";
		
	} else {
		el.style.display = "block";
		field.value = "";
		s = document.getElementById("zm_suggest_content");
		s.innerHTML = "";
		s.style.height = "0px";
		suggest_state = "close";
	}
}

function switchSA(element)
{

}

function makeArray() {
	for (i = 0; i<makeArray.arguments.length; i++)
	this[i + 1] = makeArray.arguments[i];
}




function showDate()
{
	
	var months = new makeArray('januari','februari','maart','april','mei', 'juni','juli','augustus','september','oktober','november','december');
	var days= ["Zondag","Maandag","Dinsdag","Woensdag","Donderdag","Vrijdag","Zaterdag"];
	var date = new Date();
	var day = date.getDate();
	var month = date.getMonth() + 1;
	var yy = date.getYear();
	var year = (yy < 1000) ? yy + 1900 : yy;
	var currentDay = date.getDay();
	var thisDay = days[currentDay];
	
	document.getElementById('datumdag').innerHTML = thisDay + " " + day + " " + months[month];
}

function closeThisBlock(element)
{
	var strBlockId = element.parentNode.parentNode.id;
	var objBlock = element.parentNode.parentNode;
	var strColumnId = element.parentNode.parentNode.parentNode.id;
	var objColumn = element.parentNode.parentNode.parentNode;
	
	var kolom = strColumnId;
	
	if (closing=="aan")
	{

		blokstart=0;
		if (kolom=="kolom1" && nieuws=="uit" && statdir!="kinder")
		{
			blokstart=1;
		}
		
		var column = document.getElementById(kolom);
		var objBlockHeader = element.parentNode;
		
		var nh=objBlockHeader.getElementsByTagName("h2").length;
		tag="h1";

		if (nh > 0) 
		{
			tag="h2";
		}
		
		blockHeaders = objBlockHeader.getElementsByTagName(tag);

		blokimg=objBlockHeader.getElementsByTagName("img");
		
		blockTitle = blockHeaders[0].innerHTML;
		
		blockContent = objBlock.getElementsByTagName('div');		
		
		if(blockContent[1] && blockContent[1].className == "block_content" && blockContent[1].style.display == "none")
		{
			
			var cookieJar = GetCookie('blokken');
			if(cookieJar != null)
			{
				
				var arrCookieItems = cookieJar.split("&#181;&#181;");
				var strNewCookie = "";
				for(x=0;x<arrCookieItems.length;x++)
				{
					
					if(strBlockId != arrCookieItems[x])
					{
						if(strNewCookie == "")
						{
							strNewCookie = strNewCookie + arrCookieItems[x];
						} else {
							strNewCookie = strNewCookie + "&#181;&#181;" + arrCookieItems[x];
						}
						
					}
				}
				setCookie("blokken",strNewCookie);
			}
		} 
		else if(blockContent[1] && blockContent[1].className == "block_content")
		{
			
			
			
			
			blockContent[1].style.display = "none";
			blockId	= strBlockId; 
		
			objColumn.appendChild(objBlock);
			
			var cookieJar = GetCookie('blokken');
			if(cookieJar == "" || cookieJar == null)
			{
				var newCookie = blockId;
			} else {
				var newCookie = cookieJar+"&#181;&#181;"+blockId;
			}
			
			setCookie("blokken",newCookie);
		}
		
		top.location = "./";

	}
}

function closeblocks()
{
	var strCookieJar = GetCookie('blokken');
	if(strCookieJar != null)
	{
		var arrCookieItems = strCookieJar.split("&#181;&#181;");
		for(x=0;x<arrCookieItems.length;x++)
		{
			var objBlock = document.getElementById(arrCookieItems[x]);
			if(objBlock)
			{
				var objColumn = objBlock.parentNode;
				
				blockContent = objBlock.getElementsByTagName('div');		
				if(blockContent[1] && blockContent[1].className == "block_content")
				{
					if(blockContent[1].style.display != "none")
					{
						blockContent[1].style.display = "none";
						objColumn.appendChild(objBlock);
					      convert_blokimg=objBlock.getElementsByTagName("img");
				            convert_blokimg[0].setAttribute('src','img/2.0/o.gif'); 
					
					}
				}
			}
		}
	}	
}




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/inc/dochter.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")
		{
			
		}
		else
		{
			query = el.value;
			site			=	"http://alias.pagina.nl/redirect.php?q="+query;
			
			zoekopdracht=1;
//			n("kolom4dochtersuggestie","k4-dochtersuggestie-gadget", site);
			zoek2=1;
			target=telt();
            n(target,site);
		}
	}
}




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";
	}
}

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();
}


function sLastFM(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();
}

function receptvandedag(plus_or_min)
{    
	
	if(document.getElementById("recept1"))
    {
		alttxt="";imgrecepcol="";imgrecepco=""
		
		if (plus_or_min=="+") recept=recept+1;
		if (plus_or_min=="-") recept=recept-1;
		if (recept==4) {recept=3;}
		if (recept==3) {alttxt="max 3 recepten";imgrecepcol="grijs_";}
		if (recept==0) {recept=1;}
		if (recept==1) {imgrecepco="grijs_";}
		
		document.getElementById("recept1").style.display ="none"
		document.getElementById("recept2").style.display ="none"
		document.getElementById("recept3").style.display ="none"
		document.getElementById("recept"+recept).style.display ="block"
		//document.getElementById("lrecept"+recept).innerHTML="<a href=\"http://www.startpagina.nl\"onclick=\"receptvandedag('-');return false;\"><img src=\"http://www.startpagina.nl/img/recept_"+imgrecepco+"rechts.gif\" border=\"0\" alt='' style='padding-left:27px;'/></a>	<a href=\"http://www.startpagina.nl\"  onclick=\"receptvandedag('+');return false;\"><img src=\"http://www.startpagina.nl/img/recept_"+imgrecepcol+"links.gif\" border=\"0\" alt='"+alttxt+"' title='"+alttxt+"' style='padding-left:10px;float: right;'/></a>";
		document.getElementById("lrecept"+recept).innerHTML="<a href=\"http://www.startpagina.nl\"  onclick=\"receptvandedag('+');return false;\"><img src=\"http://www.startpagina.nl/img/recept_"+imgrecepcol+"links.gif\" border=\"0\" alt='"+alttxt+"' title='"+alttxt+"' style='padding-top: 5px; float: right;'/></a> <a href=\"http://www.startpagina.nl\"onclick=\"receptvandedag('-');return false;\" style=\"\"><img src=\"http://www.startpagina.nl/img/recept_"+imgrecepco+"rechts.gif\" border=\"0\" alt='' style='padding-top: 5px; float: right;'/></a>";
    }
}

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 = "#999999";
		aanknop.style.fontWeight = "";
	}
	
	if(currentSuggestActiveState == "aan")
	{
		aanknop.style.color = "#FF9000";
		aanknop.style.fontWeight = "bold";
		
		uitknop.style.color = "#999999";
		uitknop.style.fontWeight = "";
	}
	
}

function doSuggesties(o)
{
	var el = document.getElementById(o);
	if(el.value != "")
	{
		//defeat ' js error
		el.value = el.value.replace(/'/g, "’");
		
		var t=setTimeout("doSuggestiesAction('"+el.value+"')",750);
	} else {
		document.getElementById('suggesties_content').style.display = "none";
	}
}

function doSuggestAction(value)
{
	var el = document.getElementById('zm_suggest_query');
	
	s = document.getElementById("zm_suggest_content");
	if(s)
	{
		if(el.value.length>0)
		{
			if(suggest_state == "close")
			{
				suggest_open();
				var el2 = document.getElementById('zm_suggest_blocks');
				el2.style.display = "none";
			}
		}
		else
		{
			s.innerHTML = "";
			if(suggest_state == "open")
				suggest_close();
		}
		//
	}
	
	if(el.value == value)
	{
		document.getElementById('zm_suggest_content').style.display = "block";
		
		if(el.value == suggesta_last_query) return false;
		suggesta_last_query = el.value;
	
		var url = "/active/inc/suggest.php?q="+el.value+"&u="+document.URL;
		ajaxpage(url, "zm_suggest_content");
	}
}

//'
function suggest(o)
{
	if(readCookieZM('zm_search_active') != "uit") {
	
	//	var el = document.getElementById(o);
		var el = o;
		//defeat ' js error
		el.value = el.value.replace(/'/g, "’");
		
		var t=setTimeout("doSuggestAction('"+el.value+"')",750);
	
	}
}
//'
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";
			
			sLastFM(site, 360, 200, 'k4_lastfm_gadget', 'no', '', 'k4_last_fmgadget'); 
		}
	}
	
//'
	
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 = "#999999";
		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 = "#999999";
		aanknop.style.fontWeight = "";
		
		
		createCookieZM('zm_search_active', "uit", 360);
		if(suggest_state == "open")
		{
			document.getElementById('zm_suggest_content').innerHTML = "";
		
			suggest_close();
			
		}
	}
	
	
}

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 arnostat(naam)
{
	if(Math.random()<(1/10))
	{
		var arno =new Image();
		arno.src =("http://spclicks.arnostat.nl/click.gif?ln="+naam)
	}
}
	
	

onthou="no";onthou2="no";
	function highlight(strID)
{
	var el = document.getElementById(strID);
	
	//eventueel gesloten blok weer terughalen
		el.style.display="block"
	    //ander blokkleur+linkleur
        n_divs_inblock = el.getElementsByTagName('div');
           n_divs_inblock[2].className= "direct";
		 n_divs_inblock[3].className= "direct";
		 

//oude blokkleur terug
if (onthou!="no"  && n_divs_inblock[2]!=onthou)
		{
		 onthou.className= "block_content_normal";
		 onthou2.className= "block_content_meer";
		
		}
		
		 
onthou= n_divs_inblock[2]
onthou2= n_divs_inblock[3]
		return onthou
		return onthou2 
}
  
function lmswl_ad_request_done(ad)
		{
			var wlContainer = document.createElement("span");
			
			var wlBlock = document.createElement("div");
			wlBlock.className = "block";
			
			var wlBlockHeader = document.createElement("div");
			wlBlockHeader.className = "block_header";
		
				
			var wlBlockHeaderH3 = document.createElement("h2");
			wlBlockHeaderH3.innerHTML = "Startpagina Sponsors";	
				
			var wlBlockContent = document.createElement("div");
			wlBlockContent.className = "block_content";
			
			var wlBlockContentNormal = document.createElement("div");
			wlBlockContentNormal.className = "block_content_normal";
			
			
			wlContainer.appendChild(wlBlock);
			wlBlock.appendChild(wlBlockHeader);
			wlBlock.appendChild(wlBlockContent);
			wlBlockHeader.appendChild(wlBlockHeaderH3);
			wlBlockContent.appendChild(wlBlockContentNormal);
			
			for(i=0; i < ad.links.length; ++i)
			{
				var wlBR = document.createElement("br");
				var wlLink = document.createElement("a");
				wlLink.href = ad.links[i].url;
				wlLink.target = ad.links[i].n;
				wlLink.innerHTML = ad.links[i].title;
				
				wlBlockContentNormal.appendChild(wlLink);
				wlBlockContentNormal.appendChild(wlBR);
			}
			
			
			document.write(wlContainer.innerHTML);
			
			
			return;
		}
		
		
		function showWhiteLabel(intOffset)
		{
			if (sponsor_exist==1){
				if (tradelinks_aan=="yes" && aldultsponsorlinks=="false" && afgrp!="ero")
				{

					lmswl_ad_position = '5350562fb96c9472923396fdbd0db7cf';
					lmswl_ad_output = 'js';
					lmswl_skip_ads = intOffset;
					lmswl_ad_amount = 5;
					lmswl_ad_adtest = "off";
				
					document.write('<script src="http://links.overzicht.nl/links/lmswl_get_links.js" type="text/javascript"></script>');
				}
			}
		}

