// ---------------------------------------------------------------------- Rollover tabs 
function setupRollovers() {

  if (!document.getElementsByTagName)
    return;
  var all_links = document.getElementsByTagName('a');
  for (var i = 0; i < all_links.length; i++) {
    var link = all_links[i]; 
    if (link.className &&
        (' ' + link.className + ' ').indexOf('rollover') != -1) {
      if (link.childNodes &&
          link.childNodes.length == 1 &&
          link.childNodes[0].nodeName.toLowerCase() == 'img') {
        link.onmouseover = mouseover;
        link.onmouseout = mouseout;
      }
    }
  }
}

function find_target(e)
{
  /* Begin the DOM events part, which you */
  /* can ignore for now if it's confusing */
  var target; 

  if (window.event && window.event.srcElement) 
    target = window.event.srcElement;
  else if (e && e.target)
    target = e.target;
  if (!target)
    return null;

  while (target != document.body &&
      target.nodeName.toLowerCase() != 'a')
    target = target.parentNode;

  if (target.nodeName.toLowerCase() != 'a')
    return null;

  return target;
}

function mouseover(e) {
  var target = find_target(e);
  if (!target) return;

  // the only child node of the a tag in target will be an img tag
  var img_tag = target.childNodes[0];

  // Take the "src", which names an image called "something.ext",
  // Make it point to "something_over.ext"
  // This is done with a regular expression
  img_tag.src = img_tag.src.replace(/(\.[^.]+)$/, '_over$1');
}

function mouseout(e) {
  var target = find_target(e);
  if (!target) return;

  // the only child node of the A-tag in |target| will be an IMG-tag
  var img_tag = target.childNodes[0];

  // Take the "src", which names an image as "something_over.ext",
  // Make it point to "something.ext"
  // This is done with a regular expression
  img_tag.src = img_tag.src.replace(/_over(\.[^.]+)$/, '$1');
}


// ---------------------------------------------------------------------- Tooltip
function toolTips(){
	var toolTip = new Tips($$('.toolTip'));
}

// ---------------------------------------------------------------------- Striketrough breadcrumb
function strikeTrough(linkID) {
		$(linkID).toggleClass('strikeTrough');
}

// ---------------------------------------------------------------------- Son of Suckerfish (edited)
function sfHover() {
//	var sfEls = document.getElementById("horizontalNav").getElementsByTagName("li");
//	for (var i=0; i<sfEls.length; i++) {
//		sfEls[i].onmouseover=function() {
//			this.className+=" sfhover";
//			}
//		sfEls[i].onmouseout=function() { 
//			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
//			}
//		}
	}
if (window.attachEvent) window.attachEvent("onload", sfHover); 

// ---------------------------------------------------------------------- Clears form and changes text color
// Usage: <input id="search" name="search" type="text" value="Type uw zoekterm" onfocus="checkEntry(this,'Type uw zoekterm');"/>
function checkEntry(o,dTxt){
	if (!o.defTxt){
		o.defTxt = dTxt;
		o.onblur = function (){
			trimField(this);
			with (this){
				if (value == '' || value == defTxt){
					value = defTxt;
					o.style.color = '#a5acb2';
				}
			}
		}
	}
	if (o.value == o.defTxt){
		o.value = '';
		o.style.color = '#000000';
	}
}
function trimField (o){
	var v = o.value.replace(/^ +| +$/g,'');
	o.value = v;
}
// ---------------------------------------------------------------------- Mouse-over images
// Usage: <body id="bodyHome" onload="createMouseOvers();"> | name images "name_over" and "name_out"
function createMouseOvers(){
	var p = 0, d = document.images;
	prelImgs = new Array();
	for (var i = 0; i < d.length; i++){
		var o = d[i];
		if (o.src.indexOf('_out') != -1){
			var s = o.src, l = s.length, e = s.substring(l-4,l);
			o.outSrc = s;
			o.overSrc = s.substring(0,l-8)+'_over'+e;
			o.onmouseover = function(){this.src = this.overSrc;}
			o.onmouseout = function(){this.src = this.outSrc;}
			prelImgs[p] = new Image();
			prelImgs[p].src = o.overSrc;
			p++;
		}
	}
}

// When the page loads, set up the rollovers
window.onload = setupRollovers;