function MM_jumpMenuKoopzondag(targ,selObj,restore){ //v3.0
	if (selObj.options[selObj.selectedIndex].value != "") {
	  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	  if (restore) selObj.selectedIndex=0;
	 }
}

function MM_jumpMenuMarktMaand(targ,selObj,restore){ //v3.0
	if (selObj.options[selObj.selectedIndex].value != "") {
	  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
	  if (restore) selObj.selectedIndex=0;
	 }
}

function MM_jumpMenuGemeente(targ,selObj,restore){ //v3.0
	if (selObj.options[selObj.selectedIndex].value != "9999") {
	  eval(targ+".location='/koopzondag/"+selObj.options[selObj.selectedIndex].text+".html'");
	  if (restore) selObj.selectedIndex=0;
	}
}

function MM_jumpMenuPlaats(targ,selObj,restore){ //v3.0
	if (selObj.options[selObj.selectedIndex].value != "") {
	  eval(targ+".location='/koopavond/plaats/"+selObj.options[selObj.selectedIndex].value+".html'");
	  if (restore) selObj.selectedIndex=0;
	}
}

function bookmark(url, description)
{
    if (document.all)
    {
    window.external.AddFavorite(url, description);
    }
    else if (window.sidebar)
    {
    window.sidebar.addPanel(description, url, "");
    }
}

function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+''
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

function MM_jumpMenuKoopavond(targ,selObj,restore){ //v3.0
	if (selObj.options[selObj.selectedIndex].value != "") {
	  eval(targ+".location='/koopavond/"+selObj.options[selObj.selectedIndex].value+".html'");
	  if (restore) selObj.selectedIndex=0;
	 }
}

function MM_jumpMenuMarktenBraderieen(targ,selObj,restore){ //v3.0
	if (selObj.options[selObj.selectedIndex].value != "9999") {
	  eval(targ+".location='/evenementen/dagje_weg_"+selObj.options[selObj.selectedIndex].text+".html'");
	  if (restore) selObj.selectedIndex=0;
	}
}

function hl( name ) {
	name.className = 'hl';
}
function dl( name ) {
	name.className = 'dl';
}

function hl_ka( name ) {
	name.className = 'hl_ka';
}
function dl_ka( name ) {
	name.className = 'dl_ka';
}

function hl_mb( name ) {
	name.className = 'hl_mb';
}
function dl_mb( name ) {
	name.className = 'dl_mb';
}

function hl_vr( name ) {
	name.className = 'hl_vr';
}
function dl_vr( name ) {
	name.className = 'dl_vr';
}

function show_dat(tekst) {
	document.getElementById('Datum_div').style.visibility = 'visible';
	document.getElementById('Datum_div').style.display = '';
	document.getElementById('Datum_div').innerHTML = '<img src=images/spacer.gif width=4 height=1>'+tekst;	
}

function hide_dat() {
	document.getElementById('Datum_div').style.visibility = 'visible';
	document.getElementById('Datum_div').style.display = '';
	document.getElementById('Datum_div').innerHTML = '<img src=images/spacer.gif width=4 height=1></A>';
}

function show_prov(tekst) {
	document.getElementById('Prov_div').style.visibility = 'visible';
	document.getElementById('Prov_div').innerHTML = 'Klik om provincie '+tekst+' te bekijken';	
}

function hide_prov() {
	document.getElementById('Prov_div').style.visibility = 'hidden';
}

function pos(){ 
    if(window.innerHeight)
        return window.pageYOffset; 
    if(document.documentElement&&document.documentElement.scrollTop)
        return document.documentElement.scrollTop; 
    if(document.body)
        return document.body.scrollTop; 
    return 0;
}

var _lastPos;
function adScroll(){ 

	foo=document.getElementById('side-ads');

	if (pos() > 320) {
		if(_lastPos!=pos()){ 
			_lastPos=pos();
			foo.style.top=(_lastPos+8)+'px'; 
		}
	} else {
		if(_lastPos!=pos()){ 
			_lastPos=pos();
			foo.style.top='333px'; 
		}
	}
    setTimeout('adScroll()',4000);    
}

function checkform (form)
{
  if (form.email_reminder.value == "") {
    alert("Vul svp een geldig e-mailadres in.");
    form.email_reminder.focus();
    return false ;
  }
  if (form.akkoord1.checked == false) {
    alert("Je moet akkoord gaan met de algemene voorwaarden.");
    form.akkoord1.focus();
    return false ;
  }
  return true ;
}


function filterlist(selectobj) {
  this.selectobj = selectobj;
  this.flags = 'i';
  this.match_text = true;
  this.match_value = false;
  this.show_debug = false;

  this.init = function() {
    if (!this.selectobj) return this.debug('selectobj not defined');
    if (!this.selectobj.options) return this.debug('selectobj.options not defined');
    this.optionscopy = new Array();
    if (this.selectobj && this.selectobj.options) {
      for (var i=0; i < this.selectobj.options.length; i++) {
        this.optionscopy[i] = new Option();
        this.optionscopy[i].text = selectobj.options[i].text;
        if (selectobj.options[i].value) {
          this.optionscopy[i].value = selectobj.options[i].value;
        } else {
          this.optionscopy[i].value = selectobj.options[i].text;
        }
      }
    }
  }

  this.reset = function() {
    this.set('');
  }

  this.set = function(pattern) {
    var loop=0, index=0, regexp, e;
    if (!this.selectobj) return this.debug('selectobj not defined');
    if (!this.selectobj.options) return this.debug('selectobj.options not defined');
    this.selectobj.options.length = 0;
    try {
      regexp = new RegExp(pattern, this.flags);
    } catch(e) {
      if (typeof this.hook == 'function') {
        this.hook();
      }
      return;
    }
    for (loop=0; loop < this.optionscopy.length; loop++) {
      var option = this.optionscopy[loop];
      if ((this.match_text && regexp.test(option.text)) ||
          (this.match_value && regexp.test(option.value))) {
        this.selectobj.options[index++] =
          new Option(option.text, option.value, false);
      }
    }
    if (typeof this.hook == 'function') {
      this.hook();
    }
  }

  this.set_ignore_case = function(value) {
    if (value) {
      this.flags = 'i';
    } else {
      this.flags = '';
    }
  }

  this.debug = function(msg) {
    if (this.show_debug) {
      alert('FilterList: ' + msg);
    }
  }
  this.init();
}

function setClickRef(sUrl,sRef,iChannelID) {
  postdata = 'page=setClick&iChannelID='+iChannelID+'&sRef='+sRef+'&sUrl='+escape(sUrl);
  sAjax( '/js/datahandler.php', postdata, function(ajaxRequest) {	
  })
}

function setClick(sUrl) {
  postdata = 'page=setClick&sUrl='+escape(sUrl);
  sAjax( '/js/datahandler.php', postdata, function(ajaxRequest) {	
  })
}

function sAjax(url, postdata, eventhandler) {

	var http;
	if (window.ActiveXObject) 
	{
		http = new ActiveXObject("Microsoft.XMLHTTP");
	}
	else if (window.XMLHttpRequest) 
	{
		http = new XMLHttpRequest();
	}

	http.onreadystatechange = function() {
		if (http.readyState == 4) {
			if (http.status == 200) {
				eventhandler(http);
			}
		}
	}
   http.open("POST", url, true)
   http.setRequestHeader('Content-Type','application/x-www-form-urlencoded')
   http.send(postdata)
}

function NewWindow(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+''
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}
