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

function fillSearchField() {
	var searchField = $R('search_field2');

	if (searchField) {
		
		searchField.value = "vul een zoekterm in ";
		searchField.style.color = "#9b97ac";
		searchField.style.textAlign = "right";
		searchField.style.fontSize = "10px";		
		
		searchField.onclick = function tmp() {
			this.value = "";
			this.style.color = "#000";
			this.style.textAlign = "right";
			this.style.fontSize = "10px";
		}		
	}
}

/*einde*/

function fillSearchField2() {
	var searchField2 = $R('search_field');

	if (searchField2) {
		
		searchField2.value = "vul een zoekterm in ";
		searchField2.style.color = "#9b97ac";
		searchField2.style.textAlign = "right";
		searchField2.style.fontSize = "10px";
		
		searchField2.onclick = function tmp() {
			this.value = "";
			this.style.color = "#000";
			this.style.textAlign = "right";
			this.style.fontSize = "10px";
		}
		
	}
}

function $R(element) {
	return document.getElementById(element);
}

//======================== Function to check is javascript is activated. If it is the class js-active is assigned to html tag
var newclassname = 'js-active'; 				// define class 
var ob = document.getElementsByTagName('HTML');// get the html tag 
if (ob.length > 0){
  ob = ob[0];									// check if there is already a class applied to html tag
  if (ob.className == ''){
	  ob.className = newclassname;				// if there isn't then add class
  } else {
	 ob.className += ' ' + newclassname;		// if there is a class already present add class js-active after it
  }
}
