﻿// JScript File

//this function will unescape JSON specific characters in Google's JSON feeds.
function rep (string) {
    var i = 1;
    return string.gsub("Ã©","é").gsub("Ã«","ë").gsub("Ã§","ç").gsub("â€™","'").gsub("Ã¨","è").gsub("Ã","à").gsub("â€˜","'").gsub("â€¦","…").gsub("à´","ô").gsub("àª","ê").gsub("à»","û").gsub("Â«","«").gsub("Â»","»").gsub("à®","î").gsub("â‚¬","€").gsub("à¯","ï");  
}


// ==========================================================================
/**
 * Singleton object used to convert Dates from one format to another.
 */
var DateConverter = {
	rfc3339toDate: function(t){
		t = t.substr(0,19).replace(/-/g,"/").replace("T"," ");
		var dt = new Date();
		dt.setTime(Date.parse(t));
		return dt;
	},
	JSDateToText: function(date) {
	    var months = {0: '01',1:'02',2:'03',3:'04',4:'05',5:'06',6:'07',7:'08',8:'09',9: '10',10:'11',11:'12'};
	    return date.getDate()+"/"+months[date.getMonth()]+"/"+date.getFullYear();
	},
	JSDateToTime: function(date) {	    
	    return date.getHours()+":"+(date.getMinutes()<10?"0" + date.getMinutes():date.getMinutes());
	}	
};
