// magictime.js converts all the dates from showthread into a more // useful display of 'how long ago' function ofClass(element, className) { return (new RegExp('(^|\\s+)' + className + '(\\s+|$)')).test(element.className); } function magictime() { //var now = new Date(); var elapsed; var years,months, days, hrs, mins, secs; var spans = document.getElementsByTagName('span'); var stime = document.getElementById('servertime'); var numspans = spans.length; var output; var now=stime.getAttribute("value"); for (var a = 0; a < numspans; ++a) { if(!(ofClass(spans[a],'magictime'))) continue; secs = (now)-spans[a].getAttribute("value"); // time in seconds mins = Math.round(secs/60); hrs = Math.round(mins/60); days = Math.round(hrs/24); months = Math.round(days/30); years = Math.round(days/365); if(years>1) output = (years)+' years ago'; else if(months>1) output = (months)+' months ago'; else if(days>1) output = (days)+' days ago'; else if(hrs>1) output = (hrs)+' hrs ago'; else if(mins>1) output = (mins)+' mins ago'; else output = (secs)+' secs ago'; //spans[a].innerHTML = output; // the DOM way: spans[a].firstChild.nodeValue=output; } } function toggleshow(id) { if(document.getElementById(id).style.display != "none") { document.getElementById(id).style.display = "none"; document.getElementById(id+'b').firstChild.nodeValue = "(+)"; //document.getElementById(id+'a').firstChild.nodeValue = ""; }else { //for(i=1;i