function dateToRelative(localTime){ var diff=new Date().getTime()-localTime; var ret=""; var min=60000; var hour=3600000; var day=86400000; var wee=604800000; var mon=2629800000; var yea=31557600000; if (diff<-yea*2) ret ="in ## years".replace("##",(-diff/yea).toFixed(0)); else if (diff<-mon*9) ret ="in ## months".replace("##",(-diff/mon).toFixed(0)); else if (diff<-wee*5) ret ="in ## weeks".replace("##",(-diff/wee).toFixed(0)); else if (diff<-day*2) ret ="in ## days".replace("##",(-diff/day).toFixed(0)); else if (diff<-hour) ret ="in ## hours".replace("##",(-diff/hour).toFixed(0)); else if (diff<-min*35) ret ="in about one hour"; else if (diff<-min*25) ret ="in about half hour"; else if (diff<-min*10) ret ="in some minutes"; else if (diff<-min*2) ret ="in few minutes"; else if (diff<=min) ret ="just now"; else if (diff<=min*5) ret ="few minutes ago"; else if (diff<=min*15) ret ="some minutes ago"; else if (diff<=min*35) ret ="about half hour ago"; else if (diff<=min*75) ret ="about an hour ago"; else if (diff<=hour*5) ret ="few hours ago"; else if (diff<=hour*24) ret ="## hours ago".replace("##",(diff/hour).toFixed(0)); else if (diff<=day*7) ret ="## days ago".replace("##",(diff/day).toFixed(0)); else if (diff<=wee*5) ret ="## weeks ago".replace("##",(diff/wee).toFixed(0)); else if (diff<=mon*12) ret ="## months ago".replace("##",(diff/mon).toFixed(0)); else ret ="## years ago".replace("##",(diff/yea).toFixed(0)); return ret; } //override date format i18n Date.monthNames = ["January","February","March","April","May","June","July","August","September","October","November","December"]; // Month abbreviations. Change this for local month names Date.monthAbbreviations = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]; // Full day names. Change this for local month names Date.dayNames =["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]; // Day abbreviations. Change this for local month names Date.dayAbbreviations = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]; // Used for parsing ambiguous dates like 1/2/2000 - default to preferring 'American' format meaning Jan 2. // Set to false to prefer 'European' format meaning Feb 1 Date.preferAmericanFormat = false; Date.firstDayOfWeek =0; Date.defaultFormat = "dd/MM/yyyy"; Number.decimalSeparator = "."; Number.groupingSeparator = ","; Number.minusSign = "-"; Number.currencyFormat = "###,##0.00"; var i18n = { FORM_IS_CHANGED:"You have some unsaved data on the page!", CLOSE:"close", YES:"yes", NO:"no", DOWNLOAD:"download", ERR_FIELD_MAX_SIZE_EXCEEDED:"Field max size exceeded", FLD_CONFIRM_DELETE:"FLD_CONFIRM_DELETE", INVALID_DATA:"INVALID_DATA", ERROR_ON_FIELD:"Error on field", DO_YOU_CONFIRM:"DO_YOU_CONFIRM", HIDE:"hide", SEE_MORE:"see more", MAX_LENGTH_EXCEEDED:"max length exceeded", MAX_VAL_REACHED:"Max suggested value reached!", REDIR_TO_NEW_DOCUMENT:"Save done. Do you want to be redirected to the new document?", REDIR_TO_NEW_QUIZ:"Save done. Do you want to be redirected to the new quiz?", // FO INVALID_MAIL:"Invalid e-mail", ERROR_LOADING_VERSION:"Sorry, there was an error loading the version", MISSING_AUDIO:"Missing audio", YOUR_BROWSER_DOESNOT_SUPPORT_FULLSCREEN:"Your browser does not support subtitles in fullscreen mode!", YOUR_BROWSER_DOESNT_SUPPORT_VIDEOALONG:"your browser does not support html5 video features!", MISSING_GLOSSARY_URL_IN_SETTINGS:"Glossary can\'t work properly as the \"glossary url\" value is missing in global settings", IMAGE:"image", OF:"of", SEARCH_IN_SITE:"search", FULL_SCREEN:"full screen", VALUES_DONT_MATCH:"The values ​​do not match" };