
//Get the current system time
var systemTime = new Date();

//Initialize the encoding / decoding key using the following map: 
//    1 <-> F
//    2 <-> B
//    3 <-> D
//    4 <-> A
//    5 <-> C
//    6 <-> E
var key = new String("DBFACE");

//This function is used to decode the numeric representation of GMT time using the decoding key. 
function decodeGMTTime(){    	        

// Create a String object representing the system time. For reference, the GMT time is represented as a numeric value ( i.e. the number of milliseconds since January 1, 1970 00:00:00.
var gmtTime = new String(encodeGMTTime());
var replaceToken;
// Encode the time according to the encoding map
for (var index = 0; index < key.length; index++){
	replaceToken = new RegExp(key.charAt(index));
	gmtTime = gmtTime.replace(replaceToken, index+1);
	}
	return gmtTime;
}


// This function is used to encode the numeric representation of GMT time using the encoding key.
function encodeGMTTime(){

// Create a String object representing the system time. For reference, the GMT time is represented as a numeric value (i.e. the number of milliseconds since January 1, 1970 00:00:00.
var gmtTime = new String(getGMTTime(systemTime));
var replaceToken;
// Encode the time according to the encoding map
for (var index = 0; index < key.length; index++){
	replaceToken = new RegExp(index+1);
	gmtTime = gmtTime.replace(replaceToken, key.charAt(index));
	}
	return gmtTime;
}


// This function is used to convert the GMT time to its numeric representation. The way JavaScript handles dates is very similar to the way Java handles dates: both languages have many of the
// same date methods, and both store dates internally as the number of milliseconds since January 1, 1970 00:00:00. Dates prior to 1970 are not allowed.
function getGMTTime(){
	return Date.UTC(systemTime.getUTCFullYear(),
					systemTime.getUTCMonth(),
					systemTime.getUTCDate(),
					systemTime.getUTCHours(),
					systemTime.getUTCMinutes(),
					systemTime.getUTCSeconds(),
					systemTime.getUTCMilliseconds());
}


// This function is used to view the HTML source code.
function getSource(){
	window.location= "view-source:" + window.location;
}
