var offsetxpoint=0; 
var offsetypoint=20;
var ie=document.all;
var ns6=document.getElementById && !document.all;
var enabletip=false;
var tipobj;
function showHelp(h){
	switch (h) {
	case 'xclift225': ddrivetip('The potential maximum height a glider could thermal. Similar to the Thermal Index (TI) of -3.', '#ffffaa', 300); break;
	case 'xcbldepth': ddrivetip('The potential maximum height a glider could thermal above ground level (AGL).', '#ffffaa', 300); break;
	case 'xcm0': ddrivetip('Absolute predicted tops of thermals. The top of the boundary layer, close to where the Thermal Index equals 0.', '#ffffaa', 300); break;
	case 'xcbs': ddrivetip('The buoyancy to shear ratio. A relationship between the strength of thermals and the average wind speed aloft. Values of 5 and above typically indicates thermals will not be broken by wind shear turbulence.', '#ffffaa', 300); break;
	case 'xcuncert': ddrivetip('The height difference of thermal tops if the surface were heated roughly an additional 2.2 C (about 4 F). Indicates airmass sensitivity to additional heat.', '#ffffaa', 300); break;
	case 'xcwstar': ddrivetip('The average strength of thermal updrafts. Subtract your gliders sink rate to arrive at the effective thermal strength. ', '#ffffaa', 300); break;
	case 'xcpot': ddrivetip('Experimental. A comparison of buoynacy/shear, averaged winds aloft to thermal tops, thermal updraft velocity, and the top of usable lift above ground. Target audience is an intermediate paraglider pilot, so likely not useful for HG and Sailplane pilots. See parameter descriptions for details.', '#ffffaa', 300); break;
	case 'xccbase': ddrivetip('A unique approach to predicting potential cloud base height MSL. An averaged dew point through the thermal profile adjusted for mixing air (entrainment).', '#ffffaa', 300); break;
	case 'xccdepth': ddrivetip('The potential minimum cloud depth where clouds occur. Assumes dry lapse rate to thermal tops, so deep convective clouds are expected to be deeper than forecasted here. Deep cumulus may indicate potential over development (compare with Lifted Index and CAPE).', '#ffffaa', 300); break;
	case 'xcskycond': ddrivetip('Total sky cloud cover for a given location through all layers (high, mid, and low). ', '#ffffaa', 300); break;
	case 'xcskycondnohigh': ddrivetip('Total sky cloud cover minus high clouds. High clouds can often be thin and impact soaring conditions minimally.', '#ffffaa', 300); break;
	case 'xcskycondcnv': ddrivetip('Clouds due to forecasted large scale convection. An indication of large thunderstorms.', '#ffffaa', 300); break;
	case 'xcprecipx': ddrivetip('Predicted precipitation and Lifted Index. Lifted index intervals are often associated to thunderstorm potential in warm seasons.<br>Yellow: LI=0 to -1.5<br>Orange: LI=-1.5 to -3.0<br>Red: LI= < -3', '#ffffaa', 300); break;
	case 'xcprecip': ddrivetip('Predicted precipitation for a 3hr period. Default totals are in millimeters.', '#ffffaa', 300); break;
	case 'xcliftidx': ddrivetip('Lifted Index. Negative values imply instability, with large negative values leading to areas of over-development.', '#ffffaa', 300); break;
	case 'xcrhavg': ddrivetip('Maximum relative humidity value through the tops of thermals. High RH can indicate potential instability for deep convection.', '#ffffaa', 300); break;
	case 'xccape': ddrivetip('Convective Available Potential Energy. The amount of buoyant energy available to accelerate a parcel vertically. Values above 1000 represent unstable regions. ', '#ffffaa', 300); break;
	case 'xcgust': ddrivetip('Maximum surface wind gust. Comes directly from RUC/NAM models.', '#ffffaa', 300); break;
	case 'xcwspd225': ddrivetip('Wind speed at the top of the usable lift. Contours the height of the usable lift.', '#ffffaa', 300); break;
	case 'xcwspd225': ddrivetip('Vector averaged wind speed from the ground through thermal tops. ', '#ffffaa', 300); break;
	case 'xcstemp': ddrivetip('Surface temperatures at 2 meters above ground. Interpolated over terrain as a function of elevation to 1km resolution.', '#ffffaa', 300); break;
	case 'xcsflux': ddrivetip('The surface sensible heat flux. A parameter that acts as the trigger mechanism to release thermals at varying strengths. Higher fluxes tend to produce stronger thermals for relatively deep boundary layers.', '#ffffaa', 300); break;
	case 'xcdp': ddrivetip('Surface dew point. These values are not used to calculate cloud base alone (see Cloud Base).', '#ffffaa', 300); break;
	case 'elev': ddrivetip('The surface elevation used in XC Maps model. A resolution of 1km.', '#ffffaa', 300); break;
	case 'veg': ddrivetip('Vegetation type at 1 km resolution. The vegetation type plays an important role with surface heating and thermal triggers. This data is used in surface models.', '#ffffaa', 300); break;
	case 'exp3': ddrivetip('GFS only. An experimental version of the Top of Usable Lift parameter with (hopefully) better coastal and mountain/valley lift differentiation. We disregard the model output boundary layer info and create our own in a nested grid approach.', '#ffffaa', 300); break;
	case 'cslift': ddrivetip('Cross section analysis of lift and temperature along a route. Black line is thermal tops. Red line is top of usable lift. White line is where the thermal tops would be if the ground was 2 deg. C higher.', '#ffffaa', 300); break;
	case 'csti': ddrivetip('Cross section analysis of thermal index. Black line is thermal tops. Red line is top of usable lift.', '#ffffaa', 300); break;
	case 'csdp': ddrivetip('Cross section analysis of dew point and cumulus cloud depths along a route. Black line is thermal tops. Red line is top of usable lift.', '#ffffaa', 300); break;
	case 'csrh': ddrivetip('Cross section analysis of relative humidity along a route. Black line is thermal tops. Red line is top of usable lift.', '#ffffaa', 300); break;
	case 'csbs': ddrivetip('Cross section analysis of lift to wind ratio along a route. Black line is thermal tops. Red line is top of usable lift.', '#ffffaa', 300); break;
	case 'csvel': ddrivetip('Cross section analysis of updraft strength along a route. Black line is thermal tops. Red line is top of usable lift.', '#ffffaa', 300); break;
	case 'cswind': ddrivetip('Cross section analysis of winds aloft along a route. Black line is thermal tops. Red line is top of usable lift.', '#ffffaa', 300); break;
	case 'clickme': ddrivetip('Click on this image to enlarge.', '#ffffaa', 170); break;
	case 'pt3daytmp': ddrivetip('3 Day Point Forecast of temperature. Black line is thermal tops. Red line is top of usable lift.', '#ffffaa', 300); break;
	case 'pt3dayti': ddrivetip('3 Day Point Forecast of thermal index. Black line is thermal tops. Red line is top of usable lift.', '#ffffaa', 300); break;
	case 'pt3daydp': ddrivetip('3 Day Point Forecast of dew point and cumulus cloud. Black line is thermal tops. Red line is top of usable lift.', '#ffffaa', 300); break;
	case 'pt3dayrh': ddrivetip('3 Day Point Forecast of relative humidity. Black line is thermal tops. Red line is top of usable lift.', '#ffffaa', 300); break;
	case 'pt3daybs': ddrivetip('3 Day Point Forecast of lift to wind ratio. Black line is thermal tops. Red line is top of usable lift.', '#ffffaa', 300); break;
	case 'pt3dayvel': ddrivetip('3 Day Point Forecast of updraft strength. Black line is thermal tops. Red line is top of usable lift.', '#ffffaa', 300); break;
	case 'pt3daywind': ddrivetip('3 Day Point Forecast of winds aloft. Black line is thermal tops. Red line is top of usable lift.', '#ffffaa', 300); break;
	case 'comingsoon': ddrivetip('Mouse Over data values coming soon. This will allow you to get exact pixel values for any parameter just by placing your mouse pointer over the map.', '#ffffaa', 300); break;
	
	case 'togmap': ddrivetip('Hide/Show left navigation.', '#ffffaa', 170); break;
	case 'togroute': ddrivetip('Create a route forecast by drawing a route on the map.', '#ffffaa', 170); break;
	case 'togpoint': ddrivetip('Create a point forecast by clicking anywhere on the map', '#ffffaa', 170); break;
	case 'togskewt': ddrivetip('View Skew-T plot and soundings for a point on the map.', '#ffffaa', 170); break;
	case 'tograob': ddrivetip('View recent balloon soundings.', '#ffffaa', 170); break;
	case 'toglayers': ddrivetip('Toggle XC layers on and off for quick viewing of base layer.', '#ffffaa', 170); break;
	case 'togsettings': ddrivetip('Change unit settings for this map session.', '#ffffaa', 170); break;
	case 'togsave': ddrivetip('Save a new profile or update loaded profile with the current map view.', '#ffffaa', 170); break;
	case 'togload': ddrivetip('Load a saved profile onto this map.', '#ffffaa', 170); break;
	case 'togtz': ddrivetip('Select a new time zone offset.', '#ffffaa', 170); break;
	case 'togcal': ddrivetip('Select a different day. Historical data only.', '#ffffaa', 170); break;
	
	case 'clickme': ddrivetip('Click on this image to enlarge.', '#ffffaa', 170); break;
	
	case '': ddrivetip('', '#ffffaa', 300); break;
	
	default: break;
	}
}
                     
/***********************************************
* Cool DHTML tooltip script- © 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
***********************************************/
function ietruebody(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thecolor, thewidth){
	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 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 rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
	var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20
	
	var leftedge=(offsetxpoint<0)? offsetxpoint*(-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=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
	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+offsetxpoint+"px"
	
	//same concept with the vertical position
	if (bottomedge<tipobj.offsetHeight)
	tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
	else
	tipobj.style.top=curY+offsetypoint+"px"
	tipobj.style.visibility="visible"
	}
}

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