Date.prototype.dateFormat = function(Mask) {
  var FormattedDate = "";
  var MaskChars = "dmy";
  var Ref_MonthFullName = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
  var Ref_MonthAbbreviation = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
  var Ref_DayFullName = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"];
  var Ref_DayAbbreviation = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
 
   // Convert any supported simple masks into "real" masks
  switch (Mask) {
   case "short":
    Mask = "d/m/yy";  
   break;
   case "medium":
    Mask = "d mmm, yyyy";
   break;
   case "long":
    Mask = "d mmmm, yyyy";
   break;
   case "full":
    Mask = "dddd, d mmmm, yyyy";
   break;
  };
 
   // Tack a temporary space at the end of the mask to ensure that the last character isn't a mask character
  Mask += " ";
 
   // Parse the Mask
  var CurChar;
  var MaskPart = "";
  for ( var Cnt = 0; Cnt < Mask.length; Cnt++ ) {
    // Get the character
   CurChar = Mask.charAt(Cnt);
    // Determine if the character is a mask element
   if ( ( MaskChars.indexOf(CurChar) == -1 ) || ( MaskPart != "" && CurChar != MaskPart.charAt(MaskPart.length - 1) ) ) {
     // Determine if we need to parse a MaskPart or not
    if ( MaskPart != "" ) {
      // Convert the mask part to the date value
     switch (MaskPart) {
      case "d":
       FormattedDate += this.getDate();
       break;
      case "dd":
       FormattedDate += ("0" + this.getDate()).slice(-2);
       break;
      case "ddd":
       FormattedDate += Ref_DayAbbreviation[this.getDay()];
       break;
      case "dddd":
       FormattedDate += Ref_DayFullName[this.getDay()];
       break;
      case "m":
       FormattedDate += this.getMonth() + 1;
       break;
      case "mm":
       FormattedDate += ("0" + (this.getMonth() + 1)).slice(-2);
       break;
      case "mmm":
       FormattedDate += Ref_MonthAbbreviation[this.getMonth()];
       break;
      case "mmmm":
       FormattedDate += Ref_MonthFullName[this.getMonth()];
       break;
      case "yy":
       FormattedDate += ("0" + this.getFullYear()).slice(-2);
       break;
      case "yyyy":
       FormattedDate += ("000" + this.getFullYear()).slice(-4);
       break;
     };
      // Reset the MaskPart to nothing
     MaskPart = "";
    };
     // If the char is a mask char, start a new mask part, otherwise, dump it to the output
    if ( MaskChars.indexOf(CurChar) > -1 ) {
     MaskPart = CurChar;
    } else {
     FormattedDate += CurChar;
    };
   } else {
     // Add the current mask character to the MaskPart
    MaskPart += CurChar;
   };
  };
 
   // Remove the temporary space from the end of the formatted date
  FormattedDate = FormattedDate.substring(0,FormattedDate.length - 1);
 
   // Return the formatted date
  return FormattedDate;
 
 };
function displayClock(){ 
	theTime=setTimeout('displayClock()',1000);
	d = new Date();
	hr= d.getHours();
	mn= d.getMinutes();
	
	if(mn < 10)
	{
		mn = "0" + mn;
	}
	
	timeType = "AM";
	if(hr >= 12)
	{
		timeType = "PM"
	}
	
	tot=''+hr +"<span id='clockColumn'>:</span>"+mn + " " + timeType ;
	$("#clock-holder").html(tot)
	flashClockColumn()
}
 
var colockColumnVisible = true; 
function flashClockColumn()
{
	if(colockColumnVisible)
	{
		$("#clockColumn").css('visibility', 'hidden')
		colockColumnVisible = false;
	}
	else
	{
		$("#clockColumn").css('visibility', 'visible')
		colockColumnVisible = true
	}
}

function displayTime()
{
	var today = new Date();
	document.write("-- " + today.dateFormat("dddd d mmmm, yyyy") + " // <span id='clock-holder'></span> --");
	displayClock();
}


