// Copyright (C) 2008 BlueGolf, LLC. All Rights Reserved
Util.chainHandler('onload',function()
{var lat=document.forms.weather.elements.latitude.value;var lon=document.forms.weather.elements.longitude.value;var zip=document.forms.weather.elements.zip.value;new Weather(lat,lon,function()
{var alldiv=document.getElementById('alldiv');var today=new Date();today.setHours(12);today.setMinutes(0);today.setSeconds(0);today.setMilliseconds(0);for(var i=0;Weather.forecast&&i<Weather.forecast.length;i++)
{var iso=Weather.forecast[i].iso;var then=Util.iso2date(iso);var delta=Math.round((then.getTime()-today.getTime())/(24*60*60*1000));var head=document.getElementById('head'+iso);var icon=document.getElementById('weather'+iso);var wdesc=document.getElementById('weatherdesc'+iso);if(!head)
{continue;}
if(icon)
{icon.style.display="";if(wdesc)
{wdesc.style.display="";}
continue;}
var description=Weather.forecast[i].description;if(description)
{var div=document.getElementById('weather'+iso+'tooltip');if(!div)
{div=document.createElement('div');div.id='weather'+iso+'tooltip';div.className='tooltip';alldiv.insertBefore(div,null);var line=document.createElement('div');line.style.fontWeight='bolder';line.style.textAlign='center';div.insertBefore(line,null);var text=document.createTextNode(description);line.insertBefore(text,null);if(Weather.forecast[i].high)
{line=document.createElement('div');div.insertBefore(line,null);text=document.createTextNode('High: '+Weather.forecast[i].high+String.fromCharCode(176)+'F');line.style.color='#c00';line.insertBefore(text,null);}
if(Weather.forecast[i].low)
{line=document.createElement('div');div.insertBefore(line,null);text=document.createTextNode('Low: '+Weather.forecast[i].low+String.fromCharCode(176)+'F');line.style.color='#00c';line.insertBefore(text,null);}
if(Weather.forecast[i].day)
{line=document.createElement('div');div.insertBefore(line,null);text=document.createTextNode('Chance of '+Weather.forecast[i].type+': '+(Weather.forecast[i].day|0)+'%');line.insertBefore(text,null);}}
var a=document.createElement('a');a.href=Weather.getDetailLink(zip,delta);a.id=a.name='weather'+iso;a.style.marginLeft=a.style.marginRight='4px';head.parentNode.insertBefore(a,head.nextSibling);var img=document.createElement('img');img.align='middle';img.border='0';img.alt='';img.src=Weather.forecast[i].icon;a.insertBefore(img,null);window.Note?new Note(a):new Tooltip(a);a.onclick=null;a.target='_blank';if(document.forms.weather.elements.label&&document.forms.weather.elements.label.value)
{a.style.color='black';a.style.textDecoration='none';img.style.verticalAlign='middle';var text=document.createTextNode(' '+document.forms.weather.elements.label.value);a.appendChild(text);}
var divdesc=document.getElementById('weatherdesc'+iso);var multi=document.getElementById('dateHdg');if(multi&&!divdesc)
{var b=document.createElement('b');b.id='weatherdesc'+iso;var text=document.createTextNode(description);b.insertBefore(text,null);head.parentNode.insertBefore(b,img.nextSibling);}}}});});