<!--//
var scroll;
var content;
var contentText;
var contentTextTop;

var minTop;

var handle;
var handleTop = 0;
var handleMax;

var animate = setTimeout('', 500);

var dragging = false;

function initScroll()
{
	scroll = document.getElementById('scroll');
	content = document.getElementById('content');
	contentText = document.getElementById('contentText');
	handle = document.getElementById('handle');

	if (scroll.childNodes)
	{	
		minTop = content.offsetHeight - content.scrollHeight;
		
		if (minTop < 0)
		{
			scroll.className = 'show';
			
			handleMax = handle.clientHeight - 15;
			
			contentTextTop = parseInt(contentText.style.top);
			
			if (isNaN(contentTextTop))
				contentTextTop = 0;
			
			for (var i = 0; i < scroll.childNodes.length; i++)
			{
				if (scroll.childNodes[i].tagName == 'A')
				{
					scroll.childNodes[i].onmousedown = mouseDown;
					scroll.childNodes[i].onmouseup = mouseUp;
					scroll.childNodes[i].onfocus = hideFocus;

					if (scroll.childNodes[i].id == 'handle')
						scroll.childNodes[i].onmousemove = mouseMove;
				}
			}
		}
	}
	else
		content.style.overflow = 'auto';
}

mouseDown = function(e)
{
	var src = e ? e.target : event.srcElement;
	
	switch(src.id)
	{
		case "up":
			return scrollUp();
			break;
		case "down":
			return scrollDown();
			break;
		case "handle":
			var position = e ? e.pageY - src.offsetTop : event.offsetY;
			
			handleTop = position - 7;
						
			if (handleTop < 0)
				handleTop = 0;
				
			if (handleTop > handleMax)
				handleTop = handleMax;
								
			getContentTop();
			
			doMove();
			
			if (handleTop <= position <= handleTop + 15)
				dragging = true;
					
			break;
	}
		
	return false;
}

mouseUp = function(e)
{
	clearTimeout(animate);
	
	dragging = false;
	
	return true;	
}

mouseMove = function(e)
{
	if (dragging)
	{ 
		var src = e ? e.target : event.srcElement;
		
		switch(src.id)
		{
			case "handle":
				var position = e ? e.pageY - src.offsetTop : event.offsetY;				
				
				handleTop = position - 7;
							
				if (handleTop < 0)
					handleTop = 0;
					
				if (handleTop > handleMax)
					handleTop = handleMax;
									
				getContentTop();
				
				doMove();
				break;
		}
	}
	
	return false;	
}

hideFocus = function(e)
{
	var src = e ? e.target : event.srcElement;
	
	src.hideFocus = true;
}

function scrollDown()
{
	contentTextTop -= 5;
	
	if (contentTextTop <= minTop)
	{
		contentTextTop = minTop;
		
		doMove();
	}
	else
	{
		doMove();
		
	    animate = setTimeout('scrollDown()',25);
	}
            
    return false;
}

function scrollUp()
{
	contentTextTop += 5;
	
	if (contentTextTop >= 0)
	{
		contentTextTop = 0;
		
		doMove();
		
		return mouseUp();
	}
	else
	{
		doMove();
		
		animate = setTimeout('scrollUp()',25);
	}	
            
    return false;
}

function getHandleTop()
{
	handleTop = (contentTextTop / minTop) * handleMax;
}

function getContentTop()
{
	contentTextTop = (handleTop	/ handleMax) * minTop;
}

function doMove()
{
	contentText.style.top = contentTextTop + 'px';
	
	doHandle();
}

function doHandle()
{
	getHandleTop();
	
	handle.style.backgroundPosition = '0 ' + handleTop + 'px';	
}
//-->