/********************************************
* Pop-up									*
*********************************************/
var newwin;

function launchwin(winurl,winname,winfeatures)
{
	//This launches a new window and then
	//focuses it if window.focus() is supported.
	newwin = window.open(winurl,winname,winfeatures);
	if(javascript_version > 1.0)
	{
		//delay a bit here because IE4 encounters errors
		//when trying to focus a recently opened window
 		setTimeout('newwin.focus();',250);
	}
}

/******************************************
* Contractible Headers Script- © Dynamic Drive (www.dynamicdrive.com)
* Visit http://www.dynamicdrive.com/ for full source code
* This notice must stay intact for use
******************************************/

var ns6=document.getElementById&&!document.all?1:0

var head="display:''"
var folder=''

function expandit(curobj){
folder=ns6?curobj.nextSibling.nextSibling.style:document.all[curobj.sourceIndex+1].style
if (folder.display=="none")
folder.display=""
else
folder.display="none"
}

/********************************************
* Mouse-overs Hoofdnavigatie				*
*********************************************/

function swapImgRestore() { //v3.0
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

function findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function swapImage() { //v3.0
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function printPage(){
  //alert("We raden aan deze pagina op afdrukstand 'Liggend' of 'Landscape' te printen.");
  if      (window.print) { window.print(); }
  else if (self.print)   { self.print();   }
  else    { alert("Deze functie werkt niet in uw browser."); }
}

/********************************************
* Drop script Hoofdnavigatie				*
*********************************************/

//do browser detect stuff
if (document.layers) {
	var isNS = true;
}
if (!document.all && document.getElementById){
	var NNnew = true;
}
var isMacIE = ( (navigator.userAgent.indexOf("IE 4")  > -1) && (navigator.userAgent.indexOf("Mac")  > -1) );
var layerRef = (isNS) ? "document" : "document.all";
var styleRef = (isNS) ? "" : ".style";
var extralayers = (isNS) ? "" : "";
var activeMenu = 0;
var finalClip;

function initdrop() {
		if (isNS) { 
			document.captureEvents(Event.MOUSEMOVE); 
			document.onmousemove = killMenu;
		} else {
			document.onmouseover = killMenu;
		}
}

function activateMenu(menuLayerRef, offset) {
	
	if (activeMenu != menuLayerRef) {

		if (activeMenu) hideMenu("menu" + activeMenu);
			
		menuID = "menu" + menuLayerRef;
		activeMenu = menuLayerRef;
	
		if (isNS) {
			document[menuID].top =0;
			document[menuID].left = offset;
		} else {
			document.getElementById(menuID).style.top = 0;
			document.getElementById(menuID).style.left = offset;
		}

		showMenu(menuID)
		
	}
	//if (!isNS) window.event.cancelBubble = true;
}

function showMenu(layerID) {
	if (isNS) {
		document[menuID].visibility = "visible";
	}else{
		document.getElementById(layerID).style.visibility = "visible";
	}
	
	var target;
	if(layerID=="menu1")target="menutab1";
	if(layerID=="menu2")target="menutab2";
	if(layerID=="menu3")target="menutab3";
	if(layerID=="menu4")target="menutab4";
	if(layerID=="menu5")target="menutab5";
	if(layerID=="menu6")target="menutab6";
	if(!isNS){
		document.getElementById(target).style.color = "black"
	}
}

function hideMenu(layerID) {
	if (isNS) {
		document[menuID].visibility = "hidden";
	}else{
		document.getElementById(layerID).style.visibility = "hidden";
	}
	var target;
	if(layerID=="menu1")target="menutab1";
	if(layerID=="menu2")target="menutab2";
	if(layerID=="menu3")target="menutab3";
	if(layerID=="menu4")target="menutab4";
	if(layerID=="menu5")target="menutab5";
	if(layerID=="menu6")target="menutab6";
	if(!isNS)document.getElementById(target).style.color = ""
}

function killMenu(e) {
	//check if theres a menu active
	if (activeMenu) {
		menuID = "menu" + activeMenu;
		if (isNS) {
			menuX1 = document[menuID].pageX;
			menuX2 = menuX1 + document[menuID].clip.right;
			menuY1 = document[menuID].pageY;
			menuY2 = menuY1 + document[menuID].clip.bottom+50;
			if (e.pageX < menuX1 || e.pageX > menuX2  || e.pageY > menuY2|| e.pageY < menuY1) {
				hideMenu(menuID);
				activeMenu = 0;
				if(document.images.men1)document.images.men1.src=lijngrijs.src;
				if(document.images.men2)document.images.men2.src=lijngrijs.src;
				if(document.images.men3)document.images.men3.src=lijngrijs.src;
				if(document.images.men4)document.images.men4.src=lijngrijs.src;
			}
		} else if(NNnew) {
			menuX1 = document.getElementById(menuID).offsetLeft;
			menuX2 = menuX1 + document.getElementById(menuID).offsetWidth;
			
			menuY1 = document.getElementById(menuID).offsetTop-50;
			menuY2 = menuY1 + document.getElementById(menuID).offsetHeight+50;
			//alert(e.clientX+"--"+menuX1)
			//alert(e.clientX+"--"+menuX2)
			//alert(e.clientY+"--"+menuY2)
			//alert(e.clientY+"--"+menuY1)
			//alert(e.clientX < menuX1);
			//alert(e.clientX > menuX2 );
			//alert(e.clientY > menuY2);
			//alert(e.clientY < menuY1);
			if (e.clientX < menuX1 || e.clientX > menuX2  || e.clientY > menuY2|| e.clientY < menuY1) {
				//alert(e.clientY)
				hideMenu(menuID);
				activeMenu = 0;
				//alert(menuID);
			}
		}else {
				hideMenu(menuID);
				activeMenu = 0;

		}
	}  

}