﻿var mnuNoClick = false;

function NavPage(obj, vw) {


    if (vw == null) {
        vw = '#rsView';
    }

    loader('hide', vw);
    $(vw).removeClass("pnloading");

    $('#revisions').addClass("hide");

    if (obj.errorVw != null) {

        var htm = '<div class="container-fluid pgcontent mt-20"><div class="row">';
        htm = htm + '<div class="col-sm-12 col-md-12 red" >'
        htm = htm + obj.errorVw
        htm = htm + '</div></div></div>'


        $(vw).html(htm);
    } else if (obj.PageContent.htmcontent != null) {
        document.title = obj.PageContent.title;
         
        $('#uqId').val(obj.PageContent.unique_id);

        $(vw).html(obj.PageContent.htmcontent);
        $("subsection").html(obj.PageContent.metaTags);
        $("scriptsection").html(obj.PageJsInclude);
        $("stylessection").html(obj.PageCssInclude);

     

    

    }
    else {

        var htm = '<div class="container-fluid pgcontent mt-20"><div class="row">';
        htm = htm + '<div class="col-sm-12 col-md-12 red" > <h2>Network Error&nbsp; Page Cannot be Loaded</h2>';
        htm = htm + '<p> Sorry something has gone wrong or this page has moved.&nbsp;</p></div></div></div>'


        $(vw).html(htm);
    }


   

}


function ReloadPrism() {
    Prism.highlightAll();
}

function ScrollTo(id) {
    var pos = 0;
    try {
        $('#lnav').scrollTop(0, 0);
        $('html, body').scrollTop(0, 0);
        pos = $("#" + id).position().top - 50;
        cp = $("#lnav").position().top;


    } catch (er) {
        pos = 0;
    }

    $('html, body').animate({ scrollTop: pos }, 500);

    //$('#lnav').animate({
    //        scrollTop: pos
    //    }, 500);

}

function ScrollTop() {
    $('body').scrollTop(0);
    window.scrollTo(0, 0);
    $('#lnav').scrollTop(0, 0);
}
