// 2008-03-13 - modified to act on class="qn" as well as id="qn" - shawn
function attach_scrollers()
{
	// find quicknav links
	if($$('#qn','.qn'))
	{
		var links = $$('#qn a','.qn a');
		
		// add scroll action and return action
		for(var i=0; i < links.length; i++)
		{
			tgt = $(links[i].hash.replace('#',''));

			if(tgt)
			{
				if (tgt.offsetTop < 2500) { links[i].speed = 1; tgt.speed = 1; }
				else if (tgt.offsetTop < 3500) { links[i].speed = 1.5; tgt.speed = 1.5; }
				else if (tgt.offsetTop < 5000) { links[i].speed = 2; tgt.speed = 2; }
				else if (tgt.offsetTop < 7000) { links[i].speed = 2.5; tgt.speed = 2.5; }
				else if (tgt.offsetTop < 9000) { links[i].speed = 3; tgt.speed = 3; }
				else if (tgt.offsetTop > 9000) { links[i].speed = 3.5; tgt.speed = 3.5; }

				links[i].onclick = function() { new Effect.ScrollTo(this.hash.replace('#',''),{offset:-20,duration:this.speed}); return false; }
				tgt.innerHTML += ' &nbsp; <small><a href="#top" onclick="new Effect.ScrollTo(\'top\',{duration:this.parentNode.parentNode.speed}); ' +
															  'return false;" style="font-weight: normal; font-size: .85em;">&uarr; Top</a></small>';
			}
		}
	}

	var anchors = document.getElementsByClassName('top');
	//alert(anchors);
	anchors.onclick = function() { alert('hi'); return false; }
}

Event.observe(window,'load',attach_scrollers,false);
