
timerID = null;
var gScrollTop = true;
var gScrollBottom = false;
//var select_index = 0 // selected navi_picture;        

function initScroll() {
    if (document.getElementById) {
        //cnt = document.getElementById("viewLayer");
        txt = document.getElementById("contentLayer");
        txt.style.top = 20;
    }
}



function verScroll(direction,speed,delay) {
	if (direction == 'up') {
		if(document.getElementById){
  		    if(parseInt(txt.style.top) < 20) {
    	     	txt.style.top = parseInt(txt.style.top) + parseInt(speed) + "px";
       		    //select button
        		window.document.images['up'].src = "../pictures/mainscrolluphi_200212.gif";
        		window.document.images['dn'].src = "../pictures/mainscrolldown_200212.gif";
    	     	if(parseInt(txt.style.top) >= 20) {
    	     		txt.style.top = "20px";
    	     	}
			 	timerID = setTimeout("verScroll('up'," + speed +"," + delay +")",parseInt(delay));
			 	gScrollBottom = false;
			} else {
			    window.document.images['up'].src = "../pictures/mainscrollupoff_200212.gif";
			    gScrollTop = true;
			}
    	}
	}
	if (direction == 'dn') {
	    //alert (document.images.lenght);
		if(document.getElementById){                        
       		if(parseInt(txt.style.top) > 242 - txt.offsetHeight) {
        		//select button
        		window.document.images['dn'].src = "../pictures/mainscrolldownhi_200212.gif";
        		window.document.images['up'].src = "../pictures/mainscrollup_200212.gif";
        		txt.style.top = parseInt(txt.style.top) - parseInt(speed) + "px";
        		timerID = setTimeout("verScroll('dn'," + speed +"," + delay +")",parseInt(delay));
        		gScrollTop = false;
        	} else {
        		window.document.images['dn'].src = "../pictures/mainscrolldownoff_200212.gif";
                gScrollBottom = true;
        	}
    	}
	}
}

function stopScroll(direction) {
    if(document.getElementById){
        clearTimeout(timerID);
    }
    if (direction == 'up' && gScrollTop == false) {
         window.document.images['up'].src = "../pictures/mainscrollup_200212.gif";      
    } 
    if (direction == 'dn' && gScrollBottom == false) {
         window.document.images['dn'].src = "../pictures/mainscrolldown_200212.gif";       
    }
}


onload=initScroll;

