/***********************************************
* Cool DHTML tooltip script II- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
var offsetfromcursorX=12 //Customize x offset of tooltip
var offsetfromcursorY=10 //Customize y offset of tooltip

var offsetdivfrompointerX=10 //Customize x offset of tooltip DIV relative to pointer image
var offsetdivfrompointerY=14 //Customize y offset of tooltip DIV relative to pointer image. Tip: Set it to (height_of_pointer_image-1).

document.write('<div id="dhtmltooltip"></div>') //write out tooltip DIV
document.write('<img id="dhtmlpointerl" src="tooltiparrow2.gif">') //write out pointer image
document.write('<img id="dhtmlpointerr" src="tooltiparrow2r.gif">') //write out pointer image

var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false

var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

var pointerobjl=document.all? document.all["dhtmlpointerl"] : document.getElementById? document.getElementById("dhtmlpointerl") : ""

var pointerobjr=document.all? document.all["dhtmlpointerr"] : document.getElementById? document.getElementById("dhtmlpointerr") : ""

function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thewidth, thecolor){
	if (ns6||ie){
		if (typeof thewidth!="undefined")
			tipobj.style.width=thewidth+"px"
		if (typeof thecolor!="undefined" && thecolor!="")
			tipobj.style.backgroundColor=thecolor
		tipobj.innerHTML=thetext
		enabletip=true
		return false
	}
}

function positiontip(e){
	if (enabletip){
		var nondefaultpos=false
		var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
		var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
		//Find out how close the mouse is to the corner of the window
		var winwidth=ie&&!window.opera? ietruebody().clientWidth : window.innerWidth-20
		var winheight=ie&&!window.opera? ietruebody().clientHeight : window.innerHeight-20

		var rightedge=ie&&!window.opera? winwidth - event.clientX - offsetfromcursorX : winwidth - e.clientX - offsetfromcursorX
		var bottomedge=ie&&!window.opera? winheight - event.clientY - offsetfromcursorY : winheight - e.clientY - offsetfromcursorY

		var leftedge=(offsetfromcursorX<0)? offsetfromcursorX*(-1) : -1000
		//if the horizontal distance isn't enough to accomodate the width of the context menu
		if (rightedge<tipobj.offsetWidth){
			//move the horizontal position of the menu to the left by it's width
			tipobj.style.left = curX - tipobj.offsetWidth + "px"
			pointerobjr.style.left = curX - 20 - offsetfromcursorX + "px"
			nondefaultpos=true
		} else if (curX<leftedge) {
			tipobj.style.left="5px"
		} else {
			//position the horizontal position of the menu where the mouse is positioned
			tipobj.style.left=curX + offsetfromcursorX - offsetdivfrompointerX + "px"
			pointerobjl.style.left=curX + offsetfromcursorX + "px"
		}

		//same concept with the vertical position
		if (bottomedge<tipobj.offsetHeight){
			tipobj.style.top=curY-tipobj.offsetHeight-offsetfromcursorY+"px"
			nondefaultpos=true
		}
		else{
			tipobj.style.top=curY+offsetfromcursorY+offsetdivfrompointerY+"px"
			pointerobjl.style.top=curY+offsetfromcursorY+"px"
			pointerobjr.style.top=curY+offsetfromcursorY+"px"
		}

		// Display the arrow
		tipobj.style.visibility="visible"
		if (!nondefaultpos) {
			//pointerobjl.style.visibility="visible"
			pointerobjl.style.visibility="hidden"
			pointerobjr.style.visibility="hidden"
		} else {
			pointerobjl.style.visibility="hidden"
			pointerobjr.style.visibility="hidden"
			//pointerobjr.style.visibility="visible"
		}
	}
}

function hideddrivetip(){
	if (ns6||ie){
		enabletip=false
		tipobj.style.visibility="hidden"
		pointerobjl.style.visibility="hidden"
		pointerobjr.style.visibility="hidden"
		tipobj.style.left="-1000px"
		tipobj.style.backgroundColor=''
		tipobj.style.width=''
	}
}

document.onmousemove=positiontip

function display_help(help_context) {
  var uvreturn = "<table bgcolor=white class=videotable width=100%>\n<th colspan=2>UV Index</th>\n<tr><td bgcolor=#CCFFCC>0-2</td><td>Low danger to Average person</td></tr>\n<tr><td bgcolor=#FFFF99>3-5</td><td>Moderate risk of harm from unprotected sun exposure</td></tr>\n<tr><td bgcolor=#FFCC99>6-7</td><td>High risk of harm from unprotected sun exposure</td></tr><tr><td bgcolor=#FF9999>8-10</td><td>Very high risk of harm from unprotected sun exposure</td></tr><tr><td bgcolor=#CC99CC>11-16</td><td>Extreme risk of harm from unprotected sun exposure</td></tr></table>";
  var aqreturn = "<table bgcolor=white class=videotable width=100%>\n<th colspan=2>Air Quality Index</th>\n<tr><td bgcolor=#CCFFCC>0-50</td><td>Good</td></tr>\n<tr><td bgcolor=#FFFF99>51-100</td><td>Moderate</td></tr>\n<tr><td bgcolor=#FFCC99>101-150</td><td>Unhealthy for sensitive groups</td></tr><tr><td bgcolor=#FF9999>151-200</td><td>Unhealthy</td></tr><tr><td bgcolor=#CC99CC>200-300</td><td>Very unhealthy</td></tr><tr><td bgcolor=#CC9999>301-500</td><td>Hazardous</td></tr></table>";
  var hireturn = "<TABLE bgcolor=white class=videotable width=400><TR align=middle> <TD><B>Category</B></TD> <TD><B>Heat Index/ Summer Simmer Index</B></TD> <TD><B>Possible heat disorders for people in high risk groups</B></TD></TR> <TR align=middle bgColor=#FFFF99> <TD>Caution</TD> <TD>80 - 90&deg;F</TD> <TD>Fatigue possible with prolonged exposure and/or physical activity.</TD></TR> <TR align=middle bgColor=#FFCC99> <TD>Extreme<BR>Caution</TD> <TD>90 - 105&deg;F</TD> <TD>Sunstroke, muscle cramps, and/or heat exhaustion possible with prolonged exposure and/or physical activity.</TD></TR> <TR align=middle bgColor=#FF9999> <TD>Danger</TD> <TD>105 - 129&deg;F</TD> <TD>Sunstroke, muscle cramps, and/or heat exhaustion likely. Heatstroke possible with prolonged exposure and/or physical activity.</TD></TR> <TR align=middle bgColor=#CC99CC> <TD>Extreme<BR>Danger</TD> <TD>130&deg;F or higher</TD> <TD>Heat stroke or sunstroke likely.</TD></TR> <TR align=middle> <TD colspan=3> Summer Simmer Index ussually only applies at night, or in dark shady places like forests and caves, where you tend to \"simmer\" more than react to direct sunlight</td></tr> </TABLE>";
  var beareturn = " <table bgcolor=white class=videotable width=100%>\n <tr>\n <th>Beaufort number</th>\n <th>Wind speed</th>\n <th>Description</th>\n <th>Conditions</th>\n </tr>\n <tr>\n <th>0</th>\n <td>0</td>\n <td>Calm</td>\n <td>Calm. Smoke rises vertically.</td>\n </tr>\n <tr>\n <th>1</th>\n <td>1-3</td>\n <td>Light air</td>\n <td>Wind motion visible in smoke.</td>\n </tr>\n <tr>\n <th bgcolor=#99FFCC>2</th>\n <td>4-7</td>\n <td>Light breeze</td>\n <td>Wind felt on exposed skin. Leaves rustle.</td>\n </tr>\n <tr>\n <th bgcolor=#99FF66>3</th>\n <td>8-12</td>\n <td>Gentle breeze</td>\n <td>Leaves and smaller twigs in constant motion.</td>\n </tr>\n <tr>\n <th bgcolor=#33CC66>4</th>\n <td>13-18</td>\n <td>Moderate breeze</td>\n <td>Dust and loose paper raised. Small branches begin to move.</td>\n </tr>\n <tr>\n <th bgcolor=#CCCC33>5</th>\n <td>19-24</td>\n <td>Fresh breeze</td>\n <td>Smaller trees sway.</td>\n </tr>\n <tr>\n <th bgcolor=#CC9900>6</th>\n <td>25-31</td>\n <td>Strong breeze</td>\n <td>Large branches in motion. Whistling heard in overhead wires. Umbrella use becomes difficult.</td>\n </tr>\n <tr>\n <th bgcolor=#CC6600>7</th>\n <td>32-38</td>\n <td>Near gale</td>\n <td>Whole trees in motion. Effort needed to walk against the wind.</td>\n </tr>\n <tr>\n <th bgcolor=#CC3300>8</th>\n <td>39-46</td>\n <td>Gale</td>\n <td>Twigs broken from trees. Cars veer on road.</td>\n </tr>\n <tr>\n <th bgcolor=#FF6633>9</th>\n <td>47-54</td>\n <td>Strong gale</td>\n <td>Light structure damage.</td>\n </tr>\n <tr>\n <th bgcolor=#FF3300>10</th>\n <td>55-63</td>\n <td>Storm</td>\n <td>Trees uprooted. Considerable structural damage.</td>\n </tr>\n <tr>\n <th bgcolor=#FF0033>11</th>\n <td>64-72</td>\n <td>Violent storm</td>\n <td>Widespread structural damage.</td>\n </tr>\n <tr>\n <th bgcolor=#FF0000>12</th>\n <td>&gt;72</td>\n <td>Hurricane</td>\n <td>Massive and widespread damage to structures.</td>\n </tr>\n </table>\n ";

  if ( help_context == 1 ) return(uvreturn);
  else if ( help_context == 2 ) return(aqreturn);
  else if ( help_context == 3 ) return(hireturn);
  else if ( help_context == 4 ) return(beareturn);
}
