		if(YAHOO.env.ua.ie)
		{
			document.getElementsByClassName = YAHOO.util.Dom.getElementsByClassName;	
		}
		var tooltipHideTimer = "";
		var audioTooltip = 'Audio downloads are high quality MP3 music files (192 kbps) featuring the audio recording only, without lyric cues. This is the most common standard for digital media devices and is also compatible with iPod, iTouch/iPhone. Files should work on many other platforms (including mobile phones, portable media devices, game consoles and DVD players), but are not officially supported. Check your device manual for compatibility.';
		var videoTooltip = 'Video downloads combine the song\'s music AND the lyric cues into a single high-quality video file. Video resolution for most versions is 640 by 480. Two download formats are available:<br/>•MP4 (works on iPod Video, iPod Nano v3, iPod Touch, iPhone, Mac, Apple TV)<br/>•WMV (works on Zune, Windows PC, X-Box 360, PS3)';
		function tooltip(){
			var elem = document.getElementsByClassName('help');
			for(var i = 0; i < elem.length; i++){
				elem[i].onmouseover = function(){
					clearTimeout(tooltipHideTimer);
					showTooltip(this);
				}
				elem[i].onmouseout = function(){
					hideTooltip();
				}
			}
			/*
			YAHOO.namespace("example.container");
			YAHOO.example.container.tt1 = new YAHOO.widget.Tooltip("tt1", { context: elem,autodismissdelay:120000 });			
			YAHOO.example.container.tt1.onContextMouseOver()
			*/
		}
		function hideTooltip(){
			tooltipHideTimer = window.setTimeout('document.getElementById("tooltip").style.display="none"',250);
		}
		function setTooltip(mediaDiv){
			var tooltip = document.getElementById("tooltip");
			if(mediaDiv.innerHTML.toLowerCase().indexOf('audio') != -1){
				tooltip.innerHTML = audioTooltip;
			}else if(mediaDiv.innerHTML.toLowerCase().indexOf('video') != -1){					
				tooltip.innerHTML = videoTooltip;
			}else{
				tooltip.innerHTML = $(mediaDiv).getAttribute("tooltip");
			}
		}
		function showTooltip(mediaDiv){
			var tooltip = document.getElementById("tooltip");
			setTooltip(mediaDiv);
			positionTooltip(tooltip, mediaDiv);
			tooltip.style.display="block";
		}
		function positionTooltip(tooltip, mediaDiv){
			// can't get width when display:none!!
			/*var tooltipWidth = parseInt(tooltip.clientWidth);
			alert(tooltipWidth);
			*/
			
			var tooltipWidth = 400;
			var tooltipHeight = 150;
			var offsetLeft=5;
			var offsetTop=20;
			var pos = findPos(mediaDiv);
			var left = pos[0]+offsetLeft;
			var top = pos[1]+offsetTop;
			
			var limitRight = f_clientWidth()+f_scrollLeft();
			var limitBottom = f_clientHeight()+f_scrollTop();
			var tooltipRightEdge = left+tooltipWidth;
			var tooltipBottomEdge = top+tooltipHeight;

			// if off limit reposition
			if(tooltipRightEdge>limitRight){
				left = left-(tooltipRightEdge-limitRight)-offsetLeft;
			}
			if(tooltipBottomEdge>limitBottom){
				top = top-(tooltipBottomEdge-limitBottom)-offsetTop;
			}
			tooltip.style.left = left+"px";
			tooltip.style.top = top+"px";
		}
		function findPos(obj) {
			var curleft = curtop = 0;
			if (obj.offsetParent) {
				do {
					curleft += obj.offsetLeft;
					curtop += obj.offsetTop;
				} while (obj = obj.offsetParent);
			}
			return [curleft,curtop];
		}
		function f_clientWidth() {
			return f_filterResults (
				window.innerWidth ? window.innerWidth : 0,
				document.documentElement ? document.documentElement.clientWidth : 0,
				document.body ? document.body.clientWidth : 0
			);
		}
		function f_clientHeight() {
			return f_filterResults (
				window.innerHeight ? window.innerHeight : 0,
				document.documentElement ? document.documentElement.clientHeight : 0,
				document.body ? document.body.clientHeight : 0
			);
		}
		function f_scrollLeft() {
			return f_filterResults (
				window.pageXOffset ? window.pageXOffset : 0,
				document.documentElement ? document.documentElement.scrollLeft : 0,
				document.body ? document.body.scrollLeft : 0
			);
		}
		function f_scrollTop() {
			return f_filterResults (
				window.pageYOffset ? window.pageYOffset : 0,
				document.documentElement ? document.documentElement.scrollTop : 0,
				document.body ? document.body.scrollTop : 0
			);
		}
		function f_filterResults(n_win, n_docel, n_body) {
			var n_result = n_win ? n_win : 0;
			if (n_docel && (!n_result || (n_result > n_docel)))
				n_result = n_docel;
			return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
		}
		

		YAHOO.util.Event.onDOMReady(tooltip);

