NAME = Time and Date

CAN_EDIT_STYLE = 1
CAN_EDIT_STRINGS = 1
CAN_EDIT_BACKGROUND_IMAGE = [$DEFINITION]/background.png

INCLUDE_1 = 

BEGIN_BODY_ONLOAD

	<div id="[$DEF_name]Div" style="
	[$STYLE_background]
	[$STYLE_background-color]
	[$STYLE_color]
	[$STYLE_text-shadow]
	[$STYLE_font-family]
	[$STYLE_font-weight]
	[$STYLE_font-size]
	[$STYLE_height]
	[$STYLE_width]
	[$STYLE_margin]
	[$STYLE_padding]
	[$STYLE_font-style]
	[$STYLE_word-spacing]
	[$STYLE_text-align]
	[$STYLE_text-indent]
	[$STYLE_text-transform]
	[$STYLE_text-decoration]
	[$STYLE_line-height]
	[$STYLE_border]
	[$STYLE_border-top]
	[$STYLE_border-bottom]
	[$STYLE_border-left]
	[$STYLE_border-right]
	[$STYLE_position_element]
	[$STYLE_transform]
	min-height: 10px;
	overflow: hidden;
	">

		<span id="[$DEF_name]Text" style="display: none;
		[$STYLE_position_content]
		[$STYLE_reflection]
		">
		</span>
	  
	</div>
  
END_BODY_ONLOAD

BEGIN_ONLOAD

  [$DEF_name]Load();

END_ONLOAD

BEGIN_DEFINITION

	var [$DEF_name]Interval 	= 1000 * [$DEF_interval];
	var [$DEF_name]IntervalID 	= 0;
	var [$DEF_name]LastShown 	= 0;

	var [$DEF_name]WeekdayNames 			= new Array();
	var [$DEF_name]MonthNames 				= new Array();

	[$DEF_name]WeekdayNames['0'] 			= new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
	[$DEF_name]MonthNames['0']   			= new Array("January", "February", "March", "April", "May", "June", "July", "August","September", "October", "November", "December");

	[$LOCALIZABLE_STRINGS]

	//-------------------------------------------------------------

	function [$DEF_name]Load()
	{
		var CurrentTimestamp = new Date();
		var CurrentTime = CurrentTimestamp.getTime();
		
		delete CurrentTimestamp;
		
		if ([$DEF_name]LastShown + [$DEF_name]Interval - 1000 <= CurrentTime)
		{
			var CurrentHours24 		= CurrentTimestamp.getHours();
			var CurrentHours12 		= CurrentTimestamp.getHours();
			var CurrentMinutes 		= CurrentTimestamp.getMinutes();
			var CurrentSeconds 		= CurrentTimestamp.getSeconds();
			var CurrentWeekday 		= CurrentTimestamp.getDay();
			var CurrentDay    		= CurrentTimestamp.getDate();
			var CurrentMonth   		= CurrentTimestamp.getMonth();
			var CurrentYear    		= CurrentTimestamp.getFullYear();

			var FormatStr = "[$DEF_format]";
			var theText;

			var AmPm 					= "";
			var	WeekdayNames_			= [$DEF_name]WeekdayNames['0'];
			var MonthNames_				= [$DEF_name]MonthNames['0'];

			if ([$DEF_name]WeekdayNames[LANGUAGE] != undefined) 	WeekdayNames_ 	= [$DEF_name]WeekdayNames[LANGUAGE];
			if ([$DEF_name]MonthNames[LANGUAGE] != undefined) 		MonthNames_ 	= [$DEF_name]MonthNames[LANGUAGE];

			if (CurrentHours12 >= 12)	{AmPm = "PM"; CurrentHours12 = CurrentHours12 - 12;}
			else						AmPm = "AM";
				
			if (CurrentHours12 == 0)	CurrentHours12 = 12;

			theText = FormatStr;
			//---
			
			str = sprintf("%02d", CurrentHours12);
			theText = theText.replace(/\$HOUR012/g, str);
			theText = theText.replace(/\$HOUR12/g, CurrentHours12);
			
			theText = theText.replace(/\$AMPM/g, AmPm);
			
			str = sprintf("%02d", CurrentHours24);
			theText = theText.replace(/\$HOUR024/g, str);
			theText = theText.replace(/\$HOUR24/g, CurrentHours24);
			
			str = sprintf("%02d", CurrentMinutes);
			theText = theText.replace(/\$MINUTE0/g, str);
			theText = theText.replace(/\$MINUTE/g, CurrentMinutes);
			
			str = sprintf("%02d", CurrentSeconds);
			theText = theText.replace(/\$SECOND0/g, str);
			theText = theText.replace(/\$SECOND/g, CurrentSeconds);
			
			str = MonthNames_[CurrentMonth].substring(0, 3);
			theText = theText.replace(/\$MONTH_NAME3/g, str);
			theText = theText.replace(/\$MONTH_NAME/g, MonthNames_[CurrentMonth]);
			
			str = sprintf("%02d", CurrentMonth+1);
			theText = theText.replace(/\$MONTH0/g, str);
			theText = theText.replace(/\$MONTH/g, CurrentMonth+1);
			
			str = WeekdayNames_[CurrentWeekday].substring(0, 3);
			theText = theText.replace(/\$WEEKDAY3/g, str);
			theText = theText.replace(/\$WEEKDAY/g, WeekdayNames_[CurrentWeekday]);
			
			str = sprintf("%02d", CurrentDay);
			theText = theText.replace(/\$DAY0/g, str);
			theText = theText.replace(/\$DAY/g, CurrentDay);

			str = sprintf("%02d", CurrentYear-2000);
			theText = theText.replace(/\$YEAR0/g, str);
			theText = theText.replace(/\$YEAR/g, CurrentYear);

			//---
			
			document.getElementById("[$DEF_name]Text").style.display = 'block';
			document.getElementById("[$DEF_name]Text").innerHTML = theText;
			
			//---
			
			var CurrentTimestamp = new Date();
			[$DEF_name]LastShown = CurrentTimestamp.getTime();
			delete CurrentTimestamp;
		}

		if ([$DEF_name]IntervalID)
		{
			clearInterval( [$DEF_name]IntervalID );
			[$DEF_name]IntervalID = 0;
		}
		
		if ([$DEF_name]Interval)
			[$DEF_name]IntervalID = setInterval([$DEF_name]Load, [$DEF_name]Interval);
	}

END_DEFINITION

BEGIN_DEF

	DEF_name = 
	DEF_interval = 30
	DEF_format = [$HOUR12:$MINUTE0 $AMPM<br>$WEEKDAY, $MONTH_NAME $DAY '$YEAR0]

END_DEF

BEGIN_FORMAT_MENU
	
	BEGIN_FORMAT_ENTRY
		CODE = 1
		DESC = Default
		FORMAT = $HOUR12:$MINUTE0 $AMPM<br>$WEEKDAY, $MONTH_NAME $DAY '$YEAR0
	END_FORMAT_ENTRY

	//---
	
	BEGIN_FORMAT_ENTRY
		CODE = 0
		DESC = Hour (1..12)
		FORMAT = $HOUR12
	END_FORMAT_ENTRY
	
	BEGIN_FORMAT_ENTRY
		CODE = 0
		DESC = Hour (01..12)
		FORMAT = $HOUR012
	END_FORMAT_ENTRY
	
	BEGIN_FORMAT_ENTRY
		CODE = 0
		DESC = Hour (0..23)
		FORMAT = $HOUR24
	END_FORMAT_ENTRY
	
	BEGIN_FORMAT_ENTRY
		CODE = 0
		DESC = Hour (00..23)
		FORMAT = $HOUR024
	END_FORMAT_ENTRY
	
	BEGIN_FORMAT_ENTRY
		CODE = 0
		DESC = Minute (0..59)
		FORMAT = $MINUTE
	END_FORMAT_ENTRY
	
	BEGIN_FORMAT_ENTRY
		CODE = 0
		DESC = Minute (00..59)
		FORMAT = $MINUTE0
	END_FORMAT_ENTRY
	
	BEGIN_FORMAT_ENTRY
		CODE = 0
		DESC = Second (0..59)
		FORMAT = $SECOND
	END_FORMAT_ENTRY
	
	BEGIN_FORMAT_ENTRY
		CODE = 0
		DESC = Second (00..59)
		FORMAT = $SECOND0
	END_FORMAT_ENTRY
	
	BEGIN_FORMAT_ENTRY
		CODE = 0
		DESC = Am/Pm
		FORMAT = $AMPM
	END_FORMAT_ENTRY
	
	BEGIN_FORMAT_ENTRY
		CODE = 0
		DESC = Weekday
		FORMAT = $WEEKDAY
	END_FORMAT_ENTRY
	
	BEGIN_FORMAT_ENTRY
		CODE = 0
		DESC = Short Weekday
		FORMAT = $WEEKDAY3
	END_FORMAT_ENTRY
	
	BEGIN_FORMAT_ENTRY
		CODE = 0
		DESC = Month Name
		FORMAT = $MONTH_NAME
	END_FORMAT_ENTRY
	
	BEGIN_FORMAT_ENTRY
		CODE = 0
		DESC = Short Month Name
		FORMAT = $MONTH_NAME3
	END_FORMAT_ENTRY
	
	BEGIN_FORMAT_ENTRY
		CODE = 0
		DESC = Month (1..12)
		FORMAT = $MONTH
	END_FORMAT_ENTRY
	
	BEGIN_FORMAT_ENTRY
		CODE = 0
		DESC = Month (01..12)
		FORMAT = $MONTH0
	END_FORMAT_ENTRY
	
	BEGIN_FORMAT_ENTRY
		CODE = 0
		DESC = Day (1..31)
		FORMAT = $DAY
	END_FORMAT_ENTRY
	
	BEGIN_FORMAT_ENTRY
		CODE = 0
		DESC = Day (01..31)
		FORMAT = $DAY0
	END_FORMAT_ENTRY
	
	BEGIN_FORMAT_ENTRY
		CODE = 0
		DESC = Year
		FORMAT = $YEAR
	END_FORMAT_ENTRY
	
	BEGIN_FORMAT_ENTRY
		CODE = 0
		DESC = Short Year
		FORMAT = $YEAR0
	END_FORMAT_ENTRY
	
END_FORMAT_MENU
	
BEGIN_STYLE

	STYLE_position_element = 0px 0px;
	STYLE_position_content = 0px 0px;
	STYLE_transform = none;
	STYLE_padding = 0px 0px 2px 0px;
	STYLE_reflection = none;
	STYLE_font-size = 20px;
	STYLE_text-align = center;
	STYLE_height = 60px;
	STYLE_width = 300px;
	STYLE_background-color = none;
	STYLE_margin = 0px 0px 0px 0px;
	STYLE_border = none;
	STYLE_text-shadow = 4px 4px 4px rgba(0, 0, 0, 0.75);
	STYLE_font-family = Helvetica;
	STYLE_font-weight = bold;
	STYLE_color = rgba(255, 128, 128, 1);

	STYLE_background = 
	STYLE_font-style = 
	STYLE_word-spacing = 
	STYLE_text-align = 
	STYLE_text-indent = 
	STYLE_text-transform = 
	STYLE_text-decoration = 
	STYLE_line-height = 
	STYLE_border-top = 
	STYLE_border-bottom = 
	STYLE_border-left = 
	STYLE_border-right = 

END_STYLE
