var place1=Math.floor(Math.random()*700)
var place2=Math.floor(Math.random()*700)
var place3=Math.floor(Math.random()*700)
var place4=Math.floor(Math.random()*700)
var place5=Math.floor(Math.random()*700)
var place6=Math.floor(Math.random()*700)
var place7=Math.floor(Math.random()*700)
var place8=Math.floor(Math.random()*700)
var place9=Math.floor(Math.random()*700)
var place10=Math.floor(Math.random()*700)
var place11=Math.floor(Math.random()*700)
var place12=Math.floor(Math.random()*700)
var place13=Math.floor(Math.random()*700)
var place14=Math.floor(Math.random()*700)
var place15=Math.floor(Math.random()*700)
var place16=Math.floor(Math.random()*700)
var place17=Math.floor(Math.random()*700)
var place18=Math.floor(Math.random()*700)
var place19=Math.floor(Math.random()*700)
var place20=Math.floor(Math.random()*700)
var place21=Math.floor(Math.random()*700)
var place22=Math.floor(Math.random()*700)
var place23=Math.floor(Math.random()*700)
var place24=Math.floor(Math.random()*700)
var place25=Math.floor(Math.random()*700)
var place26=Math.floor(Math.random()*700)
var place27=Math.floor(Math.random()*700)
var place28=Math.floor(Math.random()*700)
var place29=Math.floor(Math.random()*700)
var place30=Math.floor(Math.random()*700)
var place31=Math.floor(Math.random()*700)
var place32=Math.floor(Math.random()*700)
var place33=Math.floor(Math.random()*700)
var place34=Math.floor(Math.random()*700)
var place35=Math.floor(Math.random()*700)
var place36=Math.floor(Math.random()*700)
var place37=Math.floor(Math.random()*700)
var place1y=Math.floor(Math.random()*500)
var place2y=Math.floor(Math.random()*500)
var place3y=Math.floor(Math.random()*500)
var place4y=Math.floor(Math.random()*500)
var place5y=Math.floor(Math.random()*500)
var place6y=Math.floor(Math.random()*500)
var place7y=Math.floor(Math.random()*500)
var place8y=Math.floor(Math.random()*500)
var place9y=Math.floor(Math.random()*500)
var place10y=Math.floor(Math.random()*500)
var place11y=Math.floor(Math.random()*500)
var place12y=Math.floor(Math.random()*500)
var place13y=Math.floor(Math.random()*500)
var place14y=Math.floor(Math.random()*500)
var place15y=Math.floor(Math.random()*500)
var place16y=Math.floor(Math.random()*500)
var place17y=Math.floor(Math.random()*500)
var place18y=Math.floor(Math.random()*500)
var place19y=Math.floor(Math.random()*500)
var place20y=Math.floor(Math.random()*500)
var place21y=Math.floor(Math.random()*500)
var place22y=Math.floor(Math.random()*500)
var place23y=Math.floor(Math.random()*500)
var place24y=Math.floor(Math.random()*500)
var place25y=Math.floor(Math.random()*500)
var place26y=Math.floor(Math.random()*500)
var place27y=Math.floor(Math.random()*500)
var place28y=Math.floor(Math.random()*500)
var place29y=Math.floor(Math.random()*500)
var place30y=Math.floor(Math.random()*500)
var place31y=Math.floor(Math.random()*500)
var place32y=Math.floor(Math.random()*500)
var place33y=Math.floor(Math.random()*500)
var place34y=Math.floor(Math.random()*500)
var place35y=Math.floor(Math.random()*500)
var place36y=Math.floor(Math.random()*500)
var place37y=Math.floor(Math.random()*500)
var menunavgfxpath = "gfx/nav-menu/";
var parts       = new Array("chromosoom","date","yesterday","twoday","threeday","show","show1","show2","show3","show4","show5","show6","show7","show8","show9","show10", "show11","show12","show13","show14", "show15","show16","show17","show18","show19","show20","show21","show22","show23","show24", "show25","show26","show27","show28","show29","show30","show31","show32","book1","book2","book3","book4","enjoy1","enjoy2","mailing");
var partsStatus = new Array(1,0,0,0,0,0,0,0,0,0,0);
var partsPosX   = new Array(150,150,300,353,395,place1,place2,place3,place4,place5,place6,place7,place8,place9,place10,place11,place12,place13,place14,place15,place16,place17,place18,place19,place20,place21,place22,place23,place24,place25,place26,place27,place28,place29,place30,place31,place32,place33,180,200,220,240,260,280, 150);
var partsPosY   = new Array(48,70,209,249,284,place1y,place2y,place3y,place4y,place5y,place6y,place7y,place8y,place9y,place10,place11y,place12y,place13y,place14y,place15y,place16y,place17y,place18y,place19y,place20y,place21y,place22y,place23y,place24y,place25y,place26y,place27y,place28y,place29y,place30y,place31y,place32y,place33y,180,200,220,240,260,280,620);

function initDateTimeTimer() {
 displayTimeAndData();
 setTimeout("displayTimeAndData()",1000);

}

function displayTimeAndData() {
 var spanDate,spanTime;
 var datetime;
 var h,m,s;
 datetime = new Date(); //get the current date
 spanDate = document.getElementById('spandate');
 spanTime = document.getElementById('spantime');

 
 y = datetime.getYear();
 y = y.toString();
 y = y.substr(y.length - 2);

 m = datetime.getMonth()+1;
 if (m < 10) m = '0' + m;
 
 d = datetime.getDate();
 if (d < 10) d = '0' + d;
 
 if (spanDate != null) {
  spanDate.innerHTML = d + '.' + m + '.' + y;
 }

 h = datetime.getHours();
 m = datetime.getMinutes();
 if (m < 10) m = '0' + m;
 s = datetime.getSeconds();
 if (s < 10) s = '0' + s;

 if (spanTime != null) {
  spanTime.innerHTML = h + ':' + m + ':' + s;
 }
 setTimeout("displayTimeAndData()",1000);
}

function getPartIndex(name) {
 var index;
 
 for (i=0;i<parts.length;i++) {
  if (parts[i] == name) {
   index = i;
   break;
  }
 }
 
 return index;
}

function bringLastPartToFront() {
 
 for (i=0;i<parts.length;i++) {
  if (partsStatus[i] == 1) {
   bringPartToFront(parts[i]);
   break;
  }
 }  
}


function bringPartToFront(name) {
 var partindex;
 var partwindow;
 var divdisable;
 
 for (i=0;i<parts.length;i++) {
  partwindow = document.getElementById('w_' + parts[i]);
  divdisable = document.getElementById('disable_' + parts[i]);
  if (partwindow != null) {
   partwindow.style.zIndex = 100+i;
  }
  if (divdisable != null) {
   divdisable.style.display = '';
  }
 }
 partindex = getPartIndex(name);
 
 partwindow = document.getElementById('w_' + name);
 divdisable = document.getElementById('disable_' + name);
 if (partwindow != null) {
   partwindow.style.zIndex = 500;
 }
 if (divdisable != null) {
   divdisable.style.display = 'none';
 } 
  
}



function menuChoose(name) {
 var partindex;
 var partwindow;
 menuSwap(name,'hide');
 partindex = getPartIndex(name);
 partsStatus[partindex] = 1; //set status to opened 
 partwindow = document.getElementById('w_' + name); 
 partwindow.style.left = partsPosX[partindex] + 'px';
 partwindow.style.top  = partsPosY[partindex] + 'px'; 
 partwindow.style.display = '';
 
 bringPartToFront(name);
 if (name == 'object') {
  document.getElementById('i_objects_frame').src = 'objects.php';
 } else if (name == 'subject') {
  document.getElementById('i_subject_frame').src = 'subject.html';
 }
 
}

function menuClose(name) {
 var partindex;
 partindex = getPartIndex(name);
 partsStatus[partindex] = 0; //set status to opened 
 menuSwap(name,'out');
 document.getElementById('w_' + name).style.display = 'none'; 
 bringLastPartToFront();
 if (name == 'object') {
  document.getElementById('i_objects').src = 'empty.php';
 }
}

function menuSwap(name,why) {
 var img;
 var partindex;
 img = document.getElementById('m_img_'+name);
 partindex = getPartIndex(name);
 if (partsStatus[partindex] == 1) { return -1; } //part is opened, so do not swap
 
 if (img != null) {
  if (why == 'over') { img.src = menunavgfxpath + name + '-over.gif'; }
  if (why == 'out') { img.src = menunavgfxpath + name + '.gif'; }
  if (why == 'hide') { img.src = 'gfx/x.gif'; }  
 }
}

function hideMenu() {
 div = document.getElementById('LayerMenu');
 if (div != null) {
  if (div.style.display == '') { 
   div.style.display = 'none'; 
  }
  else { 
   div.style.display = ''; 
  }
 }
}

function menuToggle() {
 var div,img;
 div = document.getElementById('divMenu');
 img = document.getElementById('imgMenu');

 if (div != null && img != null) {
  if (div.style.display == '') { 
   
   div.style.display = 'none';
   img.src = menunavgfxpath + 'window-plus.gif';
  }
  else { 
   div.style.display = ''; 
   img.src = menunavgfxpath + 'window-minus.gif';
  }
 }
 
 if (img != null) {
  if (img.src == '') { div.style = 'none'; }
  else { div.style = ''; }
 
 }
  
}


function randomBackground() {
 var imgnum = Math.round(1+Math.random()*2);
 var img;
 img = document.getElementById('imgBackground');
 img.src = "gfx/background/bg_pattern" + imgnum + ".gif";
}	


function getElementHeight(id) {
 var value;
 value = -1;
 if (document.defaultView) {
  elm = document.getElementById(id);
  cst= document.defaultView.getComputedStyle(elm, "");
  if (cst != null) { 
   value = cst.getPropertyValue("height");
  }
 } else if (document.getElementById(id).currentStyle) {
   value = document.getElementById(id).currentStyle.height;
 }
 if (value != -1) {
  value = value.toString();
  if (value.indexOf('px') != -1) { 
   value = value.substr(0,value.length-2); //remove 'px' from string
  }
 }
 return parseInt(value);
}
function getElementWidth(id) {
 var value;
 value = -1;
 if (document.defaultView) {
  elm = document.getElementById(id);
  cst= document.defaultView.getComputedStyle(elm, "");
  if (cst != null) { 
   value = cst.getPropertyValue("width");
  }
 } else if (document.getElementById(id).currentStyle) {
  value = document.getElementById(id).currentStyle.width;
 }
 
 if (value != -1) {
  value = value.toString();
  if (value.indexOf('px') != -1) { 
   value = value.substr(0,value.length-2); //remove 'px' from string
  }
 }
 return parseInt(value);
}

function getElementLeft(id) {
 var value;
 value = -1;
 if (document.defaultView) {
  elm = document.getElementById(id);
  cst= document.defaultView.getComputedStyle(elm, "");
  if (cst != null) { 
   value = cst.getPropertyValue("left");
  }
 } else if (document.getElementById(id).currentStyle) {
  value = document.getElementById(id).currentStyle.left;
 }
 if (value != -1) {
  value = value.toString();
  if (value.indexOf('px') != -1) { 
   value = value.substr(0,value.length-2); //remove 'px' from string
  }
 }
 return parseInt(value);
}

function getElementTop(id) {
 var value;
 value = -1;
 if (document.defaultView) {
  elm = document.getElementById(id);
  cst= document.defaultView.getComputedStyle(elm, "");
  if (cst != null) { 
   value = cst.getPropertyValue("top");
  }
 } else if (document.getElementById(id).currentStyle) {
  value = document.getElementById(id).currentStyle.top;
 }
 if (value != -1) {
  value = value.toString();
  if (value.indexOf('px') != -1) { 
   value = value.substr(0,value.length-2); //remove 'px' from string
  }
 }
 return parseInt(value);
}

getViewportScrollTop = function() {
	var x;
	if (self.scrollTop) // all except Explorer
	{
		x = self.scrollTop;
	}
	else if (document.documentElement && document.documentElement.scrollTop)
		// Explorer 6 Strict Mode
	{
		x = document.documentElement.scrollTop;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.scrollTop;
	}
	return x;		
};


// First paramter is a nodes id, second the CSS property you want
function getCSSProperty(sNodeId, sProperty)
{
	var oNode = document.getElementById(sNodeId);
	
	if(document.defaultView)
	{
		return document.defaultView.getComputedStyle(oNode, null).getPropertyValue(sProperty);
	}
	else if(oNode.currentStyle)
	{
		var sProperty = sProperty.replace(/-\D/gi, function(sMatch)
		{
			return sMatch.charAt(sMatch.length - 1).toUpperCase();
		});

		return oNode.currentStyle[sProperty];
	}
	else return null;
}

getViewportScrollTop = function() {
	var x;
	if (self.scrollTop) // all except Explorer
	{
		x = self.scrollTop;
	}
	else if (document.documentElement && document.documentElement.scrollTop)
		// Explorer 6 Strict Mode
	{
		x = document.documentElement.scrollTop;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.scrollTop;
	}
	return x;		
};

var detect = navigator.userAgent.toLowerCase();

safariCheck = function () {

 if ( detect.indexOf('safari') + 1) {
  return true;
 } else { 
  return false; 
 }

}

 //returns the current date in YYYYMMDD format
 function getCurrentDateString(){

   //make a new date object set at the current date
   var currentDate = new Date();

   //get the four position year and
   //make it a string
   var currentYear = currentDate.getFullYear() + "";

   //get the zero-indexed month and add 1
   //for the real month and make it a strintg
   var currentMonth = (currentDate.getMonth() + 1) + "";

   //add a zero at the beginning if only one
   //digit month
   if (currentMonth.length == 1) {
     currentMonth = "0" + currentMonth;
   }

   //get the current day of the month and
   //make it a string
   var currentDayOfMonth = currentDate.getDate() + "";

   //add a zero if necessary
   if (currentDayOfMonth.length == 1) {
     currentDayOfMonth = "0" + currentDayOfMonth;
   }

   return(currentYear + currentMonth + currentDayOfMonth);
 }

 //preload image based upon currentDate
 var currentDateString = getCurrentDateString();
 var dailyImageObject = new Image();
 dailyImageObject.src = "gfx/nav-menu/" + currentDateString + ".gif";

 //called when the page loads to
 //set the actual HTML IMG element to have the same
 //SRC as our cached Image object
 function showDailyImage(){
   document.getElementById("dailyIMGElement").src = dailyImageObject.src;
 }

//preload image based upon currentDate
 var currentDateString = getCurrentDateString();
 var date = new Image();
 date.src = "gfx/every-day/" + currentDateString + ".jpg";

 //called when the page loads to
 //set the actual HTML IMG element to have the same
 //SRC as our cached Image object
 function showdate(){
   document.getElementById("dateElement").src = date.src;
 }




<!-- yesterday -->

 function getYesterday(){
   var yesterdayDate = new Date();
            yesterdayDate.setDate(yesterdayDate.getDate() - 1);
			
   var yesterdayYear = yesterdayDate.getFullYear() + "";
   var yesterdayMonth = (yesterdayDate.getMonth() + 1) + "";
   if (yesterdayMonth.length == 1) {
     yesterdayMonth = "0" + yesterdayMonth;
   }

   var yesterdayDayOfMonth = yesterdayDate.getDate() + "";
   if (yesterdayDayOfMonth.length == 1) {
     yesterdayDayOfMonth = "0" + yesterdayDayOfMonth;
   }

   return(yesterdayYear + yesterdayMonth + yesterdayDayOfMonth);
 }

 var yesterdayDateString = getYesterday();
 var yesterdayImageObject = new Image();
 yesterdayImageObject.src = "gfx/nav-menu/" + yesterdayDateString + ".gif";

 function showyesterdayImage(){
   document.getElementById("yesterdayIMGElement").src = yesterdayImageObject.src;
 }

 var yesterdayDateString = getYesterday();
 var yesterdate = new Image();
 yesterdate.src = "gfx/every-day/" + yesterdayDateString + ".jpg";

 function showyesterdaydate(){
   document.getElementById("yesterdayElement").src = yesterdate.src;
 }
 

<!-- day before yesterday (two days ago) -->

 function twodays(){
   var twodaysDate = new Date();
            twodaysDate.setDate(twodaysDate.getDate() - 2);
			
   var twodaysYear = twodaysDate.getFullYear() + "";
   var twodaysMonth = (twodaysDate.getMonth() + 1) + "";
   if (twodaysMonth.length == 1) {
     twodaysMonth = "0" + twodaysMonth;
   }

   var twodaysDayOfMonth = twodaysDate.getDate() + "";
   if (twodaysDayOfMonth.length == 1) {
     twodaysDayOfMonth = "0" + twodaysDayOfMonth;
   }

   return(twodaysYear + twodaysMonth + twodaysDayOfMonth);
 }

 var twodaysDateString = twodays();
 var twodaysImageObject = new Image();
 twodaysImageObject.src = "gfx/nav-menu/" + twodaysDateString + ".gif";

 function showtwodaysImage(){
   document.getElementById("twodaysElement").src = twodaysImageObject.src;
 }

 var twodaysDateString = twodays();
 var twodaysdate = new Image();
 twodaysdate.src = "gfx/every-day/" + twodaysDateString + ".jpg";

 function showtwodaysdate(){
   document.getElementById("twodaysdateElement").src = twodaysdate.src;
 }


<!-- three days ago) -->

 function threedays(){
   var threedaysDate = new Date();
            threedaysDate.setDate(threedaysDate.getDate() - 3);
			
   var threedaysYear = threedaysDate.getFullYear() + "";
   var threedaysMonth = (threedaysDate.getMonth() + 1) + "";
   if (threedaysMonth.length == 1) {
     threedaysMonth = "0" + threedaysMonth;
   }

   var threedaysDayOfMonth = threedaysDate.getDate() + "";
   if (threedaysDayOfMonth.length == 1) {
     threedaysDayOfMonth = "0" + threedaysDayOfMonth;
   }

   return(threedaysYear + threedaysMonth + threedaysDayOfMonth);
 }

 var threedaysDateString = threedays();
 var threedaysImageObject = new Image();
 threedaysImageObject.src = "gfx/nav-menu/" + threedaysDateString + ".gif";

 function showthreedaysImage(){
   document.getElementById("threedaysElement").src = threedaysImageObject.src;
 }

 var threedaysDateString = threedays();
 var threedaysdate = new Image();
 threedaysdate.src = "gfx/every-day/" + threedaysDateString + ".jpg";

 function showthreedaysdate(){
   document.getElementById("threedaysdateElement").src = threedaysdate.src;
 }
