var zoekopdracht = 0;
var tab = "uit";
var d=document;
var y='toolbar=yes,location=yes,resizable=yes,status=yes,scrollbars=yes,menubar=yes,width=';

function morecontent(mode,bloknaam)
{
  if (mode=="aan")
  {
    document.getElementById("morecontent"+bloknaam).style.display ="block";
    document.getElementById("plusknop"+bloknaam).style.display ="none";
    document.getElementById("minknop"+bloknaam).style.display ="block";
  }
  else
  {
    document.getElementById("morecontent"+bloknaam).style.display ="none";
    document.getElementById("minknop"+bloknaam).style.display ="none"
    document.getElementById("plusknop"+bloknaam).style.display ="block";
  }
}


function preLoadProvincieImages()
{
  // cache provincie images
  var imgpath = "/img/regionaal/"
  provincie_brabant    = new Image();provincie_brabant.src    = imgpath + "brabant.gif";
  provincie_zeeland    = new Image();provincie_zeeland.src    = imgpath + "zeeland.gif";
  provincie_limburg    = new Image();provincie_limburg.src    = imgpath + "limburg.gif";
  provincie_zholland   = new Image();provincie_zholland.src   = imgpath + "zholland.gif";
  provincie_nholland   = new Image();provincie_nholland.src   = imgpath + "nholland.gif";
  provincie_gelderland = new Image();provincie_gelderland.src = imgpath + "gelderland.gif";
  provincie_utrecht    = new Image();provincie_utrecht.src    = imgpath + "utrecht.gif";
  provincie_flevoland  = new Image();provincie_flevoland.src  = imgpath + "flevoland.gif";
  provincie_overijsel  = new Image();provincie_overijsel.src  = imgpath + "overijsel.gif";
  provincie_friesland  = new Image();provincie_friesland.src  = imgpath + "friesland.gif";
  provincie_drenthe    = new Image();provincie_drenthe.src    = imgpath + "drenthe.gif";
  provincie_groningen  = new Image();provincie_groningen.src  = imgpath + "groningen.gif";
}                                                       

function doSearch()
{
  var d = document;
  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=site.substring(site.indexOf(")")+1,site.length);

  if(site == "http://spsearch.ilse.nl/?in=")
{
	site = "http://www.startpagina.nl/zoeken/?in=";
}


  site+=searchitems;

	if (site.indexOf("startgoogle.startpagina.nl") != -1)
	{
		site += "&origin=sp_navigation";
	}
	
	if (site.indexOf("www.startpagina.nl/zoeken") != -1)
	{
		site += "&origin=sp_navigation";
	}


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

function n(target_comm,naam)
{
  if(typeof(wi) == "undefined") wi = 0;

  //zlostat ook vermeld in function s
  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));
  }

  //arnostat(escape(naam));
  // tijdens demo en testen extra arnostat functie toegevoegd
  //arnostatDemo(escape(naam));

  if (tab=="aan")
  {
    datnaam=new Date();
    tellertargets=datnaam.getTime();
    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");
      }
    }

    if(wi==1 &&  zoekopdracht==0)
    {
      document.getElementById(target_comm).target="_top";
    }
  
    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");
      }
    }

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

    //if (wi!=1) tellertargets.focus()
  }
  tab="";
}


//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_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);
}
//end arnostat breed



function sitestat(ns_l)
{
  ns_l+='&amp;ns__t='+(new Date()).getTime();ns_pixelUrl=ns_l;
  ns_0=document.referrer;
  ns_0=(ns_0.lastIndexOf('/')==ns_0.length-1)?ns_0.substring(ns_0.lastIndexOf('/'),0):ns_0;
  if(ns_0.length>0)
    ns_l+='&amp;ns_referrer='+escape(ns_0);
  if(document.images)
  {
    ns_1=new Image();ns_1.src=ns_l;
  }
  else
  {
    document.write('<img src="'+ns_l+'" width="1" height="1" alt="">');
  }
}


//open in venster
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");

		
		vensternaam.focus();
	}

