NAME = Time Dependent Image

CAN_EDIT_STYLE = 1

CAN_EDIT_BACKGROUND_IMAGE = [$DEFINITION]/background.png

CAN_ADD_IMAGES = 1

BEGIN_BODY_ONLOAD

	<div id="[$DEF_name]Div" style="display: block;
	[$STYLE_background]
	[$STYLE_background-color]
	[$STYLE_height]
	[$STYLE_width]
	[$STYLE_margin]
	[$STYLE_padding]
	[$STYLE_border]
	[$STYLE_border-top]
	[$STYLE_border-bottom]
	[$STYLE_border-left]
	[$STYLE_border-right]
	[$STYLE_position_element]
	[$STYLE_transform]
	min-height: 1px;
	overflow: hidden;
	">

		<img id="[$DEF_name]Image" src="" alt="" style="display: none;
		width: 100%;
		height: 100%;
		[$STYLE_reflection]
		">

	</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;

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

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

			if (CurrentHours12 >= 12) 	CurrentHours12 = CurrentHours12 - 12;
			if (CurrentHours12 == 0)	CurrentHours12 = 12;
			
			delete dateObj;
			
			//---
			
			[$CONDITIONS]
			
			//---
			
			if (imgPath.length)
			{
				document.getElementById("[$DEF_name]Image").style.display = 'block';
				document.getElementById("[$DEF_name]Image").src = imgPath;
			}
			else
			{
				document.getElementById("[$DEF_name]Image").style.display = 'none';
			}
			
			//---
			
			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

END_DEF

BEGIN_COND

END_COND

BEGIN_CONDITION_MENU
	
	BEGIN_CONDITION_ENTRY
		DESC = Ignore
		VAR = 
	END_CONDITION_ENTRY
	
	BEGIN_CONDITION_ENTRY
		DESC = Hour (1..12)
		VAR = CurrentHours12
	END_CONDITION_ENTRY
	
	BEGIN_CONDITION_ENTRY
		DESC = Hour (0..23)
		VAR = CurrentHours24
	END_CONDITION_ENTRY
	
	BEGIN_CONDITION_ENTRY
		DESC = Minute (0..59)
		VAR = CurrentMinutes
	END_CONDITION_ENTRY
	
	BEGIN_CONDITION_ENTRY
		DESC = Second (0..59)
		VAR = CurrentSeconds
	END_CONDITION_ENTRY
	
	BEGIN_CONDITION_ENTRY
		DESC = Weekday (0..6)
		VAR = CurrentWeekday
	END_CONDITION_ENTRY
	
	BEGIN_CONDITION_ENTRY
		DESC = Month (1..12)
		VAR = CurrentMonth
	END_CONDITION_ENTRY
	
	BEGIN_CONDITION_ENTRY
		DESC = Year
		VAR = CurrentYear
	END_CONDITION_ENTRY
	
END_CONDITION_MENU

BEGIN_STYLE

	STYLE_background = none;
	STYLE_width = 320px;
	STYLE_height = 480px;
	STYLE_padding = 0px 0px 0px 0px;
	STYLE_position_element = absolute; top: 0px; left: 0px;
	STYLE_background-color = none;
	STYLE_transform = none;
	STYLE_reflection = none;
	STYLE_margin = 0px 0px 0px 0px;
	STYLE_border = none;
	STYLE_border-top = none;
	STYLE_border-bottom = none;
	STYLE_border-left = none;
	STYLE_border-right = none;

END_STYLE
