//used by questcoaching.co.uk
var lc = Array();

function goto(c)
{
	var n = document.getElementById("contentbody_container").scrollTop
	setTimeout('scrto('+n+','+c+',0)',1);
// 	scrto('+n+','+c+',0)
	return false;
}

function scrto(n,c,s)
{
// document.write(n);
document.getElementById("contentbody_container").scrollTop=parseInt(n+(0.01*s)*(c-n));
if (s<100)
  {
		s=(s+1)*1.2;
		if (s>100) s=100;
		setTimeout('scrto('+n+','+c+','+s+')',20);  
  }
}

function display_top(id)
{
	document.getElementById(id).style.backgroundPosition="0px 0px";
}

function display_bottom(id)
{
	document.getElementById(id).style.backgroundPosition="0px -28px";
}

function linkify()
{

  if (document.getElementById("contentbody_container") != null)
  {
    var as = document.getElementsByTagName('a');
	
    for (var i in as)
    {

    	if (as[i].name != null) 
			{
				lc[''+as[i].name+'']=as[i].offsetTop-(document.getElementById("contentbody_container").offsetTop);
			}
    }
    for (var i in as)
    {
			
			//alert(as[i])
    	if (as[i].href != null)
			{
				var m = as[i].href.split('#');
				if (m[1] != null) 
				{
// 					alert(as[i].href);
// 					var div_pos="'"+((lc[m[1]])+0)+"'";
					as[i].setAttribute('onclick','javascript:return goto('+((lc[m[1]])+0)+')');
// 					as[i].setAttribute('onclick','javascript:return goto(div_pos)')
					
				}
			}
    }
  }
}
