//var var_fnsstartpage = 3;
//function setfnsstartpage(fromaijv) {
//    var_fnsstartpage = fromaijv;
//}
//function fnsstartpage() {
//    return (var_fnsstartpage == 1);
//}

function MakeMenuObject() {
  //if (top.topindirect){alert("MakemenuObject1");if(top.frames[0].oCMenu){alert("MakemenuObject2");top.frames[0].oCMenu.makeObjects(0,self,0);}}
  if (top.topindirect){
    //alert("MakemenuObject1");
	if(top.frames[0].oCMenu){
	  //alert("MakemenuObject2");
	  top.frames[0].oCMenu.makeObjects(0,self,0);
	}
  }
  else {
  	if (top.oCMenu){top.oCMenu.makeObjects(0,self,0);}
  }
}

function boodschap(tekst){
  window.status=tekst;
}

function wacht(t)
{
    var t;
}

function wacht1sec()
{
    setTimeout("countdown()",1000);
}

function countdown()
{
}

function MakeArray(size)
{
  this.length = size;
  for (var i = 1; i <= size; i++)
  {
    this[i] = 0;
  }
  return this;
}

function numberdaysbeforefns(theoccasion){

  var today=new Date()

var one_day=1000*60*60*24
var calculatediff=""

calculatediff=Math.ceil((theoccasion.getTime()-today.getTime())/(one_day))
// if (calculatediff<0){ //if bday already passed
//  var nextyeartoday=new Date()
//  nextyeartoday.setFullYear(today.getFullYear()+1)
//  calculatediff=Math.ceil((nextyeartoday.getTime()-today.getTime())/(one_day)+calculatediff)/
//}

return calculatediff;
}

function fnscountdown(){

//Customize text to show before and on occasion. Follow grammer below:
var beforeOccasionText="te gaan tot FNS"
var onOccasiontext="Vandaag FNS........ Happy Skating! Droog -en lekker warm-, de FNS gaat door"
var monthtext=new Array("Januari","Februari","Maart","April","Mei","Juni","Juli","Augustus","September","Oktober","November","December")
//Enter the occasion's MONTH (1-12) and DAY (1-31):

var nfnsdates = 10;
fnsdate = new MakeArray(nfnsdates + 1);
fnsdate[0] = new Date(2006, 4, 2);
fnsdate[1] = new Date(2006, 5, 7);
fnsdate[2] = new Date(2006, 5, 26);
fnsdate[3] = new Date(2006, 6, 4);   
fnsdate[4] = new Date(2006, 6, 30);
fnsdate[5] = new Date(2006, 7, 2);
fnsdate[6] = new Date(2006, 7, 28);
fnsdate[7] = new Date(2006, 8, 6);
fnsdate[8] = new Date(2006, 9, 3);
fnsdate[9] = new Date(2006, 10, 2);

var foundindex = -1;
var daystogo = -1;
var theoccasion = fnsdate[0];
for (var i = 0; i <= nfnsdates -1  && daystogo < 0 ; i++)
{ 

  theoccasion=fnsdate[i];
  theoccasion.setMonth(theoccasion.getMonth()-1) //change to 0-11 month format

  daystogo = numberdaysbeforefns(theoccasion)
  if (daystogo >= 0 && foundindex == -1) {foundindex = i; if ( i == (nfnsdates - 1)) daystogo = daystogo -1;}
}


var showdate = " ";
if (foundindex < 9) showdate =" op "+theoccasion.getDate()+" "+monthtext[theoccasion.getMonth()];//show date of occasion
//var showdate=" op "+theoccasion.getDate()+" "+monthtext[theoccasion.getMonth()]+" " //show date of occasion
//Display message accordingly
var pluraldayornot=(daystogo==1)? "dag" : "dagen"
var text=""
if (foundindex==2 || foundindex==4 || foundindex==6)
{
    beforeOccasionText="te gaan tot FNS-Amersfoort"
    //onOccasiontext="Vandaag FNS-Amersfoort. Start om 20.00 uur. Droog..., de FNS gaat door"
onOccasiontext="Vandaag FNS-Amersfoort. Om 19.00 uur staat op de site of de tocht door gaat..."
	// onOccasiontext="Vandaag FNS-Amersfoort. Vanwege het komende weer gaat de tocht vanavond, helaas, <b>NIET</b> door..."
}
else
{
    beforeOccasionText="te gaan tot Lazy Sunday Afternoon Skate in Amersfoort"
    onOccasiontext="Vandaag Lazy Sunday Afternoon Skate. Start om 14.00 uur vanaf clubgebouw."
	// onOccasiontext="Vandaag FNS-Amersfoort. Om 18.30 uur staat op de site of de tocht door gaat..."
	// onOccasiontext="Vandaag FNS-Amersfoort. Vanwege het komende weer gaat de tocht vanavond, helaas, <b>NIET</b> door..."
}
if (daystogo<10 && daystogo > 0)
//	document.write("<marquee behavior=slide bgcolor=#C0C0C0 align=middle loop=1>"+daystogo+" "+pluraldayornot+" "+beforeOccasionText+" "+showdate+"!</marquee>")
	text="&nbsp;"+daystogo+" "+pluraldayornot+" "+beforeOccasionText+" "+showdate+"!"

else if (daystogo==0)
//	document.write("<marquee behavior=slide bgcolor=#C0C0C0 align=middle loop=1>"+onOccasiontext+" "+showdate+"!</marquee>")
	text=onOccasiontext


return text
}
function printPage() { 
    if(document.all) { 
        document.all.divButtons.style.visibility = 'hidden'; 
        window.print(); 
        document.all.divButtons.style.visibility = 'visible'; 
    } else { 
        document.getElementById('divButtons').style.visibility = 'hidden'; 
        window.print(); 
        document.getElementById('divButtons').style.visibility = 'visible'; 
    } 
}
function meelurl(showlink, showname, showhost, subject)
{
  var mailme;
  mailme = new MakeArray(80 + 1);
  mailme = "<a href=" + "mail" + "to:" + showname + "@" + showhost;
  if (subject) { mailme = mailme + "?subject=" + subject; }
  mailme = mailme + "> " + showlink + "</a>";
  document.write(mailme);
}

function setVisible(div_id)
{
  var style_sheet = getStyleObject(div_id);
  if (style_sheet)
  {
    hideAll();
    changeObjectVisibility(div_id, "visible");
  }
  else 
  {
    alert("sorry, this only works in browsers that do Dynamic HTML");
  }
}
function switchDiv(this_div, next_div)
{
  if (getStyleObject(this_div) && getStyleObject(next_div)) {
    changeObjectVisibility(this_div, "hidden");
    changeObjectVisibility(next_div, "visible");
  }
}
function hideAll()
{
   changeObjectVisibility("e1","hidden");
   changeObjectVisibility("e2","hidden");
   changeObjectVisibility("e3","hidden");
   changeObjectVisibility("e4","hidden");
}
function getStyleObject(objectId) {
  // checkW3C DOM, then MSIE 4, then NN 4.
  //
  if(document.getElementById && document.getElementById(objectId)) {
	return document.getElementById(objectId).style;
   }
   else if (document.all && document.all(objectId)) {  
	return document.all(objectId).style;
   } 
   else if (document.layers && document.layers[objectId]) { 
	return document.layers[objectId];
   } else {
	return false;
   }
}
function changeObjectVisibility(objectId, newVisibility) {
    // first get the object's stylesheet
    var styleObject = getStyleObject(objectId);
    // then if we find a stylesheet, set its visibility
    // as requested
    //
    if (styleObject) { 
	styleObject.visibility = newVisibility;
	return true;
    } else {
	return false;
    }
}


