
var Notes = 0;
var InNotes = 0;
var HideSuitabilityPopup = false;
var HideEligibilityPopup = true;
var Hideblockly = false;
var Hideblockly1 = true;
var HidePayoffGraph = false;
var HidePayoffGraph1 = true;
var HideFolders = false;
var HideFolders1 = true;
var hideDivMain = true;
var ShowHideFilterVal = '';

var prevBidYtmFrom = '';
var prevBidYtmTo = '';
var prevAskYtmFrom = '';
var prevAskYtmTo = '';
var prevBidPriceFrom = '';
var prevBidPriceTo = '';
var prevAskPriceFrom = '';
var prevAskPriceTo = '';
var prevCouponFrom = '';
var prevCouponTo = '';
var prevLtvFrom = '';
var prevLtvTo = '';
var prevMaturityFrom = '';
var prevMaturityTo = '';
var prevLtv2From = '';
var prevLtv2To = '';
var prevStrikeFrom = '';
var prevStrikeTo = '';
var prevRiskScoreFrom = '';
var prevRiskScoreTo = '';
//Aditya B || 05-Apr-2021 || For RHB || Start
var prevKIFrom = '';
var prevKITo = '';
var prevKOFrom = '';
var prevKOTo = '';
//Aditya B || 05-Apr-2021 || For RHB || End

//Aditya B || 20-Aug-2021 || For Mashreq || Start
var prevLinkIndex = '';
var skipIndexChk = '';
//Aditya B || 20-Aug-2021 || For Mashreq || End

function allownum(e, sender, limit) {
    var retval;
    var key = window.event ? e.keyCode : e.which;
    var keychar = String.fromCharCode(key);
    var reg = new RegExp("[0-9]")
    if (key == 8) {
        keychar = String.fromCharCode(key);
    }
    if (key == 13) {
        key = 8;
        keychar = String.fromCharCode(key);
    }
    retval = reg.test(keychar);

    if (retval == true) {
        var val;
        val = sender.value + (key - 48);
        if (val > limit) {
            key = 8;
            keychar = String.fromCharCode(key);
        }
    }

    return reg.test(keychar);

}

function toggleFilterHide() {

    var btnHideStateFilter = document.getElementById("filterTableToHide").style.display;
    var btnHideFilter = document.getElementById("btnHideFilter");

    btnHideFilter.className.replace(/(?:^|\s)btn(?!\S)/g, '') = "btnHide";
    //hide of apply filter div
    if (btnHideStateFilter == "none") {
        document.getElementById("filterTableToHide").style.display = "block";
        btnHideFilter.value = "Hide";
        btnHideFilter.className = "btnHide";
    }
    else {
        document.getElementById("filterTableToHide").style.display = "none";
        btnHideFilter.value = "Show";
        btnHideFilter.className = "btnShow";
    }
}
function toggleProductHide() {
    var btnHideProductState = document.getElementById("productTableToHide").style.display;
    var btnHideProduct = document.getElementById("btnHideProduct");

    if (btnHideProductState == "none") {
        document.getElementById("productTableToHide").style.display = "block";
        btnHideProduct.value = "Hide";
    }
    else {
        document.getElementById("productTableToHide").style.display = "none";
        btnHideProduct.value = "Show";
    }
}


function toggleReferenceHide() {

    var btnHideRefernceState = document.getElementById("referenceTableToHide").style.display;
    var btnHideReference = document.getElementById("btnHideReference");

    if (btnHideRefernceState == "none") {
        document.getElementById("referenceTableToHide").style.display = "block";
        btnHideReference.value = "Hide";
    }
    else {
        document.getElementById("referenceTableToHide").style.display = "none";
        btnHideReference.value = "Show";
    }
}

function toggleRiskScoreToHide() {

    var btnHideRiskScoreState = document.getElementById("riskScoreToHide").style.display;     //div
    var btnHideRiskScore = document.getElementById("btnHideRiskScore");                       //button id

    if (btnHideRiskScoreState == "none") {
        document.getElementById("riskScoreToHide").style.display = "block";
        btnHideRiskScore.value = "Hide";
    }
    else {
        document.getElementById("riskScoreToHide").style.display = "none";
        btnHideRiskScore.value = "Show";
    }
}

function toggleRatingHide() {

    var btnHideRatingState = document.getElementById("ratingToHide").style.display;     //div
    var btnHideRating = document.getElementById("btnHideRating");                       //button id

    if (btnHideRatingState == "none") {
        document.getElementById("ratingToHide").style.display = "block";
        btnHideRating.value = "Hide";
    }
    else {
        document.getElementById("ratingToHide").style.display = "none";
        btnHideRating.value = "Show";
    }
}

function mouseHover(obj) {

    //$(obj).css("background-color", "#262626");

}
function MouseOut(obj) {

    //$(obj).css("background-color", "#262626");

}
// Added funIncludes by Dashrath on 22-Jan-2018 for WLB bonds.
function funIncludes(str, searchStr) {
    var returnValue = false;

    if (str.indexOf(searchStr) !== -1) {
        returnValue = true;
    }

    return returnValue;
}

//Aditya Bhong on 29-Jan-2016 to launch new order in accordian
function New_Order(lblcntrl) {
 
    var NoteMasterId = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblnotemasterid").text();
  
    //Added by Gopika w to open bond entry page
    var Mode = document.getElementById('ctl00_MainContent_hdn_Mode').value;  
    var UID = document.getElementById('ctl00_MainContent_hdn_UID').value;
 
    //if (Mode = "RM" && UID.includes("IA")) {
    //    Mode = "Dealer"
    //}
    //else {
    //    Mode = document.getElementById('ctl00_MainContent_hdn_Mode').value;
    //}
 
    if (Mode = "RM" && funIncludes(UID,"IA")==true) {
        Mode = "Dealer"
    }
    else {
        Mode = document.getElementById('ctl00_MainContent_hdn_Mode').value;
    }
 
    window.open('../FinIQ_Bond_Entry/FinIQ_Bond_Entry.aspx?NoteId=' + NoteMasterId + '&Mode=' + Mode + '&Master_Popup=POPUP', 'OpenPopup', 'top=150,left=120,status=1,scrollbars=1,resizable=1,width=1500px,height=800px');
    // var CustomerID = document.getElementById('ctl00_MainContent_hdncustid').value;

    // if ($("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblproductcode").text()   != 'BOND')
    // {
    //      $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").html("<iframe id='iframe" + lblcntrl + "'   scrolling='no' frameborder='0' style='height:1000px !important;width:1250px !important' src='../TrancheOrderEntry/TrancheOrderEntry.aspx?RMWMode=Y&Note_Master_Id= " + NoteMasterId + "&CustID= " + CustomerID + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>");
    // }
    // else
    // {
    //     $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").html("<iframe id='iframe" + lblcntrl + "'   scrolling='no' frameborder='0' style='height:1000px !important;width:1350px !important' src='../FinIQ_Bond_Entry/FinIQ_Bond_Entry.aspx?RMWMode=Y&NoteId= " + NoteMasterId + "&CustID= " + CustomerID + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&WithFullView=Y&pagenum=1&view=fitH,0'></iframe>");
    // }
    // $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblproductclusters").hide();
    // $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").show();
    // $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblorderlog").hide();
    // $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbliFramContainer").hide();
    // $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllipperdetails").hide();
    // $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblEQAllPrices").hide();
    // $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblBNDSGXPrices").hide();
    // $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblSuitabilityurl").hide();
    // $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblviewquota").hide();
    // $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblViewAttachedFiles").hide();
    //// $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchPriceUpdate").hide();
    // document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + lblcntrl + '_imgblockly1').style.display = "none";
    // $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblpayoffgraph").hide();
    // $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchNewRFQ").hide();
    // $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchManualRFQ").hide();
    // $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblDisplayNews").hide();
    // $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchProductFolder").hide();
    // $("#div" + lblcntrl).css('height', 'auto');
    // $("#div" + lblcntrl).slideToggle();

}
//End
// start Added by Dashrath for IPO order entry for WLB bonds


function New_Order_Ipo(lblcntrl) {

    var NoteMasterId = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblnotemasterid").text();

   
    var Mode = document.getElementById('ctl00_MainContent_hdn_Mode').value;
    var UID = document.getElementById('ctl00_MainContent_hdn_UID').value;

   

    if (Mode = "RM" && funIncludes(UID, "IA") == true) {
        Mode = "Dealer"
    }
    else {
        Mode = document.getElementById('ctl00_MainContent_hdn_Mode').value;
    }
    Mode="IPO_Order" + Mode
    window.open('../FinIQ_Bond_Entry/FinIQ_Bond_Entry.aspx?NoteId=' + NoteMasterId + '&Mode=' + Mode + '&Master_Popup=POPUP', 'OpenPopup', 'top=150,left=120,status=1,scrollbars=1,resizable=1,width=1500px,height=800px');
  

}


// End Added by Dashrath for IPO order entry for WLB bonds
//Aditya Bhong on 30-May-2017 to launch new rfq in accordian for SCB.
function New_RFQ(lblcntrl) {

    var ISIN = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblISIN").text();

    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchNewRFQ").html("<iframe id='iframe" + lblcntrl + "'   scrolling='no' frameborder='0' style='height:500px !important;width:1350px !important' src='../Bonds_RFQ/Bonds_RFQ.aspx?ISIN=" + ISIN + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>");

    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblproductclusters").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchNewRFQ").show();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchManualRFQ").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblorderlog").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbliFramContainer").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllipperdetails").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblEQAllPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblBNDSGXPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblSuitabilityurl").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblviewquota").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblViewAttachedFiles").hide();
    // $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchPriceUpdate").hide();
    document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + lblcntrl + '_imgblockly1').style.display = "none";
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblpayoffgraph").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblDisplayNews").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchProductFolder").hide();
    $("#div" + lblcntrl).css('height', 'auto');
    $("#div" + lblcntrl).slideToggle();
}
//End

//End

//Aditya Bhong on 07-Jun-2017 to launch manual rfq in accordian for SCB.
function Manual_RFQ(lblcntrl) {

    //debugger

    var ISIN = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblISIN").text();
    var Ccy = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblccy").text().trim(); //Changed by Gopika W

    //Added by Nikita S for Note Master ID told by DJ On 30-Oct-2017
    var NoteMasterId = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblnotemasterid").text();


    ////alert(NoteMasterId);

    var ProductName = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblproduct").text();
    var MaturityDate = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblmaturitydate").text();



    //Changed by Gopika W on 24 july 2017
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchManualRFQ").html("<iframe id='iframe" + lblcntrl + "'   scrolling='no' frameborder='0' style='height:90px !important;width:1100px !important' src='../Bonds_ManualRFQ/Bonds_ManualRFQ.aspx?ISIN=" + ISIN + "&CCY=" + Ccy + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>");
    //window.open('../Bonds_ManualRFQ/Bonds_ManualRFQ.aspx?ISIN=' + ISIN + '&CCY=' + Ccy + '&ProductName=' + ProductName + '&MaturityDate=' + MaturityDate + '&Master_Popup=POPUP', 'OpenPopup', 'top=250,left=750,status=1,scrollbars=1,resizable=1,width=370px,height=300px');

    //window.open('../Bonds_ManualRFQ/Bonds_ManualRFQ.aspx?WorkflowMode="EDIT"&ISIN=' + ISIN + '&CCY=' + Ccy + '&ProductName=' + ProductName + '&MaturityDate=' + MaturityDate + '&Master_Popup=POPUP', 'OpenPopup', 'top=250,left=750,status=1,scrollbars=1,resizable=1,width=370px,height=300px');

    //Changed by Nikita S for Note Master ID told by DJ On 30-Oct-2017
    window.open('../Bonds_ManualRFQ/Bonds_ManualRFQ.aspx?WorkflowMode="EDIT"&ISIN=' + ISIN + '&CCY=' + Ccy + '&NoteMasterId=' + NoteMasterId + '&ProductName=' + ProductName + '&MaturityDate=' + MaturityDate + '&Master_Popup=POPUP', 'OpenPopup', 'top=250,left=750,status=1,scrollbars=1,resizable=0,width=420px,height=450px');
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblproductclusters").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchNewRFQ").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchManualRFQ").show();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblorderlog").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbliFramContainer").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllipperdetails").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblEQAllPrices").hide(); 
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblBNDSGXPrices").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblSuitabilityurl").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblviewquota").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblViewAttachedFiles").hide();
    //// $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchPriceUpdate").hide();
    //document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + lblcntrl + '_imgblockly1').style.display = "none";
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblpayoffgraph").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblDisplayNews").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchProductFolder").hide();
    ////$('#ctl00_MainContent_dlProductPriceDetails_ctl00__Commentary').css('display', 'none !important');
    ////$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "__Commentary").hide(); //Added By gopika w
    //$("#div" + lblcntrl).css('height', 'auto');
    //$("#div" + lblcntrl).slideToggle();
}
//End

function callme(x, lblcntrl) {
    ////alert(1)
    //$('#'+x).toggle("slow");
    //$('#' + x).slideDown("slow");

    if (InNotes == 1) {
        InNotes = 0;
        return;
    }

    //$('#' + x).css('height', 'auto !important');

    if (lblcntrl < 10)
        lblcntrl = "0" + lblcntrl;

    //$("#ctl00_MainContent_dlProductPriceDetails_ctl" + lblcntrl + "_lbliFramContainer").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl" + lblcntrl + "_lbllipperdetails").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl" + lblcntrl + "_lblorderlog").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl" + lblcntrl + "_lblEQAllPrices").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl" + lblcntrl + "_lblBNDSGXPrices").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl" + lblcntrl + "_lblviewquota").hide();

    //if (HideEligibilityPopup == true && HideSuitabilityPopup != false) {
    //    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblSuitabilityurl").hide();
    //    HideSuitabilityPopup = true;
    //}
    //else {
    //    HideSuitabilityPopup = true;
    //}

    //if (Hideblockly1 == true && Hideblockly != false) {
    //    document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + lblcntrl + '_imgblockly1').style.display = "none";
    //    Hideblockly = true;
    //}
    //else {
    //    Hideblockly = true;
    //}

    //if (HidePayoffGraph1 == true && HidePayoffGraph != false) {
    //    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblpayoffgraph").hide();
    //    HidePayoffGraph = true;
    //}
    //else {
    //    HidePayoffGraph = true;
    //}

    //if (HideFolders1 == true && HideFolders != false) {
    //    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchProductFolder").hide();
    //    HideFolders = true;
    //}
    //else {
    //    HideFolders = true;
    //}

    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchProductInfo").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchNewRFQ").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchManualRFQ").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblDisplayNews").hide();

    var templateID = $("#ctl00_MainContent_dlProductPriceDetails_ctl" + lblcntrl + "_lbltemplateid").text();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl" + lblcntrl + "_lblActionLinkContent").html("<iframe id='iframe" + lblcntrl + "' scrolling='no' frameborder='0' style='width:1470px !important' src='../RMWorkstation_Generic/WorkbenchFeatures.aspx?TemplateId=" + templateID + "#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0' onload=resizeIframe(this)></iframe>");

    $('#' + x).css('display', 'none');
    if (hideDivMain == true) {
        $('#divMain' + lblcntrl).css('display', 'none');        
    }
    else {
        hideDivMain = true;
    }
    //$('#' + x).slideToggle();

}

function resizeIframe(obj) {
    obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
}

function LoadAction(TargetFunction,TargetDataType,TargetSubDataType,rowIndex) {
    try
    {
     $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowIndex + "_lblActionLinkContent").html("<iframe id='iframeWFC" + rowIndex + "' scrolling='no' frameborder='0' style='height:400px !important;width:400px !important' src='../RMWorkstation_Generic/WorkbenchFeatures.aspx?TargetDataType=" + TargetDataType + "&TargetSubDataType=" + TargetSubDataType + "&TargetFunction=" + TargetFunction + "'#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>");
     $("#div" + rowIndex).css('height', 'auto');
     $("#div" + rowIndex).slideToggle();
    }
    catch (errMessage) {
        console.log(errMessage);
    }
}

function show_Bond_Prices_SGX(x, lblcntrl, NoteMasterID) {

    lblcntrl = lblcntrl.id.replace('ctl00_MainContent_dlProductPriceDetails_ctl0', '').replace('_dSGXPrice', '');
    ////alert(lblcntrl);
    var notemasterid = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblnotemasterid").text();
    ////alert(notemasterid);
    //var CustomerID = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblnotemasterid").text();
    var CustomerID = document.getElementById('ctl00_MainContent_hdncustid').value;
    var parentCntrl1 = "#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "";
    ////alert(notemasterid);
    ////alert(parentCntrl1);
    var bestprice = document.getElementById("<%= Hdn_SGX_Price_Val.ClientID %>").value;
    //Added Customer ID in querystring  by Anand K on 03 Sep 2015
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblorderlog").html("<iframe id='iframe" + lblcntrl + "'   scrolling='no' frameborder='0' src='../OrderLog_OCBC/OrderLog_OCBC.aspx?Mode=VIEW&NMID=" + notemasterid + "&CustomerID=" + CustomerID + "#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>");

    var str = '';
    str = str + '<br/><br/><table><tr><td>';

    str = str + '<span style="float:left;height:26px; line-height:26px; font:bold 13px/26px verdana !important;">' + bestprice + '</span>';

    str = str + '</td></tr></table>';
    ////alert(str);
    ////alert($("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblorderlog").text());
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_dSGXPrice").html('<img src="../App_Resources/PP_Icons/1.png" alt="" style="float:left;"/> <span style="float:left; vertical-align: middle; height:26px; line-height:26px; font:bold 13px/26px verdana !important;">' + bestprice + '</span>');
    $(parentCntrl1 + "_lblBNDSGXPrices").html('<img src="../App_Resources/PP_Icons/1.png" alt="" style="float:left;"/> ' + str + '<span><img src="../App_Resources/Accept.png"/><a href="#" onClick="AcceptPrice(' + bestprice + ',' + lblcntrl + ');"style="font:normal 15px verdana !important;line-height:26px;">Accept Price</a></span>');
    //            var BNDSGXPrices = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblBNDSGXPrices").text();
    //            //alert(BNDSGXPrices);
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblBNDSGXPrices").show();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblorderlog").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbliFramContainer").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllipperdetails").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblEQAllPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "__Commentary").empty();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblSuitabilityurl").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblviewquota").hide();
    document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + lblcntrl + '_imgblockly1').style.display = "none";
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblpayoffgraph").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchNewRFQ").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchManualRFQ").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblDisplayNews").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchProductFolder").hide();
    //document.getElementById("dBestPrice").style.display = "none";
    $("#div" + lblcntrl).css('height', 'auto');
    $("#div" + lblcntrl).slideToggle();
}
function show_Orders(x, lblcntrl, NoteMasterID) {
    ////alert(x);
    ////alert(lblcntrl);
    ////alert(NoteMasterID);

    var notemasterid = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblnotemasterid").text();
    //var CustomerID = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblnotemasterid").text();
    var CustomerID = document.getElementById('ctl00_MainContent_hdncustid').value;

    ////alert(notemasterid);
    //Added Customer ID in querystring  by Anand K on 03 Sep 2015
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblorderlog").html("<iframe id='iframe" + lblcntrl + "'   scrolling='no' frameborder='0' src='../OrderLog/OrderLog.aspx?Mode=GT&NMID=" + notemasterid + "&CustomerID=" + CustomerID + "#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>");

    ////alert($("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblorderlog").text());

    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblorderlog").show();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbliFramContainer").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllipperdetails").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblEQAllPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblBNDSGXPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblSuitabilityurl").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblviewquota").hide();
    document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + lblcntrl + '_imgblockly1').style.display = "none";
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblpayoffgraph").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchProductFolder").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchProductInfo").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchNewRFQ").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchManualRFQ").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblDisplayNews").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchProductFolder").hide();
    $("#div" + lblcntrl).css('height', 'auto');
    $("#div" + lblcntrl).slideToggle();



    //$('#'+x).toggle("slow");
    //$('#' + x).slideDown("slow");
    // window.open("../OrderLog_OCBC/OrderLog_OCBC.aspx?Mode=VIEW&NMID=" & NoteMasterID & "#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1,0");
    //document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl00_lblorderlog').text = "<iframe id='iframe0'   scrolling='no' frameborder='0' src='../OrderLog_OCBC/OrderLog_OCBC.aspx?Mode=VIEW&NMID=" & NoteMasterID & "'></iframe>"

    // $('#ctl00_MainContent_dlProductPriceDetails_ctl00_lblorderlog').text('<iframe scrolling="no" frameborder="0" style="width:1100px; height:500px; background-color:#FF0000;" src="../OrderLog_OCBC/OrderLog_OCBC.aspx?Mode=VIEW&NMID=' & NoteMasterID & '"></iframe>');


    //  $('#ctl00_MainContent_dlProductPriceDetails_ctl00__Commentary').css('display', 'none');

    //$('#' + x).slideToggle();
}

function view_quota(lblcntrl) {

    var notemasterid = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblnotemasterid").text();

    var CustomerID = document.getElementById('ctl00_MainContent_hdncustid').value;

    ////alert(notemasterid);

    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblorderlog").html("<iframe id='iframe" + lblcntrl + "' scrolling='no' frameborder='0' style='height:1000px !important;width:1000px !important' src='../OrderLog/OrderLog.aspx?Mode=VIEW&NMID=" + notemasterid + "&CustomerID=" + CustomerID + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>");

    //var str = ''

    //str = str + '<table cellpadding=2 cellspacing=2>'                        
    //str = str + '<tr><td>' + $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblviewquota").html("<iframe id='iframe" + lblcntrl + "'   scrolling='no' frameborder='0' style='height:500px !important' src='../PriceEnquiry_New/Branch_Level_Quota.aspx?NoteMasterID=" + notemasterid + "&RowIndex=" + lblcntrl + "#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>"); +'</td></tr>'
    //str = str + '<tr><td>' + $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblorderlog").html("<iframe id='iframe" + lblcntrl + "'   scrolling='no' frameborder='0' style='height:1000px !important' src='../OrderLog/OrderLog.aspx?Mode=VIEW&NMID=" + notemasterid + "&CustomerID=" + CustomerID + "#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>"); +'</td></tr>' //Added Customer ID in querystring  by Anand K on 03 Sep 2015
    //str = str + '</table>'

    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblorderlog").show();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbliFramContainer").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllipperdetails").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblEQAllPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblBNDSGXPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblSuitabilityurl").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblviewquota").hide();
    document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + lblcntrl + '_imgblockly1').style.display = "none";
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblpayoffgraph").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchProductFolder").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchProductInfo").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchNewRFQ").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchManualRFQ").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblDisplayNews").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchProductFolder").hide();
    $("#div" + lblcntrl).css('height', 'auto');
    $("#div" + lblcntrl).slideToggle();

}

function AcceptPrice(bestprice, index) {

    var notemasterid = document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + index + '_lblnotemasterid').innerText;

    PageMethods.UpdateEQBestPrice(bestprice, notemasterid)

}

function show_prices(index) {

    index = index.id.replace('ctl00_MainContent_dlProductPriceDetails_ctl0', '').replace('_dBestPrice', '');

    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + index + "_lblEQAllPrices").show();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + index + "_lblBNDSGXPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + index + "_lblorderlog").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + index + "_lbliFramContainer").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + index + "_lbllipperdetails").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + index + "__Commentary").empty();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + index + "_lblSuitabilityurl").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + index + "_lblviewquota").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + index + "_lblpayoffgraph").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + index + "_lblLaunchNewRFQ").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + index + "_lblLaunchManualRFQ").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + index + "_lblDisplayNews").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + index + "_lblLaunchProductFolder").hide();
    document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + index + '_imgblockly1').style.display = "none";
    $("#div" + index).css('height', 'auto');
    $("#div" + index).slideToggle();
}

function show_hide_notes(NmID) {

    if ($("#ctl00_MainContent_rdbtargetclient_1").is(":checked") && $("#ctl00_MainContent_FinIQ_Fast_Find_Customer1_txtCustomerName").text() != '') {
        InNotes = 1;
        ////alert(Notes);
        if (Notes == 0) {
            $("#DNotes").show();
            Notes = 1;
            $("#ctl00_MainContent_hdnNoteMasterIDForNotes").val($("#ctl00_MainContent_dlProductPriceDetails_ctl0" + NmID + "_lblnotemasterid").text());
            ////alert($("#ctl00_MainContent_hdnNoteMasterIDForNotes").val());
            $("#ctl00_MainContent_lblNMCustName").text($("#ctl00_MainContent_FinIQ_Fast_Find_Customer1_txtCustomerName").text());
            $("#ctl00_MainContent_Notes").val("");

            var currenttime = new Date();

            currenttime = [currenttime.getMonth() + 1,
                           currenttime.getDate(),
                           currenttime.getFullYear()].join('/') + ' ' +
                          [currenttime.getHours(),
                          currenttime.getMinutes(),
                          currenttime.getSeconds()].join(':');

            ////alert(currenttime);

            document.getElementById('ctl00_MainContent_hdn_stickynote_opened_at').value = currenttime;

            ////alert(document.getElementById('ctl00_MainContent_hdn_stickynote_opened_at').value);
        }
        else {
            $("#DNotes").hide();
            Notes = 0;
        }
    }
}
function clear_notes() {
    ////alert('hi');
    $("#ctl00_MainContent_Notes").val("");
}
//#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1,0
function showhide(obj) {


    // //alert("Hi");
}

function switchViews(obj, row) {
    var div = document.getElementById(obj);


    if (div.style.display == "none") {
        div.style.display = "inline";
    }
    else {
        div.style.display = "none";
    }
}



function BlinkText() {

    $('.blink').blink(); // default is 500ms blink interval.
    //$('.blink').blink({delay:100}); // causes a 100ms blink interval.
}



function showemptynotesicon() {
    //$(document).ready(function() {
    ////alert("empty_notes");
    $("html #Div2").css("display", "inline");

    //});

    // document.getElementById('Div2').style.display = 'inline !important';
}

function showfillednotesicon() {
    //$(document).ready(function() {
    ////alert("filled_notes");
    $("html #Div1").css("display", "inline");

    //});

    //document.getElementById('Div1').style.display = 'inline !important';
}



function showfilters() {


    $("#ctl00_MainContent_hdn_showfilters").val("Yes");

    // Set the effect type
    //var effect = 'slide';

    // Set the options for the effect type chosen
    //var options = { direction: $('.mySelect').val() };

    // Set the duration (default: 400 milliseconds)
    var duration = 1500;

    $('#ctl00_MainContent_myDiv').toggle("slide", duration);

    $('#btnhidefilters').css("display", "block");
    $('#btnshowfilters').css("display", "none");



}

function hidefilters() {

    ////alert('hide');

    $("#ctl00_MainContent_hdn_showfilters").val("No");

    // Set the effect type
    //var effect = 'slide';

    // Set the options for the effect type chosen
    //var options = { direction: $('.mySelect').val() };

    // Set the duration (default: 400 milliseconds)

    var duration = 1500;

    $('#ctl00_MainContent_myDiv').toggle("slide", duration);



    //$('#ctl00_MainContent_dvpriceenquiry').toggle("slide", duration);

    //            $('#ctl00_MainContent_myDiv').animate({

    //                left: 0 - $('#ctl00_MainContent_myDiv').width() + 10 + 'px'
    //                ////alert($('#ctl00_MainContent_myDiv').width());

    //            }, 500, function() {

    //                $('#tdmasterfilters').width("0px");

    //            });

    //            $('#ctl00_MainContent_dvpriceenquiry').animate({

    //            left:'10px'
    //            
    //    }, 500);

    $('#btnshowfilters').css("display", "block");
    $('#btnhidefilters').css("display", "none");
}



function ShowHideMasterFilter() {

    ////alert($('#ctl00_MainContent_btnHideFilter1').attr("class"));
    ////alert('Hii');

    if ($('#ctl00_MainContent_btnHideFilter1').attr("class") == 'btnShow') {

        $("#slider-range").show();
        $("#slider-range1").show();
        $("#slider-range2").show();
        $("#slider-range3").show();
        $("#slider-range4").show();
        $("#slider-range5").show();
        $("#slider-range6").show();
        $('#ctl00_MainContent_filterTableToHide').slideDown(500);
        $('#ctl00_MainContent_btnHideFilter1').attr("class", "btnHide");
        $('#ctl00_MainContent_hdn_showmasterfilter').val("Show");
    }

    else if ($('#ctl00_MainContent_btnHideFilter1').attr("class") == 'btnHide') {

        $("#slider-range").hide();
        $("#slider-range1").hide();
        $("#slider-range2").hide();
        $("#slider-range3").hide();
        $("#slider-range4").hide();
        $("#slider-range5").hide();
        $("#slider-range6").hide();
        $('#ctl00_MainContent_filterTableToHide').slideUp(500);
        $('#ctl00_MainContent_btnHideFilter1').attr("class", "btnShow");
        $('#ctl00_MainContent_hdn_showmasterfilter').val("Hide");

    }
}

function ShowHideProductFilter() {

    if ($('#btnHideProduct1').attr("class") == 'btnShow') {

        $('#ctl00_MainContent_productTableToHide').slideDown(500);
        $('#btnHideProduct1').attr("class", "btnHide");
        $('#ctl00_MainContent_hdn_showproductfilter').val("Show");
    }

    else if ($('#btnHideProduct1').attr("class") == 'btnHide') {

        $('#ctl00_MainContent_productTableToHide').slideUp(500);
        $('#btnHideProduct1').attr("class", "btnShow");
        $('#ctl00_MainContent_hdn_showproductfilter').val("Hide");

    }

}

function ShowHideReferenceNo() {

    if ($('#btnHideReference1').attr("class") == 'btnShow') {

        $('#ctl00_MainContent_referenceTableToHide').slideDown(500);
        $('#btnHideReference1').attr("class", "btnHide");
        $('#ctl00_MainContent_hdn_showreferencenofilter').val("Show");
    }

    else if ($('#btnHideReference1').attr("class") == 'btnHide') {

        $('#ctl00_MainContent_referenceTableToHide').slideUp(500);
        $('#btnHideReference1').attr("class", "btnShow");
        $('#ctl00_MainContent_hdn_showreferencenofilter').val("Hide");

    }

}

function ShowHideRiskScore() {

    if ($('#btnHideRiskScore1').attr("class") == 'btnShow') {

        $('#ctl00_MainContent_riskScoreToHide').slideDown(500);
        $('#btnHideRiskScore1').attr("class", "btnHide");
        $('#ctl00_MainContent_hdn_showriskscorefilter').val("Show");
    }

    else if ($('#btnHideRiskScore1').attr("class") == 'btnHide') {

        $('#ctl00_MainContent_riskScoreToHide').slideUp(500);
        $('#btnHideRiskScore1').attr("class", "btnShow");
        $('#ctl00_MainContent_hdn_showriskscorefilter').val("Hide");

    }

}

function ShowHideRating() {

    if ($('#btnHideRating1').attr("class") == 'btnShow') {

        $('#ctl00_MainContent_ratingToHide').slideDown(500);
        $('#btnHideRating1').attr("class", "btnHide");
        $('#ctl00_MainContent_hdn_showrating').val("Show");
    }

    else if ($('#btnHideRating1').attr("class") == 'btnHide') {

        $('#ctl00_MainContent_ratingToHide').slideUp(500);
        $('#btnHideRating1').attr("class", "btnShow");
        $('#ctl00_MainContent_hdn_showrating').val("Hide");

    }

}

function ProductCssClass_Hide() {

    $('#btnHideProduct1').attr("class", "btnHide");
}

function ProductCssClass_Show() {

    //alert($('#btnHideProduct1').attr("class"));
    $('#btnHideProduct1').attr("class", "btnShow");
    //alert($('#btnHideProduct1').attr("class"));
}

function ShowSuitabilityPopup(cntrl) {

    ////alert("ShowSuitabilityPopup");

    var rowid = cntrl.id.replace('ctl00_MainContent_dlProductPriceDetails_ctl0', '').replace('_imgbtnnoneligibleproducts', '');

    var customerid = document.getElementById('ctl00_MainContent_hdncustid').value;
    var customertype = document.getElementById('ctl00_MainContent_hdn_cust_Type').value;
    var productcode = document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + rowid + '_lblproductcode').innerText;
    var notemasterid = document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + rowid + '_lblnotemasterid').innerText;
    var scheme = document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + rowid + '_lblscheme').innerText;

    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblEQAllPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblBNDSGXPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblorderlog").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lbliFramContainer").empty();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblviewquota").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lbllipperdetails").empty();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblSuitabilityurl").show();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblpayoffgraph").hide();
    document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + rowid + '_imgblockly1').style.display = "none";
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblLaunchProductFolder").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lbllaunchneworder").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblLaunchProductInfo").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblLaunchNewRFQ").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblLaunchManualRFQ").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblDisplayNews").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblLaunchProductFolder").hide();
    HideSuitabilityPopup = false;
}

function Show_Blockly(cntrl) {


    var rowid = cntrl.id.replace('ctl00_MainContent_dlProductPriceDetails_ctl0', '').replace('_imgblockly', '');

    var template_Code = document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + rowid + '_lbltemplatecode').innerText;

    ////alert(template_Code);

    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblEQAllPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblBNDSGXPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblorderlog").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lbliFramContainer").empty();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lbllipperdetails").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblSuitabilityurl").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblviewquota").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblpayoffgraph").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblLaunchProductFolder").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lbllaunchneworder").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblLaunchProductInfo").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblLaunchNewRFQ").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblLaunchManualRFQ").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblDisplayNews").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblLaunchProductFolder").hide();
    document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + rowid + '_imgblockly1').style.display = "inline";
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_imgblockly1").attr("src", "../App_Resources/imagesPE/" + template_Code + ".jpeg");
    Hideblockly = false;
}

function Show_Payoff_Graph(cntrl) {


    var rowid = cntrl.id.replace('ctl00_MainContent_dlProductPriceDetails_ctl0', '').replace('_imgpayoff', '');

    var notemasterid = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblnotemasterid").text();

    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblEQAllPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblBNDSGXPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblorderlog").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lbliFramContainer").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lbllipperdetails").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblSuitabilityurl").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblviewquota").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblLaunchNewRFQ").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblLaunchManualRFQ").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblDisplayNews").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblLaunchProductFolder").hide();
    document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + rowid + '_imgblockly1').style.display = "none";

    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblpayoffgraph").show();

    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblpayoffgraph").html("<iframe id='iframe" + rowid + "' scrolling='no' frameborder='0' style='height:600px !important' src='../PriceEnquiry_New/Payoff_Graph.aspx?NoteMasterID=" + notemasterid + "#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>");

    HidePayoffGraph = false;
}

function Create_Folder(cntrl) {

    var rowid = cntrl.id.replace('ctl00_MainContent_dlProductPriceDetails_ctl0', '').replace('_imgproductfolder', '');

    var notemasterid = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblnotemasterid").text();
    var customerid = document.getElementById('ctl00_MainContent_hdncustid').value;
    var Mode = document.getElementById('ctl00_MainContent_hdn_Mode').value;
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblEQAllPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblBNDSGXPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblorderlog").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lbliFramContainer").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lbllipperdetails").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblSuitabilityurl").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblviewquota").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lbllaunchneworder").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblLaunchProductInfo").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblLaunchNewRFQ").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblLaunchManualRFQ").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblDisplayNews").hide();
    document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + rowid + '_imgblockly1').style.display = "none";
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblLaunchProductFolder").show();

    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowid + "_lblLaunchProductFolder").html("<iframe id='iframe" + rowid + "' scrolling='no' frameborder='0' style='height:300px !important;width:600px !important' src='../RMWorkstation_Bonds/CreateFolders.aspx?NoteMasterID=" + notemasterid + "&CustomerID=" + customerid + "&Mode=" + Mode + "#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>");
    HideFolders = false;
}

function View_Factsheet(cntrl) {

    var notemasterid = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblnotemasterid").text();

    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblEQAllPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblBNDSGXPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblorderlog").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductFolder").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbllipperdetails").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblSuitabilityurl").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblviewquota").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbllaunchneworder").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductInfo").hide();
    document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + cntrl + '_imgblockly1').style.display = "none";
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchNewRFQ").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchManualRFQ").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbliFramContainer").show();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblDisplayNews").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductFolder").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbliFramContainer").html("<iframe id='iframe" + cntrl + "' scrolling='no' frameborder='0' style='height:300px !important;width:600px !important' src='../RMWorkstation_Bonds/ViewAttachedFiles.aspx?NoteMasterID=" + notemasterid + "#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>");

    $("#div" + cntrl).css('height', 'auto');
    $("#div" + cntrl).slideToggle();
}


function View_ProductInfo(cntrl) {

    var notemasterid = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblnotemasterid").text();

    //Added By Gopika w on 28 July 2017
    //window.open('ProductInfo.aspx?NoteMasterID=' + notemasterid + '&Master_Popup=POPUP', 'OpenPopup', 'top=150,left=500,status=1,scrollbars=1,resizable=0,width=750px,height=700px');

    window.open('ProductInfo.aspx?NoteMasterID=' + notemasterid + '&Master_Popup=POPUP', 'OpenPopup', 'top=500,left=500,status=1,scrollbars=1,resizable=0,width=750px,height=900px');

    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblEQAllPrices").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblBNDSGXPrices").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblorderlog").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductFolder").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbllipperdetails").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblSuitabilityurl").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblviewquota").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbliFramContainer").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbllaunchneworder").hide();
    //document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + cntrl + '_imgblockly1').style.display = "none";
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchNewRFQ").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchManualRFQ").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductInfo").show();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblDisplayNews").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductFolder").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductInfo").html("<iframe id='iframe" + cntrl + "' scrolling='yes' frameborder='0' style='height:800px !important;width:1000px !important' src='../FinIQ_UCP_Control/FinIQ_UCPDealEntry.aspx?WorkflowMode=UCPRMW&DealNum=N:" + notemasterid + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=1&pagenum=1&view=fitH,0'></iframe>");

    //$("#div" + cntrl).css('height', 'auto');
    //$("#div" + cntrl).css('width', 'auto');
    //$("#div" + cntrl).slideToggle();
}

//Aditya Bhong on 1-Jul-2017 to display the news for SCB FI Connect. <Start>
function displayNews(lblcntrl) {
    var notemasterid = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblnotemasterid").text();

    var str = ''

    str = str + '<table cellpadding=2 cellspacing=2>'
    //Modified by Gopika W on 24 july 2017
    str = str + '<tr><td>' + $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblDisplayNews").html("<iframe id='iframe" + lblcntrl + "' scrolling='yes' frameborder='0' style='height:400px !important;width:1100px !important' src='../RMWorkstation_Bonds/DisplayNews.aspx?NoteMasterId=" + notemasterid + "#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>"); +'</td></tr>'
    str = str + '</table>'

    ////alert(notemasterid)

    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblproductclusters").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblProductPerformance").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblorderlog").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbliFramContainer").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllipperdetails").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblEQAllPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblBNDSGXPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblSuitabilityurl").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblviewquota").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblViewAttachedFiles").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchPriceUpdate").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblViewScenarioAnalysis").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblDisplayNews").show();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchProductFolder").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblpayoffgraph").hide();
    $("#div" + lblcntrl).css('height', 'auto');
    $("#div" + lblcntrl).slideToggle();

}
//Aditya Bhong on 1-Jul-2017 to display the news for SCB FI Connect. <End>

//function showhidefilters() {

//function pageLoad(sender,args)
//{

//$(document).ready(function() {

//  $("#PENav").addAttr('jQuery110207620929944938339', '13');

//              //alert($("#ctl00_MainContent_hdn_showfilters").val());

//                if ($("#ctl00_MainContent_hdn_showfilters").val() == "No") {

//                    $("#PENav").toggleClass("rightNav");
//                    $("#PENav").removeClass("leftNav");
//                }
//                else if ($("#ctl00_MainContent_hdn_showfilters").val() == "") {
//                    //$("#PENav").toggleClass("leftNav");
//                    // $("#PENav").removeClass("rightNav");
//                }

//                else {
//                    $("#PENav").toggleClass("leftNav");
//                    $("#PENav").removeClass("rightNav");

//                }

//              //alert($('#tblmain').css("left"));

//              if ($('#tblmain').css("left")=="0px") {

//                     $('.tblMainPE').stop().animate({
//                      left: (-1 * 450) + 'px'
//                  }, 500);
//                  $('#tblmain').css("left", "-450px");
//              }
//              else {
//                 //Do Nothing
//              }

//              $('.tblMainPE').stop().animate({
//                  left: (-1 * 450) + 'px'
//              }, 500);

//              $(document).ready(function() {
//                  $(this).toggleClass("rightNav");
//                  $(this).removeClass("leftNav");
//              });

//function PageLoad_RMW() {

//    //$("#ctl00_MainContent_PENav").click(function () {

//    $(this).toggleClass("rightNav");
//    $(this).removeClass("leftNav");

//    if ($(this).attr('class') == "rightNav") {
//            $('.tblMainPE').stop().animate({
//                left: (-1 * 535) + 'px'     //490
//            }, 1000);
//            //$('.tblMainPE').toggle("slide");
//        }
//        else {
//        $(this).toggleClass("leftNav");
//        $(this).removeClass("rightNav");
//            $('.tblMainPE').stop().animate({
//                left: (0) + 'px'
//            }, 1000);
//            //$('.tblMainPE').toggle("slide");
//        }
//    //});
//}
// });

//   }


function HideMasterFilters() {



    $("#ctl00_MainContent_PENav").toggleClass("rightNav");
    $("#ctl00_MainContent_PENav").removeClass("leftNav");

    $('.tblMainPE').stop().animate({
        left: (-1 * 450) + 'px'            //450
    }, 1000);



}

function storeCurrentValue() {
    try
    {
        prevBidYtmFrom = $("#ctl00_MainContent_txtfrom").val();
        prevBidYtmTo = $("#ctl00_MainContent_txtto").val();
        prevAskYtmFrom = $("#ctl00_MainContent_txtAskYieldFrom").val();
        prevAskYtmTo = $("#ctl00_MainContent_txtAskYieldTo").val();
        prevBidPriceFrom = $("#ctl00_MainContent_txtpricefrom").val();
        prevBidPriceTo = $("#ctl00_MainContent_txtpriceto").val();
        prevAskPriceFrom = $("#ctl00_MainContent_txtAskPriceFrom").val();
        prevAskPriceTo = $("#ctl00_MainContent_txtAskPriceTo").val();
        prevCouponFrom = $("#ctl00_MainContent_txtcouponfrom").val();
        prevCouponTo = $("#ctl00_MainContent_txtcouponto").val();
        prevLtvFrom = $("#ctl00_MainContent_txtltvfrom").val();
        prevLtvTo = $("#ctl00_MainContent_txtltvto").val();
        prevLtv2From = $("#ctl00_MainContent_txtltv2from").val();
        prevLtv2To = $("#ctl00_MainContent_txtltv2to").val();
        prevMaturityFrom = $("#ctl00_MainContent_txtMaturityFrom").val();
        prevMaturityTo = $("#ctl00_MainContent_txtMaturityTo").val();
        prevRiskScoreFrom = $("#ctl00_MainContent_txtriskfrom").val();
        prevRiskScoreTo = $("#ctl00_MainContent_txtriskto").val();
        prevStrikeFrom = $("#ctl00_MainContent_txtstrikefrom").val();
        prevStrikeTo = $("#ctl00_MainContent_txtstriketo").val();
        //Aditya B || 05-Apr-2021 || For RHB || Start
        prevKIFrom = $("#ctl00_MainContent_txtkifrom").val();
        prevKITo = $("#ctl00_MainContent_txtkito").val();
        prevKOFrom = $("#ctl00_MainContent_txtkofrom").val();
        prevKOTo = $("#ctl00_MainContent_txtkoto").val();
        //Aditya B || 05-Apr-2021 || For RHB || End
    }
    catch (error) {
        console.log('Error in storeCurrentValue(): ' + error);
    }
}

//Generic load Slider
function loadSlider(object,setInputVal) {

    $(document).ready(function () {
        //debugger;
        if (object != null) {
            document.getElementById('ctl00_MainContent_hdn_TextBoxId').value = $(object).attr('id');
        }
        //else {
        //    document.getElementById('ctl00_MainContent_hdn_CheckBox').value = "";
        //}
        
        var minprice = document.getElementById('ctl00_MainContent_hdn_min_Customer_price').value;
        var minstrike = document.getElementById('ctl00_MainContent_hdn_StrikePercBetween_From').value;
        var mincoupon = document.getElementById('ctl00_MainContent_hdn_Coupon_From').value;
        var minriskscore = document.getElementById('ctl00_MainContent_hdn_RiskScoreBetween_From').value;
        
        var maxprice = document.getElementById('ctl00_MainContent_hdn_max_Customer_price').value;
        var maxcoupon = document.getElementById('ctl00_MainContent_hdn_Coupon_To').value;
        var maxstrike = document.getElementById('ctl00_MainContent_hdn_StrikePercBetween_To').value;
        var maxriskscore = document.getElementById('ctl00_MainContent_hdn_RiskScoreBetween_To').value;

        var maxBidyield = document.getElementById('ctl00_MainContent_hdn_BidYTM_To').value;
        var maxAskyield = document.getElementById('ctl00_MainContent_hdn_AskYTM_To').value;
        var maxBidprice = document.getElementById('ctl00_MainContent_hdn_BidPrice_To').value;
        var maxAskPrice = document.getElementById('ctl00_MainContent_hdn_AskPrice_To').value;
        var maxLTV = document.getElementById('ctl00_MainContent_hdn_LTV1_To').value;
        //Added by Dashrath on 20-Dec-2017 for WLB bonds.
        var maxLTV2 = document.getElementById('ctl00_MainContent_hdn_LTV2_To').value;
        var maxMaturity = document.getElementById('ctl00_MainContent_hdn_TenorLeft_To').value;

        var minMaturity = document.getElementById('ctl00_MainContent_hdn_TenorLeft_From').value;
        var minBidyield = document.getElementById('ctl00_MainContent_hdn_BidYTM_From').value;
        var minAskyield = document.getElementById('ctl00_MainContent_hdn_AskYTM_From').value;
        var minBidprice = document.getElementById('ctl00_MainContent_hdn_BidPrice_From').value;
        var minAskPrice = document.getElementById('ctl00_MainContent_hdn_AskPrice_From').value;
        var minLTV = document.getElementById('ctl00_MainContent_hdn_LTV1_From').value;
        //Added by Dashrath on 20-Dec-2017 for WLB bonds.
        var minLTV2 = document.getElementById('ctl00_MainContent_hdn_LTV2_From').value;

        //Aditya B || 05-Apr-2021 || For RHB || Start
        var minKI = document.getElementById('ctl00_MainContent_hdn_KI_From').value;
        var maxKI = document.getElementById('ctl00_MainContent_hdn_KI_To').value;
        var minKO = document.getElementById('ctl00_MainContent_hdn_KO_From').value;
        var maxKO = document.getElementById('ctl00_MainContent_hdn_KO_To').value;
        //Aditya B || 05-Apr-2021 || For RHB || End

        if (setInputVal) {
            //if ($("#ctl00_MainContent_txtfrom").val() == "") {
            $("#ctl00_MainContent_txtfrom").val(minBidyield);
            $("#ctl00_MainContent_txtto").val(maxBidyield);
            //$("#ctl00_MainContent_txtfrom").val(minyield);
            //$("#ctl00_MainContent_txtto").val(maxyield);
            //$("#ctl00_MainContent_txtfrom").val(0);
            //$("#ctl00_MainContent_txtto").val(200);
            //}

            //if ($("#ctl00_MainContent_txtpricefrom").val() == "") {
            $("#ctl00_MainContent_txtpricefrom").val(minBidprice);
            $("#ctl00_MainContent_txtpriceto").val(maxBidprice);
            //$("#ctl00_MainContent_txtpricefrom").val(minprice);
            //$("#ctl00_MainContent_txtpriceto").val(maxprice);
            //$("#ctl00_MainContent_txtpricefrom").val(0);
            //$("#ctl00_MainContent_txtpriceto").val(200);
            //}

            //if ($("#ctl00_MainContent_txtstrikefrom").val() == "") {
            $("#ctl00_MainContent_txtstrikefrom").val(minstrike);
            $("#ctl00_MainContent_txtstriketo").val(maxstrike);
            //$("#ctl00_MainContent_txtstrikefrom").val(0);
            //$("#ctl00_MainContent_txtstriketo").val(99);
            //}

            //if ($("#ctl00_MainContent_txtcouponfrom").val() == "") {
            $("#ctl00_MainContent_txtcouponfrom").val(mincoupon);
            $("#ctl00_MainContent_txtcouponto").val(maxcoupon);
            //$("#ctl00_MainContent_txtcouponfrom").val(0);
            //$("#ctl00_MainContent_txtcouponto").val(99);
            //}

            //if ($("#ctl00_MainContent_txtriskfrom").val() == "") {
            $("#ctl00_MainContent_txtriskfrom").val(minriskscore);
            $("#ctl00_MainContent_txtriskto").val(maxriskscore);
            //$("#ctl00_MainContent_txtriskfrom").val(0);
            //$("#ctl00_MainContent_txtriskto").val(99);
            //}

            //Aditya B on 4-Aug-2015 <Start>
            if ($("#ctl00_MainContent_txtcorelationfrom").val() == "") {
                $("#ctl00_MainContent_txtcorelationfrom").val(0);
                $("#ctl00_MainContent_txtcorelationto").val(99);
            }
            //Aditya B on 4-Aug-2015 <End>

            //Aditya B on 5-Nov-2015 <Start>
            if ($("#ctl00_MainContent_txtwdfrom").val() == "") {
                $("#ctl00_MainContent_txtwdfrom").val(0);
                $("#ctl00_MainContent_txtwdto").val(99);
            }
            //Aditya B on 5-Nov-2015 <End>

            //Aditya B on 06-Jun-2017 <Start> for SCB.
            //if ($("#ctl00_MainContent_txtMaturityFrom").val() == "") {
            $("#ctl00_MainContent_txtMaturityFrom").val(minMaturity);
            $("#ctl00_MainContent_txtMaturityTo").val(maxMaturity);
            //}
            //Aditya B on 06-Jun-2017 <End>

            //Aditya B on 21-Jun-2017 <Start> for SCB FI Connect.
            //if ($("#ctl00_MainContent_txtAskYieldFrom").val() == "") {
            $("#ctl00_MainContent_txtAskYieldFrom").val(minAskyield);
            $("#ctl00_MainContent_txtAskYieldTo").val(maxAskyield);
            //$("#ctl00_MainContent_txtAskYieldFrom").val(0);
            //$("#ctl00_MainContent_txtAskYieldTo").val(200);
            //}

            //if ($("#ctl00_MainContent_txtAskPriceFrom").val() == "") {
            $("#ctl00_MainContent_txtAskPriceFrom").val(minAskPrice);
            $("#ctl00_MainContent_txtAskPriceTo").val(maxAskPrice);
            //$("#ctl00_MainContent_txtAskPriceFrom").val(0);
            //$("#ctl00_MainContent_txtAskPriceTo").val(200);
            //}
            //Aditya B on 21-Jun-2017 <End>

            //Aditya B on 28-Jun-2017 <Start> for SCB FI Connect.
            //if ($("#ctl00_MainContent_txtltvfrom").val() == "") {
            $("#ctl00_MainContent_txtltvfrom").val(minLTV);
            $("#ctl00_MainContent_txtltvto").val(maxLTV);
            //$("#ctl00_MainContent_txtltvfrom").val(0);
            //$("#ctl00_MainContent_txtltvto").val(200);
            //}
            //Aditya B on 28-Jun-2017 <End> for SCB FI Connect.

            //Dashrath on 20-Dec-2017 <Start> for WLB.
            //if ($("#ctl00_MainContent_txtltv2from").val() == "") {
            $("#ctl00_MainContent_txtltv2from").val(minLTV2);
            $("#ctl00_MainContent_txtltv2to").val(maxLTV2);
            //$("#ctl00_MainContent_txtltvfrom").val(0);
            //$("#ctl00_MainContent_txtltvto").val(200);
            //}
            //Dashrath on 20-Dec-2017 <End> for WLB.

            //Aditya B || 05-Apr-2021 || For RHB || Start
            $("#ctl00_MainContent_txtkifrom").val(minKI);
            $("#ctl00_MainContent_txtkito").val(maxKI);

            $("#ctl00_MainContent_txtkofrom").val(minKO);
            $("#ctl00_MainContent_txtkoto").val(maxKO);
            //Aditya B || 05-Apr-2021 || For RHB || End
        }
        else {
            $("#ctl00_MainContent_txtfrom").val(prevBidYtmFrom);
            $("#ctl00_MainContent_txtto").val(prevBidYtmTo);

            $("#ctl00_MainContent_txtpricefrom").val(prevBidPriceFrom);
            $("#ctl00_MainContent_txtpriceto").val(prevBidPriceTo);

            $("#ctl00_MainContent_txtstrikefrom").val(prevStrikeFrom);
            $("#ctl00_MainContent_txtstriketo").val(prevStrikeTo);

            $("#ctl00_MainContent_txtcouponfrom").val(prevCouponFrom);
            $("#ctl00_MainContent_txtcouponto").val(prevCouponTo);

            $("#ctl00_MainContent_txtriskfrom").val(prevRiskScoreFrom);
            $("#ctl00_MainContent_txtriskto").val(prevRiskScoreTo);

            $("#ctl00_MainContent_txtMaturityFrom").val(prevMaturityFrom);
            $("#ctl00_MainContent_txtMaturityTo").val(prevMaturityTo);

            $("#ctl00_MainContent_txtAskYieldFrom").val(prevAskYtmFrom);
            $("#ctl00_MainContent_txtAskYieldTo").val(prevAskYtmTo);

            $("#ctl00_MainContent_txtAskPriceFrom").val(prevAskPriceFrom);
            $("#ctl00_MainContent_txtAskPriceTo").val(prevAskPriceTo);

            $("#ctl00_MainContent_txtltvfrom").val(prevLtvFrom);
            $("#ctl00_MainContent_txtltvto").val(prevLtvTo);

            $("#ctl00_MainContent_txtltv2from").val(prevLtv2From);
            $("#ctl00_MainContent_txtltv2to").val(prevLtv2To);

            //Aditya B || 05-Apr-2021 || For RHB || Start
            $("#ctl00_MainContent_txtkifrom").val(prevKIFrom);
            $("#ctl00_MainContent_txtkito").val(prevKITo);

            $("#ctl00_MainContent_txtkofrom").val(prevKOFrom);
            $("#ctl00_MainContent_txtkoto").val(prevKOTo);
            //Aditya B || 05-Apr-2021 || For RHB || End
        }

        $(function () {

            $("#slider-range").slider({
                range: true,
                min: 0,
                //max:maxyield,
                max: maxBidyield,
                values: [$("#ctl00_MainContent_txtfrom").val(), $("#ctl00_MainContent_txtto").val()],
                slide: function (event, ui) {
                    $("#ctl00_MainContent_txtfrom").val(ui.values[0]);
                    $("#ctl00_MainContent_txtto").val(ui.values[1]);
                }
            });
        });




        $(function () {
            $("#slider-range1").slider({
                range: true,
                min: 0,
                //max: maxprice,
                max: maxAskPrice,
                values: [$("#ctl00_MainContent_txtpricefrom").val(), $("#ctl00_MainContent_txtpriceto").val()],
                slide: function (event, ui) {
                    // $("#amount").val(ui.values[0] + "%" + " - " + ui.values[1] + "%");
                    $("#ctl00_MainContent_txtpricefrom").val(ui.values[0]);
                    $("#ctl00_MainContent_txtpriceto").val(ui.values[1]);
                }
            });


        });

        $(function () {

            $("#slider-range2").slider({
                range: true,
                min: 0,
                //max: maxstrike,
                max: maxstrike,
                values: [$("#ctl00_MainContent_txtstrikefrom").val(), $("#ctl00_MainContent_txtstriketo").val()],
                slide: function (event, ui) {
                    //$("#amount").val(ui.values[0] + "%" + " - " + ui.values[1] + "%");
                    $("#ctl00_MainContent_txtstrikefrom").val(ui.values[0]);
                    $("#ctl00_MainContent_txtstriketo").val(ui.values[1]);
                }
            });


        });

        $(function () {
            $("#slider-range3").slider({
                range: true,
                min: 0,
                //max: maxcoupon,
                max: maxcoupon,
                values: [$("#ctl00_MainContent_txtcouponfrom").val(), $("#ctl00_MainContent_txtcouponto").val()],
                slide: function (event, ui) {
                    //$("#amount").val(ui.values[0] + "%" + " - " + ui.values[1] + "%");
                    $("#ctl00_MainContent_txtcouponfrom").val(ui.values[0]);
                    $("#ctl00_MainContent_txtcouponto").val(ui.values[1]);
                }
            });


        });

        /*$(function() {
        $("#slider-range4").slider({
        range: true,
        min: 0,
        max: 99,
        values: [$("#ctl00_MainContent_txtriskscorefrom").val(), $("#ctl00_MainContent_txtriskscoreto").val()],
        slide: function(event, ui) {
                  
        $("#ctl00_MainContent_txtriskscorefrom").val(ui.values[0]);
        $("#ctl00_MainContent_txtriskscoreto").val(ui.values[1]);
        }
        });


        });*/


        $(function () {
            $("#slider-range4").slider({
                range: true,
                min: 0,
                //max:maxriskscore,
                max: maxriskscore,
                values: [$("#ctl00_MainContent_txtriskfrom").val(), $("#ctl00_MainContent_txtriskto").val()],
                slide: function (event, ui) {
                    // $("#amount").val(ui.values[0] + "%" + " - " + ui.values[1] + "%");
                    $("#ctl00_MainContent_txtriskfrom").val(ui.values[0]);
                    $("#ctl00_MainContent_txtriskto").val(ui.values[1]);
                }
            });


        });

        //Added by Aditya B on 4-Aug-2015 for corelation % filter as told by Milind Sir
        $(function () {
            $("#slider-range5").slider({
                range: true,
                min: 0,
                max: 99,
                values: [$("#ctl00_MainContent_txtcorelationfrom").val(), $("#ctl00_MainContent_txtcorelationto").val()],
                slide: function (event, ui) {
                    // $("#amount").val(ui.values[0] + "%" + " - " + ui.values[1] + "%");
                    $("#ctl00_MainContent_txtcorelationfrom").val(ui.values[0]);
                    $("#ctl00_MainContent_txtcorelationto").val(ui.values[1]);
                }
            });
        });
        //Added by Aditya B on 4-Aug-2015 <END>

        //Added by Aditya B on 5-Nov-2015 for watch distance filter as told by Milind Sir
        $(function () {
            $("#slider-range6").slider({
                range: true,
                min: 0,
                max: 200,
                values: [$("#ctl00_MainContent_txtwdfrom").val(), $("#ctl00_MainContent_txtwdto").val()],
                slide: function (event, ui) {
                    // $("#amount").val(ui.values[0] + "%" + " - " + ui.values[1] + "%");
                    $("#ctl00_MainContent_txtwdfrom").val(ui.values[0]);
                    $("#ctl00_MainContent_txtwdto").val(ui.values[1]);
                }
            });
        });
        //Added by Aditya B on 5-Nov-2015 <END>

        //Added by Aditya B on 06-Jun-2017 for tenor left between filter for SCB FI Connect. <Start>
        $(function () {
            $("#slider-range7").slider({
                range: true,
                min: 0,
                max: maxMaturity,
                values: [$("#ctl00_MainContent_txtMaturityFrom").val(), $("#ctl00_MainContent_txtMaturityTo").val()],
                slide: function (event, ui) {
                    // $("#amount").val(ui.values[0] + "%" + " - " + ui.values[1] + "%");
                    $("#ctl00_MainContent_txtMaturityFrom").val(ui.values[0]);
                    $("#ctl00_MainContent_txtMaturityTo").val(ui.values[1]);
                }
            });
        });
        //Added by Aditya B on 06-Jun-2017 for tenor left between filter for SCB FI Connect. <End>

        //Added by Aditya B on 21-Jun-2017 for ask yield between filter for SCB FI Connect. <Start>
        $(function () {
            $("#slider-range8").slider({
                range: true,
                min: 0,
                max: maxAskyield,
                values: [$("#ctl00_MainContent_txtAskYieldFrom").val(), $("#ctl00_MainContent_txtAskYieldTo").val()],
                slide: function (event, ui) {
                    // $("#amount").val(ui.values[0] + "%" + " - " + ui.values[1] + "%");
                    $("#ctl00_MainContent_txtAskYieldFrom").val(ui.values[0]);
                    $("#ctl00_MainContent_txtAskYieldTo").val(ui.values[1]);
                }
            });
        });
        //Added by Aditya B on 21-Jun-2017 for ask yield between filter for SCB FI Connect. <End>

        //Added by Aditya B on 21-Jun-2017 for ask price between filter for SCB FI Connect. <Start>
        $(function () {
            $("#slider-range9").slider({
                range: true,
                min: 0,
                max: maxAskPrice,
                values: [$("#ctl00_MainContent_txtAskPriceFrom").val(), $("#ctl00_MainContent_txtAskPriceTo").val()],
                slide: function (event, ui) {
                    // $("#amount").val(ui.values[0] + "%" + " - " + ui.values[1] + "%");
                    $("#ctl00_MainContent_txtAskPriceFrom").val(ui.values[0]);
                    $("#ctl00_MainContent_txtAskPriceTo").val(ui.values[1]);
                }
            });
        });
        //Added by Aditya B on 21-Jun-2017 for ask price between filter for SCB FI Connect. <End>

        //Added by Aditya B on 28-Jun-2017 for ltv % between filter for SCB FI Connect. <Start>
        $(function () {
            $("#slider-range10").slider({
                range: true,
                min: 0,
                max: maxLTV,
                values: [$("#ctl00_MainContent_txtltvfrom").val(), $("#ctl00_MainContent_txtltvto").val()],
                slide: function (event, ui) {
                    // $("#amount").val(ui.values[0] + "%" + " - " + ui.values[1] + "%");
                    $("#ctl00_MainContent_txtltvfrom").val(ui.values[0]);
                    $("#ctl00_MainContent_txtltvto").val(ui.values[1]);
                }
            });
        });
        //Added by Aditya B on 21-Jun-2017 for ltv % between filter for SCB FI Connect. <End>

        //Added by Dashrath   on 20-Dec-2017 for ltv2 % between filter for WLB. <Start>
        $(function () {
            $("#slider-range11").slider({
                range: true,
                min: 0,
                max: maxLTV2,
                values: [$("#ctl00_MainContent_txtltv2from").val(), $("#ctl00_MainContent_txtltv2to").val()],
                slide: function (event, ui) {
                    // $("#amount").val(ui.values[0] + "%" + " - " + ui.values[1] + "%");
                    $("#ctl00_MainContent_txtltv2from").val(ui.values[0]);
                    $("#ctl00_MainContent_txtltv2to").val(ui.values[1]);
                }
            });
        });
        //Added by Dashrath   on 20-Dec-2017 for ltv2 % between filter for WLB. <End>

        //Aditya B || 05-Apr-2021 || For RHB || Start
        $(function () {
            $("#slider-range12").slider({
                range: true,
                min: 0,
                max: 99,
                values: [$("#ctl00_MainContent_txtkifrom").val(), $("#ctl00_MainContent_txtkito").val()],
                slide: function (event, ui) {
                    // $("#amount").val(ui.values[0] + "%" + " - " + ui.values[1] + "%");
                    $("#ctl00_MainContent_txtkifrom").val(ui.values[0]);
                    $("#ctl00_MainContent_txtkito").val(ui.values[1]);
                }
            });
        });

        $(function () {
            $("#slider-range13").slider({
                range: true,
                min: 0,
                max: 99,
                values: [$("#ctl00_MainContent_txtkofrom").val(), $("#ctl00_MainContent_txtkoto").val()],
                slide: function (event, ui) {
                    // $("#amount").val(ui.values[0] + "%" + " - " + ui.values[1] + "%");
                    $("#ctl00_MainContent_txtkofrom").val(ui.values[0]);
                    $("#ctl00_MainContent_txtkoto").val(ui.values[1]);
                }
            });
        });
        //Aditya B || 05-Apr-2021 || For RHB || End
    });
}

function doHourglass() {
    $('#DisableDiv').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif"/>');


    //            cntrl.click();
    //            if (cntrl) cntrl.disabled = true;
    //            document.body.style.cursor = 'wait';
}



function ShowSearchByProductLoading() {
    $('#DivSearchByProductLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}



function ShowSearchByProductLoading1() {
    $('#DivSearchByProductLoading1').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}



function ShowSearchByProductLoading2() {
    $('#DivSearchByProductLoading2').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}



function ShowSearchByProductLoading3() {
    $('#DivSearchByProductLoading3').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}



function ShowSearchByProductLoading4() {
    $('#DivSearchByProductLoading4').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}



function ShowSearchByReferenceNoLoading() {
    $('#DivSearchByReferenceNoLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}



function ShowSearchByRatingLoading() {
    $('#DivSearchByRatingLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}



function ShowSearchByMasterFiltersLoading() {
    $('#DivSearchByMasterFiltersLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}



function ShowSearchByExchangeFilterLoading() {
    $('#DivSearchByExchangeFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}



function ShowSearchByCurrencyFilterLoading() {
    $('#DivSearchByCurrencyFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchBySchemeFilterLoading() {
    $('#DivSearchBySchemeFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByTemplateFilterLoading() {
    $('#DivSearchByTemplateFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByIssuerFilterLoading() {
    $('#DivSearchByIssuerFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByGuarantorFilterLoading() {
    $('#DivSearchByGuarantorFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByAssetClassFilterLoading() {
    $('#DivSearchByAssetClassFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByMarketScenarioFilterLoading() {
    $('#DivSearchByMarketScenarioFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByRecommendationFilterLoading() {
    $('#DivSearchByRecommendationFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByYieldFilterLoading() {
    $('#DivSearchByYieldFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByPriceFilterLoading() {
    $('#DivSearchByPriceFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByStrikeFilterLoading() {
    $('#DivSearchByStrikeFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByCouponFilterLoading() {
    $('#DivSearchByCouponFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByMyLikesFilterLoading() {
    $('#DivSearchByMyLikesFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByRiskScoreFilterLoading() {
    $('#DivSearchByRiskScoreFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByEligibleProductsFilterLoading() {
    $('#DivSearchByEligibleProductsFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByCustRecommendationFilterLoading() {
    $('#DivSearchByCustRecommendationFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByIPOFilterLoading() {
    $('#DivSearchByIPOFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

//Added By Gopika w for SCB FI Connect
function ShowSearchBySecBondFilterLoading() {
    $('#DivSearchBySecBondsFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByBothFilterLoading() {
    $('#DivSearchByBothFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}
//END By Gopika w for SCB FI Connect
function ShowSearchByMaturityFilterLoading() {
    $('#DivSearchByMaturityFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowFactsheetLoading(cntrl) {

    var rowindex = cntrl.id.replace('ctl00_MainContent_dlProductPriceDetails_ctl0', '').replace('_lnkGenerateTermsheet', '');

    $('#ctl00_MainContent_dlProductPriceDetails_ctl0' + rowindex + '_DivFactsheetLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" />');
}

function ApplyFavouriteFilterLoading() {
    $('#DivApplyFavouriteFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

//Added By Gopika w
function DeleteFavouriteFilterLoading() {
    $('#DivDeleteFavouriteFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ApplyGenerateProposalLoading() {
    $('#DivApplyGenerateProposalLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ApplySaveFavouriteFilterLoading() {
    $('#DivApplySaveFavouriteFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ApplySetWatchFilterLoading() {
    $('#DivApplySetWatchFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ApplySaveNotesLoading() {
    $('#DivApplySaveNotesLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ApplyExportToExcelLoading() {
    $('#DivExportToExcelLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByCategoryLoading() {
    $('#dvSearchByCategoryFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

//Show hourglass on enter key press
$(document).keyup(function (e) {
    if (e.keyCode == 13) {
        ApplySaveNotesLoading();
    }
});

function ApplyCreateFolderLoading() {
    $('#DivApplyCreateFolderLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowUpdatePriceLoading() {
    $('#DivUpdatePriceLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowApplySortLoading() {

    $('#DivApplySortLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByAskYieldFilterLoading() {
    $('#dvsearchbyaskyieldfilterloading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByAskPriceFilterLoading() {
    $('#dvsearchbyaskpricefilterloading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByTenorLeftFilterLoading() {
    $('#dvsearchbytenorleftfilterloading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByMaturityDateBetweenFilterLoading() {
    $('#dvsearchbymaturitybtwfilterloading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByPRRFilterLoading() {
    $('#dvsearchbyprrfilterloading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByMoodysRatingFilterLoading() {
    $('#dvsearchbymoodysratingfilterloading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByFitchRatingFilterLoading() {
    $('#dvsearchbyfitchratingfilterloading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchBySPRatingFilterLoading() {
    $('#dvsearchbyspratingfilterloading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByHKOnShelfFilterLoading() {
    $('#dvsearchbyhkonshelffilterloading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByLTVFilterLoading() {
    $('#dvsearchbyltvfilterloading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}
//Added by Dashrath on 20-Dec-2017 for WLB bonds.
function ShowSearchByLTVFilterLoading() {
    $('#dvsearchbyltv2filterloading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

//Aditya B || 20-Feb-2020 || Changes done for 'Only' & 'All' functionality for filters || JIRA Ref: WBDIN-52 || Start
function ShowSearchByShowProductsWithinFilterLoading() {
    $('#DivSearchByShowProductsWithinLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}
//Aditya B || 20-Feb-2020 || Changes done for 'Only' & 'All' functionality for filters || JIRA Ref: WBDIN-52 || End

function ShowPrivateListFilterLoading() {
    $('#divPrivateListFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowPublicListFilterLoading() {
    $('#divPublicListFilterLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowCMSFilterIconLoading() {
    $('#divShowCMSFilterIconsLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowPrrAssetClassLoading() {
    $('#dvPrrAssetClassLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

//Aditya B || 05-Apr-2021 || Added for RHB || Start
function ShowSearchByTenorLoading() {
    $('#DivSearchByTenorLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByCutOffTimeLoading() {
    $('#DivSearchByCutOffTimeLoading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByKIFilterLoading() {
    $('#dvsearchbykifilterloading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByKOFilterLoading() {
    $('#dvsearchbykofilterloading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}

function ShowSearchByTradeDateBetweenFilterLoading() {
    $('#dvsearchbytradedatebtwfilterloading').html('<img src="../App_Resources/Ajax_loader_White/loading_1.gif" class="HourGlass"/>');
}
//Aditya B || 05-Apr-2021 || Added for RHB || End

// Aditya B on 27-Oct-2015 to close client call notes on escape key press
$(document).keyup(function (e) {
    if (e.keyCode == 27) {
        $("#ctl00_MainContent_pnnotes").hide();
    }
});
// End  

function toggleLinkRMW(ctlLink) {
    var ctlLink = $(ctlLink).attr('id');
    $("#" + ctlLink).toggleClass('off');
    var button = $("#" + ctlLink);
    button.text(button.text() == "List" ? "Tabular" : "List")
    $("#ctl00_MainContent_hdnRMWView").val(button.text());
}

$(document).ready(function () {
    $('.tblDataList1').each(function (rowIndex, j) {
        templateId = $(this).find('span[id$="lbltemplateid"]').html();
        LayoutCode = $(this).find('span[id$="lblProductLayout"]').html();
        //Aditya B || 28-Oct-2021 || For action link-queue status mapping filter || JIRA: HSBCELINT-69 || Start
        queueStatus = $(this).find('span[id$="lblQueueStatus"]').html();
        //Aditya B || 28-Oct-2021 || For action link-queue status mapping filter || JIRA: HSBCELINT-69 || End
        RenderActionLinks(templateId, rowIndex, LayoutCode, queueStatus, j);

        //Aditya B || 23-May-2021 || For product watch feature || Start
        var marketPrice = parseFloat($(this).find('span[id$="lblMarketPrice"]').html());
        var alertPerc = parseFloat($(this).find('span[id$="lblalertpc"]').html());
        var watchType = $(this).find('span[id$="lblalertdirection"]').html()
        setWatchAlert(watchType, marketPrice, alertPerc, j);
        //Aditya B || 23-May-2021 || For product watch feature || End

        //designLabelId=$(this).find('span[id$="lblDesignLabelId"]').html();
        //columnCss = $(this).find('span[id$="lblColumnCSS"]').html();
        //if (columnCss != undefined)
        //ApplyCssToColumn(rowIndex, j, designLabelId, columnCss);
    });
});

 Sys.WebForms.PageRequestManager.getInstance().remove_endRequest();
 Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function () {
     $('.tblDataList1').each(function (rowIndex, j) {
         templateId = $(this).find('span[id$="lbltemplateid"]').html();
         LayoutCode = $(this).find('span[id$="lblProductLayout"]').html();
         //Aditya B || 28-Oct-2021 || For action link-queue status mapping filter || JIRA: HSBCELINT-69 || Start
         queueStatus = $(this).find('span[id$="lblQueueStatus"]').html();
         //Aditya B || 28-Oct-2021 || For action link-queue status mapping filter || JIRA: HSBCELINT-69 || End
         RenderActionLinks(templateId, rowIndex, LayoutCode, queueStatus, j);

         //Aditya B || 23-May-2021 || For product watch feature || Start
         var marketPrice = parseFloat($(this).find('span[id$="lblMarketPrice"]').html());
         var alertPerc = parseFloat($(this).find('span[id$="lblalertpc"]').html());
         var watchType = $(this).find('span[id$="lblalertdirection"]').html()
         setWatchAlert(watchType, marketPrice, alertPerc, j);
         //Aditya B || 23-May-2021 || For product watch feature || End

         //designLabelId = $(this).find('span[id$="lblDesignLabelId"]').html();
         //columnCss = $(this).find('span[id$="lblColumnCSS"]').html();
         //if (columnCss != undefined)
         //    ApplyCssToColumn(rowIndex, j, designLabelId, columnCss);
     });

     ShowHideFilters(); //Aditya B || 12-Feb-2021
 });

 //function ApplyCssToColumn(rowIndex,row, designLabelId, columnCss) {

 //    var cssKey = '';
 //    var cssVal = '';

 //    try
 //    {
 //        cssKey = columnCss.split(':')[0];
 //        cssVal = columnCss.split(':')[1];

 //        if (rowIndex < 10) {
 //            rowIndex = "0" + rowIndex;
 //        }

 //        if(cssKey.trim().toUpperCase()!='PADDING-TOP')
 //            $(row).find('[id$="' + designLabelId + '"]').parent("td").css(cssKey, cssVal);
 //        else
 //            $(row).find('[id$="' + designLabelId + '"]').parent("div").css(cssKey, cssVal);
 //    }

 //    catch (errorMessage) {
 //        console.log(errorMessage);
 //    }
 //}

//Aditya B || 19-Oct-2021 || For Action Link - Queue Status Mapping || JIRA: HSBCELINT-69 || Start
function getQueueStatus() {
    try {
        //if ($('#ctl00_MainContent_hdnExchange_TargetField').val().trim().toUpperCase() == 'QI_ID_CURRENT') {
        //    if ($('#ctl00_MainContent_ddlExchange :selected').text().trim().toUpperCase() == 'ALL') {
        //        $('#ctl00_MainContent_ddlExchange option').each(function () {
        //            if ($('#ctl00_MainContent_hdnQueueAccess').val().trim() == '') {
        //                $('#ctl00_MainContent_hdnQueueAccess').val("'" + this.text + "'");
        //            }
        //            else {
        //                $('#ctl00_MainContent_hdnQueueAccess').val($('#ctl00_MainContent_hdnQueueAccess').val() + "," + "'" + this.text + "'");
        //            }
        //        });
        //    }
            //else {
                $('#ctl00_MainContent_hdnQueueAccess').val($('#ctl00_MainContent_ddlExchange :selected').text());
            //}
        //}
    }
    catch (err) {
        console.log(err);
    }
}
//Aditya B || 19-Oct-2021 || For Action Link - Queue Status Mapping || JIRA: HSBCELINT-69 || End

 function RenderActionLinks(templateId, rowIndex,LayoutCode,queueStatus,row) {

     var myPageName = '../RMWorkstation_Generic/RMW.aspx';
     var objData = '';
     var UserGrp = ''; //Aditya B || 07-Oct-2021 || JIRA: MASCLI-1601

     try {
         UserGrp = $("#ctl00_MainContent_hdnUserGroup").val(); //Aditya B || 07-Oct-2021 || For Action Link - User Group Mapping || JIRA: MASCLI-1601

         return $.ajax({
             type: "POST",
             url: "" + myPageName + "/GetRMWActionLinksMetadataFields",
             contentType: "application/json; charset=utf-8",
             dataType: "text",
             cache: false,
             //Aditya B || 19-Oct-2021 || Added QueueAccess param. to fetch action links according to the queue status mapping || JIRA: HSBCELINT-69
             data: "{TemplateId:'" + templateId + "',ExcludeLikeButtonAndInfoFields:'Y',LayoutCode:'" + LayoutCode + "',QueueAccess:'" + queueStatus + "',UserAccess:'" + UserGrp + "'}", //Aditya B || 07-Oct-2021 || Replaced 'RM' with UserId variable || JIRA: MASCLI-1601
             crossDomain: true,
             async: false,
             success: function (result) {
                 var obj = jQuery.parseJSON(result);
                 $.each(obj, function (key, value) {
                     var jsonData = JSON.stringify(value);
                     objData = $.parseJSON(jsonData);
                 })

                 if (objData != null) {

                     if (rowIndex < 10) {
                         rowIndex = "0" + rowIndex;
                     }

                     //Aditya B || 09-Apr-2021 || Commented for Mashreq as told by Swapnil Morwal || Start
                     //if (LayoutCode.trim().toUpperCase() == "LIFECYCLE") {
                     //    $(row).find('[id$="tdActionLinkResetRules"]').css('display', 'inline');
                     //    $(row).find('[id$="tdActionLinkProcessRules"]').css('display', 'inline');
                     //    $(row).find('[id$="tdRuleInfoMsg"]').css('display', 'inline');
                     //}
                     //Aditya B || 09-Apr-2021 || Commented for Mashreq as told by Swapnil Morwal || End

                     $.each(objData, function (index, element) {

                         $(row).find('[id$="tdActionLink' + index + '"]').css('display', (element.RAM_VisibleYN.trim().toUpperCase() == 'Y' ? 'inline' : 'none'));

                         if (element.RAM_TargetField.trim() != '') {
                             $(row).find('[id$="hdnActionLink' + index + '_TargetFunctionName"]').val(element.RAM_TargetField);
                         }

                         if (element.RAM_ScreenOpenMode.trim() != '') {
                             $(row).find('[id$="hdnActionLink' + index + '_ScreenOpenMode"]').val(element.RAM_ScreenOpenMode);
                         }

                         if (element.RAM_DisplayName.trim() != '') {
                             $(row).find('[id$="tdActionLink' + index + '"]').find('[id^="divActionLink"]').html(element.RAM_DisplayName);
                         }

                         //Commented & Added below conditions by Aditya B || 04-Oct-2021 || JIRA: WBDIN-67 || START
                         //if (element.RAM_CSS_Style != null && element.RAM_ApplyCSSStyleTo != null) {
                         //    if (element.RAM_ApplyCSSStyleTo.trim().toUpperCase() == "DISPLAYNAME") {
                         //        $(row).find('[id$="tdActionLink' + index + '"]').find('[id^="divActionLink"]').attr('style', element.RAM_CSS_Style.trim());
                         //    }
                         //}

                         if (element.RAM_DisplayFieldCssStyle != null) {
                             $(row).find('[id$="tdActionLink' + index + '"]').find('[id^="divActionLink"]').attr('style', element.RAM_DisplayFieldCssStyle.trim());
                         }
                         //Commented & Added below conditions by Aditya B || 04-Oct-2021 || JIRA: WBDIN-67 || END
                     });
                 }
             },
             error: function (x, e) {
                 FinIQ_NotifyDealEntry(x.responseJSON.Message, e);
             }
         });
     }
     catch (errorMessage) {
         console.log(errorMessage);
     }
}

//Aditya B || 22-May-2021 || For Product watch feature || Start
function setWatchAlert(watchType, marketPrice, alertPerc,row) {
    try {
        if (watchType.trim().toUpperCase() == "PRICE_UP") {
            if (marketPrice >= alertPerc) {                
                $(row).find('[id$="imgglowredwatchproduct"]').css('display', 'none');
                $(row).find('[id$="imghollowwatchproduct"]').css('display', 'none');
                $(row).find('[id$="imggreenwatchproduct"]').css('display', 'none');
                $(row).find('[id$="imgredwatchproduct"]').css('display', 'none');
                $(row).find('[id$="imgglowgreenwatchproduct"]').css('display', 'block');
                $(row).find('[id$="imgglowgreenwatchproduct"]').addClass("blink");
                BlinkText();
            }
            else {
                $(row).find('[id$="imgglowgreenwatchproduct"]').css('display', 'none');
                $(row).find('[id$="imgglowredwatchproduct"]').css('display', 'none');
                $(row).find('[id$="imghollowwatchproduct"]').css('display', 'none');
                $(row).find('[id$="imggreenwatchproduct"]').css('display', 'block');
                $(row).find('[id$="imgredwatchproduct"]').css('display', 'none');
            }
        }
        else if (watchType.trim().toUpperCase() == "PRICE_DOWN") {
            if (marketPrice <= alertPerc) {                
                $(row).find('[id$="imgglowgreenwatchproduct"]').css('display', 'none');
                $(row).find('[id$="imghollowwatchproduct"]').css('display', 'none');
                $(row).find('[id$="imggreenwatchproduct"]').css('display', 'none');
                $(row).find('[id$="imgredwatchproduct"]').css('display', 'none');
                $(row).find('[id$="imgglowredwatchproduct"]').css('display', 'block');
                $(row).find('[id$="imgglowredwatchproduct"]').addClass("blink");
                BlinkText();
            }
            else {
                $(row).find('[id$="imgglowgreenwatchproduct"]').css('display', 'none');
                $(row).find('[id$="imgglowredwatchproduct"]').css('display', 'none');
                $(row).find('[id$="imghollowwatchproduct"]').css('display', 'none');
                $(row).find('[id$="imggreenwatchproduct"]').css('display', 'none');
                $(row).find('[id$="imgredwatchproduct"]').css('display', 'block');
            }
        }
    }
    catch (errorMessage) {
        console.log(errorMessage);
    }
}
//Aditya B || 22-May-2021 || For Product watch feature || End

//Actions for tranches || Start
function View_Factsheet_Tranche(cntrl, count) {
    //Commented by Manasi A on 01-Mar-2018
    //var notemasterid = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblRemarks").text();
    //var TemplateName = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblTempName").text();

    var notemasterid = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblnotemasterid").text();
    var TemplateName = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblTempName").text();

    if (count == 0) {
        $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblEQAllPrices").hide();
        $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblBNDSGXPrices").hide();
        $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblorderlog").hide();
        $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductFolder").hide();
        $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbllipperdetails").hide();
        $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblSuitabilityurl").hide();
        $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblviewquota").hide();
        $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbllaunchneworder").hide();
        $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductInfo").hide();
        document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + cntrl + '_imgblockly1').style.display = "none";
    }
    if (count == 1) {
        $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbliFramContainer").html("<iframe id='iframe" + cntrl + "' scrolling='no' frameborder='0' style='height:500px !important;width:700px !important' src='../RM_Workstation_Tranche/ViewUploadDocuments_Tranche.aspx?NoteMasterID=" + notemasterid + "&TemplateName=" + TemplateName + "#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>");

        //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbliFramContainer").html("<iframe id='iframe" + cntrl + "' scrolling='no' frameborder='0' style='height:100px !important;width:100px !important' src='../RMWorkstation/ViewAttachedFiles.aspx?NoteMasterID=" + notemasterid + "&TemplateName=" + TemplateName + "#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>");
        //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbliFramContainer").html("<iframe id='iframe" + cntrl + "' scrolling='yes' frameborder='0' style='height:700px !important;width:1000px !important' src='" + TemplateName + "'></iframe>");
        $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbliFramContainer").show();

        $("#div" + cntrl).slideToggle();
        $("#div" + cntrl).css('display', 'block');
    }


    if (count == 0) {
        count = 1;
        View_Factsheet_Tranche(cntrl, count);
    }
}

//////Added by Manasi A on 28-Feb-2018 ----------------------------Start--------------------------------------
function View_IndicativeTermInfo_Tranche(cntrl) {
    var SessionToken = document.getElementById('ctl00_MainContent_hdnSessionTokenVariable').value;
    var strDealNum = "";
    //alert(SessionToken);
    var notemasterid = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblnotemasterid").text();
    //  alert(notemasterid);

    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblEQAllPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblBNDSGXPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblorderlog").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductFolder").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbllipperdetails").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblSuitabilityurl").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblviewquota").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbliFramContainer").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbllaunchneworder").hide();
    document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + cntrl + '_imgblockly1').style.display = "none";

    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductInfo").show();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductInfo").html("<iframe id='iframe" + cntrl + "'  frameborder='0' style='vertical-align: top; min-height:1200px; max-height:1500px; width:2000px; overflow:hidden !important; '  src='../DocumentGeneration/DocumentGeneration.aspx?ButtonID=0&DealNum= " + notemasterid + "&WorkflowMode=RMWorkstation&TokenID=0&OBJECTTYPE=Product&EVENT=PRODUCT_TERMSHEET&LANGUAGEID=1&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=1&pagenum=1&view=fitH,0'></iframe>");

    //$("#div" + cntrl).css('height', 'auto');
    //$("#div" + cntrl).css('width', 'auto');
    //$("#div" + cntrl).slideToggle();
}

//////----------------------------------------------End--------------------------------------------------

function View_ProductInfo_Tranche(cntrl) {

    var SessionToken = document.getElementById('ctl00_MainContent_hdnSessionTokenVariable').value;
    var strDealNum = "";
    //alert(SessionToken);
    var notemasterid = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblnotemasterid").text();
    //  alert(notemasterid);
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblEQAllPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblBNDSGXPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblorderlog").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductFolder").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbllipperdetails").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblSuitabilityurl").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblviewquota").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbliFramContainer").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbllaunchneworder").hide();
    document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + cntrl + '_imgblockly1').style.display = "none";

    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductInfo").show();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductInfo").html("<iframe id='iframe" + cntrl + "'  frameborder='0' style='vertical-align: top; min-height:950px; max-height:950px; width:1950px; '  src='../UCP/FinIQ_UCPDealEntry.aspx?WorkflowMode=UCPWFL&NoteMasterID=N:" + notemasterid + "&DealNum=" + strDealNum + "&csrfToken=" + SessionToken + "&RMWYN=Y&RMWMode=PRD&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=1&pagenum=1&view=fitH,0'></iframe>");

    $("#div" + cntrl).css('height', 'auto');
    $("#div" + cntrl).css('width', 'auto');
    $("#div" + cntrl).slideToggle();
}

function View_OrderEntry_Tranche(cntrl) {

    var SessionToken = document.getElementById('ctl00_MainContent_hdnSessionTokenVariable').value;
    var strDealNum = "";
    //alert(SessionToken);
    var notemasterid = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblnotemasterid").text();
    //  alert(notemasterid);
    var TemplateCode = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbltemplatecode").text();

    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblEQAllPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblBNDSGXPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblorderlog").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductFolder").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbllipperdetails").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblSuitabilityurl").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblviewquota").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbliFramContainer").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbllaunchneworder").hide();
    //shweta to hide ytm/coupon on order entery click on 2aug

    //couponfreqid = "#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblcouponfreq"
    //couponfreqvalue = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblcouponfreq").text();
    //couponlabelid = "#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblYTM_Coupon"


    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblYTM_Coupon").hide();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblcouponfreq").hide();
    //end shweta
    document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + cntrl + '_imgblockly1').style.display = "none";

    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductInfo").show();
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductInfo").html("<iframe id='iframe" + cntrl + "'  frameborder='0' style='vertical-align: top; min-height:1200px; max-height:1500px; width:2000px; overflow:hidden !important; '  src='../UCP/FinIQ_UCPDealEntry.aspx?WorkflowMode=UCPWFL&NoteMasterID=N:" + notemasterid + "&DealNum=" + strDealNum + "&csrfToken=" + SessionToken + "&RMWYN=Y&Master_Popup=IFRAME#navpanes=0&toolbar=0&statusbar=0&scrollbar=1&pagenum=1&view=fitH,0'></iframe>");

    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductInfo").show();

    //////Added by Manasi to manage width for AC and BL 
    if (TemplateCode == "BullELI") {
        $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductInfo").html("<iframe id='iframe" + cntrl + "' frameborder='0' style='vertical-align: top; height:490px; width:3600px;'  src='../UCP/FinIQ_UCPDealEntry.aspx?WorkflowMode=UCPWFL&NoteMasterID=N:" + notemasterid + "&UCPCondition=Y" + "&DealNum=" + strDealNum + "&csrfToken=" + SessionToken + "&RMWYN=Y&RMWMode=ORD&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>");

    }
    else if (TemplateCode == "AutocallELN") {
        $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductInfo").html("<iframe id='iframe" + cntrl + "' frameborder='0' style='vertical-align: top; height:490px; width:2400px;'  src='../UCP/FinIQ_UCPDealEntry.aspx?WorkflowMode=UCPWFL&NoteMasterID=N:" + notemasterid + "&UCPCondition=Y" + "&DealNum=" + strDealNum + "&csrfToken=" + SessionToken + "&RMWYN=Y&RMWMode=ORD&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>");

    }
    else {
        $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductInfo").html("<iframe id='iframe" + cntrl + "' frameborder='0' style='vertical-align: top; height:490px; width:2400px;'  src='../UCP/FinIQ_UCPDealEntry.aspx?WorkflowMode=UCPWFL&NoteMasterID=N:" + notemasterid + "&UCPCondition=Y" + "&DealNum=" + strDealNum + "&csrfToken=" + SessionToken + "&RMWYN=Y&RMWMode=ORD&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>");
    }

    //   $("#div" + cntrl).css('height', 'auto');
    //    $("#div" + cntrl).css('width', 'auto');
    $("#div" + cntrl).slideToggle();



}
//Actions for tranches || End


//Added by Aditya B on 8-Jun-2019 || Actions for funds || Start
function View_Factsheet_Funds(cntrl) {

    var notemasterid = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblnotemasterid").text();

    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblEQAllPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblBNDSGXPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblorderlog").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductFolder").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbllipperdetails").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblSuitabilityurl").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblviewquota").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbllaunchneworder").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductInfo").hide();
    document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + cntrl + '_imgblockly1').style.display = "none";

    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbliFramContainer").show();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbliFramContainer").html("<iframe id='iframe" + cntrl + "' scrolling='no' frameborder='0' style='height:300px !important;width:600px !important' src='../RMWorkstation/ViewAttachedFiles.aspx?NoteMasterID=" + notemasterid + "#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>");

    $("#div" + cntrl).css('height', 'auto');
    $("#div" + cntrl).slideToggle();
}

function View_ProductInfo_Funds(cntrl) {


    var notemasterid = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblnotemasterid").text();

    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblEQAllPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblBNDSGXPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblorderlog").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductFolder").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbllipperdetails").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblSuitabilityurl").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblviewquota").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbliFramContainer").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lbllaunchneworder").hide();
    document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + cntrl + '_imgblockly1').style.display = "none";

    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductInfo").show();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + cntrl + "_lblLaunchProductInfo").html("<iframe id='iframe" + cntrl + "' scrolling='yes' frameborder='0' style='height:800px !important;width:1500px !important' src='../UCP/FinIQ_UCPDealEntry.aspx?WorkflowMode=UCPRDL&DealNum=N:" + notemasterid + " &NoteMasterID=N:" + notemasterid + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=1&pagenum=1&view=fitH,0'></iframe>");

    $("#div" + cntrl).css('height', 'auto');
    $("#div" + cntrl).css('width', 'auto');
    $("#div" + cntrl).slideToggle();
}

function New_Order_Funds(lblcntrl) {

    var NoteMasterId = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblnotemasterid").text();
    var CustomerID = document.getElementById('ctl00_MainContent_hdncustid').value;
    var wflurl = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblWflUrl").text();
    var prdurl = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblPrdUrl").text();
    //var templateID = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbltemplateid").text();
    var templateID = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbltemplatecode").text();
    //alert(templateID);
    //var template_Code = document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + rowid + '_lbltemplatecode').innerText;

    //if (CustomerID != '') {
    //    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").html("<iframe id='iframe" + lblcntrl + "' scrolling='yes' frameborder='0' style='height:800px !important;width:1500px !important' src='../FinIQ_UCP_Control/FinIQ_UCPDealEntry.aspx?WorkflowMode=UCPQEN&TemplateID=T:" + templateID + "&DealNum=N:" + NoteMasterId + "&Customer=C:" + CustomerID + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=1&pagenum=1&view=fitH,0'></iframe>");
    //}
    //else {
    //    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").html("<iframe id='iframe" + lblcntrl + "' scrolling='yes' frameborder='0' style='height:800px !important;width:1500px !important' src='../FinIQ_UCP_Control/FinIQ_UCPDealEntry.aspx?WorkflowMode=UCPQEN&TemplateID=T:" + templateID + "&DealNum=N:" + NoteMasterId + "&Customer=C:" + CustomerID + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=1&pagenum=1&view=fitH,0'></iframe>");
    //}


    if (wflurl == 'Y' && prdurl == '') {
        if (CustomerID != '') {
            $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").html("<iframe id='iframe" + lblcntrl + "' scrolling='yes' frameborder='0' style='height:800px !important;width:1500px !important' src='../UCP/FinIQ_UCPDealEntry.aspx?WorkflowMode=UCPWFL&TemplateID=T:" + templateID + "&DealNum=N:" + NoteMasterId + "&Customer=C:" + CustomerID + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=1&pagenum=1&view=fitH,0'></iframe>");

        }
        else {
            $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").html("<iframe id='iframe" + lblcntrl + "' scrolling='yes' frameborder='0' style='height:800px !important;width:1500px !important' src='../UCP/FinIQ_UCPDealEntry.aspx?WorkflowMode=UCPWFL&DealNum=N:" + NoteMasterId + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=1&pagenum=1&view=fitH,0'></iframe>");

        }
    }
    else if (wflurl == 'Y' && prdurl != '') {
        if (templateID == 'Fund_Setup') {
            templateID = 'Funds_Trade_Setup';
        }

        if (CustomerID != '') {
            //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").html("<iframe id='iframe" + lblcntrl + "' scrolling='yes' frameborder='0' style='height:800px !important;width:1500px !important' src='../UCP/FinIQ_UCPDealEntry.aspx?WorkflowMode=UCPQEN&TemplateID=T:" + templateID + "&DealNum=N:" + NoteMasterId + "&Customer=C:" + CustomerID + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=1&pagenum=1&view=fitH,0'></iframe>");
            $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").html("<iframe id='iframe" + lblcntrl + "' scrolling='yes' frameborder='0' style='height:800px !important;width:1500px !important' src='../UCP/FinIQ_UCPDealEntry.aspx?WorkflowMode=UCPQEN&Mode=" + templateID + "&DealNum=N:" + NoteMasterId + "&Customer=C:" + CustomerID + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=1&pagenum=1&view=fitH,0'></iframe>");
        }
        else {
            //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").html("<iframe id='iframe" + lblcntrl + "' scrolling='yes' frameborder='0' style='height:800px !important;width:1500px !important' src='../UCP/FinIQ_UCPDealEntry.aspx?WorkflowMode=UCPQEN&TemplateID=T:" + templateID + "&DealNum=N:" + NoteMasterId + "&Customer=C:" + CustomerID + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=1&pagenum=1&view=fitH,0'></iframe>");
            $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").html("<iframe id='iframe" + lblcntrl + "' scrolling='yes' frameborder='0' style='height:800px !important;width:1500px !important' src='../UCP/FinIQ_UCPDealEntry.aspx?WorkflowMode=UCPQEN&Mode=" + templateID + "&DealNum=N:" + NoteMasterId + "&Customer=C:" + CustomerID + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=1&pagenum=1&view=fitH,0'></iframe>");
        }
    }
    else if (wflurl == 'N' && prdurl != '') {
        $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").html("<iframe id='iframe" + lblcntrl + "' scrolling='yes' frameborder='0' style='height:800px !important;width:1000px !important' src=" + prdurl + "?RMWMode=Y&NoteId=" + NoteMasterId + "&CustID=" + CustomerID + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=1&pagenum=1&view=fitH,0'></iframe>");
    }
    else {
        alert('Please define mapping on template master');
    }








    //if ($("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblproductcode").text()!='Bond')
    //{
    //     $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").html("<iframe id='iframe" + lblcntrl + "'   scrolling='no' frameborder='0' style='height:1000px !important;width:1250px !important' src='../TrancheOrderEntry/TrancheOrderEntry.aspx?RMWMode=Y&Note_Master_Id= " + NoteMasterId + "&CustID= " + CustomerID + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>");
    //}
    //else
    //{
    //    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").html("<iframe id='iframe" + lblcntrl + "'   scrolling='no' frameborder='0' style='height:1000px !important;width:1350px !important' src='../FinIQ_Bond_Entry/FinIQ_Bond_Entry.aspx?RMWMode=Y&NoteId= " + NoteMasterId + "&CustID= " + CustomerID + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>");
    //}
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblproductclusters").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").show();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblorderlog").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbliFramContainer").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllipperdetails").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblEQAllPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblBNDSGXPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblSuitabilityurl").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblviewquota").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblViewAttachedFiles").hide();
    // $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchPriceUpdate").hide();
    document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + lblcntrl + '_imgblockly1').style.display = "none";
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblpayoffgraph").hide();
    $("#div" + lblcntrl).css('height', 'auto');
    $("#div" + lblcntrl).slideToggle();
}

function New_Order_Compact_Funds(lblcntrl) {
    //debugger;
    var NoteMasterId = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblnotemasterid").text();
    var CustomerID = document.getElementById('ctl00_MainContent_hdncustid').value;
    var wflurl = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblWflUrl").text();
    var prdurl = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblPrdUrl").text();
    var templateID = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbltemplateid").text();
    var FundCode = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblsubscheme").text();
    var SchemeCode = document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + lblcntrl + '_lblscheme').innerText; /* Code Added By Dinesh On 21-Apr-2018 Demo*/
    //$("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblscheme").text();
    var FundCcy = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblccy").text().trim();
    //var template_Code = document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + rowid + '_lbltemplatecode').innerText;

    //if (CustomerID != '') {
    //    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").html("<iframe id='iframe" + lblcntrl + "' scrolling='yes' frameborder='0' style='height:800px !important;width:1500px !important' src='../FinIQ_UCP_Control/FinIQ_UCPDealEntry.aspx?WorkflowMode=UCPORD&TemplateID=T:" + templateID + "&DealNum=N:" + NoteMasterId + "&Customer=C:" + CustomerID + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=1&pagenum=1&view=fitH,0'></iframe>");
    //}
    //else {
    //    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").html("<iframe id='iframe" + lblcntrl + "' scrolling='yes' frameborder='0' style='height:800px !important;width:1500px !important' src='../FinIQ_UCP_Control/FinIQ_UCPDealEntry.aspx?WorkflowMode=UCPORD&TemplateID=T:" + templateID + "&DealNum=N:" + NoteMasterId + "&Customer=C:" + CustomerID + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=1&pagenum=1&view=fitH,0'></iframe>");
    //}

    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").html("<iframe id='iframe" + lblcntrl + "' scrolling='no' frameborder='0' style='height:800px !important;width:800px !important;padding: 25px 25px 5px 105px !important' src='../RMWorkstation/OrderEntry.aspx?FundCode=" + FundCode + "&Ccy=" + FundCcy + "&SchemeCode=" + SchemeCode + "&NoteMasterID=" + NoteMasterId + "&CustomerId=" + CustomerID + "#navpanes=0&toolbar=0&statusbar=0&scrollbar=1&pagenum=1&view=fitH,0'></iframe>");  /* Code Added By Dinesh On 26-Apr-2018 BRUNEI demo.*/

    //if(wflurl=='Y' && prdurl=='')
    //{
    //    if (CustomerID != '') {
    //        $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").html("<iframe id='iframe" + lblcntrl + "' scrolling='yes' frameborder='0' style='height:800px !important;width:1500px !important' src='../FinIQ_UCP_Control/FinIQ_UCPDealEntry.aspx?WorkflowMode=UCPWFL&TemplateID=T:"+ templateID +"&DealNum=N:" + NoteMasterId + "&Customer=C:" + CustomerID + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=1&pagenum=1&view=fitH,0'></iframe>");

    //    }
    //    else {
    //        $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").html("<iframe id='iframe" + lblcntrl + "' scrolling='yes' frameborder='0' style='height:800px !important;width:1500px !important' src='../FinIQ_UCP_Control/FinIQ_UCPDealEntry.aspx?WorkflowMode=UCPWFL&DealNum=N:" + NoteMasterId + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=1&pagenum=1&view=fitH,0'></iframe>");

    //    }
    //}
    //else if(wflurl=='Y' && prdurl=='')
    //{
    //    if (CustomerID != '') {
    //        $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").html("<iframe id='iframe" + lblcntrl + "' scrolling='yes' frameborder='0' style='height:800px !important;width:1500px !important' src='../FinIQ_UCP_Control/FinIQ_UCPDealEntry.aspx?WorkflowMode=UCPQEN&TemplateID=T:" + templateID + "&DealNum=N:" + NoteMasterId + "&Customer=C:" + CustomerID + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=1&pagenum=1&view=fitH,0'></iframe>");
    //    }
    //    else {
    //        $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").html("<iframe id='iframe" + lblcntrl + "' scrolling='yes' frameborder='0' style='height:800px !important;width:1500px !important' src='../FinIQ_UCP_Control/FinIQ_UCPDealEntry.aspx?WorkflowMode=UCPQEN&TemplateID=T:" + templateID + "&DealNum=N:" + NoteMasterId + "&Customer=C:" + CustomerID + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=1&pagenum=1&view=fitH,0'></iframe>");

    //    }
    //}
    //else if (wflurl == 'N' && prdurl != '') {
    //    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").html("<iframe id='iframe" + lblcntrl + "' scrolling='yes' frameborder='0' style='height:800px !important;width:1000px !important' src=" + prdurl + "?RMWMode=Y&NoteId=" + NoteMasterId + "&CustID=" + CustomerID + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=1&pagenum=1&view=fitH,0'></iframe>");
    //}
    //else {
    //    alert('Please define mapping on template master');
    //}








    //if ($("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblproductcode").text()!='Bond')
    //{
    //     $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").html("<iframe id='iframe" + lblcntrl + "'   scrolling='no' frameborder='0' style='height:1000px !important;width:1250px !important' src='../TrancheOrderEntry/TrancheOrderEntry.aspx?RMWMode=Y&Note_Master_Id= " + NoteMasterId + "&CustID= " + CustomerID + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>");
    //}
    //else
    //{
    //    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").html("<iframe id='iframe" + lblcntrl + "'   scrolling='no' frameborder='0' style='height:1000px !important;width:1350px !important' src='../FinIQ_Bond_Entry/FinIQ_Bond_Entry.aspx?RMWMode=Y&NoteId= " + NoteMasterId + "&CustID= " + CustomerID + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>");
    //}
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblproductclusters").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").show();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblorderlog").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbliFramContainer").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllipperdetails").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblEQAllPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblBNDSGXPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblSuitabilityurl").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblviewquota").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblViewAttachedFiles").hide();
    // $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchPriceUpdate").hide();
    document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + lblcntrl + '_imgblockly1').style.display = "none";
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblpayoffgraph").hide();
    $("#div" + lblcntrl).css('height', 'auto');
    $("#div" + lblcntrl).slideToggle();
}

function view_quota_Funds(lblcntrl) {

    var notemasterid = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblnotemasterid").text();

    var CustomerID = document.getElementById('ctl00_MainContent_hdncustid').value;
    var FundCode = $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblsubscheme").text();

    //alert(notemasterid);

    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblorderlog").html("<iframe id='iframe" + lblcntrl + "' scrolling='no' frameborder='0' style='height:1000px !important;width:1000px !important' src='../OrderLog/OrderLog.aspx?Mode=VIEW&NMID=" + notemasterid + "&CustomerID=" + CustomerID + "&FundCode=" + FundCode + "&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>");

    //var str = ''

    //str = str + '<table cellpadding=2 cellspacing=2>'                        
    //str = str + '<tr><td>' + $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblviewquota").html("<iframe id='iframe" + lblcntrl + "'   scrolling='no' frameborder='0' style='height:500px !important' src='../PriceEnquiry_New/Branch_Level_Quota.aspx?NoteMasterID=" + notemasterid + "&RowIndex=" + lblcntrl + "#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>"); +'</td></tr>'
    //str = str + '<tr><td>' + $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblorderlog").html("<iframe id='iframe" + lblcntrl + "'   scrolling='no' frameborder='0' style='height:1000px !important' src='../OrderLog/OrderLog.aspx?Mode=VIEW&NMID=" + notemasterid + "&CustomerID=" + CustomerID + "#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>"); +'</td></tr>' //Added Customer ID in querystring  by Anand K on 03 Sep 2015
    //str = str + '</table>'

    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblorderlog").show();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbliFramContainer").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllipperdetails").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblEQAllPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblBNDSGXPrices").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblSuitabilityurl").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblviewquota").hide();
    document.getElementById('ctl00_MainContent_dlProductPriceDetails_ctl0' + lblcntrl + '_imgblockly1').style.display = "none";
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblpayoffgraph").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchProductFolder").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lbllaunchneworder").hide();
    $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + lblcntrl + "_lblLaunchProductInfo").hide();

    $("#div" + lblcntrl).css('height', 'auto');
    $("#div" + lblcntrl).slideToggle();

}
//Added by Aditya B on 8-Jun-2019 || Actions for funds || End

//Added By ShubhamPodhade on 16-Sept-2019 || START
function ActionLink_Click(LinkIndex,rowIndex) {

    event = event || window.event;
    sender = event.currentTarget;
    $(sender).addClass('wip');

    //Aditya B || 22-Aug-2021 || To allow closing of iframe only on action link click. Made this change for Mashreq || JIRA: MASCLI-1216 || Start
    if (skipIndexChk == 'Y') {
        $("#div" + rowIndex).css('display', 'none');
        skipIndexChk = '';
        return;
    }

    if (prevLinkIndex.trim() == '' && skipIndexChk != 'Y') {
        prevLinkIndex = LinkIndex;
        //if (prevFuncName.trim() == functionName.trim()) {
        //    $("#div0").css('display', 'none');
        //    prevFuncName = '';
        //    return;
        //}
    }
    else if (prevLinkIndex.trim() == LinkIndex.trim()) {
        $("#div" + rowIndex).css('display', 'none');
        prevLinkIndex = '';
        skipIndexChk = '';
        return;
    }
    else {
        prevLinkIndex = '';
        skipIndexChk = 'Y';
    }
    //Aditya B || 22-Aug-2021 || To allow closing of iframe only on action link click. Made this change for Mashreq || JIRA: MASCLI-1216 || End

    if (rowIndex < 10)
        rowIndex = "0" + rowIndex;

    var functionName = $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_hdnActionLink' + LinkIndex + '_TargetFunctionName"]').val();  //'RMW_OpenFactSheet';
    var screenOpenMode = $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_hdnActionLink' + LinkIndex + '_ScreenOpenMode"]').val(); //Two values ==> Inline OR PopUp
    var notemasterId = $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblnotemasterid"]').text();
    var entityID = $("#ctl00_MainContent_hdnEntityId").val();
    var userID = $("#ctl00_MainContent_hdnUserId").val();
    var myPageName = "/FinIQWebApp/RMWorkstation_Generic/RMW.aspx";
    var customerId = document.getElementById('ctl00_MainContent_hdncustid').value;
    
    var dataObj =
        {
            "functionName": functionName,
            "noteMasterId": notemasterId,
            "entityID": entityID,
            "userID": userID,
            "customerId": customerId
        }
    var myData;
    myData = JSON.stringify(dataObj);
    try {
        return $.ajax({
            type: "POST",
            url: "" + myPageName + "/GetRMWActionsData",
            contentType: "application/json; charset=utf-8",
            datatype: "text",
            cache: false,
            data: "{obj:" + myData + "}",
            crossDomain: true,
            beforeSend: function () {
                $(sender).addClass('wip');
            },
            complete: function () {
                $('.wip').removeClass('wip');
            },
            error: function () {
                $('.wip').removeClass('wip');
            },
            success: function (result) {
                $.each(result.d, function (key, value) {
                    var jsonData = JSON.stringify(value);
                    objData = $.parseJSON(jsonData);
                })
                if (objData != null) {
                    //console.log(objData.paramFifth);

                    //if (functionName.trim().toUpperCase() == 'RMW_OPENFACTSHEET') {
                    //    screenOpenMode = objData.paramFifth;
                    //}

                    if (screenOpenMode.trim().toUpperCase() == 'INLINE') {
                        if (rowIndex < 10) {
                            callme('div' + rowIndex.substring(1), rowIndex.substring(1));
                        }
                        else {
                            callme('div' + rowIndex, rowIndex);
                        }
                        if (objData.paramSeventh.toUpperCase() == 'ANGULAR') {
                            $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblActionLinkContent"]').html("<iframe id='iframe" + rowIndex + "' scrolling='yes' frameborder='0' style='height:" + objData.paramFirst + "px !important;width:" + objData.paramSecond + " !important' src='" + objData.ExeName + "#navpanes=0&toolbar=0&statusbar=0&scrollbar=2&pagenum=1&view=fitH,0'></iframe>");
                        }
                        else {
                            //Aditya B || 22-Jun-2021 || Changed scrolling='yes' to scrolling='no' as told by Sanjeev Jaiswal for Mashreq.
                            $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblActionLinkContent"]').html("<iframe id='iframe" + rowIndex + "' scrolling='yes' frameborder='0' style='height:" + objData.paramFirst + "px !important;width:" + objData.paramSecond + " !important' src='" + objData.ExeName + "" + objData.paramSixth + "&RowIndex=" + rowIndex + "#navpanes=0&toolbar=0&statusbar=0&scrollbar=2&pagenum=1&view=fitH,0'></iframe>");
                        }

                        if (rowIndex < 10) {
                            $("#div" + rowIndex.substring(1)).css('height', 'auto');
                            $("#div" + rowIndex.substring(1)).slideToggle();
                        }
                        else {
                            $("#div" + rowIndex).css('height', 'auto');
                            $("#div" + rowIndex).slideToggle();
                        }
                    }
                    else if (screenOpenMode.trim().toUpperCase() == 'POPUP') {
                        if (objData.paramSeventh.toUpperCase() == 'ANGULAR') {
                            Embedded_PopUp_Open_Workbench(objData.ExeName, objData.paramSecond, objData.paramFirst, 'ANGULAR')
                            //window.open('' + objData.ExeName + '', 'OpenPopup', 'top=' + objData.paramThird + ',left=' + objData.paramFourth + ',status=1,scrollbars=2,resizable=1,width=' + objData.paramSecond + ',height=' + objData.paramFirst + '');
                        }
                        else {
                            //Embedded_PopUp_Open_Workbench(objData.ExeName + objData.paramSixth, objData.paramSecond, objData.paramFirst, 'DOTNET')
                            if (objData.paramTwelfth.trim().toUpperCase() == 'EXTERNALURL')
                                window.open('' + objData.ExeName + '' + objData.paramSixth + '', 'OpenPopup', 'top=' + objData.paramThird + ',left=' + objData.paramFourth + ',status=1,scrollbars=2,resizable=1,width=' + objData.paramSecond + ',height=' + objData.paramFirst + '');
                            else
                                window.open('' + objData.ExeName + '' + objData.paramSixth + '&Master_Popup=POPUP&RowIndex=' + rowIndex + '', 'OpenPopup', 'top=' + objData.paramThird + ',left=' + objData.paramFourth + ',status=1,scrollbars=2,resizable=1,width=' + objData.paramSecond + ',height=' + objData.paramFirst + '');
                        }
                    }
                }
                else {
                    alert("Target function not defined in RMW metadata");
                }
                $('.wip').removeClass('wip');
            }
        });        
    }

    catch (err) {
        $('.wip').removeClass('wip');
        console.log(err.message);
    }
}
//Added By ShubhamPodhade on 16-Sept-2019 || END

function img_click(targetFunction,rowIndex) {

    event = event || window.event;
    sender = event.currentTarget;
    $(sender).addClass('wip');

    if (rowIndex < 10)
        rowIndex = "0" + rowIndex;

    var screenOpenMode = 'Inline';
    var notemasterId = $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblnotemasterid"]').text();
    var entityID = $("#ctl00_MainContent_hdnEntityId").val();
    var userID = $("#ctl00_MainContent_hdnUserId").val();
    var myPageName = "/FinIQWebApp/RMWorkstation_Generic/RMW.aspx";
    var customerId = document.getElementById('ctl00_MainContent_hdncustid').value;
    var wbMode = document.getElementById('ctl00_MainContent_hdn_Mode').value; //Aditya B || 07-Oct-2021 || JIRA: MASINT-2228

    var dataObj =
        {
            "functionName": targetFunction,
            "noteMasterId": notemasterId,
            "entityID": entityID,
            "userID": userID,
            "customerId": customerId
        }
    var myData;
    myData = JSON.stringify(dataObj);
    try {
        return $.ajax({
            type: "POST",
            url: "" + myPageName + "/GetRMWActionsData",
            contentType: "application/json; charset=utf-8",
            datatype: "text",
            cache: false,
            data: "{obj:" + myData + "}",
            crossDomain: true,
            beforeSend: function () {
                $(sender).addClass('wip');
            },
            complete: function () {
                $('.wip').removeClass('wip');
            },
            error: function () {
                $('.wip').removeClass('wip');
            },
            success: function (result) {
                $.each(result.d, function (key, value) {
                    var jsonData = JSON.stringify(value);
                    objData = $.parseJSON(jsonData);
                })

                if (objData != null) {

                    //Aditya B || 07-Oct-2021 || Passing RMMode query param for workbench(RM) mode || JIRA: MASINT-2228 || Start
                    if (objData.ExeName.trim()!='' && objData.paramSixth.trim()!='') {
                        if (wbMode.trim().toUpperCase() == 'RM') {
                            objData.paramSixth = objData.paramSixth + '&RMMode=Y';
                        }
                    }
                    //Aditya B || 07-Oct-2021 || Passing RMMode query param for workbench(RM) mode || JIRA: MASINT-2228 || End

                    if (screenOpenMode.trim().toUpperCase() == 'INLINE') {
                        if (rowIndex < 10) {
                            callme('div' + rowIndex.substring(1), rowIndex.substring(1));
                        }
                        else {
                            callme('div' + rowIndex, rowIndex);
                        }
                        if (objData.paramSeventh.toUpperCase() == 'ANGULAR') {
                            $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblActionLinkContent"]').html("<iframe id='iframe" + rowIndex + "' scrolling='yes' frameborder='0' style='height:" + objData.paramFirst + "px !important;width:" + objData.paramSecond + " !important' src='" + objData.ExeName + "#navpanes=0&toolbar=0&statusbar=0&scrollbar=2&pagenum=1&view=fitH,0'></iframe>");
                        }
                        else {
                            $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblActionLinkContent"]').html("<iframe id='iframe" + rowIndex + "' scrolling='yes' frameborder='0' style='height:" + objData.paramFirst + "px !important;width:" + objData.paramSecond + " !important' src='" + objData.ExeName + "" + objData.paramSixth + "&RowIndex=" + rowIndex + "#navpanes=0&toolbar=0&statusbar=0&scrollbar=2&pagenum=1&view=fitH,0'></iframe>");
                        }

                        if (rowIndex < 10) {
                            $("#div" + rowIndex.substring(1)).css('height', 'auto');
                            $("#div" + rowIndex.substring(1)).slideToggle();
                        }
                        else {
                            $("#div" + rowIndex).css('height', 'auto');
                            $("#div" + rowIndex).slideToggle();
                        }
                    }
                    else if (screenOpenMode.trim().toUpperCase() == 'POPUP') {
                        if (objData.paramSeventh.toUpperCase() == 'ANGULAR') {
                            Embedded_PopUp_Open_Workbench(objData.ExeName, objData.paramSecond, objData.paramFirst, 'ANGULAR')
                            //window.open('' + objData.ExeName + '', 'OpenPopup', 'top=' + objData.paramThird + ',left=' + objData.paramFourth + ',status=1,scrollbars=2,resizable=1,width=' + objData.paramSecond + ',height=' + objData.paramFirst + '');
                        }
                        else {
                            //Embedded_PopUp_Open_Workbench(objData.ExeName + objData.paramSixth, objData.paramSecond, objData.paramFirst, 'DOTNET')
                            window.open('' + objData.ExeName + '' + objData.paramSixth + '&Master_Popup=POPUP', 'OpenPopup', 'top=' + objData.paramThird + ',left=' + objData.paramFourth + ',status=1,scrollbars=2,resizable=1,width=' + objData.paramSecond + ',height=' + objData.paramFirst + '');
                        }
                    }
                }
                else {
                    alert("Target function not defined in RMW metadata");
                }
                $('.wip').removeClass('wip');
            }
        });
    }

    catch (err) {
        $('.wip').removeClass('wip');
        console.log(err.message);
    }
}

//Aditya B || 22-May-2021 || To Launch product watch pop-up as told by Nitish Bandle || Start
function LaunchProductWatch(rowIndex) {

    if (rowIndex < 10)
        rowIndex = "0" + rowIndex;

    var notemasterid = $("#ctl00_MainContent_dlProductPriceDetails_ctl" + rowIndex + "_lblnotemasterid").text();

    if (rowIndex < 10) {
        callme('div' + rowIndex.substring(1), rowIndex.substring(1));
    }
    else {
        callme('div' + rowIndex, rowIndex);
    }

    $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblActionLinkContent"]').html("<iframe id='iframe" + rowIndex + "' scrolling='no' frameborder='0' style='width:700px !important;height:500px !important' src='../RMWorkstation_Generic/ProductWatch.aspx?NoteMasterId=" + notemasterid + "&RowIndex=" + rowIndex + "#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>");

    if (rowIndex < 10) {
        $("#div" + rowIndex.substring(1)).css('height', 'auto');
        $("#div" + rowIndex.substring(1)).slideToggle();
    }
    else {
        $("#div" + rowIndex).css('height', 'auto');
        $("#div" + rowIndex).slideToggle();
    }
}
//Aditya B || 22-May-2021 || To Launch product watch pop-up as told by Nitish Bandle || End

function ResetRules(rowIndex) {

    event = event || window.event;
    sender = event.currentTarget;
    $(sender).addClass('wip');
    $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblRuleInfoMsg"]').text('');

    if (rowIndex < 10)
        rowIndex = "0" + rowIndex;

    var notemasterId = $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblnotemasterid"]').text();
    var startDate = $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblStartDate"]').text();
    var endDate = $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblEndDate"]').text();
    var userID = $("#ctl00_MainContent_hdnUserId").val();
    var myPageName = "/FinIQWebApp/RMWorkstation_Generic/RMW.aspx";

    try {
        return $.ajax({
            type: "POST",
            url: "" + myPageName + "/ResetRules",
            contentType: "application/json; charset=utf-8",
            datatype: "text",
            cache: false,
            data: "{'NoteMasterId':'" + notemasterId + "', 'StartDate':'" + startDate + "', 'EndDate':'" + endDate + "', 'UserId':'" + userID + "'}",
            crossDomain: true,

            beforeSend: function () {
                $(sender).addClass('wip');
                $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblRuleInfoMsg"]').text('');
            },
            complete: function () {
                $('.wip').removeClass('wip');
            },
            error: function () {
                $('.wip').removeClass('wip');
            },

            success: function (result) {
                if (result != null) {
                    if (result.d==1) {
                        $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblRuleInfoMsg"]').text("Rules reset successfully !");
                        $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblRuleInfoMsg"]').addClass("lblSuccess");
                    }
                    else if (result.d == -1) {
                        $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblRuleInfoMsg"]').text("Error while reseting rules!");
                        $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblRuleInfoMsg"]').addClass("lblError");
                    }
                    else {
                        $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblRuleInfoMsg"]').text("No rules found to reset!");
                        $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblRuleInfoMsg"]').addClass("lblError");
                    }
                }

                $('.wip').removeClass('wip');
            }
        });
    }

    catch (err) {
        $('.wip').removeClass('wip');
        console.log(err.message);
    }
}

function ProcessRules(rowIndex) {

    event = event || window.event;
    sender = event.currentTarget;
    $(sender).addClass('wip');
    $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblRuleInfoMsg"]').text('');

    if (rowIndex < 10)
        rowIndex = "0" + rowIndex;

    var notemasterId = $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblnotemasterid"]').text();
    var startDate = $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblStartDate"]').text();
    var endDate = $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblEndDate"]').text();
    var userID = $("#ctl00_MainContent_hdnUserId").val();
    var entityId = $("#ctl00_MainContent_hdnEntityId").val();
    var myPageName = "/FinIQWebApp/RMWorkstation_Generic/RMW.aspx";

    try {
        return $.ajax({
            type: "POST",
            url: "" + myPageName + "/ProcessRules",
            contentType: "application/json; charset=utf-8",
            datatype: "text",
            cache: false,
            data: "{'NoteMasterId':'" + notemasterId + "', 'StartDate':'" + startDate + "', 'EndDate':'" + endDate + "', 'UserId':'" + userID + "', 'EntityId':'" + entityId + "'}",
            crossDomain: true,

            beforeSend: function () {
                $(sender).addClass('wip');
                $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblRuleInfoMsg"]').text('');
            },
            complete: function () {
                $('.wip').removeClass('wip');
            },
            error: function () {
                $('.wip').removeClass('wip');
            },

            success: function (result) {
                
                if (result != null) {
                    if (result.d.ResultStatus == 0) {
                        $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblRuleInfoMsg"]').text("Rules processed successfully !");
                        $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblRuleInfoMsg"]').addClass("lblSuccess");
                    }
                    else if (result.d.ResultStatus == 4) {
                        $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblRuleInfoMsg"]').text("Error in updation. Please check logs.");
                        $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblRuleInfoMsg"]').addClass("lblError");
                    }
                    else if (result.d.ResultStatus == 1) {
                        $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblRuleInfoMsg"]').text("No rules found to process!");
                        $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblRuleInfoMsg"]').addClass("lblError");

                    } else if (result.d.ResultStatus == 5) {
                        $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblRuleInfoMsg"]').text( "Missing Index. Please check logs.");
                        $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblRuleInfoMsg"]').addClass("lblError");
                    } else {
                        $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblRuleInfoMsg"]').text( "Runtime Error. Please check logs.");
                        $('[id$="dlProductPriceDetails_ctl' + rowIndex + '_lblRuleInfoMsg"]').addClass("lblError");
                    }
                }

                $('.wip').removeClass('wip');
            }
        });
    }

    catch (err) {
        $('.wip').removeClass('wip');
        console.log(err.message);
    }
}

function RenderDocuments(NoteMasterID, DocType, rowIndex) {

    try
    {
        $("#ctl00_MainContent_dlProductPriceDetails_ctl0" + rowIndex + "_lblDivContainer").html("<iframe id='ifrmDocuments" + rowIndex + "' scrolling='no' frameborder='0' style='height:200px !important;width:1000px !important' src='../RMWorkstation_Generic/DocumentCollection.aspx?NoteMasterID=" + NoteMasterID + "&DocType="+ DocType +"&Master_Popup=POPUP#navpanes=0&toolbar=0&statusbar=0&scrollbar=0&pagenum=1&view=fitH,0'></iframe>");
        $("#divMain" + rowIndex).css('height', 'auto');
        $("#divMain" + rowIndex).slideToggle();
        hideDivMain = false;
    }
    catch (err) {
        console.log(err.message);
    }
}

function chkPRR_CheckedChanged() {

    try
    {
        var chkPRR = document.getElementById('ctl00_MainContent_chkPRR');

        var chkPRR1 = document.getElementById('ctl00_MainContent_chkPRR1');
        var chkPRR2 = document.getElementById('ctl00_MainContent_chkPRR2');
        var chkPRR3 = document.getElementById('ctl00_MainContent_chkPRR3');
        var chkPRR4 = document.getElementById('ctl00_MainContent_chkPRR4');
        var chkPRR5 = document.getElementById('ctl00_MainContent_chkPRR5');
        var chkPRR6 = document.getElementById('ctl00_MainContent_chkPRR6');
        var chkPRR7 = document.getElementById('ctl00_MainContent_chkPRR7');
        var chkPRR8 = document.getElementById('ctl00_MainContent_chkPRR8');
        var chkPRR9 = document.getElementById('ctl00_MainContent_chkPRR9');

        if (chkPRR1.checked == false && chkPRR2.checked == false && chkPRR3.checked == false && chkPRR4.checked == false && chkPRR5.checked == false && chkPRR6.checked == false && chkPRR7.checked == false && chkPRR8.checked == false && chkPRR9.checked==false) {
            chkPRR.checked = false;
        }
        else {
            chkPRR.checked = true;
        }
    }
    catch (err) {
        console.log(err.message);
    }
}

var blnShowHideButtonClicked = false;

function setFlag() {
    blnShowHideButtonClicked = true;
}

function ShowHideFilters() {

    var showHideVal = '';

    if (ShowHideFilterVal == '') {
        showHideVal = $("#imgShowHideFilters").attr('alt');
    }
    else {
        showHideVal = ShowHideFilterVal;
    }

    if (blnShowHideButtonClicked == true) {        
        if (showHideVal.trim().toUpperCase() == "HIDE FILTERS") {
            $("#ctl00_MainContent_myDiv").css("display", "none");            
            $("#imgShowHideFilters").attr('alt', 'Show Filters');
            ShowHideFilterVal = $("#imgShowHideFilters").attr('alt');
            $("#imgShowHideFilters").attr('src', '../App_Resources/RMW_Images/rightNav.png');
            $("#ctl00_MainContent_PENav").removeClass("rightNav");
            $("#ctl00_MainContent_PENav").addClass("leftNav");
            $("#divRefreshImg").removeClass("left");
            $("#divRefreshImg").addClass("right");
        }
        else {
            $("#ctl00_MainContent_myDiv").css("display", "block");            
            $("#imgShowHideFilters").attr('alt', 'Hide Filters');
            ShowHideFilterVal = $("#imgShowHideFilters").attr('alt');
            $("#imgShowHideFilters").attr('src', '../App_Resources/RMW_Images/leftNav.png');
            $("#ctl00_MainContent_PENav").removeClass("leftNav");
            $("#ctl00_MainContent_PENav").addClass("rightNav");
            $("#divRefreshImg").removeClass("right");
            $("#divRefreshImg").addClass("left");
        }

        blnShowHideButtonClicked = false;
    }
    else {
        if (showHideVal.trim().toUpperCase() == "HIDE FILTERS") {
            $("#ctl00_MainContent_myDiv").css("display", "block");
            //ShowHideFilterVal = $("#imgShowHideFilters").attr('alt');
            //$("#imgShowHideFilters").attr('alt', 'Hide Filters');
            $("#imgShowHideFilters").attr('src', '../App_Resources/RMW_Images/leftNav.png');
            $("#ctl00_MainContent_PENav").removeClass("leftNav");
            $("#ctl00_MainContent_PENav").addClass("rightNav");
            $("#divRefreshImg").removeClass("right");
            $("#divRefreshImg").addClass("left");
        }
        else {
            $("#ctl00_MainContent_myDiv").css("display", "none");
            //ShowHideFilterVal = $("#imgShowHideFilters").attr('alt');
            //$("#imgShowHideFilters").attr('alt', 'Show Filters');
            $("#imgShowHideFilters").attr('src', '../App_Resources/RMW_Images/rightNav.png');
            $("#ctl00_MainContent_PENav").removeClass("rightNav");
            $("#ctl00_MainContent_PENav").addClass("leftNav");
            $("#divRefreshImg").removeClass("left");
            $("#divRefreshImg").addClass("right");
        }
    }
}


