var trefwoordOpenImg = new Image();		trefwoordOpenImg.src = "CMS/Images/tree_plus.gif"
var trefwoordClosedImg = new Image();	trefwoordClosedImg.src = "CMS/Images/tree_min.gif"

var toggleTrefwoorden = function(){
	var obj = document.getElementById("trefwoordDiv")
	var objDisplay
	if(obj != null){
		objDisplay = obj.style.display
		switch(objDisplay){
			case "": obj.style.display = "block";		document.images["trefwoordImg"].src = trefwoordClosedImg.src;	break;
			case "none": obj.style.display = "block";	document.images["trefwoordImg"].src = trefwoordClosedImg.src;	break;
			case "block": obj.style.display = "none";	document.images["trefwoordImg"].src = trefwoordOpenImg.src;		break;
		}
	}
}

var tipobj

onload = function(){
	fixLayOut()
	if(page == "Home"){
		if (ie||ns6)
		tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""
		document.onmousemove = positiontip
	}
	if(document.getElementById('blink')){
		Knipper();
	}
}
onresize = function(){
	fixLayOut()
}

function doIt(){
	document.getElementById('blink').style.visibility =  (document.getElementById('blink').style.visibility == "hidden") ? "visible" : "hidden";
}
function Knipper(){
	setInterval('doIt()',1000);
}

var fixLayOut = function(){
	var availH, availW, fixH, fixW
	var agt			= navigator.userAgent.toLowerCase();
	var is_safari	= ((agt.indexOf('safari')!=-1)&&(agt.indexOf('mac')!=-1))?true:false;

	if(document.all){
		availW = document.body.clientWidth
		availH = document.body.clientHeight
	}else{
		availW = innerWidth
		availH = innerHeight
	}
	
	if(agt.search(/msie/gi) != -1){
		var obj = document.getElementById("zoekVeldDiv")
		if(obj != null){
			obj.style.top	= "98px"
			obj.style.right = "82px"
		}
	}
	if(is_safari){
		fixW = (availW - 180) + "px"
		fixH = (availH - 120) + "px"

		var obj = document.getElementById("contentDiv")
		if(obj != null){
			if(page != "Home"){
				obj.style.width		= fixW
			}
			obj.style.height	= fixH
		}
		var obj = document.getElementById("subnavigatieDiv")
		if(obj != null){
			obj.style.height	= fixH
		}
	}
}
//start documentatie functies


var errfound = false;
function ValidLength(item, len) {
   return (item.length >= len);
}
function ValidEmail(item) {
   if (!ValidLength(item, 5)) return false;
   return true;
}
function error(elem, text) {
   if (errfound) return;
   window.alert(text);
   elem.select();
   elem.focus();
   errfound = true;
}
function Validate() {
   errfound = false;
   with(document.forms[0]){
   	   if (!ValidLength(naam.value,2))			error(naam,"Vult u s.v.p. een Naam in.");
	   if (!ValidLength(bedrijfsnaam.value,2))	error(bedrijfsnaam,"Vult u s.v.p. een Bedrijfsnaam in.");
	   if (!ValidLength(adres.value,2)) 		error(adres,"Vult u s.v.p. een Adres in."); 
	   if (!ValidLength(postcode.value,2))		error(postcode, "Vult u s.v.p. een Postcode in.");
	   if (!ValidLength(plaats.value,2))		error(plaats, "Vult u s.v.p. een Plaats in.");
	   if (!ValidLength(telefoon.value,2))		error(telefoon, "Vult u s.v.p. een Telefoonnummer in.");
	   if (!ValidEmail(email.value,2))			error(email, "Vult u s.v.p. een geldig Emailadres in.");
	  }
   return !errfound;
}
//einde documentatie functies


//start homepage tooltip
var offsetxpoint=-60 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false

function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function ddrivetip(thetext, thecolor, thewidth){
	if(typeof tipobj != "undefined"){
		if (ns6||ie){
		if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
		if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
			tipobj.innerHTML=thetext
			enabletip=true
			return false
		}
	}else{
		return false
	}
}
function positiontip(e){
if (enabletip){
var curX=(ns6)?e.pageX : event.x+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.y+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
else if (curX<leftedge)
tipobj.style.left="5px"
else
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetxpoint+"px"

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight)
tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
else
tipobj.style.top=curY+offsetypoint+"px"
tipobj.style.visibility="visible"
}
}
function hideddrivetip(){
	if (ns6||ie){
		enabletip=false
		tipobj.style.visibility="hidden"
		tipobj.style.left="-1000px"
		tipobj.style.backgroundColor=''
		tipobj.style.width=''
	}
}
var doblur=function(o){
//o.blur()
}
//einde homepage tooltip

//start sollicitatieformulier

function ValidateSollicitatie() {
	errfound = false;
	with(document.forms[0]){
		if (!ValidLength(roepnaam.value,2))			error(roepnaam,"Vult u s.v.p. een Roepnaam in.");
		if (!ValidLength(achternaam.value,2))		error(achternaam,"Vult u s.v.p. de Achternaam in.");
		if (!ValidLength(adres.value,2)) 			error(adres,"Vult u s.v.p. een Adres in."); 
		if (!ValidLength(postcode.value,2))			error(postcode, "Vult u s.v.p. een Postcode in.");
		if (!ValidLength(woonplaats.value,2))		error(woonplaats, "Vult u s.v.p. een Plaats in.");
		if (!ValidLength(telefoonprive.value,2))	error(telefoonprive, "Vult u s.v.p. een Telefoonnummer in.");
		if (!ValidEmail(emailadres.value,2))		error(emailadres, "Vult u s.v.p. een geldig Emailadres in.");
	}
	return !errfound; /* true if there are no errors */
}
function formatdataSollicitatie(){
	var sp = "\n<br>"
	var data = "<u>Formulier voor solliciteren, verzonden vanuit www.vbi.nl </u>"+sp+sp
	var obj = document.forms[0].geslacht;
	var len = obj.length;
	for(i=0;i<len;i++){
		if(obj[i].checked){
			document.forms[0].geslachtWaarde.value=obj[i].value
		}
	}
	with(document.forms[0]){
		data += "Naam: " +geslachtWaarde.value+", "+ achternaam.value +sp
		data += "Roepnaam: " + roepnaam.value +sp
		data += "Tussenvoegsels: " + tussenvoegsels.value +sp
		data += "Voorletters: " + voorletters.value +sp
		data += "Geboortedatum: " + geboortedatum.value +sp
		data += "Adres: " + adres.value +sp
		data += "Postcode: " + postcode.value +sp
		data += "Woonplaats: " + woonplaats.value +sp
		data += "Telefoonprive: " + telefoonprive.value +sp
		data += "Telefoonwerk: " + telefoonwerk.value +sp
		data += "Emailadres: " + emailadres.value +sp+sp
		data += "Advertentie: " + advertentie.value +sp
		data += "Welke_advertentie: " + welke_advertentie.value +sp
		data += "Stage: " + stage.value +sp
		data += "Open_sollicitatie: " + open_sollicitatie.value +sp
		data += "Welke_functie: " + welke_functie.value +sp
		data += "Richting: " + richting.value +sp
		data += "Dienstverband: " + dienstverband.value +sp
		data += "Functie_ambities: " + functie_ambities.value +sp
		data += "Salarisindicatie: " + salarisindicatie.value +sp
		data += "werkervaring: " + werkervaring.value +sp
		data += sp
		bodytext.value = data
	}
}

//einde sollicitatieformulier

var ClickFlash = function(innovatieId){
	var URL
	switch(innovatieId){
		case 1:	URL = "http://www.vbi.nl/?pageID=71&Title=VBI_appartementenvloer";			break;
		case 2:	URL = "http://www.vbi.nl/?pageID=72&Title=VBI_klimaatvloer";				break;
		case 3:	URL = "http://www.vbi.nl/?pageID=73&Title=Flexcasco";						break;
		case 4:	URL = "http://www.vbi.nl/?pageID=74&Title=Passende_Ventilatiesparingen";	break;
		case 5:	URL = "http://www.vbi.nl/?pageID=75&Title=VBI_leidingvloer";				break;
		case 6:	URL = "http://www.vbi.nl/?pageID=76&Title=Verzonken_raveelijzer";			break;
		case 7:	URL = "http://www.vbi.nl/?pageID=77&Title=Rond_kruipgat";					break;
		case 8:	URL = "http://www.vbi.nl/?pageID=78&Title=Alpha_concept";					break;
	}
	if(typeof URL != "undefined"){
		document.location = URL
	}
}