/** News-related Functions** &copy;Copyright Mike Brockington 2004 - 2011 All rights reserved.*  Build Number:6:* This version: 15/05/2011 22:19:41*/
function addFriendlyDates(pageName){if(!document.getElementsByTagName){return;}var listOfElements=document.getElementsByTagName("H3");
for(var i=(listOfElements.length - 1);i>=0;i--){appendRelativeDate(listOfElements[i], pageName, true);}var listOfElements=document.getElementsByTagName("time");for(var i=(listOfElements.length - 1);i>=0;i--){appendRelativeDate(listOfElements[i], pageName, false);}}function appendRelativeDate(thisElement, pageName, thisFlag){if(!thisElement){return;
}var thisText=thisElement.getAttribute("datetime") || getText(thisElement);if(isDate(thisText) ){var newText=getRelativeDate(thisText);var newNode=document.createTextNode( " ("+newText+") " );var newSpan=document.createElement("span");
newSpan.appendChild( newNode );if(thisFlag){newSpan.style["display"]="block";}newSpan.style["fontStyle"]="italic";thisElement.appendChild(newSpan);}}function getRelativeDate(numericDate){var dateArray=numericDate.match(/\d+/g);var thatYear=dateArray[0] - 0;
var thatMonth=dateArray[1] - 0;var thatDayNum=dateArray[2] - 0;var rightNow=new Date();var thisYear=rightNow.getFullYear();var thisMonth=rightNow.getMonth()+1;var thisDayNum=rightNow.getDate();var thisDofW=rightNow.getDay();var diffInMillis=( rightNow - (new Date(thatYear, (thatMonth - 1), thatDayNum)) );
var diffInHours=Math.round( diffInMillis / 3600000);if(diffInHours < 24){if(thatDayNum==thisDayNum){return "Today";}return "Less than 24 hours ago";}var diffInDays=Math.round( diffInHours / 24);if(diffInDays < 2){return "Yesterday";}if(diffInDays==2){return "Two Days ago";
}if(diffInDays==3){return "Three Days ago";}if(diffInDays < thisDofW){return "This Week";}var diffInWeeks=Math.round( diffInDays / 7);if(diffInWeeks < 1){return "Less than a Week ago";}if(diffInDays < (thisDofW+7)){return "Last Week";}if(diffInWeeks < 2){return "Less than two Weeks ago";}if((thisMonth==thatMonth)&&(thisYear==thatYear)){return "This Month";}if(diffInWeeks < 4)
{return "Less than a Month ago";}var diffInMonths=Math.round( diffInDays / 30.44);if(diffInMonths < 1){return "This Month";}if( ((thisMonth - 1)==thatMonth) && (thisYear==thatYear) ){return "Last Month";}if(diffInMonths < 3){return "This Quarter";}if(diffInMonths < 6){return "Last Quarter";}if(thisYear==thatYear){return "This Year";
}if(diffInMonths < 10){return "Less than a Year ago";}if((diffInMonths >=10) && (diffInMonths < 15)){return "About a Year ago";}if((thisYear - 1)==thatYear){return "Last Year";}if(diffInMonths < 22){return "Less than two Years ago";}if(diffInMonths < 27){return "About two Years ago";}if(diffInMonths < 38){return "About three Years ago";}var diffInYears=Math.round( diffInDays / 365.2422);
if(diffInYears < 10){return "This Decade";}if(diffInYears < 20){return "Last Decade";}return "Earlier...";}function isDate(dateString){return /\d\d\d\d.\d?\d.\d?\d/.test(dateString);}function getText(thisHTMLElement)
{if(!thisHTMLElement){return "";}var strReturn="";var theseNodes=thisHTMLElement.childNodes;for(var i=0;i< theseNodes.length;i++){var thisNode=theseNodes[i];if (thisNode.nodeType==1) {strReturn+=getText(thisNode);}if (thisNode.nodeType==3) {
strReturn+=thisNode.nodeValue;}}return strReturn;}
