
function MouseOverFactory(mouseover_ele,container_ele,wid){this._container=container_ele;this._mouseover=mouseover_ele;this._wid=wid;this._dir_list=['N','NNE','NE','ENE','E','ESE','SE','SSE','S','SSW','SW','WSW','W','WNW','NW','NNW','N'];var _self=this;Event.observe(container_ele,'mousemove',function(e){_self.monitorMouse(e);});Event.observe(mouseover_ele,'mouseover',function(e){_self.stopTimer();});Event.observe(mouseover_ele,'mouseout',function(e){_self.delayHideMouseOver();});Event.observe(mouseover_ele,'click',function(e){_self.hideMouseOver();});}
MouseOverFactory.prototype._container;MouseOverFactory.prototype._mouseover;MouseOverFactory.prototype._cursor_x;MouseOverFactory.prototype._cursor_y;MouseOverFactory.prototype._dir_list;MouseOverFactory.prototype._timer_id;MouseOverFactory.prototype.showMouseOver=function(lid,rid,time,title,avg,lull,gust,dir,press,temp,mtype,zone,units,tunits,e){if(e){this.monitorMouse(e);}
this.stopTimer();var table_wrap=document.createElement('table');table_wrap.className='navTrail';table_wrap.cellPadding='1';table_wrap.cellSpacing='0';var table=document.createElement('tbody');if(title!=''){var title_row=document.createElement('tr');var title_td=document.createElement('td');title_td.colSpan='2';title_td.className='mouseoverTitle';title_td.innerHTML = '<img src="images/icons/close.png" align="right" width="14" height="13" alt="close" title="close" style="cursor:pointer;">'+title;title_row.appendChild(title_td);table.appendChild(title_row);}
if(mtype=='wfonly'){var fxonly_row=document.createElement('tr');var fxonly_td=document.createElement('td');fxonly_td.colSpan='2';fxonly_td.className='mouseoverGraph';var fxonly_text=document.createTextNode("This site is exclusive to Fx Members.");fxonly_td.appendChild(fxonly_text);fxonly_td.appendChild(document.createElement('br'));if(lid!=''&&!isNaN(parseInt(lid))&&rid!=''&&!isNaN(parseInt(rid))){var fxonly_link=document.createElement('a');fxonly_link.href="windandwhere.iws?showLogin=true&regionID="+rid;fxonly_link.innerHTML="Log in to view this site!"
fxonly_td.appendChild(fxonly_link);}
fxonly_row.appendChild(fxonly_td);table.appendChild(fxonly_row);}
else if(mtype=='down'){var late_row=document.createElement('tr');var late_td=document.createElement('td');late_td.colSpan='2';late_td.className='mouseoverGraph';var late_text=document.createTextNode("Data currently not available.");late_td.appendChild(late_text);late_row.appendChild(late_td);table.appendChild(late_row);}
else{if(mtype=='fxonly'){var fx_row=document.createElement('tr');var fx_td=document.createElement('td');fx_td.colSpan='2';fx_td.className='mouseoverGraph';var fx_text=document.createTextNode("Forecast Only");fx_td.appendChild(fx_text);fx_row.appendChild(fx_td);table.appendChild(fx_row);}
else if(mtype=='late'){var late_row=document.createElement('tr');var late_td=document.createElement('td');late_td.colSpan='2';late_td.className='mouseoverGraph';var late_text=document.createTextNode("Data from this site is late.");late_td.appendChild(late_text);late_row.appendChild(late_td);table.appendChild(late_row);}
if(avg!=''&&!isNaN(parseInt(avg))){var speed_row=document.createElement('tr');var speed_label_td=document.createElement('td');speed_label_td.className='mouseoverLabel';speed_label_td.innerHTML='Wind: ';var speed_data_td=document.createElement('td');speed_data_td.className='mouseoverData';if(dir!=''||avg!=''){speed_data_td.innerHTML+=dir+' '+parseFloat(avg).toFixed(1)+' ';if(!isNaN(parseInt(lull))&&!isNaN(parseInt(gust))&&gust>avg&&lull<avg){speed_data_td.innerHTML+='('+parseFloat(lull).toFixed(1)+' - '+parseFloat(gust).toFixed(1)+')';}else if (!isNaN(parseInt(gust)) && gust > avg) { speed_data_td.innerHTML += '(g'+parseFloat(gust).toFixed(1)+')'; } speed_data_td.innerHTML+=' '+units;}
else{speed_data_td.innerHTML+='-';}
speed_row.appendChild(speed_label_td);speed_row.appendChild(speed_data_td);table.appendChild(speed_row);}
if(temp!=''&&!isNaN(parseInt(temp))){var temp_row=document.createElement('tr');var temp_label_td=document.createElement('td');temp_label_td.className='mouseoverLabel';temp_label_td.innerHTML='Temp: ';var temp_data_td=document.createElement('td');temp_data_td.className='mouseoverData';temp_data_td.innerHTML=parseFloat(temp).toFixed(1)+tunits;temp_row.appendChild(temp_label_td);temp_row.appendChild(temp_data_td);table.appendChild(temp_row);}
if(press!=''&&!isNaN(parseInt(press))){var press_row=document.createElement('tr');var press_label_td=document.createElement('td');press_label_td.className='mouseoverLabel';press_label_td.innerHTML='Pressure: ';var press_data_td=document.createElement('td');press_data_td.className='mouseoverData';press_data_td.innerHTML=press+'mb';press_row.appendChild(press_label_td);press_row.appendChild(press_data_td);table.appendChild(press_row);}
if(time!=''){var time_row=document.createElement('tr');var time_label_td=document.createElement('td');time_label_td.className='mouseoverLabel';time_label_td.innerHTML='Time: ';var time_data_td=document.createElement('td');time_data_td.className='mouseoverData';time_data_td.innerHTML=time;time_row.appendChild(time_label_td);time_row.appendChild(time_data_td);table.appendChild(time_row);
//var tz_row = document.createElement('tr');var tz_label_td = document.createElement('td');tz_label_td.className = 'mouseoverLabel';tz_label_td.innerHTML = '';var tz_data_td = document.createElement('td');tz_data_td.className = 'mouseoverData';tz_data_td.innerHTML = zone;tz_row.appendChild(tz_label_td);tz_row.appendChild(tz_data_td);table.appendChild(tz_row);
}}
if(lid!=''&&!isNaN(parseInt(lid))&&rid!=''&&!isNaN(parseInt(rid))){var graph_row=document.createElement('tr');var graph_label_td=document.createElement('td');graph_label_td.className='mouseoverGraph';graph_label_td.colSpan='2';var graph_img=document.createElement('img'); graph_img.src='chartlet.iws?location_id='+lid;graph_img.width=137;graph_img.height=70;var graph_link=document.createElement('a');if(mtype == 'fxonly'){ graph_link.href='windandwhere.iws?regionID='+rid+'&location_id='+lid+'&ISection=Forecast+Graphs'; } else { graph_link.href='windandwhere.iws?regionID='+rid+'&location_id='+lid; }
graph_link.appendChild(graph_img);graph_label_td.appendChild(graph_link);var graph_break=document.createElement('br');graph_label_td.appendChild(graph_break);var text_link=document.createElement('a');if(mtype != 'fxonly'){var graph_link = document.createElement('a');graph_link.href = 'windandwhere.iws?regionID='+rid+'&location_id='+lid;graph_link.innerHTML = 'View Larger Graph';graph_label_td.appendChild(graph_link);var text_break = document.createElement('br');graph_label_td.appendChild(text_break);}var text_link = document.createElement('a');text_link.href = 'windandwhere.iws?regionID='+rid+'&location_id='+lid+'&ISection=Forecast+Graphs';text_link.innerHTML = 'View Forecast';graph_label_td.appendChild(text_link);graph_row.appendChild(graph_label_td);table.appendChild(graph_row);}table_wrap.appendChild(table);if(this._mouseover.firstChild){this._mouseover.replaceChild(table_wrap,this._mouseover.firstChild);}else{this._mouseover.appendChild(table_wrap);}
this.hideMouseOver();var _self=this;this._timer_id=setTimeout(function(){_self.displayMouseOver();},250);}
MouseOverFactory.prototype.displayMouseOver=function(){this.stopTimer();this._mouseover.style.left=this._cursor_x+10+'px';this._mouseover.style.top=this._cursor_y+10+'px';this._mouseover.style.display='';}
MouseOverFactory.prototype.hideMouseOver=function(){this.stopTimer();this._mouseover.style.display='none';}
MouseOverFactory.prototype.delayHideMouseOver=function(){this.stopTimer();var _self=this;this._timer_id=setTimeout(function(){_self.hideMouseOver();},2000);}
MouseOverFactory.prototype.stopTimer=function(){if(this._timer_id){clearTimeout(this._timer_id);}}
MouseOverFactory.prototype.monitorMouse=function(e){var posx=0;var posy=0;var isOpera=(navigator.userAgent.indexOf('Opera')!=-1);var isIE=(!isOpera&&navigator.userAgent.indexOf('MSIE')!=-1);if(!e)var e=window.event;if(e.pageX||e.pageY)
{posx=e.pageX;posy=e.pageY;}
else if(e.clientX||e.clientY)
{posx=e.clientX;posy=e.clientY;}
else if(e.clientX||e.clientY)
{posx=e.clientX;posy=e.clientY;if(isIE)
{posx+=document.body.scrollLeft;posy+=document.body.scrollTop;}}
this._cursor_x=posx;this._cursor_y=posy;}
