"use strict";
/*--- scroll module, initializes custom scrollbar---*/


var scroller = {

    isResizing: false,
/*--- initialize the scroller ---*/
    init: function ()
    {
        //jQuery(window).__proto__.nodeName = "window";
        jQuery(window).bind('resize', scroller.setContainerHeight);
        scroller.setContainerHeight();

        // it seems like you need to call this twice to get consistantly correct results cross browser..
        
        scroller.setContainerHeight();
    },
    // and the body scrollpane
    setContainerHeight: function()
    {
        // IE triggers the onResize event internally when you do the stuff in this function
        // so make sure we don't enter an infinite loop and crash the browser
        if (!scroller.isResizing) { 
            scroller.isResizing = true;
            scroller.remove();
            scroller.add()
            //setTimeout('scroller.add()',1000);
            //jQuery('#page-inner').jScrollPane({showArrows:true, observeHash:false});
            scroller.isResizing = false; 
        }
    },
    remove: function()
    {
        if(jQuery('#page-inner') && jQuery('#page-inner').jScrollPaneRemove)
        {
            jQuery('#page-inner').jScrollPaneRemove();
        }
    },
    add: function()
    {
        if(jQuery('#page-inner') && jQuery('#page-inner').jScrollPane)
        {
            jQuery('#page-inner').jScrollPane({showArrows:true, observeHash:false, scrollbarWidth:17, showArrows:true});
        }
    }
}


