 function y2k(number) { return (number < 1000) ? number + 1900 : number; } 
 function timeTillDate(whenDay,whenMonth,whenYear) { 
var now = new Date(); 
var thisDay = now.getDate(), thisMonth = now.getMonth() + 1, thisYear = y2k(now.getYear()); 
var yearsDifference = whenYear - thisYear, monthsDifference = 0, daysDifference = 0, string = ''; 
if (whenMonth >= thisMonth) monthsDifference = whenMonth - thisMonth; 
else { yearsDifference--; monthsDifference = whenMonth + 12 - thisMonth; } 
if (whenDay >= thisDay)daysDifference = whenDay - thisDay; 
else { if (monthsDifference > 0) monthsDifference--; 
else { yearsDifference--; monthsDifference+=11; } daysDifference = whenDay + 31 - thisDay; } 
if (yearsDifference < 0) 
return '<img src="gem_3.gif">'; 
if ((yearsDifference == 0) && (monthsDifference == 0) && (daysDifference == 0)) return ' <font color="#00FF00">i dag</font>'; 
if (yearsDifference > 0) { string = yearsDifference + ' år'; 
if (yearsDifference > 1) string += ''; string += ' '; }  
if (monthsDifference > 0) { string += monthsDifference + ' måned'; 
if (monthsDifference > 1) string += 'er'; string += ' '; } 
if (daysDifference > 0) { string += daysDifference + ' dag'; 
if (daysDifference > 1) string += 'e'; string += ' '; } 
var difference = Date.UTC(y2k(now.getYear()),now.getMonth(),now.getDate()) - Date.UTC(y2k(now.getYear()),now.getMonth(),now.getDate(),0,0,0); difference = 1000*60*60*24 - difference; 
return string; }

