/* Minification failed. Returning unminified contents.
(1,10): run-time error CSS1031: Expected selector, found 'CreateLoginUrl('
(1,10): run-time error CSS1025: Expected comma or open brace, found 'CreateLoginUrl('
(6,10): run-time error CSS1031: Expected selector, found 'LoginContentFetch('
(6,10): run-time error CSS1025: Expected comma or open brace, found 'LoginContentFetch('
(67,1): run-time error CSS1019: Unexpected token, found '$'
(67,2): run-time error CSS1019: Unexpected token, found '('
(67,11): run-time error CSS1031: Expected selector, found ')'
(67,11): run-time error CSS1025: Expected comma or open brace, found ')'
(83,2): run-time error CSS1019: Unexpected token, found ')'
 */
function CreateLoginUrl(url) { 
    var actionUrl =  url;     
    return actionUrl;
}

function LoginContentFetch() {
    var url = CreateLoginUrl('/Login/FetchLoginScreenValues');
    $.ajax({
        url: url,
        type: 'GET',
        cache: false,
        dataType: 'json',
        data: {},
        success: function (result) {
            if (result.BackGroundImages.indexOf('ERROR') > -1) {
                alert(result);
            }
            else {
                var urlPath = "";
                var redirectUrl = document.location.protocol + "//" + document.location.host;               
                    urlPath = redirectUrl;
                for (var i = 0; i < result.BackGroundImages.length; i++) {
                    if (result.BackGroundImages[i].indexOf('.jpg') > -1 || result.BackGroundImages[i].indexOf('.png') > -1 || result.BackGroundImages[i].indexOf('.jpeg') > -1 || result.BackGroundImages[i].indexOf('.html') > -1 || result.BackGroundImages[i].indexOf('.htm') > -1) {
                        images.push(urlPath + "/Images/LoginContent/Images/" + result.BackGroundImages[i]);
                    }
                    else {
                        images.push(result.BackGroundImages[i]);
                    }
                }

                var numimages = images.length;;
                var rndimg = images;
                x = (Math.floor(Math.random() * numimages));

                randomimage = (rndimg[x]);
                document.getElementById("banner").style.height = +window.innerHeight - 73 + "px";
                document.getElementById("banner").style.margin = '0px';
                document.getElementById("banner").parentElement.style.margin = '0px';
                document.getElementById("banner").parentElement.style.padding = '0px';
                document.getElementById("banner").style.padding = '0px!important';
                document.getElementById("banner").style.background = "url(" + randomimage + ")";
                document.getElementById("banner").style.overflow = 'hidden';
                document.getElementById("banner").style.position = 'relative';
                document.getElementById("banner").style.backgroundSize = "cover";
                document.getElementById("banner").style.backgroundRepeat = "no-repeat";
                document.getElementById("banner").style.backgroundPosition = "center";

                var htmlPages = [];
                for (var i = 0; i < result.HtmlPages.length; i++) {
                    htmlPages.push(result.HtmlPages[i]);
                }

                var numHtmlPages = htmlPages.length;;


                var htmlPageIndex = (Math.floor(Math.random() * numHtmlPages));
                $("#banner").html(htmlPages[htmlPageIndex]);

            }
        },
        error: function (result) {
            alert("AjaxError: " + result.responseText);
        }
    });
}

$(document).on("click", ".showHideMainPassword", function (e) {
    if ($(e.target).attr("acttype") == "showpass") {
        $(e.target).attr("acttype", "hidepass");
        //$(e.target).removeClass("fa-eye");
        $(e.target).removeClass("non-view-reverse");
        $(e.target).addClass("view-white");
        $("#txtPassword").attr("type", "text");
        $(e.target).attr("title", "Hide Password");
    }
    else {
        $(e.target).attr("acttype", "showpass");
        $("#txtPassword").attr("type", "password");
        $(e.target).attr("title", "Show Password");
        $(e.target).removeClass("view-white");
        $(e.target).addClass("non-view-reverse");
    }
});
 
