/*This file created to add site js functions */
var isiStartPosFinal;

$(document).ready(function () {

    //Start Pane
    var pane = $('#topISI');
    pane.jScrollPane(
		{
		    showArrows: true,
		    verticalDragMinHeight: 25
		});
    var api = pane.data('jsp');

    $('.jspPane').attr("id", "toControlStop");

    if (document.getElementById("toControlStop")) {
        var hoverElement1 = document.getElementById('toControlStop');

        if (window.addEventListener) hoverElement1.addEventListener('DOMMouseScroll', stopScroll, false);
        hoverElement1.onmousewheel = stopScroll;
    }

    if ($.browser.msie && $.browser.version == "6.0")
        $('.jspPane').bgiframe();


    //Stop Animation when the scoller is clicked
    $('.jspTrack, .jspArrow').click(function () {
        stopScroll();
    });


});

function autoScroll() {
    $(document).ready(function () {
        //$('#ISI').data('jsp').scrollToElement('.isiEnd', true, true);

        var isiEndPos = $('.isiEnd').position();
        var isiEndPosFinal = isiEndPos.top - 114;
        isiStartPosFinal = isiEndPos.top;

        $('#toControlStop').animate({
            top: '-' + isiEndPosFinal + 'px'
        }, {
            duration: 40000,
            complete: function () {
                scrollToTop();
            }
        });


        $('.jspDrag').animate({
            top: '77px'
        }, {
            duration: 40000,
            complete: function () {

            }
        });


    });
}

function stopScroll(event) {
    $("div").stop();
}

function scrollToTop() {

    $('#toControlStop, .jspDrag').animate({
        top: '0px'
    }, {
        duration: 5000,
        complete: function () {

        }
    });

}
