var popUpWin=0;
function popUpWindow(URLStr, left, top, width, height){
  if(popUpWin){
	if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin','toolbar=yes,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}
	
	
// bepaalt hoogte contentcontainer
function setContentSize() {
	if (document.getElementById) {
		var windowHeight=getWindowHeight();
		if (windowHeight>0) {
			theEle=document.getElementById('scrollcontainer');
			if(theEle.className=='home'){
				theEle.style.height=(windowHeight-224)+'px';  // offset from top - footer - footerborder	
			} else {
				theEle.style.height=(windowHeight-109)+'px';  // offset from top - footer - footerborder
			}
		}
		var windowWidth=getWindowWidth();
		if (windowWidth>0) {
			document.getElementById('scrollcontainer').style.width=(windowWidth-185)+'px';  // offset from top - footer - footerborder
		}
	}
}



function getWindowHeight() {
	var windowHeight=0;
	if (typeof(window.innerHeight)=='number') {
		windowHeight=window.innerHeight;
	} else {
		if (document.documentElement&&
			document.documentElement.clientHeight) {
			windowHeight=
			document.documentElement.clientHeight;
		} else {
			if (document.body&&document.body.clientHeight) {
				windowHeight=document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function getWindowWidth() {
	var windowWidth=0;
	if (typeof(window.innerWidth)=='number') {
		windowWidth=window.innerWidth;
	} else {
		if (document.documentElement&&
			document.documentElement.clientWidth) {
			windowWidth=
			document.documentElement.clientWidth;
		} else {
			if (document.body&&document.body.clientWidth) {
				windowWidth=document.body.clientWidth;
			}
		}
	}
	return windowWidth;
}


/* Activating the submenu */


function liClicked(theEl){
	var currentstate=theEl.className;
	liCloser();
	if(currentstate=='subs'){
		theEl.className='subsopen';
	}
}


function liCloser(){
	var menu=document.getElementById('submenu');
	theLIs=menu.getElementsByTagName('li');
	for (ti=0;ti<theLIs.length;ti++) {
        thisLI = theLIs[ti];
		if(thisLI.className=='subsopen'){
			thisLI.className='subs';
		}
    }
	theAs=menu.getElementsByTagName('A');
	for (ti=0;ti<theAs.length;ti++) {
		/* Each Item should have an extra clickHandler */
		theA=theAs[ti]; 
		if(theA.getAttribute('href')!="javascript:void(0);"){
			theA.className='';
		}
	}
	
}

function XBrowserAddHandler(target,eventName,handlerName) { 
	if ( target.addEventListener ) { 
		target.addEventListener(eventName, function(e){target[handlerName](e);}, false);
	} else if ( target.attachEvent ) { 
		target.attachEvent("on" + eventName, function(e){target[handlerName](e);});
	} else { 
		var originalHandler = target["on" + eventName]; 
		if ( originalHandler ) { 
			  target["on" + eventName] = function(e){originalHandler(e);target[handlerName](e);}; 
		} else { 
			  target["on" + eventName] = target[handlerName]; 
		} 
	} 
}
function makeCookie(Name,Value,Expiry,Path,Domain,Secure) {
	if (Expiry != null) {
		var datenow = new Date();
		datenow.setTime(datenow.getTime() + Math.round(86400000*Expiry));
		Expiry = datenow.toGMTString();
	}
	Expiry = (Expiry != null) ? '; expires='+Expiry : '';
	Path = (Path != null)?'; path='+Path:'';
	Domain = (Domain != null) ? '; domain='+Domain : '';
	Secure = (Secure != null) ? '; secure' : '';
	document.cookie = Name + '=' + escape(Value) + Expiry + Path + Domain + Secure;
}

function readCookie(Name) {
	var cookies = document.cookie;
	if (cookies.indexOf(Name + '=') == -1){ return null; }
	var start = cookies.indexOf(Name + '=') + (Name.length + 1);
	var finish = cookies.substring(start,cookies.length);
	finish = (finish.indexOf(';') == -1) ? cookies.length : start + finish.indexOf(';');
	return unescape(cookies.substring(start,finish));
}