// JavaScript Document

window.onload = function() {                                                  // should NOT be 'domready', coz rendering is not ready then (unable to fetch dimensions)
    var scrollSettings = {
        container:document.getElementById('contentcontainer'),                // Reference to container to scroll (mandatory)
        startEvent:'mousedown',                                               // Trigger scrollstart whithin this event (mandatory)
        stopEvent:'mouseup',                                                  // Trigger scrollstop whithin this event (mandatory)
        buttons:{
            /*left:document.getElementById('scrollLeft'),  */                     // References to the elements to be used as buttons (minimum 1 is obviously mandatory)
           /* right:document.getElementById('scrollRight'),*/
            up:document.getElementById('scrollUp'),
            down:document.getElementById('scrollDown')
        },
        hideScrollBars:true,                                                  // Hide scrollbars (optional)
        onscrollstart:disableButtons,                                         // Reference to function to be triggered on start of scrolling (optional)
        onscrollstop:disableButtons,                                          // Reference to function to be triggered on stop of scrolling (optional)
        fps:50,                                                               // Frames per second (optional, defaults to 25)
        step:5                                                               // Pixels to be scrolled by 1 frame (optional, defaults to 20)
    }
    window.rc = new RemoteScroller(scrollSettings);
};

/**
 * example for a callback
 */
var disableButtons = function (e) {
    for (i in e.scrollableButtons) {
        e.buttons[i].className = e.scrollableButtons[i] ? '' : 'disabled';
    }
}

/**
 * for ie only if you need a debugging console
 * prevents ie from throwing errors
 *
 * optional... delete when in production
 */
if (typeof console == 'undefined') {
    var console = {
        log:function(thing) {
            if (typeof thing.id != 'undefined')
                document.body.appendChild(document.createTextNode(this.id))
            else
                document.body.appendChild(document.createTextNode(thing));
        }
    }
}

