

function timeweather(){	
	
	var twidget = new Widget({
		style: 'margin: 4px; float: left; width: 100px; height: 100px; position: relative; z-index: 1000000; border: 0px solid black; background-image: url(images/widgets/wbg20.png); box-shadow: 0px 0px 4px 0.5px;', 
		className: 'draggable cloneable',
		set: 'timeweather',
		id: 'Default-Widget-12'
	});
	
	var tpart = new WidgetPart({
		widget: twidget, 
		style: 'position: relative; z-index: 1000000; text-align: left;', 
		className: 'item_child',
		element: makeElement('div', ''),
		responsive: true,
		resize: function(){
		},
		update: function(){
			if (undef(this.element)) return;
		},
		fn: {
		},
		init: function(){
			this.fn.selfid = this.id;
		}
	});
	tpart.element.style.cssText += 'height: 12%; width: 100%; background-color: black; color: white;';
	
	var tpart2 = new WidgetPart({
		widget: twidget, 
		style: 'position: relative; z-index: 1000000; text-align: center; font-family: time', 
		className: 'item_child',
		element: makeElement('div', 'Time +<br>Weather'),
		responsive: true,
		resize: function(){
		},
		update: function(){
			if (undef(this.element)) return;
			this.element.innerHTML = '&nbsp;<strong>' + getDateTime().timestring + '</strong>';
		},
		fn: {
		},
		init: function(){
			this.fn.selfid = this.id;
			
			$(this.element).flowtype({
				fontRatio: 3.0,
				lineRatio: 1
			});
		},
		ontopanel: function(){
			this.element.style.textAlign = "left";
		}
	});
	tpart2.element.style.cssText += 'cursor: default; height: 88%; width: 100%; color: white; -webkit-box-shadow: inset 0 0 60px rgba(0,0,0,0.4);';
	
	var tpart3 = new WidgetPart({
		widget: twidget, 
		style: 'position: absolute; left: 3%; top: 4%; z-index: 1000000; text-align: left; font-family: time', 
		className: 'item_child',
		element: makeElement('div', ''),
		responsive: true,
		resize: function(){
		},
		update: function(){
			if (undef(this.element)) return;
		},
		fn: {
		},
		init: function(){
			this.fn.selfid = this.id;
			
			$(this.element).flowtype({
				fontRatio: 35.0,
				lineRatio: 1
			});
			
			if (this.onpanel) this.ontopanel();
		},
		ontopanel: function(){
			
			this.element.innerHTML = 
				'<strong><span id="sun" style="color: grey; text-shadow: 0 0 0.2em #111; font-weight: bold;">SUN&nbsp;</span></strong>'+
				'<strong><span id="mon" style="color: grey; text-shadow: 0 0 0.2em #111; font-weight: bold;">MON&nbsp;</span></strong>'+
				'<strong><span id="tue" style="color: grey; text-shadow: 0 0 0.2em #111; font-weight: bold;">TUE&nbsp;</span></strong>'+
				'<strong><span id="wed" style="color: grey; text-shadow: 0 0 0.2em #111; font-weight: bold;">WED&nbsp;</span></strong>'+
				'<strong><span id="thu" style="color: grey; text-shadow: 0 0 0.2em #111; font-weight: bold;">THU&nbsp;</span></strong>'+
				'<strong><span id="fri" style="color: grey; text-shadow: 0 0 0.2em #111; font-weight: bold;">FRI&nbsp;</span></strong>'+
				'<strong><span id="sat" style="color: grey; text-shadow: 0 0 0.2em #111; font-weight: bold;">SAT</span></strong>';
				
			var day = getDateTime().weekday;
			
			switch (day) {
				case 'Sunday':
					$('#sun').css({color: 'white', 'text-shadow': '0 0 7px #fff;'});
					break;
				case 'Monday':
					$('#mon').css({color: 'white', 'text-shadow': '0 0 0.7em #fff;'});
					break;
				case 'Tuesday':
					$('#tue').css({color: 'white', 'text-shadow': '0 0 0.7em #fff;'});
					break;
				case 'Wednesday':
					$('#wed').css({color: 'white', 'text-shadow': '0 0 0.7em #fff;'});
					break;
				case 'Thursday':
					$('#thu').css({color: 'white', 'text-shadow': '0 0 0.7em #fff;'});
					break;
				case 'Friday':
					$('#fri').css({color: 'white', 'text-shadow': '0 0 7px #fff;'});
					break;
				case 'Saturday':
					$('#sat').css({color: 'white', 'text-shadow': '0 0 0.7em #fff;'});
					break;
				default:
					break;
			}
		}
	});
	tpart3.element.style.cssText += 'height: 15%; width: 85%; color: white;';
	
	var tpart4 = new WidgetPart({
		widget: twidget, 
		style: 'position: absolute; right: 3%; top: 4%; z-index: 1000000; text-align: right; font-family: time', 
		className: 'item_child',
		element: makeElement('div', ''),
		responsive: true,
		resize: function(){
		},
		update: function(){
			if (undef(this.element)) return;
		},
		fn: {
		},
		init: function(){
			this.fn.selfid = this.id;
			
			$(this.element).flowtype({
				fontRatio: 35.0,
				lineRatio: 1
			});
			
			if (this.onpanel) this.ontopanel();
		},
		ontopanel: function(){
			
			this.element.innerHTML = 
				'<strong><span id="jan" style="color: grey; text-shadow: 0 0 0.2em #111; font-weight: bold;">JAN&nbsp;</span></strong>'+
				'<strong><span id="feb" style="color: grey; text-shadow: 0 0 0.2em #111; font-weight: bold;">FEB&nbsp;</span></strong>'+
				'<strong><span id="mar" style="color: grey; text-shadow: 0 0 0.2em #111; font-weight: bold;">MAR&nbsp;</span></strong>'+
				'<strong><span id="apr" style="color: grey; text-shadow: 0 0 0.2em #111; font-weight: bold;">APR&nbsp;</span></strong>'+
				'<strong><span id="may" style="color: grey; text-shadow: 0 0 0.2em #111; font-weight: bold;">MAY&nbsp;</span></strong>'+
				'<strong><span id="jun" style="color: grey; text-shadow: 0 0 0.2em #111; font-weight: bold;">JUN&nbsp;</span></strong>'+
				'<strong><span id="jul" style="color: grey; text-shadow: 0 0 0.2em #111; font-weight: bold;">JUL&nbsp;</span></strong>'+
				'<strong><span id="aug" style="color: grey; text-shadow: 0 0 0.2em #111; font-weight: bold;">AUG&nbsp;</span></strong>'+
				'<strong><span id="sep" style="color: grey; text-shadow: 0 0 0.2em #111; font-weight: bold;">SEP&nbsp;</span></strong>'+
				'<strong><span id="oct" style="color: grey; text-shadow: 0 0 0.2em #111; font-weight: bold;">OCT&nbsp;</span></strong>'+
				'<strong><span id="nov" style="color: grey; text-shadow: 0 0 0.2em #111; font-weight: bold;">NOV&nbsp;</span></strong>'+
				'<strong><span id="dec" style="color: grey; text-shadow: 0 0 0.2em #111; font-weight: bold;">DEC</span></strong>';
				
			var month = getDateTime().month;
			
			switch (month) {
				case 'January':
					$('#jan').css({color: 'white', 'text-shadow': '0 0 0.3em #fff;'});
					break;
				case 'February':
					$('#feb').css({color: 'white', 'text-shadow': '0 0 0.3em #fff;'});
					break;
				case 'March':
					$('#mar').css({color: 'white', 'text-shadow': '0 0 0.3em #fff;'});
					break;
				case 'April':
					$('#apr').css({color: 'white', 'text-shadow': '0 0 0.3em #fff;'});
					break;
				case 'May':
					$('#may').css({color: 'white', 'text-shadow': '0 0 0.3em #fff;'});
					break;
				case 'June':
					$('#jun').css({color: 'white', 'text-shadow': '0 0 0.3em #fff;'});
					break;
				case 'July':
					$('#jul').css({color: 'white', 'text-shadow': '0 0 0.3em #fff;'});
					break;
				case 'August':
					$('#aug').css({color: 'white', 'text-shadow': '0 0 0.3em #fff;'});
					break;
				case 'September':
					$('#sep').css({color: 'white', 'text-shadow': '0 0 0.3em #fff;'});
					break;
				case 'October':
					$('#oct').css({color: 'white', 'text-shadow': '0 0 0.3em #fff;'});
					break;
				case 'November':
					$('#nov').css({color: 'white', 'text-shadow': '0 0 0.3em #fff;'});
					break;
				case 'December':
					$('#dec').css({color: 'white', 'text-shadow': '0 0 0.3em #fff;'});
					break;
				default:
					break;
			}
		}
	});
	tpart4.element.style.cssText += 'height: 15%; width: 85%; color: white;';
	
	var tpart5 = new WidgetPart({
		widget: twidget, 
		style: 'position: absolute; right: 3%; top: 16%; z-index: 1000000; text-align: right; font-family: time', 
		className: 'item_child',
		element: makeElement('div', ''),
		responsive: true,
		resize: function(){
		},
		update: function(){
			if (undef(this.element)) return;
		},
		fn: {
		},
		init: function(){
			this.fn.selfid = this.id;
			
			$(this.element).flowtype({
				fontRatio: 35.0,
				lineRatio: 1
			});
			
			if (this.onpanel) this.ontopanel();
		},
		ontopanel: function(){
			
			this.element.innerHTML = 
				'<img id="am" src="images/widgets/am2.png" style="width: 50%; opacity: 0.38; position: absolute; left: 5%; top: 0;" />\
					<img id="pm" src="images/widgets/pm2.png" style="width: 50%; opacity: 0.38; position: absolute; left: 45%; top: 0;" />';
				
			var ampm = getDateTime().ampm;
			
			switch (ampm) {
				case 'am':
					$('#am').css({opacity: 1.0});
					$('#pm').css({opacity: 0.38});
					break;
				case 'pm':
					$('#am').css({opacity: 0.38});
					$('#pm').css({opacity: 1.0});
					break;
				default:
					break;
			}
		}
	});
	tpart5.element.style.cssText += 'width: 40%; color: white;';
	
	var tpart6 = new WidgetPart({
		widget: twidget, 
		style: 'position: absolute; display: none; left: 6%; top: 52%; z-index: 1000000; text-align: right; font-family: time', 
		className: 'item_child',
		element: makeElement('div', ''),
		responsive: true,
		resize: function(){
		},
		update: function(){
			if (undef(this.element)) return;
		},
		fn: {
		},
		init: function(){
			this.fn.selfid = this.id;
			
			$(this.element).flowtype({
				fontRatio: 35.0,
				lineRatio: 1
			});
			
			if (this.onpanel) this.ontopanel();
		},
		ontopanel: function(){
			this.element.style.display = "block";
			this.element.innerHTML = '';
		}
	});
	tpart6.element.style.cssText += 'width: 88%; height: 42%; color: white; background-color: black; border-radius: 20%/50%;\
			-webkit-box-shadow:0 0 15px #ffffff; ';
			
	var tpart7 = new WidgetPart({
		widget: twidget, 
		style: 'position: absolute; right: 6%; top: 52%; z-index: 1000000; text-align: left; font-family: time;', 
		className: 'item_child',
		element: makeElement('div', ''),
		responsive: true,
		resize: function(){
		},
		update: function(){
			//if (undef(this.element)) return;
		},
		fn: {
		},
		init: function(){
			this.fn.selfid = this.id;
			
			$(this.element).flowtype({
				fontRatio: 15.0,
				lineRatio: 0.85
			});
			
			if (this.onpanel) this.ontopanel();
		},
		ontopanel: function(){
		
			if (undef(pb.location)) locate();
			
			this.initInterval = runInterval(
				function(){
				
					getWeather(this);
					var tstring = this.weatherHTML;

					if (tstring) {
						
						this.weatherArray = [];
					
						this.weatherArray[0] = parseInt(tstring.substring(0, tstring.indexOf('|')));
						tstring = tstring.replace(this.weatherArray[0]+'|', '');
						this.weatherArray[1] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[1]+'|', '');
						this.weatherArray[2] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[2]+'|', '');
						this.weatherArray[3] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[3]+'|', '');
						this.weatherArray[4] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[4]+'|', '');
						this.weatherArray[5] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[5]+'|', '');
						this.weatherArray[6] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[6]+'|', '');
						this.weatherArray[7] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[7]+'|', '');
						this.weatherArray[8] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[8]+'|', '');
						this.weatherArray[9] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[9]+'|', '');
						this.weatherArray[10] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[10]+'|', '');
						this.weatherArray[11] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[11]+'|', '');
						this.weatherArray[12] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[12]+'|', '');
						this.weatherArray[13] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[13]+'|', '');
						this.weatherArray[14] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[14]+'|', '');
						this.weatherArray[15] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[15]+'|', '');
						this.weatherArray[16] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[16]+'|', '');
						this.weatherArray[17] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[17]+'|', '');
						this.weatherArray[18] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[18]+'|', '');
						this.weatherArray[19] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[19]+'|', '');
						this.weatherArray[20] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[20]+'|', '');
						this.weatherArray[21] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[21]+'|', '');
						this.weatherArray[22] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[22]+'|', '');
						this.weatherArray[23] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[23]+'|', '');
						this.weatherArray[24] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[24]+'|', '');
						this.weatherArray[25] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[25]+'|', '');
						this.weatherArray[26] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[26]+'|', '');
						this.weatherArray[27] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[27]+'|', '');
						this.weatherArray[28] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[28]+'|', '');
						this.weatherArray[29] = tstring.substring(0, tstring.indexOf('|'));
						tstring = tstring.replace(this.weatherArray[29]+'|', '');
						
						var wcodestring = '';
						switch (this.weatherArray[0]){
							case 32:
								wcodestring = '<div style="position: absolute; left: -33%; top: 23%;width: 30%;">\
									<img src="images/widgets/weather/weather (6).png" style="width: 100%;" />\
									</div>';
								break;
							case 30:
								wcodestring = '<div style="position: absolute; left: -33%; top: 23%;width: 30%;">\
									<img src="images/widgets/weather/weather (4).png" style="width: 100%;" />\
									</div>';
								break;
							default:
								wcodestring = '<div style="position: absolute; left: -33%; top: 23%;width: 30%;">\
									<img src="images/widgets/weather/weather (6).png" style="width: 100%;" />\
									</div>';
								break;
						}
						
						this.element.innerHTML = '<div style="position: absolute; left: -54%; top: 3%; width: 166.667%; text-align: center;">'
													+ this.weatherArray[1] + '</div>' +
												'<div style="position: absolute; left: 0%; top: 22%; font-size: 2em;">'
													+ this.weatherArray[2] + this.weatherArray[3] + '&deg;'
													+ this.weatherArray[4] + '</div>' +
												'<div style="position: absolute; left: 2%; top: 34%; font-size: 0.78em;">'
													+ '<br>&nbsp;&nbsp;&nbsp;' + this.weatherArray[5]
													+ this.weatherArray[6] + this.weatherArray[7]
													+ this.weatherArray[8] + this.weatherArray[9]
													+ '<br>&nbsp;&nbsp;&nbsp;'+ this.weatherArray[10]
													+ this.weatherArray[11] + this.weatherArray[12]
													+ this.weatherArray[13] + this.weatherArray[14]
													+ '<br>&nbsp;&nbsp;&nbsp;' + this.weatherArray[15]
													+ this.weatherArray[16] + this.weatherArray[17]
													+ this.weatherArray[18] + this.weatherArray[19]
													+ '<br>&nbsp;&nbsp;&nbsp;' + this.weatherArray[20]
													+ this.weatherArray[21] + this.weatherArray[22]
													+ this.weatherArray[23] + this.weatherArray[24]
													+ '<br>&nbsp;&nbsp;&nbsp;' + this.weatherArray[25]
													+ this.weatherArray[26] + this.weatherArray[27]
													+ this.weatherArray[28] + this.weatherArray[29]
													+ '</div>' +
													wcodestring +
													'';
						clearInterval(this.initInterval);
					}
				}.bind(this), 3000);
		}
	});
	tpart7.element.style.cssText += 'width: 60%; height: 40%; color: white;';

	twidget.addPart(tpart);
	twidget.addPart(tpart2);
	twidget.addPart(tpart3);
	twidget.addPart(tpart4);
	twidget.addPart(tpart5);
	twidget.addPart(tpart6);
	twidget.addPart(tpart7);
	
	return twidget;
}