var Netscape4 = (navigator.appName == "Netscape" && navigator.appVersion.substring(0,1) >= "4");
var Explorer4 = (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.substring(0,1) >= "4");

//check on which page we are
var thisurl = document.URL.toLowerCase();
var section = "anne"; //default
var basehref = ""; //default
if (thisurl.indexOf("work") > 0) {
	section = "work";
} else if (thisurl.indexOf("linx") > 0) {
	section = "linx";
} else if (thisurl.indexOf("weblog") > 0) {
	section = "linx";
} else if (thisurl.indexOf("atomz") > 0) {
	section = "linx";
	basehref = "http://www.veling.nl";
} 
//window.status = section;

//preload images

//anne
var imgAnneOn = new Image();
imgAnneOn.src = basehref + "/anne/images/anneon.gif";
var imgAnneOff = new Image();
imgAnneOff.src = basehref + "/anne/images/anneoff.gif";

var imgOrangeOn = new Image();
imgOrangeOn.src = basehref + "/anne/images/orangeon.gif";
var imgOrangeOff = new Image();
imgOrangeOff.src = basehref + "/anne/images/orangeoff.gif";

if (section == "anne") {
	imgAnneOff.src = imgAnneOn.src;
	imgOrangeOff.src = imgOrangeOn.src;
}

//work
var imgWorkOn = new Image();
imgWorkOn.src = basehref + "/anne/images/workon.gif";
var imgWorkOff = new Image();
imgWorkOff.src = basehref + "/anne/images/workoff.gif";

var imgYellowOn = new Image();
imgYellowOn.src = basehref + "/anne/images/yellowon.gif";
var imgYellowOff = new Image();
imgYellowOff.src = basehref + "/anne/images/yellowoff.gif";

if (section == "work") {
	imgWorkOff.src = imgWorkOn.src;
	imgYellowOff.src = imgYellowOn.src;
}

//linx
var imgLinxOn = new Image();
imgLinxOn.src = basehref + "/anne/images/linxon.gif";
var imgLinxOff = new Image();
imgLinxOff.src = basehref + "/anne/images/linxoff.gif";

var imgRedOn = new Image();
imgRedOn.src = basehref + "/anne/images/redon.gif";
var imgRedOff = new Image();
imgRedOff.src = basehref + "/anne/images/redoff.gif";

if (section == "linx") {
	imgLinxOff.src = imgLinxOn.src;
	imgRedOff.src = imgRedOn.src;
}

function writeImage() {

  var anneonoff = "off.gif";
	var workonoff = "off.gif";
	var linxonoff = "off.gif";
	if (section == "anne") {
		anneonoff = "on.gif";	  
	} else if (section == "work") {
		workonoff = "on.gif";
	} else if (section == "linx") {
	  linxonoff = "on.gif";
	}

	if (Netscape4) { 
	  //anne
		document.write('<layer id="anne" left="0" top="50" visibility="hidden">\n');
	  document.write('<a href="/anne/" onMouseOver="changeAnne(true); return true" onMouseOut="changeAnne(false); return true">'); 
	  document.write('<img src="/anne/images/anne' + anneonoff + '" name="imgAnne" border=0></a>\n</layer>\n'); 
		document.write('<layer id="orange" left="0" top="50" visibility="hidden" >\n');
	  document.write('<a href="/anne/" onMouseOver="changeAnne(true); return true" onMouseOut="changeAnne(false); return true">'); 
	  document.write('<img src="/anne/images/orange' + anneonoff + '" name="imgOrange" border=0></a>\n</layer>\n'); 

	  //work
		document.write('<layer id="work" left="0" top="50" visibility="hidden">\n');
	  document.write('<a href="/anne/work.html" onMouseOver="changeWork(true); return true" onMouseOut="changeWork(false); return true">'); 
	  document.write('<img src="/anne/images/work' + workonoff + '" name="imgWork" border=0></a>\n</layer>\n'); 
		document.write('<layer id="yellow" left="0" top="50" visibility="hidden" >\n');
	  document.write('<a href="/anne/work.html" onMouseOver="changeWork(true); return true" onMouseOut="changeWork(false); return true">'); 
	  document.write('<img src="/anne/images/yellow' + workonoff + '" name="imgYellow" border=0></a>\n</layer>\n'); 

	  //linx
		document.write('<layer id="linx" left="0" top="50" visibility="hidden">\n');
	  document.write('<a href="/anne/weblog/" onMouseOver="changeLinx(true); return true" onMouseOut="changeLinx(false); return true">'); 
	  document.write('<img src="/anne/images/linx' + linxonoff + '" name="imgLinx" border=0></a>\n</layer>\n'); 
		document.write('<layer id="red" left="0" top="50" visibility="hidden" >\n');
	  document.write('<a href="/anne/weblog/" onMouseOver="changeLinx(true); return true" onMouseOut="changeLinx(false); return true">'); 
	  document.write('<img src="/anne/images/red' + linxonoff + '" name="imgRed" border=0></a>\n</layer>\n'); 
	}
	else if (Explorer4) {
	  //anne
	  document.write('<a href="/anne/" onMouseOver="changeAnne(true); return true" onMouseOut="changeAnne(false); return true">'); 
		document.write('<img src="/anne/images/anne' + anneonoff + '" border=0 alt="" name="imgAnne" id="anne" style="container: positioned; position: absolute; left: 0; top: 0; visibility: hidden;"></a>');
	  document.write('<a href="/anne/" onMouseOver="changeAnne(true); return true" onMouseOut="changeAnne(false); return true">'); 
		document.write('<img src="/anne/images/orange' + anneonoff + '" border=0 alt="" name="imgOrange" id="orange" style="container: positioned; position: absolute; left: 0; top: 0; visibility: hidden;"></a>');

	  //work
	  document.write('<a href="/anne/work.html" onMouseOver="changeWork(true); return true" onMouseOut="changeWork(false); return true">'); 
		document.write('<img src="/anne/images/work' + workonoff + '" border=0 alt="" name="imgWork" id="work" style="container: positioned; position: absolute; left: 0; top: 0; visibility: hidden;"></a>');
	  document.write('<a href="/anne/work.html" onMouseOver="changeWork(true); return true" onMouseOut="changeWork(false); return true">'); 
		document.write('<img src="/anne/images/yellow' + workonoff + '" border=0 alt="" name="imgYellow" id="yellow" style="container: positioned; position: absolute; left: 0; top: 0; visibility: hidden;"></a>');

	  //linx
	  document.write('<a href="/anne/weblog/" onMouseOver="changeLinx(true); return true" onMouseOut="changeLinx(false); return true">'); 
		document.write('<img src="/anne/images/linx' + linxonoff + '" border=0 alt="" name="imgLinx" id="linx" style="container: positioned; position: absolute; left: 0; top: 0; visibility: hidden;"></a>');
	  document.write('<a href="/anne/weblog/" onMouseOver="changeLinx(true); return true" onMouseOut="changeLinx(false); return true">'); 
		document.write('<img src="/anne/images/red' + linxonoff + '" border=0 alt="" name="imgRed" id="red" style="container: positioned; position: absolute; left: 0; top: 0; visibility: hidden;"></a>');
	} else {
	  //anne
	  document.write('<a href="/anne/" onMouseOver="changeAnne(true); return true" onMouseOut="changeAnne(false); return true">'); 
		document.write('<img src="/anne/images/anne' + anneonoff + '" width='+imgAnneOn.width+' height='+imgAnneOn.height+' name="imgAnne" border=0 alt=""></a>');
		document.write('<BR>');

	  //work
	  document.write('<a href="/anne/work.html" onMouseOver="changeWork(true); return true" onMouseOut="changeWork(false); return true">'); 
		document.write('<img src="/anne/images/work' + workonoff + '" width='+imgWorkOn.width+' height='+imgWorkOn.height+' name="imgWork" border=0 alt=""></a>');
		document.write('<BR>');
		
	  //linx
	  document.write('<a href="/anne/weblog/" onMouseOver="changeLinx(true); return true" onMouseOut="changeLinx(false); return true">'); 
		document.write('<img src="/anne/images/linx' + linxonoff + '" width='+imgLinxOn.width+' height='+imgLinxOn.height+' name="imgLinx" border=0 alt=""></a>');
	}
	
	return true;
}

function changeImage(imageName, on) {
  if (document[imageName]) {
	  //only if exists
		if (on) {
			newsrc = eval(imageName + "On.src");
		} else {
		  newsrc = eval(imageName + "Off.src");
		}
		document[imageName].src = newsrc;
	}
}

function changeAnne(on) {
  changeImage("imgAnne",on);
	changeImage("imgOrange",on);
}

function changeWork(on) {
  changeImage("imgWork",on);
	changeImage("imgYellow",on);
}

function changeLinx(on) {
  changeImage("imgLinx",on);
	changeImage("imgRed",on);
}

function writeFooter() {

  var moditime = unescape(document.lastModified);
		
	//document.write("Referrer: " + document.referrer + " ");
	document.write("last modified " + moditime);

}

function writeAge(famidx) {
	var now = new Date();
	
	var years = now.getFullYear();
	if (years<100) {
		years = 2000 + years;
	}
	var y = 1972;
	var m = 11;
	var d = 7;
	
	if (famidx == 0) {
	  //anne
	  y = 1972;
	  m = 11;
	  d = 7;
	} else if (famidx == 1) {
	  //esther
	  y = 1998;
	  m = 9;
	  d = 14;
	} else if (famidx == 2) {
	  //nienke
	  y = 2000;
	  m = 11;
	  d = 10;
	} else if (famidx == 3) {
	  //marriage
	  y = 1995;
	  m = 6;
	  d = 22;
	}
	
	//do your thing
	years = years - y - 1;
	
	//see if it has been my birthday
	if (now.getMonth()+1>m) {
	  //my birthday has occurred this year
	  years = years + 1;
	} else if (now.getMonth()+1==m) {
      if (now.getDate()>=d) {
	    //my birthday has occurred this year
		years = years + 1;
	  }
	}
	
	document.write(years);
}