function setScrollButtonVisibility(clipLayerName, scrollLayerName, upButtonName, downButtonName)
{
    clipHeight = getDIVHeight(clipLayerName);
    alert("clipheight: " + clipheight);
    clipWidth = getDIVWidth(clipLayerName);
    scrollTop     = getDIVTop(scrollLayerName);
    scrollBottom  = scrollTop + getDIVHeight(scrollLayerName) - 1;
    scrollLeft    = getDIVLeft(scrollLayerName);
    scrollRight   = scrollLeft + getDIVWidth(scrollLayerName) - 1;
	
    MM_showHideLayers(upButtonName,'','hide');
    MM_showHideLayers(downButtonName,'','hide');
    if (scrollBottom >= clipHeight) {
        MM_showHideLayers(downButtonName,'','show');
    }
    if (scrollTop < 0) {
        MM_showHideLayers(upButtonName,'','show');
    }
    if (scrollRight >= clipWidth) {
            MM_showHideLayers(downButtonName,'','show');
        }
        if (scrollLeft < 0) {
            MM_showHideLayers(upButtonName,'','show');
    }
}

function scrollUp(clipLayerName, scrollLayerName, stopFlagName, increment, incrementAcceleration)
{
    clipHeight = getDIVHeight(clipLayerName);
    scrollTop     = getDIVTop(scrollLayerName);
    scrollBottom  = scrollTop + getDIVHeight(scrollLayerName) - 1;
	
    canScroll = false;

    if (eval(stopFlagName + " == false") == true) {
        if (scrollBottom > clipHeight) {
		    scrollTop -= increment;
			if (scrollBottom < clipHeight) {
			    scrollTop = clipHeight - 1;
			}
            setDIVTop(scrollLayerName, scrollTop);

            //alert("scrollTop: " + scrollTop);
		    canScroll = true;
        }   
    }
	
    if (canScroll == true) {
        setTimeout('scrollUp(\'' + clipLayerName + '\', \'' + scrollLayerName + '\', \'' + stopFlagName + '\', ' + (increment+incrementAcceleration) + ', ' + incrementAcceleration + ')', 50);
    }
}

function scrollLeft(clipLayerName, scrollLayerName, stopFlagName, increment, incrementAcceleration)
{
    clipWidth = getDIVWidth(clipLayerName);
    scrollLeft   = getDIVLeft(scrollLayerName);
    scrollRight  = scrollLeft + getDIVWidth(scrollLayerName) - 1;
            	
    canScroll = false;
    
    if (eval(stopFlagName + " == false") == true) {
        if (scrollRight > clipWidth) {
		    scrollLeft -= increment;
			if (scrollRight < clipWidth) {
			    scrollLeft = clipWidth - 1;
			}
            setDIVLeft(scrollLayerName, scrollLeft);
            
            //alert("scrollLeft: " + scrollLeft);
		    canScroll = true;
        }   
    }
	
    if (canScroll == true) {
        setTimeout('scrollLeft(\'' + clipLayerName + '\', \'' + scrollLayerName + '\', \'' + stopFlagName + '\', ' + (increment+incrementAcceleration) + ', ' + incrementAcceleration + ')', 50);
    }
}

function scrollDown(clipLayerName, scrollLayerName, stopFlagName, increment, incrementAcceleration)
{
    clipHeight = getDIVHeight(clipLayerName);
    scrollTop     = getDIVTop(scrollLayerName);

    canScroll = false;
    if (eval(stopFlagName + " == false") == true) {
        if (scrollTop < 0) {
		    scrollTop += increment;
			if (scrollTop > 0) {
			    scrollTop = 0;
			}
            setDIVTop(scrollLayerName, scrollTop);
		    canScroll = true;
        }   
    }
	
    if (canScroll == true) {
        setTimeout('scrollDown(\'' + clipLayerName + '\', \'' + scrollLayerName + '\', \'' + stopFlagName + '\', ' + (increment+incrementAcceleration) + ', ' + incrementAcceleration + ')', 50);
    }
}

function scrollRight(clipLayerName, scrollLayerName, stopFlagName, increment, incrementAcceleration)
{
    //alert("scroll right");
    clipWidth   = getDIVWidth(clipLayerName);
    //alert("clipWidth: " + clipWidth);
    scrollLeft  = getDIVLeft(scrollLayerName);
    //alert("scrollLeft: " + scrollLeft);

    canScroll = false;
    if (eval(stopFlagName + " == false") == true) {
        if (scrollLeft < 0) {
		    scrollLeft += increment;
			if (scrollLeft > 0) {
			    scrollLeft = 0;
			}
            setDIVLeft(scrollLayerName, scrollLeft);
		    canScroll = true;
        }   
    }
	
    if (canScroll == true) {
        setTimeout('scrollRight(\'' + clipLayerName + '\', \'' + scrollLayerName + '\', \'' + stopFlagName + '\', ' + (increment+incrementAcceleration) + ', ' + incrementAcceleration + ')', 50);
    }
}

function startScrollUp(clipLayerName, scrollLayerName, stopFlagName, startIncrement, incrementAcceleration)
{
     setTimeout('scrollUp(\'' + clipLayerName + '\', \'' + scrollLayerName + '\', \'' + stopFlagName + '\', ' + startIncrement+ ', ' + incrementAcceleration + ')', 50);
}

function startScrollDown(clipLayerName, scrollLayerName, stopFlagName, startIncrement, incrementAcceleration)
{
     setTimeout('scrollDown(\'' + clipLayerName + '\', \'' + scrollLayerName + '\', \'' + stopFlagName + '\', ' + startIncrement+ ', ' + incrementAcceleration + ')', 50);
}

function startScrollLeft(clipLayerName, scrollLayerName, stopFlagName, startIncrement, incrementAcceleration)
{
     setTimeout('scrollLeft(\'' + clipLayerName + '\', \'' + scrollLayerName + '\', \'' + stopFlagName + '\', ' + startIncrement+ ', ' + incrementAcceleration + ')', 50);
}

function startScrollRight(clipLayerName, scrollLayerName, stopFlagName, startIncrement, incrementAcceleration)
{
     setTimeout('scrollRight(\'' + clipLayerName + '\', \'' + scrollLayerName + '\', \'' + stopFlagName + '\', ' + startIncrement+ ', ' + incrementAcceleration + ')', 50);
}