/* Minification failed. Returning unminified contents.
(3,15): run-time error CSS1031: Expected selector, found '='
(3,15): run-time error CSS1025: Expected comma or open brace, found '='
(47,1): run-time error CSS1019: Unexpected token, found '$'
(47,2): run-time error CSS1019: Unexpected token, found '('
(47,11): run-time error CSS1031: Expected selector, found ')'
(47,11): run-time error CSS1025: Expected comma or open brace, found ')'
(63,2): run-time error CSS1019: Unexpected token, found ')'
 */


var genre_web = {

    fnGetTitleMetaDesc: function (val) {
        $.ajax({
            url: window.location.origin + "/Genre/AjxGetGenreSEO",
            data: {
                __RequestVerificationToken: common_helpers.fnGetToken(),
                genre: val
            },
            type: "POST",
            cache: false,
            success: function (result) {

                $('title').text(result.SeoTitle);
                $('meta[name=description]').attr('content', result.SeoDescription);
            }
        })
    },

    fnCaseConverter: function (string) {
        return string.replace(/\S*/g, function (word) {
            return word.charAt(0) + word.slice(1).toLowerCase();
        });
    },

    fnPostBack: function () {

        var value = $("#__value").val();

        if (value.length > 1) {
            var str = genre_web.fnCaseConverter(value);
            var element = $("label:contains('" + str + "')").attr('id');
            if (element != "btn1") {
                $('#' + element).trigger('click');
            }
        }
        else {
            var element = document.getElementById("btn1");
            var newurl = window.location.protocol + "//" + window.location.host + window.location.pathname + "?value=" + element.firstChild.textContent.toUpperCase();
            window.history.pushState({ path: newurl }, '', newurl);
        }
    }
}

$(document).ready(function () {

    $("label").click(function () {
        $("label").removeClass("active");
        $(this).addClass("active");

        var newurl = window.location.protocol + "//" + window.location.host + window.location.pathname + "?value=" + this.firstChild.textContent.toUpperCase();
        window.history.pushState({ path: newurl }, '', newurl);

        genre_web.fnGetTitleMetaDesc(this.firstChild.textContent.toString());
        
    })

   
    genre_web.fnPostBack();

});
