var chr34 = String.fromCharCode(34);
var strOutput;
var arImage = new Array(59);
var iMaximages = 60;
var strSubLinks = '';

// Replace all spaces with non breakable spaces
function ReplaceSpaces(strIn)
{
  var strOut;

  strOut = strIn;

  while (strOut.indexOf(" ")>0)
  {
    strOut = strOut.replace(" ", "&nbsp;");
  }
  return strOut;
}

// Return the random number between min and max
function cpRandom(min, max)
{
	var nRand = Math.random()*(max-min+1);
	return(Math.round(nRand + 0.5)+min-1);
}

function initImage()
{
arImage[0]="139_3929.jpg";
arImage[1]="139_3931.jpg";
arImage[2]="139_3958.jpg";
arImage[3]="139_3961.jpg";
arImage[4]="139_3979.jpg";
arImage[5]="139_3993.jpg";
arImage[6]="140_4025.jpg";
arImage[7]="140_4029.jpg";
arImage[8]="140_4040.jpg";
arImage[9]="140_4048.jpg";
arImage[10]="140_4069.jpg";
arImage[11]="140_4079.jpg";
arImage[12]="140_4084.jpg";
arImage[13]="140_4088.jpg";
arImage[14]="140_4092.jpg";
arImage[15]="2908FD~1.jpg";
arImage[16]="106_0666.jpg";
arImage[17]="107_0705.jpg";
arImage[18]="108_0808.jpg";
arImage[19]="110_1094.jpg";
arImage[20]="pic523.jpg";
arImage[21]="pic038.jpg";
arImage[22]="pic055.jpg";
arImage[23]="pic059.jpg";
arImage[24]="pic063.jpg";
arImage[25]="pic074.jpg";
arImage[26]="pic097.jpg";
arImage[27]="pic121.jpg";
arImage[28]="pic143.jpg";
arImage[29]="pic159.jpg";
arImage[30]="pic166.jpg";
arImage[31]="pic167.jpg";
arImage[32]="pic168.jpg";
arImage[33]="pic193.jpg";
arImage[34]="pic205.jpg";
arImage[35]="pic213.jpg";
arImage[36]="pic251.jpg";
arImage[37]="pic370.jpg";
arImage[38]="pic429.jpg";
arImage[39]="pic485.jpg";
arImage[40]="pic492.jpg";
arImage[41]="pic518.jpg";
arImage[42]="2006_132.jpg";
arImage[43]="2006_184.jpg";
arImage[44]="2006_202.jpg";
arImage[45]="2006_208.jpg";
arImage[46]="2006_310.jpg";
arImage[47]="B2006_006.jpg";
arImage[48]="B2006_014.jpg";
arImage[49]="B2006_016.jpg";
arImage[50]="B2006_047.jpg";
arImage[51]="B2006_050.jpg";
arImage[52]="B2006_057.jpg";
arImage[53]="B2006_076.jpg";
arImage[54]="B2006_081.jpg";
arImage[55]="B2006_212.jpg";
arImage[56]="B2006_224.jpg";
arImage[57]="B2006_233.jpg";
arImage[58]="B2006_252.jpg";
arImage[59]="B2006_279.jpg";
arImage[60]="B2006_307.jpg";

}

function getImage(iNum)
{
  return arImage[iNum];
}

// initialiseer alle collecties, variabelen, e.d.
function initAll()
{
  initImage();
  
  strImage = ""

}

// Toon het image op de pagina
function showRandomImage()
{
  var iNum;
  var strImage;
  
  initAll();
  
  iNum = cpRandom(0,iMaximages);

  strImage = getImage(iNum);	
  
  strOutput = "<img valign='middle' align='center' src='images/" + strImage + "'>";
  
  document.write(strOutput);
}
// adds the default navigation: back, home, forward
function AddNavigationButtons()
{
  document.write("<img src='backgrounds/knoplinks.jpg' width='58' height='58' border='0' alt='Terug' onClick='history.back()'; STYLE='cursor:hand;'><a href=index.html><img src='backgrounds/knophome.jpg' width='58' height='58' border='0' alt='Home'></a><img src='backgrounds/knoprechts.jpg' width='58' height='58' border='0' alt='Verder' onClick='history.forward()'; STYLE='cursor:hand;'>");

}

// adds custom navigation at the bottom of the page
function AddCustomNavigation(strLink, strText, strClass)
{

  var strTextNew;	
  strTextNew = ReplaceSpaces(strText);

  strOutput="";

  if (strClass.indexOf("SubMenu")==0)
  {	
    strOutput="<td width='109' valign='middle' align='left' background='backgrounds/groteknop.gif'>";
  }

  strOutput = strOutput + "<a href='" + strLink + "' class ='" + strClass + "' NOWRAP>" + strTextNew + "</a>";
  
  if (strClass.indexOf("SubMenu")==0)
  {	
    strOutput=strOutput + "</td>";
  }

  document.write(strOutput);
}

function AddCustomNavigationWithSubs(strLink, strText, strClass)
{
  var strTextNew;	

  strTextNew = ReplaceSpaces(strText);
  strOutput="";

	switch (strClass)
	{
	case "SubMenu": 
    strOutput="<td width='109' valign='top' align='left' background='backgrounds/groteknop.gif'><a href='" + strLink + "' class ='" + strClass + "'><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + strTextNew + "</a><ul>";
	  break;
	case "SubSubMenu": 
    strOutput = "<li><a href='" + strLink + "' class ='" + strClass + "' NOWRAP>" + strTextNew + "</a></li>";
	  break;
	case "SubMenuEnd": 
    strOutput="</ul></td>";
	  break;
	default:
	  break;
	}

  document.write(strOutput);
}

// wrapper on every page. header comes just after the <body> -tag
function wrapperheader(strParentLink, strParentText)
{

  strOutput = "<table border='0' height='600' width ='950' align='center' valign='middle' cellpadding='0' cellspacing='0'>";
  strOutput = strOutput + "<tr><!-- RIJ 1-->"; 
  strOutput = strOutput + "<td width='719' height='80' colspan='2' align='left' valign='top'><!--  Cel 1.1, Cel 1.2 -->";
  strOutput = strOutput + "  <p class='Kopje'>  <script>document.write(document.title)</script>";
  strOutput = strOutput + "</p>";
  strOutput = strOutput + "  </td>";
  strOutput = strOutput + "  <td width='181' rowspan='2' align='center' valign='top'><!--  Cel 1.3, Cel 2.3-->";
  strOutput = strOutput + "  <table width='190' border='0'><tr><td height='183' align='center' valign='middle'>";
  strOutput = strOutput + "    <script>";
  strOutput = strOutput + "      showRandomImage();";
  strOutput = strOutput + "    </script>";
  strOutput = strOutput + "    </td></tr><td valign='top'>";
  strOutput = strOutput + "     <script>";
  strOutput = strOutput + "   		   AddNavigationButtons();";
  strOutput = strOutput + "     </script>";
// Als er geen Parent is de volgende code niet uitvoeren
  if (strParentLink.indexOf("html")>0)
  {
    strOutput = strOutput + "    </td></tr><tr><td height='109' valign='middle' align='left' background='backgrounds/groteknop.gif'>";
    strOutput = strOutput + "<a href='" + strParentLink + "' class ='SubMenu' NOWRAP>" + strParentText + "</a>";
  }
  strOutput = strOutput + "    </td></tr></table>";
  strOutput = strOutput + "    </td>";
  strOutput = strOutput + "    </tr>";
  strOutput = strOutput + "<tr><!-- RIJ 2-->";
  strOutput = strOutput + "  <td height='411' width='20'><!--  Cel 2.1 -->";
  strOutput = strOutput + "  &nbsp";
  strOutput = strOutput + "  </td>";
  strOutput = strOutput + "  <td width='719' align='left' valign='top'><!--  Cel 2.2-->";

  document.write(strOutput);
}

function setStrSubLinks(strIn)
{
  strSubLinks=strIn;
}

// wrapper on every page. trailer comes just before the </body> -tag
function wrappertrailerstart()
{
  strOutput= "  </td>";
  strOutput = strOutput + "</tr>";
  strOutput = strOutput + "<tr><!-- RIJ 4-->";
  strOutput = strOutput + "    <td height='109' colspan='3'><!--  Cel 4.1, 4.2, 4.3 -->";
  strOutput = strOutput + "    	<table height='109' border='0'>";
  strOutput = strOutput + "    	<tr>";

  document.write(strOutput);
}

// wrapper on every page. trailer comes just before the </body> -tag
function wrappertrailerend()
{
  strOutput= "	</tr>";
  strOutput = strOutput + "	</table>";
  strOutput = strOutput + "  </td>";
  strOutput = strOutput + "</tr>";
  strOutput = strOutput + "</table>";

  document.write(strOutput);
}
