// header-documentation-links.js

if (IsAuthoring){   //if Expere Authoring then
    ProductName             = "Expere Authoring";
    ProductLandingPage      = "/Expere/Authoring/index.html";
    IncRNLink               = "yes";
    ChangelogLink           = "/Expere/Authoring/ReleaseNotes/index.html";
    // Changelogs
    IsRN                    = ChangelogLink;
    // User Guides
    var IsReUG 	            = window.location.href.indexOf("Authoring/RequirementsEditor") != -1;
    var IsAdminUG 			= window.location.href.indexOf("Authoring/AdministrationTool/webhelp") != -1;
    var IsDdvUG 	   		= window.location.href.indexOf("Authoring/DDV") != -1;
    var IsAuthInstallUG     = window.location.href.indexOf("Authoring/EngineInstallation") != -1;
}

if (IsDefaultData){ //if Default Data then
    ProductName             = "Default Data";
    if(IsHosted){
        console.log("IsHosted = " + IsHosted);
        ProductLandingPage  = "/WK-Hosted-Expere/";
    }
    if(IsInstalled){
        console.log("IsInstalled = " + IsInstalled);
        ProductLandingPage  = "/DGS/";
    }
    IncRNLink               = "yes";
    ChangelogLink           = "/ExpereEZConfig/DefaultData/Changelogs/index.html";
    IsRN                    = window.location.href.indexOf("/DefaultData/Changelogs") != -1;
    // User Guides
    var IsDD_InstallGuide   = window.location.href.indexOf("/DefaultData/InstallationGuide") != -1;
    var IsDD_UpgradeGuide   = window.location.href.indexOf("/DefaultData/UpgradeGuide") != -1;
    var IsDD_USerGuide      = window.location.href.indexOf("/DefaultData/UserGuide") != -1;
    var IsDD_WebServGuide   = window.location.href.indexOf("/DefaultData/WebServicesGuide") != -1;
}

if (IsPnP){ //if Packages and Packets then
    ProductName             = "Packages and Packets";
    if(IsHosted){
        console.log("IsHosted = " + IsHosted);
        ProductLandingPage  = "/WK-Hosted-Expere/";
    }
    if(IsInstalled){
        console.log("IsInstalled = " + IsInstalled);
        ProductLandingPage  = "/DGS/";
    }
    IncRNLink               = "yes";
    ChangelogLink           = "/ExpereEZConfig/PackagesAndPackets/Changelog/index.html";
    IsRN                    = window.location.href.indexOf("/PackagesAndPackets/ChangeLog") != -1;
    // User Guides
    var IsPnP_InstallGuide   = window.location.href.indexOf("/ExpereEZConfig/InstallGuide") != -1;
    var IsPnP_UpgradeGuide   = window.location.href.indexOf("/PackagesAndPackets/UpgradeGuide") != -1;
    var IsPnP_USerGuide      = window.location.href.indexOf("/PackagesAndPackets/UserGuide") != -1;
    var IsPnP_WebServGuide   = window.location.href.indexOf("/ExpereEZConfig//WebservicesGuide") != -1;
}

if (IsDGS){         //if DGS then
    // console.log(IsDGS);
    ProductName             = "Document Generation Services";
    ProductLandingPage      = "/DGS/";
    IncRNLink               = "yes";
    ChangelogLink           = "/DGS/Change-Log/index.html";
    // Changelogs
    IsRN                    = window.location.href.indexOf("/DGS/Change-Log") != -1;
    // User Guides
    var IsDGS_Changelog     = window.location.href.indexOf("/DGS/Change-Log/") != -1;
}

if (IsDocViewer){   //if DocViewer then
    ProductName             = "DocViewer";
    if(IsHosted){
        ProductLandingPage  = "/WK-Hosted-Expere/";
    }
    if(IsInstalled){
        ProductLandingPage  = "/DGS/";
    }
    IncRNLink               = "yes";
    ChangelogLink           = "/DocViewer/ReleaseNotes/index.html";
    // Changelogs
    IsRN                    = window.location.href.indexOf("/DocViewer/ReleaseNotes") != -1;
    // User Guides
    
}

if (IsEDP){         //if EDP then
    ProductName             = "Document Portal";
    if(IsHosted){
        ProductLandingPage  = "/WK-Hosted-Expere/";
    }
    if(IsInstalled){
        ProductLandingPage  = "/DGS/";
    }
    IncRNLink               = "yes";
    ChangelogLink           = "/DocumentPortal/UserGuide/index.html";
    // Changelogs
    IsRN                    = window.location.href.indexOf("/DocumentPortal/UserGuide/topics/edp_Change-Log-Overview.html") != -1;
    // User Guides
    var IsUserGuide         = window.location.href.indexOf("DocumentPortal/UserGuide") != -1;

}

if (IsEngine){      //if Expere Engine then
    ProductName             = "Expere Engine";
    ProductLandingPage      = "/Expere/Engine/";
    IncRNLink               = "yes";
    ChangelogLink           = "/Expere/Engine/Change-Log";
    // Changelogs
    IsRN                    = window.location.href.indexOf("Engine/Change-Log") != -1;
    // User Guides
    // Install and Upgrade Guides
    // OD-Related Install Guides
}

if (IseOriginal){   //if eOriginal then
    console.log("IseOriginal = " + IseOriginal);
    ProductName             = "eOriginal";
    if(IsHosted){
        ProductLandingPage  = "/WK-Hosted-Expere/";
    }
    if(IsInstalled){
        ProductLandingPage  = "/DGS/";
    }
    IncRNLink               = "yes";
    ChangelogLink           = "/WK-Hosted-Expere/Change-Log/index.html";
    // Changelogs
    IsRN                    = window.location.href.indexOf("/WK-Hosted-Expere/Change-Log") != -1;
    // User Guides
    var IsQuickGuide     = window.location.href.indexOf("eOriginal/QuickGuide") != -1;

}

if (IsEZGateway){   //if EZGateway then
    ProductName             = "EZGateway";
    ChangelogLink           = "/ExpereEZConfig/EZGateway/Changelogs/index.html";
    IsRN                    = window.location.href.indexOf("/EZGateway/Changelogs") != -1;
    if (IsRN){
        IncRNLink = "no";
    }
    else{
        IncRNLink = "yes";
    }
    if(IsHosted){
        console.log("IsHosted = " + IsHosted);
        ProductLandingPage  = "/WK-Hosted-Expere/";
    }
    if(IsInstalled){
        console.log("IsInstalled = " + IsInstalled);
        ProductLandingPage  = "/DGS/";
    }
}

if (IsI32){         //if I-32 then
    ProductName             = "I-32";
    ProductLandingPage      = "/I-32/";
    IncRNLink               = "yes";
    ChangelogLink           = "/I-32/Changelog/index.html";
    // Changelogs
    IsRN                    = window.location.href.indexOf("I-32/Changelog") != -1;
    // User Guides
    var IsFormsDesignUG     = window.location.href.indexOf("I-32/FormsDesignUserGuide") != -1;
    var IsImageUpdateUG     = window.location.href.indexOf("I-32/ImageUpdate") != -1;
    // Install and Upgrade Guides
    // OD-Related Install Guides
}

if (IsWKES){       //if WKIS  then
    ProductName             = "ESign";
    ProductLandingPage      = "/WoltersKluwer_E-Sign/index.html";
    IncRNLink               = "yes";
    ChangelogLink           = "/WoltersKluwer_E-Sign/ReleaseNotes/index.html";
    // Changelogs
    IsRN                    = window.location.href.indexOf("/WoltersKluwer_E-Sign/ReleaseNotes") != -1;
    // User Guides
    var IsWKES_UserGuide   = window.location.href.indexOf("//WoltersKluwer_E-Sign/UserGuide/") != -1;
}

if (IsWKIS){       //if WKIS  then
    ProductName             = "OPPSA";
    ProductLandingPage      = "/DGS/";
    IncRNLink               = "yes";
    ChangelogLink           = "/OPPSA/ChangeLog/index.html";
    // Changelogs
    IsRN                    = window.location.href.indexOf("/OPPSA/ChangeLog") != -1;
    // User Guides
    var IsOPPSA_UserGuide   = window.location.href.indexOf("/OPPSA/UserGuide/") != -1;
}



// console.log("ProductName = " + ProductName + "\n" +
//             "ProductLandingPage = " + ProductLandingPage + "\n" +
//             "ChangelogLink = " + ChangelogLink  + "\n" +
//             "isRN " + IsRN + "\n");

if (IsAuthoring || IsDefaultData ||IsPnP || IsDGS || IsDocViewer || IsEDP || 
    IsEngine || IseOriginal || IsEZGateway || IsI32 || IsWKES ||IsWKIS){
    $('.wh_content_area > .row:nth-child(1)').before('<div class="row DocLinks">' + 
    '<span class="glyphicon glyphicon-arrow-right landing-page-arrow"></span>' +
    '<div class="div-landing-page-btn">' +
    '<button type="button" class="btn btn-outline-primary link-landing-page">' +
    '<a class="link-primary" href="' + ProductLandingPage + '" index.html" target="_blank">View ' + ProductName + ' Documentation Page</a></button>' +
     '</div>'
     );

    }

// if(!(IsAuthoring)){
    // $('.link-landing-page').css({
    //     'border' : '1px solid #007bff'
    // });
    // $('.ChangelogLink > a').css({
    //     'background' : '#ecf2f9'
    // });
// }

// if (IncRNLink == "yes" && !(IsRN) ){
//     $('.DocLinks').append(' <span style="color: black">   |   </span> '  +
//         '<a href="' + ChangelogLink + '" target="_blank">View Changelog</a></div>');
// }
if (IncRNLink == "yes" && !(IsChangelogPage) ) {
    $('.DocLinks').append(
        '<div class="div-changelog-btn">' +
        '<button type="button" class="btn btn-outline-primary link-landing-page">' +
        '<a class="link-primary" href="' + ChangelogLink + '" index.html" target="_blank">View Changelog</a></button></div>'
    );
}

if (IsRN && (!(IsAuthoring))){
    $('#searchForm').remove();
}


if (IsEForms){
    console.log(IsEForms);
    $('.ChangelogLink').remove();
}

