// Use these variables to configure the scroller
var scroll_amount = 2
var scroll_delay = 100
var scroll_loops = 2
var scroll_start = 150     //if you change the height of the scroller, this has to be changed
                           //as well
var scroll_behavior = "scroll"

// Don't edit anything below here
var timeout_id
var loop_counter = 1

var scroller_data = new scroller_data_object()

// This function creates the scroller object
function scroller_data_object() {}

function initialize() {

    // If this is a non-DHTML browser, bail out
    if (!dhtml_ok) { return }

    // Create the DHTML objects
    create_object_array()
    
    // Set up the scroller object
    scroller_data.width = dhtml_objects['scroller'].width()
    scroller_data.height = dhtml_objects['scroller'].height()
    scroller_data.top = dhtml_objects['scroller'].top()
    scroller_data.bottom = dhtml_objects['scroller'].bottom()
    scroller_data.left = dhtml_objects['scroller'].left()
    scroller_data.scrollamount = scroll_amount
    scroller_data.scrolldelay = scroll_delay
    scroller_data.loops = scroll_loops
    scroller_data.behavior = scroll_behavior
	scroller_data.start = scroll_start
    
    // Initialize the scroller
    initialize_scroller()

}

// This function sets the initial scroller position and clip region
function initialize_scroller() {

	    // Move the scroller to the bottom
    dhtml_objects['scroller'].move_to(scroller_data.left, scroller_data.start)
	
    // Resize the clip region so that it has height 0
    //dhtml_objects['scroller'].resize_clip_to(0, scroller_data.width, 0, 0)
    
    // Show the scroller
    dhtml_objects['scroller'].set_visibility("visible")
	
    // Start scrolling
    timeout_id = setTimeout("scroll_it()", scroller_data.scrolldelay)
}

// This function scrolls the text
function scroll_it() {

    // Is the top edge of the scroller still below the top of the original left edge?
    if (dhtml_objects['scroller'].top() > scroller_data.top) {
        
        // If so, keep moving up
        dhtml_objects['scroller'].move_by(0, -scroller_data.scrollamount)
        
        // Increase the clip region by moving the bottom edge down
        //dhtml_objects['scroller'].resize_clip_by(0, 0, scroller_data.scrollamount, 0)
        
        // Set a new timeout
        timeout_id = setTimeout("scroll_it()", scroller_data.scrolldelay)
    }
    
    // Otherwise, is the bottom edge of the scroller still below the original top edge?
    else if (dhtml_objects['scroller'].bottom() > scroller_data.top && scroller_data.behavior == "scroll") {    
        
        // If so, keep moving up
        dhtml_objects['scroller'].move_by(0, -scroller_data.scrollamount)
        
        // Decrease the clip region by moving the top edge down
        //dhtml_objects['scroller'].resize_clip_by(scroller_data.scrollamount, 0, 0, 0)
        
        // Set a new timeout
        timeout_id = setTimeout("scroll_it()", scroller_data.scrolldelay)
        
    }
    else {
    
        // Otherwise, the text has scrolled completely, so reset
        clearTimeout(timeout_id)
        loop_counter++
        
        // Check the loop count
        if (true) {
        
            // If it's okay, set it up again
            initialize_scroller()
        }
    }

}

function stop_it() {
 
    // Shut down the scroller by clearing the current timeout
    clearTimeout(timeout_id)
    
    // Reset the loop counter
    loop_counter = 1
}