//-- getelementbyid wrapper
function $(_id) {
    if (document.getElementById) return document.getElementById(_id);
    if (document.all)            return document.all[_id];
    return false;
}

//-- toggle element display
function toggle(_id) {
    
    obj = $(_id);
    
    if (obj.style.display == "block") {
        obj.style.display = "none";
    } else {
        obj.style.display = "block";
    }
}

function handleStoreSearch() {
	this.form.elements['action'].value = 'storedsearch_update';	
}

function handleWgStoreSearch() {
	this.form.elements['action'].value = 'wgstoredsearch_update';
}

function storeSearchButton() {
	var el = document.getElementById('opslaan-submit');
	if(el) {
		el.onclick = handleStoreSearch;
	}
}

function wgStoreSearchButton() {
	var el = document.getElementById('wg-opslaan-submit');
	if(el) {
		el.onclick = handleWgStoreSearch;
	}
}
    
// onload event coupler
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') { 
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}

addLoadEvent(function() {
  //initRollover();
  storeSearchButton();
  wgStoreSearchButton();
});
