function createScrollBar(scrollarea)
{
	var container = scrollarea.parentNode;
	
	if(container.offsetHeight < scrollarea.scrollHeight){
		var oldheight = scrollarea.offsetHeight;
		
		scrollarea.style.height = "100%";
		scrollarea.style.marginBottom = "40px";
		
		container.style.overflow = "hidden";
		container.style.height = oldheight+"px";
		
		scrollarea.style.overflow = "visible";
		scrollarea.style.position = "relative";
		scrollarea.style.top = "0px";
		
		if(container){
			scrollarea.style.width = scrollarea.offsetWidth-15+"px";
			scrollarea.style.paddingRight = "15px";
		
			var scrollNode = document.createElement("DIV");
			scrollNode.style.position = "absolute";
			scrollNode.style.width = "10px";
			scrollNode.style.height = container.offsetHeight+"px";
			scrollNode.style.top = "0px";
			scrollNode.style.right = "0px";
			container.appendChild(scrollNode);
			
			var scrollRail = document.createElement("DIV");
			scrollRail.style.position = "relative";
			scrollRail.style.width = "1px";
			scrollRail.style.margin = "0 5px";
			scrollRail.style.height = container.offsetHeight+"px";
			scrollRail.style.backgroundColor = "#000000";
			scrollNode.appendChild(scrollRail);
			
			var scrollHandle = document.createElement("DIV");
			scrollHandle.style.position = "absolute";
			scrollHandle.style.height = "20px";
			scrollHandle.style.width = "6px";
			scrollHandle.style.margin = "0 2px";
			scrollHandle.style.backgroundColor = "#000000";
			scrollHandle.style.top = "0px";
			scrollNode.appendChild(scrollHandle);
			
			var scrollHeight = container.scrollHeight - container.offsetHeight + 20;
			
			if(scrollHeight <= 0) return;
			
			scrollHandle.onmousedown = function(event){
				event = event || window.event;
				var oldmp = event.clientY || event.pageY;
				
				// Prevent IE text selection whilst dragging
				document.body.focus();
				document.body.ondrag = function () { return false; };
				document.body.onselectstart = function () { return false; };
				
				document.onmousemove = function(event)
				{
					event = event || window.event;
					var mp = event.clientY || event.pageY;
					
					var np = mp - oldmp;
					oldmp = mp;
					
					np = parseInt(scrollHandle.style.top)+np;
					
					var min = 0;
					var max = scrollHandle.parentNode.offsetHeight-scrollHandle.offsetHeight;
					
					if(np < min) np = min;
					if(np > max) np = max;
					
					scrollHandle.style.top = np+"px";
					
					var percentScroll = np/scrollHandle.parentNode.offsetHeight;
					
					var offset = scrollHeight * percentScroll * -1;
					scrollarea.style.top = parseInt(offset)+"px";
				}
				
				document.onmouseup = function(){
					document.onmousemove = null;
				}
				
				
				return stopBubble(event);
			}
		}
	}
}

function stopBubble(event)
{
	try{
		if(event && event.stopPropagation) {
			event.stopPropagation();
		}	
	}catch(err){}
	
	try{	window.event.cancelBubble = true;	}catch(err){}
	
	return false;
}
