// JavaScript Document

        var scrollPosition	= 0.0;
        var scrollY			= 0.0;
        var scrollLastY		= 0.0;
        //var barra_y 		= 0.0;
        var moverBarra 		= false;
		var container_div	= document.getElementById('container_div');
        var div_scroll 		= document.getElementById('div_scroll');
        var barra_scroll 	= document.getElementById('barra_scroll');
        
		function resetScroll()
		{
			scrollPosition	= 0.0;
			scrollY = 0.0;
			scrollLastY = 0.0;
			barra_scroll.style.top = scrollPosition + 'px';
			div_scroll.style.top = 0;
			
		}
		
        //alert("explorer");
        barra_scroll.onmousedown = function(e)
        {
            var e 		= (window.event || e);
            if (e.layerY)
            {
                //barra_y		= ((e.layerY + e.clientY) - 8);
                scrollLastY		= ((e.layerY + e.clientY) - 8);
            }
            else
            {
                //barra_y		= ((e.offsetY + e.clientY) - 8);
                scrollLastY		= ((e.offsetY + e.clientY) - 8);
            }

            moverBarra 	= true;
            return false;
        }
        
        document.onmousemove = barra_scroll.onmousemove = function(e)
        {
            var e = (window.event || e);
            if (moverBarra == true)
            {
                scrollY = (e.clientY);
                                        
                //var posY = (e.clientY - barra_y);
                /*if (posY < 0)
                    posY = 0;
                
                if (posY > 180)
                    posY = 180;*/
                
                var incY = (scrollY - scrollLastY);
                scrollPosition += incY;
                if (scrollPosition < 0)
                    scrollPosition = 0;
                    
                if (scrollPosition > 180)
                    scrollPosition = 180;
                
                barra_scroll.style.top 	= scrollPosition + 'px';
                div_scroll.style.top 	= -((Number(div_scroll.offsetHeight) - Number(container_div.offsetHeight)) * (scrollPosition / 180)) + 'px';
                //alert(e.clientY);
                //alert(barra_scroll.style.top);
                
                //lastPosY = posY;
                scrollLastY = scrollY;
                return false;
            }
        }
        
        document.onmouseup = barra_scroll.onmouseup = function()
        {
            moverBarra = false;
            return false;
        }
