<html><head>
<!---------------------------------------------------------------------------------------------------------------->
<!-- Style section Clock/Date-->
<style>
body {
	margin: 0;
}
SPAN#clock
{
	font: 27px "Helvetica";
	font-weight: 100; 
	color: white;
	text-shadow: 0px 0px 1px black; 
       -webkit-mask-image: -webkit-gradient(linear, left top, left bottom, from(#666), to(transparent), color-stop(0.4, #666));
}
SPAN#secs
{
	font: 20px "Helvetica";
	font-weight: 100; 
	color: DeepSkyBlue;
	text-shadow: 0px 0px 1px black; 
       -webkit-mask-image: -webkit-gradient(linear, left top, left bottom, from(#666), to(transparent), color-stop(0.6, #666));
}
    SPAN#date
{
	font: 14px "Helvetica";
	font-weight: 100;
       color: DeepSkyBlue;
	text-shadow: 0px 0px 1px black;
       -webkit-mask-image: -webkit-gradient(linear, left top, left bottom, from(#666), to(transparent), color-stop(0.6, #666));
}
    SPAN#month
{
	font: 14px "Helvetica";
	font-weight: 100;
       color: white;
	text-shadow: 0px 0px 1px black;
       -webkit-mask-image: -webkit-gradient(linear, left top, left bottom, from(#666), to(transparent), color-stop(0.6, #666));
}
    SPAN#weekday
{
	font: 14px "Helvetica";
	font-weight: 100;
       color: white;
	text-shadow: 0px 0px 1px black;
       text-transform: lowercase; 
       -webkit-mask-image: -webkit-gradient(linear, left top, left bottom, from(#666), to(transparent), color-stop(0.6, #666));
}
#WeatherContainer{
    background-color: rgba(0,0,0,0);
}
#TextContainer{
    font-size:18px;
    font-family: Helvetica;
    font-weight: bold;
    color:black;
}
#city{
	position: absolute;top: 371px; left: 0px; width: 320px; height: 480px; text-align: center; z-index: 15;
	font: 11px "Helvetica";
	font-weight: 100;
	color: white;
	text-transform: uppercase;
	text-shadow: 0px 0px 1px black;
}
#temp{
       display: none;
}
#desc{
	display: none;
}
#TextContainer p{
	margin:0;
}
#weatherIcon{
	 position: absolute;top: 0px; left: 0px; z-index: -15;
	 width: 320px; 
	 height: 480px;
	opacity: 0.9;
}
#forecastTable{
	color: #bd0202; 
	text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.7), 0 0px 3px #000000;
	font-size: 11px;
	font-weight: 100;
	text-align:center;
	text-transform: uppercase;
	letter-spacing: 30px;
}
</style>
<!---------------------------------------------------------------------------------------------------------------->
<!-- Direct the script to the general folder where the weather icons are located -->
<base href="Private/"/>
<!---------------------------------------------------------------------------------------------------------------->
<script type="text/javascript">
function init ( )
{
  timeDisplay = document.createTextNode ( "" );
document.getElementById("clock").appendChild ( timeDisplay );
}
function updateClock ( )
{
  var currentTime = new Date ( );
  var currentHours = currentTime.getHours ( );
  var currentMinutes = currentTime.getMinutes ( );
  var currentSeconds = currentTime.getSeconds ( );
  // Pad the minutes and seconds with leading zeros, if required
  currentHours = ( currentHours < 10 ? "0" : "" ) + currentHours;
  currentMinutes = ( currentMinutes < 10 ? "0" : "" ) + currentMinutes;
  currentSeconds = ( currentSeconds < 10 ? "0" : "" ) + currentSeconds;
/*---------------------------------------------------------------------------------------------------------------------------------12 hours to 24 hour Edit------*/
/* Remove the /* from under this line to display the 12 hours clock */	/* NEW!! */
/*
  // Choose either "AM" or "PM" as appropriate
  var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";
  // Convert the hours component to 12-hour format if needed
  currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
  // Convert an hours component of "0" to "12"
  currentHours = ( currentHours == 0 ) ? 12 : currentHours;
/*-----------------------------------------------------------------------------------------------------------------------------------------------*/
  // Compose the string for display
  var currentTimeString = currentHours + ":" + currentMinutes;
  var currentTimeString1 = ":" + currentSeconds;
  // Update the time display
document.getElementById("clock").firstChild.nodeValue = currentTimeString;
document.getElementById("secs").firstChild.nodeValue = currentTimeString1;
}
function init2 ( )
{
  timeDisplay = document.createTextNode ( "" );
  document.getElementById("ampm").appendChild ( timeDisplay );
}
function amPm ( )
{
  var currentTime = new Date ( );
  var currentHours = currentTime.getHours ( );
/*---------------------------------------------------------------------------------------------------------------------------------AM PM Edit------*/
/* Remove the /* from under this line to display am or pm after the 12 hours clock */  /* NEW!! */
  // Choose either "AM" or "PM" as appropriate
  var timeOfDay = ( currentHours < 12 ) ? "AM" : "PM";
  // Convert the hours component to 12-hour format if needed
  currentHours = ( currentHours > 12 ) ? currentHours - 12 : currentHours;
  // Convert an hours component of "0" to "12"
  currentHours = ( currentHours == 0 ) ? 12 : currentHours;
  // Compose the string for display
  var currentTimeString = timeOfDay;
  // Update the time display
document.getElementById("ampm").firstChild.nodeValue = currentTimeString;
}
function init3 ( )
{
  timeDisplay = document.createTextNode ( "" );
  document.getElementById("date").appendChild ( timeDisplay );
}
function calendarDate ( )
{
    var this_date_name_array = new Array("00","01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31")
    var this_weekday_name_array = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
    var this_month_name_array = new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","Nov","Dec")	//predefine month names
  var this_date_timestamp = new Date()	  
  var this_weekday = this_date_timestamp.getDay()    
  var this_date = this_date_timestamp.getDate()    
  var this_month = this_date_timestamp.getMonth()  
  var this_year = this_date_timestamp.getYear()  
if (this_year < 1000)
    this_year+= 1900;
if (this_year==101)
    this_year=2001;	   
document.getElementById("date").firstChild.nodeValue = this_date_name_array[this_date] + " " //concat long date string
document.getElementById("month").firstChild.nodeValue = this_month_name_array[this_month] //concat long date string
document.getElementById("weekday").firstChild.nodeValue = this_weekday_name_array[this_weekday] + " " //concat long date string
}
// -->
<!-- Weather LEGACY -->
	var locale = "RPXX0017"
	var isCelsius = true
	var useRealFeel = false
	var enableWallpaper = true;
	var enableLockScreen = true;
	var stylesheetWall = 'mini'
	var stylesheetLock = 'mini'
	var stylesheet = 'mini'
	var iconSetWall = 'Legacy Sch Big'
	var iconExtWall = ".png"
	var iconSetLock = 'Legacy Sch Big'
	var iconExtLock = '.png'
	var source = 'yahooWeather'
	var updateInterval = 1200
	var postal;
	var demoMode = false;
	var enabled;
	if (location.href.indexOf("LockBackground")  == -1){
		stylesheet = stylesheetWall;
		iconSet = iconSetWall;
		iconExt = iconExtWall;
		enabled = enableWallpaper;
	}else{
		stylesheet = stylesheetLock;
		iconSet = iconSetLock;
		iconExt = iconExtLock;
		enabled = enableLockScreen;
	}
	if(enabled == true){
		if(iconSet == null || iconSet == 'null' || iconSet == ""){
		var iconSet = stylesheet;
	}
	var headID = document.getElementsByTagName("head")[0];	       
	var styleNode = document.createElement('link');
	styleNode.type = 'text/css';
	styleNode.rel = 'stylesheet';
	styleNode.href = 'Stylesheets/'+stylesheet+'.css';
	headID.appendChild(styleNode);
	var scriptNode = document.createElement('script');
	scriptNode.type = 'text/javascript';
	scriptNode.src = 'Sources/'+source+'.js';
	headID.appendChild(scriptNode);
	}
function onLoad(){
	if (enabled == true){ 
	if (demoMode == true){
		document.getElementById("weatherIcon").src="Icon Sets/"+iconSet+"/"+"cloudy1"+iconExt;
		document.getElementById("city").innerText="Somewhere";
		document.getElementById("desc").innerText="Partly Cloudy";
		document.getElementById("temp").innerText="100º";
		
	}else{ 
	document.getElementById("weatherIcon").src="Icon Sets/"+iconSet+"/"+"dunno"+iconExt;
	validateWeatherLocation(escape(locale).replace(/^%u/g, "%"), setPostal)
	}
	}else{
		document.getElementsByTagName("body")[0].innerText='';
	}
}
function convertTemp(num)
{
	if (isCelsius == true)
		return Math.round ((num - 32) * 5 / 9);
	else
		return num;
}
function setPostal(obj){
	
	if (obj.error == false){
		if(obj.cities.length > 0){
			postal = escape(obj.cities[0].zip).replace(/^%u/g, "%")
			document.getElementById("WeatherContainer").className = "";	
			weatherRefresherTemp();
		}else{
			document.getElementById("city").innerText="Not Found";
			document.getElementById("WeatherContainer").className = "errorLocaleNotFound";	
		}
	}else{
		document.getElementById("city").innerText=obj.errorString;
		document.getElementById("WeatherContainer").className = "errorLocaleValidate";	
		setTimeout('validateWeatherLocation(escape(locale).replace(/^%u/g, "%"), setPostal)', Math.round(1000*60*5));
	}
}
function dealWithWeather(obj){
	if (obj.error == false){
		document.getElementById("city").innerText=obj.city;
		document.getElementById("desc").innerText=obj.description.toLowerCase();
		
		if(useRealFeel == true){
			tempValue = convertTemp(obj.realFeel);
		}else{
			tempValue = convertTemp(obj.temp)
		}
		document.getElementById("city").innerHTML=obj.city.toLowerCase() + " " + tempValue+ "°" + " " + obj.description.toLowerCase();
		document.getElementById("weatherIcon").src="Icon Sets/"+iconSet+"/"+MiniIcons[obj.icon]+iconExt;
		document.getElementById("WeatherContainer").className = "";	
		
	}else{
		//Could be down to any number of things, which is unhelpful...
		document.getElementById("WeatherContainer").className = "errorWeatherDataFetch";	
	}
	
	
}
function weatherRefresherTemp(){
	fetchWeatherData(dealWithWeather,postal);
	setTimeout(weatherRefresherTemp, 60*1000*updateInterval);
}
var MiniIcons =
[
	"tstorm3",		//0	tornado
	"tstorm3",		//1	tropical storm
	"tstorm3",		//2	hurricane
	"tstorm3",		//3	severe thunderstorms
	"tstorm2",		//4	thunderstorms
	"sleet",		//5	mixed rain and snow
	"sleet",		//6	mixed rain and sleet
	"sleet",		//7	mixed snow and sleet
	"sleet",		//8	freezing drizzle
	"light_rain",		//9	drizzle
	"sleet",		//10	freezing rain
	"shower2",		//11	showers
	"shower2",		//12	showers
	"snow1",		//13	snow flurries
	"snow2",		//14	light snow showers
	"snow4",		//15	blowing snow
	"snow4",		//16	snow
	"hail", //17	hail
	"sleet",		//18	sleet
	"mist", //19	dust
	"fog",			 //20 foggy
	"fog",			 //21 haze
	"fog",			 //22 smoky
	"cloudy1",		//23	blustery
	"cloudy1",		//24	windy
	"overcast",	//25	cold
	"cloudy1",		//26	cloudy
	"cloudy4_night",	//27	mostly cloudy (night)
	"cloudy4",		//28	mostly cloudy (day)
	"cloudy2_night",	//29	partly cloudy (night)
	"cloudy2",		//30	partly cloudy (day)
	 "sunny_night", //31	clear (night)
	"sunny",		//32	sunny
	"mist_night",		//33	fair (night)
	"mist", //34	fair (day)
	"hail", //35	mixed rain and hail
	"sunny",		//36	hot
	"tstorm1",		//37	isolated thunderstorms
	"tstorm2",		//38	scattered thunderstorms
	"tstorm2",		//39	scattered thunderstorms
	"tstorm2",		//40	scattered showers
	"snow5",		//41	heavy snow
	"snow3",		//42	scattered snow showers
	"snow5",		//43	heavy snow
	"cloudy1",		//44	partly cloudy
	"storm1",		//45	thundershowers
	"snow2",		//46	snow showers
	"tstorm1",		//47	isolated thundershowers
	"dunno",		//3200	not available
]
function constructError (string)
{
	return {error:true, errorString:string};
}
function findChild (element, nodeName)
{
	var child;
	
	for (child = element.firstChild; child != null; child = child.nextSibling)
	{
		if (child.nodeName == nodeName)
			return child;
	}
	
	return null;
}
function fetchWeatherData (callback, zip)
{
	url="http://weather.yahooapis.com/forecastrss?u=f&p=" //u=Farenheit, because accuWeather sucks
	
	var xml_request = new XMLHttpRequest();
	xml_request.onload = function(e) {xml_loaded(e, xml_request, callback);}
	xml_request.overrideMimeType("text/xml");
	xml_request.open("GET", url+zip);
	xml_request.setRequestHeader("Cache-Control", "no-cache");
	xml_request.send(null); 
	
	return xml_request;
}
function xml_loaded (event, request, callback)
{
	if (request.responseXML)
	{
		var obj = {error:false, errorString:null};
		var effectiveRoot = findChild(findChild(request.responseXML, "rss"), "channel");
		obj.city = findChild(effectiveRoot, "yweather:location").getAttribute("city");
		obj.realFeel = findChild(effectiveRoot, "yweather:wind").getAttribute("chill");//Only accounts for windChill
		
		conditionTag = findChild(findChild(effectiveRoot, "item"), "yweather:condition");
		obj.temp = conditionTag.getAttribute("temp");
		obj.icon = conditionTag.getAttribute("code");
		obj.description = conditionTag.getAttribute("text"); 
		callback (obj); 
	}else{
		callback ({error:true, errorString:"XML request failed. no responseXML"});
	}
}
function validateWeatherLocation (location, callback)
{
	var obj = {error:false, errorString:null, cities: new Array};
	obj.cities[0] = {zip: location}; //Not very clever, are we?
	callback (obj);
}
</script>
</head>
<body bgcolor="Transparent" onload="onLoad()">
<div>
	<div id="WeatherContainer"> <div id="TextContainer"> <p id="city">LEGACY</p> <p id="temp">22</p> <p id="desc">Loading Wait dude!!</p> </div>
	<img id="weatherIcon"> </div>
	<table style="position: absolute; top: 284px; left: 14px; width: 320px; height: 480px; z-index: -17;">
	<tr align="left" valign="top" border="0" cellpadding="0">
       <td height="12" valign="top" margin-left="0" >
       <span id="clock"> <span id="secs">
       <script language="JavaScript">updateClock(); setInterval('updateClock()', 1000 )</script>
	</span>
       </td>
	</tr>
	</table>
<table style="position: absolute; top: 310px; left: 14px; width: 320px; height: 480px; z-index: -17;">
<tr align="left" valign="top" border="0" cellpadding="0">
    <td height="12" valign="top" margin-left="20" >
<span id="weekday"> <span id="date"> <span id="month">
<script language="JavaScript">calendarDate(); setInterval('calendarDate()', 1000 )</script>
    </span>
    </td>
</tr>
<tr></table>
<img src="../Layer.png" style="position: absolute; top: 0px; left: 0px; width: 320px; height: 480px; z-index: -20;">
</body></html>