function getFramesetCookieVal (offset) 
{
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1)
		endstr = document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}

function GetFramesetCookie (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;
}

if(GetFramesetCookie("SINGLEPAGE")!="1")
{
// FramesetLoader v1.0 script by E.Daanen (15-06-2006)
// This script handles Frameset detection and reloads the Frameset if necessary.

	// Modify only these variables
	//***********************************************
	// If enabled the Info text will not be displayed 
	// and the Frameset will be loaded automaticly
	var blnAutoRefresh = true;
	
	// The Hyperlink that will reload the Frameset automaticly
	// Use #DOCID# for the ID of the current Document
	var strHyperlink = "../../default.aspx?DocumentID=#DOCID#";
	
	// The Info text that will be displayed when blnAutoRefresh is disabled
	// Use #DOCID# for the ID of the current Document
	var strInfoHTML = "Deze pagina is onderdeel van een frameset.<BR>"
	strInfoHTML += "Klik <A href='../../default.aspx?DocumentID=#DOCID#'>hier</A> om het frameset te laden.";
	
	// Add the WebRoots from wich the site can be accessed
	var arrWebRoots = new Array();
	arrWebRoots[0] = "http://www.zgt.nl";

	//***********************************************
	
	var blnFrameless = true;
	if (window.parent == self)
	{
		if (window.opener)
		{
			for (i=0;i<arrWebRoots.length;i++)
			{
				if (window.opener.location.href.toLowerCase().indexOf(arrWebRoots[i].toLowerCase()) > -1)
				{
					blnFrameless = false;
					break;
				}
			}
		}
	}
	else
	{
		blnFrameless = false;
	}

	// Frameset was not detected
	if (blnFrameless)
	{
		// get the position of the last occurance of "DOCUMENTID="
		// if you take the position of the last "=" you can encounter problems when using bookmarks
		// for example (../loader.aspx?DocumentID=f03864aa-05bd-4020-93b6-31d647379039&BOOKMARK=Medewerkers&#Medewerkers)
		var intPos = document.location.href.toLowerCase().lastIndexOf('documentid=');
		var strDocID = document.location.href.substring(intPos + 11, document.location.href.length);
		
		if (blnAutoRefresh)
		{
			// Load Frameset automaticly
			document.location.href = strHyperlink.replace('#DOCID#',strDocID);
		}
		else
		{
			// Display Info text
			document.write(strInfoHTML.replace('#DOCID#',strDocID));
		}
	}
}
else
{
  document.write("<BR><HR><A href='../../basesitemap.aspx'>Sitemap</a> <a href='../../default.aspx'>Home</a>");
}
