

// 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();
});*/
	
 window.addEvent('load', function () {
    initRollover();
  });

/* remove or fill textinputs with a basevalue on focus/blur */
function cleanField(fieldObj){
		fieldId = document.getElementById(fieldObj);
		var baseValue = fieldId.getAttribute('basevalue');
		if(fieldId.value == baseValue){
			fieldId.value = '';
		}else if(fieldId.value == ''){
			fieldId.value = baseValue;
		}else{
			return false;
		}		
	}
	
	
function checkInput(fieldObj){

	var fieldId =  document.getElementById(fieldObj);
	var baseValue = fieldId.getAttribute('basevalue');
	var bttn = document.getElementById(fieldId.id + 'submit');

	if((fieldId.value=='') || (fieldId.value==' ') || (fieldId.value==baseValue)){
		bttn.setAttribute('disabled', true);
		bttn.setAttribute('class', 'disab');
		bttn.setAttribute('className', 'disab');
		bttn.style.cursor = "default";
		
	}else{
		bttn.removeAttribute('disabled');
		bttn.setAttribute('class', 'submitbttn');
		bttn.setAttribute('className', 'submitbttn');
		bttn.style.cursor = 'pointer';
	}
}

/* show/hide searchform */
function showThis(obj){
	var theDiv = document.getElementById(obj);	
	theDiv.className = (theDiv.className=='hideElement') ? 'showElement' : 'hideElement' ;
}

	

/* function to replace HR's with a DIV with background-image */
function replaceRulers(){
	var rulerArr = document.getElementsByTagName('hr');
	
	for(i=0; i<rulerArr.length; i++){
		var ruler = rulerArr.item(i);
		ruler.setAttribute('id', 'ruler' + i);
		var newdiv = document.createElement('div');
		newdiv.className = 'ruler';
		var rulerId = ruler.id;
		document.getElementById(rulerId).parentNode.insertBefore(newdiv,document.getElementById(rulerId)); 
		rulerArr.item(i).style.display = "none";
	}
}

 window.addEvent('load', function () {
    replaceRulers();
  });



/* function to switch the active state from the tab-buttons (projecten) */
 function setTab(which){ 
  which.blur();
  var clickedDiv = which.parentNode.id.split('tab')[0];

  var divArr = new Array('resultatenlijst', 'googlemap');
  
    for(i=0; i < divArr.length; i++){
      thediv = divArr[i];
      if(thediv == clickedDiv){
        document.getElementById(thediv).style.display = 'block';
        which.setAttribute('class', 'crosslink active');
        which.setAttribute('className', 'crosslink active');
      }else {
        document.getElementById(thediv).style.display = 'none';
        document.getElementById(thediv + 'tab').childNodes[0].setAttribute('class', 'crosslink');
        document.getElementById(thediv + 'tab').childNodes[0].setAttribute('className', 'crosslink');
      }
    }
 }
  
  


// launch sIFR replacement onload
 window.addEvent('load', function () {
    triggerSIFR();
  });
  
    
// function to identify the class that we want to replace with sifr-stuff.  
 function class_exists(nameOfClass) {
    var els = document.getElementsByTagName('div');
    var i = els.length; 
    
    while( i-- )
    {
        //alert("'" + els[i].className + "'" + " " + "'" + nameOfClass + "'")
        if(els[i].className == nameOfClass)
            return true
    }
    return false;
 }
 
 
// function which replaces headers with sifr when called.
// mainly used for headers which can't be replaced when they are in a hidden state..
function load_fonts() {
    if(class_exists('highslide-leftCon')) {
		triggerSIFR();
    }
	if(class_exists('clip')) {
		triggerSIFR();
    }
}  
