$(document).ready(function(){
$('.scroll').jScrollPane({

                showArrows                              : true
/*
                maintainPosition                        : true,
                clickOnTrack                            : true,
                autoReinitialise                        : false,
                autoReinitialiseDelay                   : 500,
                verticalDragMinHeight                   : 0,
                verticalDragMaxHeight                   : 99999,
                horizontalDragMinWidth                  : 0,
                horizontalDragMaxWidth                  : 99999,
                animateScroll                           : false,
                animateDuration                         : 300,
                animateEase                             : 'linear',
                hijackInternalLinks                     : false,
                verticalGutter                          : 4,
                horizontalGutter                        : 4,
                mouseWheelSpeed                         : 0,
                arrowButtonSpeed                        : 0,
                arrowRepeatFreq                         : 50,
                arrowScrollOnHover                      : false,
                trackClickSpeed                         : 0,
                trackClickRepeatFreq                    : 70,
                verticalArrowPositions                  : 'split',
                horizontalArrowPositions                : 'split',
                enableKeyboardNavigation                : true,
                hideFocus                               : false,
                keyboardSpeed                           : 0,
                initialDelay                            : 300,        // Delay before starting repeating
                speed                                   : 30,                // Default speed when others falsey
                scrollPagePercent                       : .8                // Percent of visible area scrolled when pageUp/Down or track area pressed
*/
        });
});

    $(function(){
            // BUTTONS
            $('.fg-button').hover(
                    function(){ $(this).removeClass('ui-state-default').addClass('ui-state-focus'); },
                    function(){ $(this).removeClass('ui-state-focus').addClass('ui-state-default'); }
            );

            // MENUS
                $('#flat').menu({
                        content: $('#flat').next().html(), // grab content from this page
                        showSpeed: 400
                });

                $('#hierarchy').menu({
                        content: $('#hierarchy').next().html(),
                        crumbDefaultText: ' '
                });

                $('#hierarchybreadcrumb').menu({
                        content: $('#hierarchybreadcrumb').next().html(),
                        backLink: false
                });

                // or from an external source
                $.get('menuContent.html', function(data){ // grab content from another page
                        $('#flyout').menu({ content: data, flyOut: true });
                });
    });

function UnCryptMailto(s, shift) {
        var n=0;
        var r="";
        for(var i=0;i<s.length;i++) {
                n=s.charCodeAt(i);
                if (n>=8364) {n = 128;}
                r += String.fromCharCode(n-(shift));
        }
        return r;
}
function linkTo_UnCryptMailto(s, shift)        {
        location.href=UnCryptMailto(s, shift);
}
function pop(file,windowname,features)  {
helpwindow = window.open(file,windowname,features);
helpwindow.focus();
return false;
}
