maxheight,56
height,56

initregion,1,0

calcvar,var29,fromconfig,numcities

//options,weathericondir,Weather Icons\Stardock,png
options,weathericondir,Weather Icons\Weather.com,png

//options,imagedir,Images\HandyPlus
options,imagedir,Images\Colors-3D


changefont,tahoma,11,
color,transparent,255_0_255
color,replacement,-1_6_-1,0_0_0
color,shadow,125_125_125
color,font,-1_4_-1

//=================================================
// REGION 1 - PAGE 0
//	Container for weather sections
//	Subregions: 2,3
//	Vars used:
//	Dimensions:  240 x 56
//=================================================
region,1,0,60
	defregion,1,0,0,240,56,6
	offset,offset_-1,offset_-1
	updateregions,2,3
	image,0,0,dotted_line.png,tr

	if,refresh
		color,font,125_125_125
	else
		color,font,-1_4_-1
	endif

	offsetadd,0,2

	//=================================================
	// REGION 3 - PAGE 0
	//	Weather forecast
	//	Vars used: 1
	//=================================================
	region,3,0,-1

		initvar,var0,1
		
		button,2,0,42,11,1,13,var0_1-highlight,		// DISPLAY NEXT CITY IF CITY NAME TAPPED, Thanks LightMan
		//imagebutton,226,2,right_arrow.png,t,1,13,var0_1

		button,45,0,180,11,0,7,1-highlight,0		// REFRESH FROM INTERNET IF DATES TAPPED, Thanks LightMan
		
		if,var,var0,,>,%var29%
			storevar,var0=1
		else
		endif
				
		load,city,%var0%

		changefont,tahoma,11,b
		text,24,0,[name],c
		changefont,tahoma,11,

		image,4,10,sunrise.png,
		suntime,%var0%,sunrise,civil,24,12,hh:mm,,,l
		//suntime,%var0%,sunrise,official,24,12,hh:mm,,,l

		image,4,24,sunset.png,
		suntime,%var0%,sunset,civil,24,26,hh:mm,,,l
		//suntime,%var0%,sunset,official,24,26,hh:mm,,,l

		suntime,%var0%,elevation,,3,40,%05.2f,Ele: ,,l

		offsetadd,48,0
		
		calcvar,var20,weatherupdatetimediff

		if,var,var20,,<,60
			color,replacement,-1_4_-1,0_0_0
			image,1,0,big_box.png,tr
			color,replacement,-1_6_-1,0_0_0

			changefont,tahoma,11,b
			text,23,0,Now,c
			changefont,tahoma,11,

			offsetadd,-2,-2
			todayicon,8,11,,t
			
			forecasticon,1,54,11,,t
			forecasticon,2,100,11,,t
			forecasticon,3,146,11,,t
			offsetadd,2,2

			button,6,12,32,32,3,4,100,1
			text,23,40,/,c
			today,realtemp,26,40,,,l
			today,temp,21,40,,,r

			button,52,12,32,32,3,4,200,1
			button,52,12,32,32,-1,6,var1=1
			button,98,12,32,32,3,4,200,1
			button,98,12,32,32,-1,6,var1=2
			button,144,12,32,32,3,4,200,1
			button,144,12,32,32,-1,6,var1=3

			changefont,tahoma,11,b
			forecast,date_ddd,1,69,0,,,c
			forecast,date_ddd,2,115,0,,,c
			forecast,date_ddd,3,161,0,,,c
			changefont,tahoma,11,

			forecast,high,1,97,16,,,r
			forecast,low,1,97,28,,,r
			forecast,precipitation,1,71,40,R: ,%,c

			forecast,high,2,143,16,,,r
			forecast,low,2,143,28,,,r
			forecast,precipitation,2,117,40,R: ,%,c

			forecast,high,3,189,16,,,r
			forecast,low,3,189,28,,,r
			forecast,precipitation,3,163,40,R: ,%,c
		else
			calcvar,var20,firstvalidforecastday
			
			if,var,var20,,<,6
				forecasticon,%var20%,6,9,,t
				button,6,12,32,32,3,4,200,1
				button,6,12,32,32,-1,6,var1=%var20%
				changefont,tahoma,11,b
				forecast,date_ddd,%var20%,23,0,,,c
				changefont,tahoma,11
				forecast,high,%var20%,51,16,,,r
				forecast,low,%var20%,51,28,,,r
				forecast,precipitation,%var20%,25,40,R: ,%,c
				addvar,var20,1
			else
				image,6,9,none.png,t
			endif
			
			if,var,var20,,<,6
				forecasticon,%var20%,52,9,,t
				button,52,12,32,32,3,4,200,1
				button,52,12,32,32,-1,6,var1=%var20%
				changefont,tahoma,11,b
				forecast,date_ddd,%var20%,69,0,,,c
				changefont,tahoma,11,				
				forecast,high,%var20%,97,16,,,r
				forecast,low,%var20%,97,28,,,r
				forecast,precipitation,%var20%,71,40,R: ,%,c				
				addvar,var20,1
			else
				image,52,9,none.png,t
			endif
			
			if,var,var20,,<,6
				forecasticon,%var20%,98,9,,t
				button,98,12,32,32,3,4,200,1
				button,98,12,32,32,-1,6,var1=%var20%
				changefont,tahoma,11,b
				forecast,date_ddd,%var20%,115,0,,,c
				changefont,tahoma,11,							
				forecast,high,%var20%,143,16,,,r
				forecast,low,%var20%,143,28,,,r
				forecast,precipitation,%var20%,117,40,R: ,%,c				
				addvar,var20,1
			else
				image,98,9,none.png,t
			endif

			if,var,var20,,<,6
				forecasticon,%var20%,144,9,,t
				button,144,12,32,32,3,4,200,1
				button,144,12,32,32,-1,6,var1=%var20%
				changefont,tahoma,11,b
				forecast,date_ddd,%var20%,161,0,,,c
				changefont,tahoma,11,							
				forecast,high,%var20%,189,16,,,r
				forecast,low,%var20%,189,28,,,r
				forecast,precipitation,%var20%,163,40,R: ,%,c				
				addvar,var20,1
			else
				image,144,9,none.png,t
			endif

			
		endif

		offsetadd,-48,0			
		offsetadd,0,54

	endregion,3,0
	//=================================================
	// REGION 3 - PAGE 100
	// Current Weather Details
	//=================================================
	region,3,100,-1
		load,city,%var0%
		button,0,0,240,54,3,3,,1
		changefont,tahoma,11,b
		text,23,0,[name],c
		todayicon,6,9,,t
		offsetadd,0,1
		today,sky,145,0,,,c
		changefont,tahoma,11,
		today,realtemp,140,24,,F,r
		changefont,tahoma,11,
		text,51,12,Temperature:,l
		today,temp,140,12,,F,r
		text,51,24,Feels Like:,l
		text,51,36,Barometer:,l
		today,barometer,140,36,, in,r
		today,humidity,235,12,,%,r
		text,150,12,Humidity:,l
		text,150,24,UV:,l
		today,uv,235,24,,,r
		text,150,36,Wind:,l
		today,windspeed,235,36,, mph,r
		today,winddir,200,36,,,r

		offsetadd,0,53
	endregion,3,100

	//=================================================
	// REGION 3 - PAGE 200
	//	Vars used: 1
	//=================================================
	region,3,200,-1
		load,city,%var0%
		button,0,0,240,54,3,3,,1
		changefont,tahoma,11,b
		forecast,date_ddd,%var1%,24,0,,,c
		changefont,tahoma,11,
		forecasticon,%var1%,6,9,,t
		nightforecasticon,%var1%,200,9,,t		
		changefont,tahoma,11,b
		text,217,0,Night,c
		changefont,tahoma,11
		forecast,text,%var1%,120,2,Day: ,,c
		forecast,nighttext,%var1%,120,14,Night: ,,c
		offsetadd,-15,14	
		forecast,high,%var1%,125,12,,F,r
		forecast,low,%var1%,195,12,,F,r
		forecast,precipitation,%var1%,205,24,,%,r
		text,75,12,High:,l
		text,145,12,Low:,l
		text,60,24,Chance of Precipitation:,l
		offsetadd,15,40
	endregion,3,200
		
	color,font,-1_4_-1		
endregion,1,0