// *******************************************************************************
// VALIDATIE VOOR HET ZOEKFORMULIER
// Voor ieder zoekgebied dient er een catalog worden toegevoegd aan de functie!!!
// *******************************************************************************

function checkform()
{
	{
	if (buzform.target1.value == "")
		{
		alert("U dient een zoekterm in te vullen!");
		return false;
		}
	}
	{
	if (buzform.target1.value == "*")
		{
		alert("U dient een geldige zoekterm in te vullen!\nU kunt niet zoeken op alleen een wildcard.");
		return false;
		}
	}
	{
	if (buzform.target1.value.length < 3)
		{
		alert("U dient een zoekterm van minimaal drie karakters in te vullen!");
		return false;
		}
	}
	{
	var string1=buzform.target1.value
	if((!(string1.indexOf("<")==-1)) || (!(string1.indexOf(">")==-1)) || (!(string1.indexOf("+")==-1)) ||   (!(string1.indexOf("&")==-1)) ||  (!(string1.indexOf("@@")==-1)) || (!(string1.indexOf("%")==-1)) || (!(string1.indexOf("!")==-1)) || (!(string1.indexOf("^")==-1)) || (!(string1.indexOf("=")==-1)) || (!(string1.indexOf("~")==-1)) || (!(string1.indexOf("?")==-1)) || (!(string1.indexOf("#")==-1)))
	{
	alert("U dient een geldige zoekterm in te vullen!")
	return false
	}
  }
}

// **************************************
//  FUNCTIE VOOR NIEUW SCHERM VOOR LINKS
// **************************************

function openscherm(URLlink) {
window.open(URLlink);
}

// ************************
//  FUNCTIE VOOR KLEEFPIJL
// ************************

// default windowstatus
window.defaultStatus='';

// floater code
var floaterheight = 20;
var up_from_corner = 15;

var IE = (document.all) ? 1 : 0;
var NS = (document.layers) ? 1 : 0;

var left = 525;
var up = floaterheight + up_from_corner;
var scrollPos = 0;
var timeout = 1;

self.onError=null;

function floater() {
  if (timeout == 1) {
    if(NS) {
      if (scrollPos == window.pageYOffset && scrollPos > 0) {
        scrollPos = window.pageYOffset;
        document.floater.visibility = "show";
        document.floater.top = (window.innerHeight+window.pageYOffset-up);
		document.floater.left = left;
      }
      else {
        scrollPos = window.pageYOffset;
        document.floater.visibility = "hide";
        timeout = 0;
        setTimeout("timeout = 1",50);
      }
    }
	if (IE) {
      if (scrollPos == document.body.scrollTop && scrollPos > 0) {
        scrollPos = document.body.scrollTop;
        document.all.floater.style.visibility = "visible";
        document.all.floater.style.pixelTop = (document.body.clientHeight+document.body.scrollTop-up);
		document.all.floater.style.pixelLeft = left;
	  }
      else {
        scrollPos = document.body.scrollTop;
        document.all.floater.style.visibility = "hidden";
        timeout = 0;
        setTimeout("timeout = 1",50);
      }
    }
  }
}

function goFloater() {
	startFloater = setInterval("floater()",10);
}

// *********************************
//  MOUSEOVER FUNCTIE VOOR PLAATJES
// *********************************

function clf(gast) {
		gast.value = "";
}

/*
Handle hovers for images, including preloading
Framfab Nederland Rotterdam Script
*/

/*
Switch image from foo0.bar to foo1.bar, or back.
*/

function toggle(img, doc) {
	if (typeof doc == 'undefined') {
		doc = document;
	}
	var url = doc.images[img].src;
	var lead = url.substr(0, url.lastIndexOf('.') - 1);
	var state = url.substr(url.lastIndexOf('.') - 1, 1);
	var ext = url.substr(url.lastIndexOf('.'));
	state = Math.abs(parseInt(state) - 1);
	doc.images[img].src = lead + state + ext;
}

/*
Preload both on and off version of an image in one go.
*/

function _prel(url) {
	preloaded_pix[preloaded_pix.length] = new Image();
	preloaded_pix[preloaded_pix.length - 1].src = url;
	var lead = url.substr(0, url.lastIndexOf('.') - 1);
	var state = url.substr(url.lastIndexOf('.') - 1, 1);
    if ((state == 0) || (state == 1) ) {
    	var ext = url.substr(url.lastIndexOf('.'));
	    state = Math.abs(parseInt(state) - 1);
    	url = lead + state + ext;
	    preloaded_pix[preloaded_pix.length] = new Image();
	    preloaded_pix[preloaded_pix.length - 1].src = url;
    }
}

/*
Gather all images that need a counterpart to preload:
*/

function _gather_img(doc) {
	var all_imgs = [];
	if (typeof doc == 'undefined') {
		doc = document;
	}
	for (i = 0; i < doc.images.length; i++) {
		if (doc.images[i].src.indexOf("0.") != -1
			|| doc.images[i].src.indexOf("1.") != -1
		) {
			all_imgs[all_imgs.length] = doc.images[i].src;
		}
	}
	for (i = 0; i < doc.layers; i++) {
		gather_img(doc.layers[i].document);
	}
	return all_imgs;
}

/*
Preload mouseover counterparts:
*/

function init_mo() {
    // Create a global array to store the images after they are loaded:
    if (typeof preloaded_pix == 'undefined') {
        preloaded_pix = [];
    }
	else {
		window.status = "Warning: 'preloaded_pix' variable overloaded!";
		return;
	}
	var img = _gather_img();
	for (var i = 0; i < img.length; i++) {
		_prel(img[i]);
	}
}

