﻿/*
* tabs.js
* Simple menu function for UR Play
*/
(function($) {

    $.fn.subtitlemenu = function(settings) {

        this.each(function() {

            var objLink = $(this);

            //The id of the menu div should be the same as the anchor of the link
            var strContainerId = objLink.attr('href');
            strContainerId = strContainerId.substring(strContainerId.lastIndexOf("#"), strContainerId.length);

            //Get menu div
            var objMenuDiv = $(strContainerId);

            //Place the menu div in start position and hide it
            var intInitialHeight = objMenuDiv.height() + 5;
            objMenuDiv.height(0).css("visibility", "visible");
            //objMenuDiv.height(0).css("visibility","visible").css("left",objLink.parent().offset().left).css("top",objLink.parent().offset().top);

            //Add toggle script to the link
            objLink.toggle(function() {
                objMenuDiv.animate({
                    "top": "-=" + intInitialHeight + "px",
                    "height": "+=" + intInitialHeight + "px"
                }, 300);
                $(this).addClass("subtitlemenulink-open");
            }, function() {
                objMenuDiv.animate({
                    "top": "+=" + intInitialHeight + "px",
                    "height": "-=" + intInitialHeight + "px"
                }, 200);
                $(this).removeClass("subtitlemenulink-open");
            });


        });

        return this;

    };

})(jQuery);
