 function ElapsedTime(inFromDate,inToDate) { 

 var inFromDate = (arguments.length == 0) ? new Date() : arguments[0]; 
 var inToDate = (arguments.length == 1) ? new Date() : arguments[1]; 

 // if (arguments.length == 0) var inFromDate = new Date(); // IE4 has a bug in constructors, 
 // if (arguments.length == 1) var inToDate = new Date(); // so use above method. 

 var fromDate = new Date(inFromDate); 
 var toDate = new Date(inToDate); 
 var tempDate = new Date(); 

 if (fromDate.getTime() > toDate.getTime()) { 
 tempDate = new Date(fromDate); 
 fromDate = new Date(toDate); 
 toDate = new Date(tempDate); 
 } 

 var totMonths = 12*toDate.getFullYear() + toDate.getMonth() + 
 -12*fromDate.getFullYear() - fromDate.getMonth() 
 var years = Math.floor(totMonths / 12) 
 var months = totMonths - 12*years 
 if (dateAsNumber(toDate,"D") < dateAsNumber(fromDate,"D")) months -= 1 
 if (months < 0) { 
 months = 0 
 if (years > 0) years -= 1 
 } 

 var yearsOff = years + fromDate.getFullYear() 
 var monthsOff = months + fromDate.getMonth() 
 if (monthsOff >= 12) { 
 monthsOff -= 12 
 yearsOff += 1 
 } 

 var tempDate = new Date(fromDate); 
 tempDate.setFullYear(yearsOff); 
 tempDate.setMonth(monthsOff); // might push us into early next month, so... 
 while (tempDate.getDate() < fromDate.getDate() && tempDate.getDate() < 9 ) 
 tempDate.setTime(tempDate.getTime() - 1000*60*60*24); // Feb 29 etc. 

 var milliSecs = toDate.getTime() - tempDate.getTime(); 
 var oneSecond = 1000; 
 var oneMinute = 60 * 1000; 
 var oneHour = 60 * oneMinute; 
 var oneDay = 24 * oneHour; 
 var oneWeek = 7 * oneDay; 
 var weeks = Math.floor(milliSecs / oneWeek); 
 milliSecs -= weeks * oneWeek; 
 var days = Math.floor(milliSecs / oneDay); 
 milliSecs -= days * oneDay; 
 var hours = Math.floor(milliSecs / oneHour); 
 milliSecs -= hours * oneHour; 
 var minutes = Math.floor(milliSecs / oneMinute); 
 milliSecs -= minutes * oneMinute; 
 var seconds = Math.floor(milliSecs / oneSecond); 
 var timeValue = ""; 

 if (years) timeValue += years + ((years==1) ? " year, " : " years, "); 
 if (months) timeValue += months + ((months==1) ? " month, " : " months, "); 
 if (weeks) timeValue += weeks + ((weeks==1) ? " week, " : " weeks, "); 
 if (days) timeValue += days + ((days==1) ? " day, " : " days, "); 

 var timeValueDays = timeValue.substring(0 , timeValue.length - 2); 
 timeValue += hours + ((hours==1) ? " hour, " :" hours, "); 
 timeValue += minutes + ((minutes==1) ? " minute, and " : " minutes, and "); 
 timeValue += seconds + ((seconds==1) ? " second" : " seconds"); 
 this.years = years; 
 this.months = months; 
 this.weeks = weeks; 
 this.days = days; 
 this.hours = hours; 
 this.minutes = minutes; 
 this.seconds = seconds; 
 this.text = timeValue; 
 this.textDays = timeValueDays; 
 } 

 function dateAsNumber(inDate,inWhat) { 

 var what = "", yearBit = 0, monthBit = 0 
 if (typeof(inWhat) == "undefined" || inWhat.toString() == "" || inWhat.toString() == null) inWhat = "" 
 what = inWhat.toString().toUpperCase() 
 if (what != "M" && what != "D") // we want yyyy bit 
 yearBit = inDate.getFullYear() * Math.pow(10,13); 
 if (what != "D") // we want month bit 
 monthBit = inDate.getMonth() * Math.pow(10,11); 
 return yearBit + 
 monthBit + 
 inDate.getDate() * Math.pow(10,09) + 
 inDate.getHours() * Math.pow(10,07) +
 inDate.getMinutes() * Math.pow(10,05) + 
 inDate.getSeconds() * Math.pow(10,03) + 
 inDate.getMilliseconds() 
 } 

 function ageClock() { 

 var leaveDate = new Date(2006,00,04,12,00) 
 var now = new Date(); 
 var elapsed = new ElapsedTime(leaveDate,now);
 return elapsed.text;
 }

 function getElement(id) {

 return document.all ? document.all(id) : 
 document.getElementById ? document.getElementById(id) :
 document.layers ? document.layers[id] : 
 null;
 }

 function update() {

 var text = ageClock();
 var aD = getElement('ageDisplay');
 if (!aD) return;
 if (!document.layers) {
 aD.innerHTML = text + ' ';
 } else {
 aD.document.write('<SPAN>' + text + ';</SPAN>');
 aD.document.close();
 }

 setTimeout('update()',1000);
 }

 /* NS4 resize bug fix from webreference.com */
 if (document.layers) {

 origWidth = innerWidth;
 origHeight = innerHeight;
 }

 if (document.layers) window.onresize = function() {
     if (innerWidth != origWidth || innerHeight != origHeight) 
         location.reload();
}

 /********************************************/
