//////////
////////// SET HIDDEN FORM FIELD FUNCTIONS
//////////
$(document).ready(function () {
    $(".homePageBanners").scrollable({ speed: 900, circular: true, easing: "swing" }).autoscroll({ autoplay: true, steps: 1, interval: 6000 });
    $(".tableTalkerScroller").scrollable({ speed: 900, circular: true });
    $(".menuScroller").scrollable({ speed: 900, circular: true });


    $('.menuThumbs').imgPreview({
        srcAttr: 'rel',
        containerID: 'MenuItem',
        imgCSS: {
            // Limit preview size:
            height: 420
        },
        // When container is shown:
        onShow: function (link) {

            $('<span>' + getImageText(link) + '</span>').appendTo(this);
            // Animate link:
            // Reset image:
            // Animate link:        
            //$(link).stop().animate({ opacity: 0.4 });
            // Reset image:        
            // $('img', this).stop().css({opacity:0});
        },
        // When container hides: 
        onHide: function (link) {
            $('span', this).remove();
            // Animate link:
            $(link).stop().animate({ opacity: 1 });

        },
        // When image has loaded:
        onLoad: function () {
            // Animate image
            $(this).animate({ opacity: 1 }, 300);
        }
    });

    $('.ttThumbs').imgPreview({
        srcAttr: 'rel',
        containerID: 'MenuItem',
        imgCSS: {
            // Limit preview size:
            height: 320
        },
        // When container is shown:
        onShow: function (link) {

            $('<span>' + getImageText(link) + '</span>').appendTo(this);
            // Animate link:
            // Reset image:
            // Animate link:        
            //$(link).stop().animate({ opacity: 0.4 });
            // Reset image:        
            // $('img', this).stop().css({opacity:0});
        },
        // When container hides: 
        onHide: function (link) {
            $('span', this).remove();
            // Animate link:
            $(link).stop().animate({ opacity: 1 });

        },
        // When image has loaded:
        onLoad: function () {
            // Animate image
            $(this).animate({ opacity: 1 }, 300);
        }
    });

})

function getImageText(link) {
    var fileName = GetFileName(link.rel);
    fileName = fileName.replace(/_/g, " ");
    fileName = fileName.replace(/-/g, " ");
    fileName = fileName.replace(".jpg", "");
    return fileName;
}
