	// globals
	var e;
	// variabelen voor de functie die meerdere subpanels tegelijk inklapt
	var PanelVisibility = new Array();
	var OnePanelOpen = "";
	var psDivID = new Array();
	var psCookieID = new Array();
	var psImageID = new Array();
	var lsImagePath = new Array();
	var BuildArrayWithVisibilityOfPanels_Counter = 0;
	// variabelen voor functies die cookies aanmaken
	var domain;
	var path;
	var secure;
	

// Deze functie wordt gebruikt om op de voorpagina meerdere panels in een blok tegelijk in te klappen
// Deze functie wordt ook gebruikt om op sub- en op voorpagina het skins menu te showen of te hiden
// Tenslotte wordt deze functie gebruikt om op de subpagina het inklapgedrag van het linkermenu te regelen
// Naast de parameter psDivId kun je ook nog extra parameters opgeven voor de in te klappen subpanels
// TODO: de functie is nog niet geschikt voor het blok mijnpkpanels op de subpagina omdat daar eigenlijk ook meerder
// parameters horen te worden meegestuurd
function ShowHideLayer(psDivID) 
{
// needed for seeing if we are in the root of the site
var UrlCurrent = escape(document.location);
var UrlSplitted = UrlCurrent.split("/");
//alert(UrlSplitted[0]);
//alert(UrlSplitted.length;   

    // meer items tegelijk
    // roep de functie aan als javascript:ShowHideLayer('surfpanels','') als je dit wilt
	if (ShowHideLayer.arguments.length > 1)
	{
        // -------------------------------------------------------------------------------------
        // Als het om een subpagina gaat en we willen in 1 keer alle container blokken als surf, mijnpk etc. hiden
        // Uitgaande van een Url als [http:]/[ ]/[www.ditisdenaamvanmijnsite.extensie]/[rootfile]
	    if (UrlSplitted.length > 4)
	    {
		    // Voor het inklapgedrag van het linker menu
		        if (document.getElementById(psDivID).style.display == "none") 
		        {
			        document.getElementById("communitypanels").style.display = "none";
				    document.getElementById("surfpanels").style.display = "none";
				    document.getElementById("mijnpkpanels").style.display = "none";
				    document.getElementById("verenigingpanels").style.display = "none";
				    document.getElementById("actueelpanels").style.display = "none";
				    document.getElementById("fotospanels").style.display = "none";
				    document.getElementById(psDivID).style.display= "";
			    }
			    else 
			    {
				    document.getElementById(psDivID).style.display= "none";
			    }
	    }
	    // einde subpagina
	
	    // -----------------------------------------------------------------------------------
        // Als het om de hoofdpagina gaat en we willen de extra functionaliteit van alle subpanels in 1 keer showen of hiden
	    else if (UrlSplitted.length <= 4)
	    {
	        // Voor alle subpanels van een blok tegelijk inklappen
	            // Alle child nodes van de panel opvragen
	            var mainPanel = document.getElementById(ShowHideLayer.arguments[0]);
                for (k=0; k <mainPanel.childNodes.length; k++)
                {
                    if (mainPanel.childNodes[k].nodeName == "DIV" && mainPanel.childNodes[k].getAttribute('id').indexOf("footer") == -1)
                    {
                        //alert(mainPanel.childNodes[k].getAttribute('id'));
                        BuildArrayWithVisibilityOfPanels(mainPanel.childNodes[k].getAttribute('id'));
                    }
                }
	            CheckVisibilityOfPanels();
	    }
	    // einde hoofdpagina
    }
    // einde meer tegelijk
    
    
    // -------------------------------------------------------------------------------------------------
    // Als we gewoon een willekeurig divje willen showen of hiden
    else if (ShowHideLayer.arguments.length == 1)
	{
	    //alert(ShowHideLayer.arguments.length);
		if (document.getElementById(psDivID).style.visibility == "" || document.getElementById(psDivID).style.visibility == "hidden") 
		{
			document.getElementById(psDivID).style.visibility = "visible";
		}
		else
		{
			document.getElementById(psDivID).style.visibility = "hidden";
		}	
	}
	// einde gewoon hiden
}




	// functie om naar de subpaginas vanaf voorpagina door te klikken d.m.v. meer buttons
	// Deze functie is nog erg specifiek voor de site die wij hebben, maar op zich zijn de blokken met surf etc. een standaard element die
	// op iedere pagina terugkomen
	function Meer(SubPageName)
	{
		if (SubPageName == "surf")
	        document.location = "/surf/windandwaves.aspx";
	    else if (SubPageName == "fotos")
	        document.location = "fotos/overzicht.aspx?soort=1";
	    else if (SubPageName == "vereniging")
	        document.location = "vereniging/faciliteiten.aspx";
	    else if (SubPageName == "actueel")
	        document.location = "actueel/";
	    else if (SubPageName == "community")
	        document.location = "community/";
	    else if (SubPageName == "mijnpk")
	        document.location = "mijnpk/";	
	}
	
	// functie om te checken welke onderdeel een onclick oproept
	function CheckTarget(e, url, PanelID) 
	{
		if (window.event) e = window.event;
		var srcEl = e.srcElement? e.srcElement : e.target;
		var nodeName = srcEl.nodeName;
		var nodeNameID = srcEl.id;
		// als je op de cel klikt
		if (nodeName == "H3")
		{
		    ShowContent(PanelID);
		}
		// als je op het +/- knopje klikt		
		else if (nodeName == "IMG" && nodeNameID == "")
		{
			location.href = url;
			//alert("img nodename");
		}	
	}
	
	// Functie voor het in en uit klappen van 1 subpanel (1 panel tegelijk)
	// Original Scripts and coding by Jesse Foster 
	// Added to DNN Core by Jeremy Oldham
	var expDays = 256;
	var exp = new Date(); 
	exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
	function ShowContent(ID)
	{
		var psImageID = ID+"Button";
		var psDivID = ID;
		var psCookieID = ID+"_Visible";
		var lsImagePath;
		var PanelVisibility = GetCookie(psCookieID);
		lsImagePath = document.getElementById(psImageID).style.backgroundImage.split("/");
		// als in de value van de cookie staat dat ie true is, maar de page heeft het item opnieuw onzichtbaar gemaakt
		if (PanelVisibility == "true" && document.getElementById(psDivID).style.display == "none")
		{
		    //alert("cookie heeft value true maar panel is opnieuw onzichtbaar gemaakt");
			document.getElementById(psDivID).style.display = "";
			lsImagePath[lsImagePath.length - 1] = 'plus.gif';
			document.getElementById(psImageID).style.backgroundImage = "url(../../images/"+lsImagePath[lsImagePath.length - 1]+")";
			SetCookie(psCookieID, "true");
		}
		// als er al een value in de cookie staat en panel is zichtbaar
		else if (PanelVisibility == "true" && document.getElementById(psDivID).style.display == "")
		{
		    //alert("cookie heeft value en panel is zichtbaar");
			document.getElementById(psDivID).style.display = "none";
			lsImagePath[lsImagePath.length - 1] = 'plus.gif';
			document.getElementById(psImageID).style.backgroundImage = "url(../../images/"+lsImagePath[lsImagePath.length - 1]+")";
			SetCookie(psCookieID, "false");
		}
		// als er al een value in de cookie staat en panel is niet zichtbaar
		else if (PanelVisibility == "false" && document.getElementById(psDivID).style.display == "none")
		{
		    //alert("cookie heeft value en panel is niet zichtbaar");
			document.getElementById(psDivID).style.display= "";
			lsImagePath[lsImagePath.length - 1] = 'min.gif'
			document.getElementById(psImageID).style.backgroundImage = "url(../../images/"+lsImagePath[lsImagePath.length - 1]+")";
			SetCookie(psCookieID, "true");
		}
		// als er nog geen value in de cookie staat en panel is niet zichtbaar
		else if (PanelVisibility == null && document.getElementById(psDivID).style.display == "none")
		{
		    //alert("cookie heeft geen value en panel is niet zichtbaar");
			document.getElementById(psDivID).style.display= "";
			lsImagePath[lsImagePath.length - 1] = 'min.gif'
			document.getElementById(psImageID).style.backgroundImage = "url(../../images/"+lsImagePath[lsImagePath.length - 1]+")";
			SetCookie(psCookieID, "true");
		}
		// als er nog geen value in de cookie staat en panel is zichtbaar
		else if (PanelVisibility == null && document.getElementById(psDivID).style.display == "")
		{
		    //alert("cookie heeft geen value en panel is zichtbaar");
			document.getElementById(psDivID).style.display= "none";
			lsImagePath[lsImagePath.length - 1] = 'min.gif'
			document.getElementById(psImageID).style.backgroundImage = "url(../../images/"+lsImagePath[lsImagePath.length - 1]+")";
			SetCookie(psCookieID, "false");
		}
	}
	
    // functies voor alle subpanels tegelijk in of uit klappen
    // Maak een array met de visibility van de panels
    function BuildArrayWithVisibilityOfPanels(ID)
	{
		psImageID.push(ID+"Button");
		//alert("psImageID :"+psImageID[BuildArrayWithVisibilityOfPanels_Counter]);
		psCookieID.push(ID+"_Visible");
		//alert("psCookieID: "+psCookieID[BuildArrayWithVisibilityOfPanels_Counter]);
		// hier gaan we eerst de hele array met cookie values vullen
		//alert("psCookieValue: "+GetCookie(psCookieID[BuildArrayWithVisibilityOfPanels_Counter]));
		PanelVisibility.push(GetCookie(psCookieID[BuildArrayWithVisibilityOfPanels_Counter]));
		psDivID.push(ID);
		lsImagePath.push(document.getElementById(psImageID[BuildArrayWithVisibilityOfPanels_Counter]).style.backgroundImage.split("/"));
		//alert("lsImagePathwaarde :"+lsImagePath[BuildArrayWithVisibilityOfPanels_Counter]);
		BuildArrayWithVisibilityOfPanels_Counter++;
    }
    
	// check de gemaakte array
	function CheckVisibilityOfPanels() {
	BuildArrayWithVisibilityOfPanels_Counter = 0;
	//alert("arraylengte :"+PanelVisibility.length);
		for (i=0; i<PanelVisibility.length; i++)
		{
		//alert("arraylengte :"+PanelVisibility.length);
		//alert("iwaarde :"+i);
		//alert("PanelVisibilitywaarde :"+PanelVisibility[i]);
		    if (PanelVisibility[i] == "true" || PanelVisibility[i] == null) {
		        // er staan 1 of meer panels open
		        OnePanelOpen = "true";
		        //alert("OnePanelOpen :"+OnePanelOpen);
		        break;
		        }
		}
		if (OnePanelOpen == "true")
		{
		    // doe alle panels dicht
		    CloseAllPanels();
		    // reset OnePanelOpen pointer variabele
		    OnePanelOpen = "";
		}
		else if(OnePanelOpen == "")
		{
		    // doe alle panels open
		    OpenAllPanels();
		}
		// reset alle arrays
		PanelVisibility = new Array();
		psDivID = new Array();
	    psCookieID = new Array();
	    psImageID = new Array();
	    lsImagePath = new Array();
	}
	
	// sluit al de panels
	function CloseAllPanels()
	{
	    for (i=0; i<PanelVisibility.length; i++)
	    {
	        document.getElementById(psDivID[i]).style.display = "none";
		    lsImagePath[i][lsImagePath[i].length - 1] = 'plus.gif';
		    document.getElementById(psImageID[i]).style.backgroundImage = "url(../../images/"+lsImagePath[i][lsImagePath[i].length - 1]+")";
		    SetCookie(psCookieID[i], "false");
		    //alert("closeallpanels");
		}
	}
	
	// open al de panels
	function OpenAllPanels()
	{
	    for (i=0; i<PanelVisibility.length; i++)
	    {
	  	    document.getElementById(psDivID[i]).style.display= "";
		    lsImagePath[i][lsImagePath[i].length - 1] = 'min.gif'
		    document.getElementById(psImageID[i]).style.backgroundImage = "url(../../images/"+lsImagePath[i][lsImagePath[i].length - 1]+")";
		    SetCookie(psCookieID[i], "true");
		    //alert("openallpanels");
		}
	}
	// einde functies voor meerdere panels tegelijk in of uit klappen
	
	
	// functie voor het instellen van een cookie die bepaalt of een subpanel visible is of niet
	function SetCookie (name, value) 
	{
		var argv = SetCookie.arguments;
		var argc = SetCookie.arguments.length;
		var expires = (argc > 2) ? argv[2] : exp;
		path = "/";
		domain = "plankenkoorts.com";
		secure = false;

		document.cookie = name+"="+escape(value)+ 
		((expires == null) ? "" : ("; expires=" +
		expires.toGMTString())) + 
		((path == null) ? "" : ("; path=" + path)) +
		((domain == null) ? "" : ("; domain=" + domain)) +
		((secure == true) ? "; secure" : "");
	}
	
    // functie die de waarde van de cookie ophaalt
    function getCookieVal (offset)
    {
	    var endstr = document.cookie.indexOf (";", offset);
	    if (endstr == -1) { endstr = document.cookie.length; }
	    return unescape(document.cookie.substring(offset, endstr));
	}

    // functie die de cookie ophaalt
    function GetCookie (name)
    {
	    var arg = name + "=";
	    var alen = arg.length;
	    var clen = document.cookie.length;
	    var i = 0;
	    while (i < clen)
	    {
		    var j = i + alen;
		    if (document.cookie.substring(i, j) == arg)
		    {
			    return getCookieVal (j);
			}
		    i = document.cookie.indexOf(" ", i) + 1;
		    if (i == 0) break; 
		    }
	    return null;
    }


// aantal functies die standaard bij Macromedia Dreamweaver geleverd worden
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function MM_findObj(n, d) { //v4.01
  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=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'block':(v=='hide')?'none':v; }
    obj.display=v; }
}

function MM_setTextOfLayer(objName,x,newText) { //v4.01
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (document.layers) {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
