var layerRef="null";
var layerStyleRef="null";
var styleSwitch="null";
var visible="null";
var hidden="null";
var mousemove="null";
var x=0,y=0;
var currTop=0;

// Use object detection to determine browser
var ie4 = (document.all != null)
var ie4Mac = ie4 && navigator.platform.indexOf("Mac") >= 0
var ns4 = (document.layers != null)


// Scrolla la pagina su o gių
// dir č un valore booleano: true=gių, false=su
function movePage(dir) {
    var clientHeight;
  
    // ricavo l'altezza della finestra da scrollare,
    // a seconda del tipo di browser usato
    if (ie4)
        clientHeight = parent.summary.document.body.clientHeight
    else
        clientHeight = window.innerHeight

    // faccio scrollare la finestra nella direzione passata in argomento
    // la finestra da scrollare č il frame superiore che si chiama "summary"
    parent.summary.window.scrollBy(0,5 * (dir ? -1 : 1))
}


// funzione di inizializzazione
function initit(){
    // setto tutte le variabili, a seconda del browser usato
    if (document.getElementById) {
        layerStyleRef = "layer.style.";
        layerRef = "parent.summary.document.getElementById";
        openBracket = '("';
        closeBracket = '")';
        styleSwitch = ".style";
        topSwitch = ".top";
        leftSwitch = ".left";
        visible = "visible";
        hidden = "hidden";
        mousemove = "onmousemove";
    }
    else if (document.layers) {
        layerStyleRef = "layer.";
        layerRef = "parent.summary.document.layers";
        openBracket = '["';
        closeBracket = '"]';
        styleSwitch = "";
        topSwitch = ".top";
        leftSwitch = ".left";
        visible = "show";
        hidden = "hide";
        mousemove = "onMouseMove";
    }
    else if (document.all) {
        layerStyleRef = "layer.style.";
        layerRef = "parent.summary.document.all";
        openBracket = '["';
        closeBracket = '"]';
        styleSwitch = ".style";
        topSwitch = ".posTop";
        leftSwitch = ".posLeft";
        visible = "visible";
        hidden = "hidden";
        mousemove = "onmousemove";
    }
}

var running=false;
var timerID="null";
var timerID1="null";


function stopScroll(){
    if (running){
        clearTimeout(timerID);

        running=false;
    }
}


function stopScroll1(){
    if (running){
        clearTimeout(timerID1);

        running=false;
    }
}


function startScroll1(){
    running = true;
    moveLayerdown('container');
}


function startScroll(){
    running = true;
    moveLayerUp('container');
}


function moveLayerUp(layerName){
    currTop-=5;

    //eval(layerRef+openBracket+layerName+closeBracket+styleSwitch+'.top=currTop');
    movePage(false);

    if (running) {
        var timerID = setTimeout('moveLayerUp("container")',10);
	}
}


function moveLayerdown(layerName){
    //eval(layerRef+openBracket+layerName+closeBracket+styleSwitch+'.top=currTop');
    movePage(true);

    if ((running) && (currTop < 0)) {
        currTop += 5;
        var timerID1 = setTimeout('moveLayerdown("container")',10);
	}
}


function resetit() {
    currTop = 50;
}
