﻿//var minScrollHeight = 90;
var speed=2
var moveupvar = -1;
var movedownvar = -1;
var scrollobj = null;
var scrollobjHeight = "";

var detailsTextObj = null;

var detailsTextObjContentheight = "";


function preScroll(obj, cHeight, direction) {
    if (obj == null || cHeight == "")
        initScrollerObj(obj, cHeight);
   
    scrollobj = obj;
    scrollobjHeight = cHeight;
    
    if (direction > 0)
        moveup();
    else
        movedown();
}

function preScroll2(obj, direction) {
    
   
    scrollobj = obj.scrollObject;
    scrollobjHeight = obj.cHeight;
    
    if (direction > 0)
        moveup();
    else
        movedown();
}
    
function movedown(){
    
    if (moveupvar) clearTimeout(moveupvar);
    
    if (parseInt(scrollobj.style.top)>=(scrollobjHeight*(-1)+100))
        scrollobj.style.top=parseInt(scrollobj.style.top)-speed+"px";
    
    movedownvar=setTimeout("movedown()",20);
}

function moveup(){
    if (movedownvar) 
        clearTimeout(movedownvar);
    
    if (parseInt(scrollobj.style.top)<=0)
        scrollobj.style.top=parseInt(scrollobj.style.top)+speed+"px";
    
    
    if (scrollobj.style.top!='')
        moveupvar=setTimeout("moveup()",20);
}

function stopscroll(){
    if (moveupvar) clearTimeout(moveupvar);
    if (movedownvar) clearTimeout(movedownvar);
}

function movetop(){
    stopscroll();
    
    scrollobj.style.top=0+"px";
}

function ScrollElement(id, navigatorID, minScrollHeight) {
    this.scrollObject = document.getElementById(id);
    this.minScrollHeight = minScrollHeight;
    this.navigator = document.getElementById(navigatorID);
    if (this.scrollObject != null) {
        this.cHeight = this.scrollObject.offsetHeight + 10;
        if (this.cHeight < this.minScrollHeight)
            this.navigator.style.display = "none";
    }    
}