var content;
var activePanel;
var JS_ROOT = "";

function initiate(currentPanel,sub){
		
		function reportSize() {
		  myWidth = 0, myHeight = 0;
		  if( typeof( window.innerWidth ) == 'number' ) {
		    //Non-IE
		    myWidth = window.innerWidth;
		    myHeight = window.innerHeight;
		  } else {
		    if( document.documentElement &&
		        ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		      //IE 6+ in 'standards compliant mode'
		      myWidth = document.documentElement.clientWidth;
		      myHeight = document.documentElement.clientHeight;
		    } else {
		      if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		        //IE 4 compatible
		        myWidth = document.body.clientWidth;
		        myHeight = document.body.clientHeight;
		      }
		    }
		  }
		}
		
		function doTest(){
			reportSize();
			if(screen.width < 1144) {
				document.getElementById('hspacerLeft').style.width = 10 + "px"; 
				document.getElementById('hspacerCenter').style.width = 800 + "px";
				document.getElementById('hspacerRight').style.width = 30 + "px";
				document.getElementById('wrapper').style.width = 980 + "px";
			}else{
			if(myWidth > 1177) {
				document.documentElement.style.overflowX = 'hidden';
				document.getElementById('wrapper').style.width = 1915 + "px";<!--1615-->
				document.getElementById('hspacerRight').style.width = 800 + "px";<!--500-->
			}else{
				document.documentElement.style.overflowX = 'scroll';
				document.getElementById('wrapper').style.width = 1230 + "px";
				document.getElementById('hspacerRight').style.width = 100 + "px";
			}}
		}
		
		window.onresize = doTest;
		doTest();

		panel = currentPanel;

		if(sub == 'sub') {
		
		timeout = 1;
		var openPanelWidth = 200 + 'px';
		
		<!-- save and remove content -->
		content = document.getElementById('content').innerHTML;
		document.getElementById('content').innerHTML = "";
		
		<!-- make changes to widths  -->
		document.getElementById(panel).style.width = openPanelWidth;
		document.getElementById('hspacerCenter').style.width = 678 + 'px';	
		
		<!--show menu items and change cursor -->
		document.getElementById(panel).style.cursor = 'auto';
		document.getElementById('panelList').style.visibility = 'visible';

		<!-- reload content -->
		document.getElementById('content').innerHTML = content;

		}
		
		<!-- when page is panel mainpage -->
		else{timeout=3500; }
		activePanel = currentPanel;
		
		<!-- save content and clear page -->
		content = document.getElementById('content').innerHTML;
		document.getElementById('content').innerHTML = "";
		
		<!-- open panel after timeout -->
		setTimeout("openPanel(activePanel)",timeout);
	
		<!-- after loading make content visible -->
		document.getElementById('content').style.visibility = "visible";
}

function openPanel(currentPanel){

	if(!(currentPanel == "pOntvangsthal")){
		
		var openPanelWidth = 200 + 'px';
		var panel = currentPanel;
		
		<!-- make changes to widths -->
		document.getElementById(panel).style.width = openPanelWidth;
		document.getElementById('hspacerCenter').style.width = 678 + 'px';
		
		<!-- show menu and change cursor -->
		document.getElementById(panel).style.cursor = 'auto';
		document.getElementById('panelList').style.visibility = 'visible';
	}

	<!-- change backgrounds for active panel -->
	if(currentPanel == "pLounge"){document.getElementById('content').style.backgroundImage = "url('" + JS_ROOT + "/images/loungebgcenter_tr.jpg')";}
	if(currentPanel == "pOntvangsthal"){document.getElementById('content').style.backgroundImage = "url('" + JS_ROOT + "/images/ontvangsthalbgcenter_tr.jpg')";}	
	if(currentPanel == "pKeuken"){document.getElementById('content').style.backgroundImage = "url('" + JS_ROOT + "/images/keukenbgcenter_tr.jpg')";}
	if(currentPanel == "pAtelier"){document.getElementById('content').style.backgroundImage = "url('" + JS_ROOT + "/images/atelierbgcenter_tr.jpg')";}	
	if(currentPanel == "pBibliotheek"){document.getElementById('content').style.backgroundImage = "url('" + JS_ROOT + "/images/bibliobgcenter_tr.jpg')";}
	
	<!-- show contact and reload content into page -->
	document.getElementById('content').innerHTML = content;
	document.getElementById('contact').style.visibility = "visible";
	
	<!--if(!(panel == "pOntvangsthal")){document.getElementById('contact').style.visibility = "visible";}-->
	

	
	
}


