﻿// AJAX API For Loading the Derivative Page

var xmlReq = new Array(); // ARRAY OF XML-HTTP REQUESTS 
var xmlIndex = new Array(0); // ARRAY OF XML-HTTP REQUEST INDEXES
xmlIndex[0] = 1; // FIRST INDEX SET TO 1 MAKING IT AVAILABLE
var underly;

function xhrRequest(type) 
{
    if (!type) 
    {
        type = 'html';
    }
    // xhrsend IS THE xmlIndex POSITION THAT GETS PASSED BACK
    // INITIALIZED TO THE LENGTH OF THE ARRAY(LAST POSITION + 1)
    var xhrsend = xmlIndex.length;

    // GO THROUGH AVAILABLE xi VALUES
    for (var i=0; i<xmlIndex.length; i++) 
    {
        // IF IT'S 1 (AVAILABLE), ALLOCATE IT FOR USE AND BREAK
        if (xmlIndex[i] == 1) 
        {
            xmlIndex[i] = 0;
            xhrsend = i;
            break;
        }
    }
    // SET TO 0 SINCE IT'S NOW ALLOCATED FOR USE
    xmlIndex[xhrsend] = 0;


    // SET UP THE REQUEST
    if (window.ActiveXObject) 
    {
        try 
        {
            xmlReq[xhrsend] = new ActiveXObject("Msxml2.XMLHTTP");
        } 
        catch (e) 
        {
            try 
            {
                xmlReq[xhrsend] = new ActiveXObject("Microsoft.XMLHTTP");
            } 
            catch (e) 
            {
                
            }
        }
    } 
    else if (window.XMLHttpRequest) 
    {
        xmlReq[xhrsend] = new XMLHttpRequest();
        if (xmlReq[xhrsend].overrideMimeType) 
        {
            xmlReq[xhrsend].overrideMimeType('text/' + type);
        }
    }
    return (xhrsend);
}

function LoadRequest(url, reqType) 
{
    var xhri = xhrRequest('html');
    xmlReq[xhri].open('GET', url, true);
    xmlReq[xhri].onreadystatechange = function() 
    {                     
        if (xmlReq[xhri].readyState == 4 && xmlReq[xhri].status == 200) 
        {                   
            // Logic for displaying the Most Active                                    
            if(url.substring(0,url.length-20) == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=MostActive&Flag=IF")
            {                
                document.getElementById('spnMostActive').innerHTML = xmlReq[xhri].responseText;
            }
            if(url.substring(0,url.length-20) == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=MostActive&Flag=IO")
            {                
                document.getElementById('spnMostActive').innerHTML = xmlReq[xhri].responseText;
            }
            if(url.substring(0,url.length-20) == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=MostActive&Flag=SF")
            {                
                document.getElementById('spnMostActive').innerHTML = xmlReq[xhri].responseText;
            }
            if(url.substring(0,url.length-20) == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=MostActive&Flag=SO")
            {                
                document.getElementById('spnMostActive').innerHTML = xmlReq[xhri].responseText;
            }
            
            if(url.substring(0,url.length-20) == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=MostActiveNew&Flag=IF")
            {                
                document.getElementById('spnMostActive').innerHTML = xmlReq[xhri].responseText;
            }
            if(url.substring(0,url.length-20) == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=MostActiveNew&Flag=IO")
            {                
                document.getElementById('spnMostActive').innerHTML = xmlReq[xhri].responseText;
            }
            if(url.substring(0,url.length-20) == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=MostActiveNew&Flag=SF")
            {                
                document.getElementById('spnMostActive').innerHTML = xmlReq[xhri].responseText;
            }
            if(url.substring(0,url.length-20) == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=MostActiveNew&Flag=SO")
            {                
                document.getElementById('spnMostActive').innerHTML = xmlReq[xhri].responseText;
            }
            // Method for displaying Open Interest
            if(url.substring(0,url.length-20) == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=OpenInterest&Flag=IF")
            {                
                document.getElementById('spnOpenInterest').innerHTML = xmlReq[xhri].responseText;
            }   
            if(url.substring(0,url.length-20) == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=OpenInterest&Flag=IO")
            {                
                document.getElementById('spnOpenInterest').innerHTML = xmlReq[xhri].responseText;
            }
            if(url.substring(0,url.length-20) == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=OpenInterest&Flag=SF")
            {                
                document.getElementById('spnOpenInterest').innerHTML = xmlReq[xhri].responseText;
            }
            if(url.substring(0,url.length-20) == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=OpenInterest&Flag=SO")
            {                
                document.getElementById('spnOpenInterest').innerHTML = xmlReq[xhri].responseText;
            }
            
            if(url.substring(0,url.length-20) == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=OpenInterestNew&Flag=IF")
            {                
                document.getElementById('spnOpenInterest').innerHTML = xmlReq[xhri].responseText;
            }   
            if(url.substring(0,url.length-20) == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=OpenInterestNew&Flag=IO")
            {                
                document.getElementById('spnOpenInterest').innerHTML = xmlReq[xhri].responseText;
            }
            if(url.substring(0,url.length-20) == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=OpenInterestNew&Flag=SF")
            {                
                document.getElementById('spnOpenInterest').innerHTML = xmlReq[xhri].responseText;
            }
            if(url.substring(0,url.length-20) == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=OpenInterestNew&Flag=SO")
            {                
                document.getElementById('spnOpenInterest').innerHTML = xmlReq[xhri].responseText;
            }
            
            if(url == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=PutCallRatio&Selection=Index")
            { 
                document.getElementById('spnPutCallRatio').innerHTML = xmlReq[xhri].responseText;
            }
            if(url == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=PutCallRatio&Selection=Company")
            {
                document.getElementById('spnPutCallRatio').innerHTML = xmlReq[xhri].responseText;
            }
            
            if(url == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=PutCallRatioNew&Selection=Index")
            { 
                document.getElementById('spnPutCallRatio').innerHTML = xmlReq[xhri].responseText;
            }
            if(url == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=PutCallRatioNew&Selection=Company")
            {
                document.getElementById('spnPutCallRatio').innerHTML = xmlReq[xhri].responseText;
            }
            // Method for displaying Get Quotes
            if(url.substring(0,60) == "GetQuotesPopUp.aspx?PageName=GetQuotes&Flag=IF")
            {
                document.getElementById('spnGetQuotes').innerHTML = xmlReq[xhri].responseText;
            }
            if(url.substring(0,60) == "GetQuotesPopUp.aspx?PageName=GetQuotes&Flag=IO")
            {
                document.getElementById('spnGetQuotes').innerHTML = xmlReq[xhri].responseText;
            }
            if(url.substring(0,60) == "GetQuotesPopUp.aspx?PageName=GetQuotes&Flag=SF")
            {
                document.getElementById('spnGetQuotes').innerHTML = xmlReq[xhri].responseText;
            }
            if(url.substring(0,60) == "GetQuotesPopUp.aspx?PageName=GetQuotes&Flag=SO")
            {
                document.getElementById('spnGetQuotes').innerHTML = xmlReq[xhri].responseText;
            }
            // Method for loading Underlying options  
            if(url == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=GetQuote&Flag=IF" || url == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=GetQuote&Flag=IO" || url == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=GetQuote&Flag=SF" || url == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=GetQuote&Flag=SO")
            {
                var ddl = document.getElementById("ddlUnderlying"); 
                var arr = xmlReq[xhri].responseText.split("|");    
                //To Remove All Items of Drop Down
                (ddl).length = 0;    
                //To Add Items In Drop Down
                for(var i = 0; i < arr.length-1; i++)
                {
                    (ddl).options[i] = new Option(arr[i].split("###")[0],arr[i].split("###")[1]);
                }
            }  
            // Method for Loading Expiry Date     
            if(url == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=Expiry")
            {
                var ddl = document.getElementById("ddlExpiry"); 
                var arr = xmlReq[xhri].responseText.split("|");    
                //To Remove All Items of Drop Down
                (ddl).length = 0;    
                //To Add Items In Drop Down
                for(var i = 0; i < arr.length-1; i++)
                {
                    (ddl).options[i] = new Option(arr[i].split("###")[0],arr[i].split("###")[1]);
                }
            }
            // Method For Loading Option Type and Strike Price
            if(url.substring(0,60) == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=GetQuotes&Flag=SO" || url.substring(0,60) == "AJAXMarket/DerivativeAjaxAPI.aspx?PageName=GetQuotes&Flag=IO")        
            {
                var ddl = document.getElementById('ddlStrikePRice');
                var arr = xmlReq[xhri].responseText.split("|");
                (ddl).length = 0;
                for(var i = 0; i < arr.length-1; i++)
                {
                    (ddl).options[i] = new Option(arr[i].split("###")[0],arr[i].split("###")[1]);
                }
            }
            if(url.substring(0,40) == "GetQuoteClickPage.aspx?PageName=GetQuote")
            {
           // window.open('GetQuoteClickPage.aspx?pageName=GetQuote&Flag=' + document.getElementById('ddlInstrument').value + '&Underlying=' + document.getElementById('ddlUnderlying').value + '&ExpDate=' + document.getElementById('ddlExpiry').value + '&OptionType=' + document.getElementById('ddlOptionType').value + '&StrikePrice=' + document.getElementById('ddlStrikePRice').value);
           window.location="GetQuoteClickPage.aspx?pageName=GetQuote&Flag=" + document.getElementById('ddlInstrument').value + "&Underlying=" + document.getElementById('ddlUnderlying').value + "&ExpDate=" + document.getElementById('ddlExpiry').value + "&OptionType=" + document.getElementById('ddlOptionType').value + "&StrikePrice=" + document.getElementById('ddlStrikePRice').value;
                //Response.Redirect('GetQuoteClickPage.aspx?pageName=GetQuote&Flag=' + document.getElementById('ddlInstrument').value + '&Underlying=' + document.getElementById('ddlUnderlying').value + '&ExpDate=' + document.getElementById('ddlExpiry').value + '&OptionType=' + document.getElementById('ddlOptionType').value + '&StrikePrice=' + document.getElementById('ddlStrikePRice').value);
            }
            xmlIndex[xhri] = 1;
            xmlReq[xhri] = null;
        }
        else
        {
            
        }
    };
    xmlReq[xhri].send(null);
}

// Method Called during the Page Load
function loadMulti() 
{
    document.getElementById('spnMostActive').innerHTML = "<table width=430px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
    document.getElementById('spnOpenInterest').innerHTML = "<table width=440px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
    document.getElementById('spnPutCallRatio').innerHTML = "<table width=440px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
    LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=MostActive&Flag=IF&ExpDate=' + document.getElementById('ddlMostActive').value);    
    LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=OpenInterest&Flag=IF&ExpDate=' + document.getElementById('ddlOpenInterest').value);
    LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=PutCallRatio&Selection=' + document.getElementById('ddlPutCallRatio').value);
    
    
    document.getElementById("ddl_OptionType").style.display = 'none';
    document.getElementById("ddl_StrikePrice").style.display = 'none';
    document.getElementById("txt_option").style.display = 'none';
    document.getElementById("txt_StrikePrice").style.display = 'none';
    
    menuSlider.init('menu_slider','slide');
   
}
// End 

function loadMultiNew()
{
    document.getElementById('spnMostActive').innerHTML = "<table width=950px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
    LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=MostActiveNew&Flag=IF&ExpDate=' + document.getElementById('ddlMostActive').value);
    
     menuSlider.init('menu_slider','slide');
}

function loadMultiRatio()
{
    document.getElementById('spnPutCallRatio').innerHTML = "<table width=950px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
    LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=PutCallRatioNew&Selection=' + document.getElementById('ddlPutCallRatio').value);
    
     menuSlider.init('menu_slider','slide');
}

function loadMultiInterest()
{
    document.getElementById('spnOpenInterest').innerHTML = "<table width=950px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
    LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=OpenInterestNew&Flag=IF&ExpDate=' + document.getElementById('ddlOpenInterest').value);           
    
     menuSlider.init('menu_slider','slide');
}

// Method called during Onchange event for Most Active Dropdown Value
function LoadMostActive()
{
    // for Index Future
    if(document.getElementById('TDIF').className == "txtNewsBottomBold")
    {        
        document.getElementById('spnMostActive').innerHTML = "<table width=430px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=MostActive&Flag=IF&ExpDate=' + document.getElementById('ddlMostActive').value);
    }
    // for Index Option
    else if(document.getElementById('TDIO').className == "txtNewsBottomBold")
    {    
        document.getElementById('spnMostActive').innerHTML = "<table width=430px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";   
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=MostActive&Flag=IO&ExpDate=' + document.getElementById('ddlMostActive').value);
    }
    // for Stock Future
    else if(document.getElementById('TDSF').className == "txtNewsBottomBold")
    {      
        document.getElementById('spnMostActive').innerHTML = "<table width=430px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";  
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=MostActive&Flag=SF&ExpDate=' + document.getElementById('ddlMostActive').value);
    }
    // for Stock Option
    else
    {    
        document.getElementById('spnMostActive').innerHTML = "<table width=430px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";    
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=MostActive&Flag=SO&ExpDate=' + document.getElementById('ddlMostActive').value);
    }
}
// End

function LoadMostActiveNew()
{
    // for Index Future
    if(document.getElementById('TDIF').className == "txtNewsBottomBold")
    {        
        document.getElementById('spnMostActive').innerHTML = "<table width=430px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=MostActiveNew&Flag=IF&ExpDate=' + document.getElementById('ddlMostActive').value);
    }
    // for Index Option
    else if(document.getElementById('TDIO').className == "txtNewsBottomBold")
    {    
        document.getElementById('spnMostActive').innerHTML = "<table width=430px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";   
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=MostActiveNew&Flag=IO&ExpDate=' + document.getElementById('ddlMostActive').value);
    }
    // for Stock Future
    else if(document.getElementById('TDSF').className == "txtNewsBottomBold")
    {      
        document.getElementById('spnMostActive').innerHTML = "<table width=430px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";  
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=MostActiveNew&Flag=SF&ExpDate=' + document.getElementById('ddlMostActive').value);
    }
    // for Stock Option
    else
    {    
        document.getElementById('spnMostActive').innerHTML = "<table width=430px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";    
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=MostActiveNew&Flag=SO&ExpDate=' + document.getElementById('ddlMostActive').value);
    }
}

// Method called during Onchange event for Open Interest Dropdown Value
function LoadOpenInterest()
{
    // for Index Future
    if(document.getElementById('TDO1').className == "txtNewsBottomBold")
    {        
        document.getElementById('spnOpenInterest').innerHTML = "<table width=440px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=OpenInterest&Flag=IF&ExpDate=' + document.getElementById('ddlOpenInterest').value);
    }
    // for Index Option
    else if(document.getElementById('TDO2').className == "txtNewsBottomBold")
    {    
        document.getElementById('spnOpenInterest').innerHTML = "<table width=440px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";   
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=OpenInterest&Flag=IO&ExpDate=' + document.getElementById('ddlOpenInterest').value);
    }
    // for Stock Future
    else if(document.getElementById('TDO3').className == "txtNewsBottomBold")
    {      
        document.getElementById('spnOpenInterest').innerHTML = "<table width=440px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";  
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=OpenInterest&Flag=SF&ExpDate=' + document.getElementById('ddlOpenInterest').value);
    }
    // for Stock Option
    else
    {    
        document.getElementById('spnOpenInterest').innerHTML = "<table width=440px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";    
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=OpenInterest&Flag=SO&ExpDate=' + document.getElementById('ddlOpenInterest').value);
    }
}
// End

function LoadOpenInterestNew()
{
    // for Index Future
    if(document.getElementById('TDO1').className == "txtNewsBottomBold")
    {        
        document.getElementById('spnOpenInterest').innerHTML = "<table width=440px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=OpenInterestNew&Flag=IF&ExpDate=' + document.getElementById('ddlOpenInterest').value);
    }
    // for Index Option
    else if(document.getElementById('TDO2').className == "txtNewsBottomBold")
    {    
        document.getElementById('spnOpenInterest').innerHTML = "<table width=440px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";   
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=OpenInterestNew&Flag=IO&ExpDate=' + document.getElementById('ddlOpenInterest').value);
    }
    // for Stock Future
    else if(document.getElementById('TDO3').className == "txtNewsBottomBold")
    {      
        document.getElementById('spnOpenInterest').innerHTML = "<table width=440px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";  
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=OpenInterestNew&Flag=SF&ExpDate=' + document.getElementById('ddlOpenInterest').value);
    }
    // for Stock Option
    else
    {    
        document.getElementById('spnOpenInterest').innerHTML = "<table width=440px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";    
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=OpenInterestNew&Flag=SO&ExpDate=' + document.getElementById('ddlOpenInterest').value);
    }
}

// Method called during Onchange event for Put Call Ratio Dropdown Value
function LoadPutCallRatio()
{
    //if(document.getElementById('TD11').className == "txtNewsBottomBold")
    //{
        document.getElementById('spnPutCallRatio').innerHTML = "<table width=440px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=PutCallRatio&Selection=' + document.getElementById('ddlPutCallRatio').value);
    //}
}
// END

function LoadPutCallRatioNew()
{
    //if(document.getElementById('TD11').className == "txtNewsBottomBold")
    //{
        document.getElementById('spnPutCallRatio').innerHTML = "<table width=440px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=PutCallRatioNew&Selection=' + document.getElementById('ddlPutCallRatio').value);
    //}
}


// Method called during Onchange event for Get Quotes All Dropdown Value
//function LoadGetQuotes()
//{
//    if(document.getElementById('G1').className == "txtNewsBottomBold")
//    {
//        document.getElementById('spnGetQuotes').innerHTML = "<table width=440px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
//        LoadRequest('GetQuotesPopUp.aspx?PageName=GetQuotes&Flag=' + document.getElementById('ddlInstrument').value + '&Underlying=' + document.getElementById('ddlUnderlying').value + '&ExpDate=' + document.getElementById('ddlExpiry').value + '&OptionType=' + document.getElementById('ddlOptionType').value + '&StrikePrice=' + document.getElementById('ddlStrikePRice').value);
//    }
//}
// END

// Method called during Onchange event for Option Type And Strike Price
function LoadOptionType()
{
    LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=GetQuotes&Flag=' + document.getElementById('ddlInstrument').value + '&Underlying=' + document.getElementById('ddlUnderlying').value + '&ExpDate=' + document.getElementById('ddlExpiry').value + '&OptionType=' + document.getElementById('ddlOptionType').value);
}
// END 

// Script for making like tabs for Most Active
function SetMMTab(a) 
{
    document.getElementById('TDIF').className = "txtNewsBottom";
    document.getElementById('TDIO').className = "txtNewsBottom";
    document.getElementById('TDSF').className = "txtNewsBottom"; 
    document.getElementById('TDSO').className = "txtNewsBottom";
    document.getElementById('aIF').style.fontWeight = "";  
    document.getElementById('aIO').style.fontWeight = ""; 
    document.getElementById('aSF').style.fontWeight = ""; 
    document.getElementById('aSO').style.fontWeight = "";
    if (a == "IF") 
    {
        document.getElementById('TDIF').className = "txtNewsBottomBold";       
        document.getElementById('aIF').style.fontWeight = "bold";         
        document.getElementById('spnMostActive').innerHTML = "<table width=430px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=MostActive&Flag=IF&ExpDate=' + document.getElementById('ddlMostActive').value);           
        document.getElementById('aIF').className = "Links";      
    }
    else if (a == "IO")
    {
       document.getElementById('TDIO').className = "txtNewsBottomBold"; 
       document.getElementById('aIO').style.fontWeight = "bold";       
       document.getElementById('spnMostActive').innerHTML = "<table width=430px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
       LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=MostActive&Flag=IO&ExpDate=' + document.getElementById('ddlMostActive').value);          
       document.getElementById('aIO').className = "Links";           
    }   
    else if (a == "SF")
    {
       document.getElementById('TDSF').className = "txtNewsBottomBold"; 
       document.getElementById('aSF').style.fontWeight = "bold";       
       document.getElementById('spnMostActive').innerHTML = "<table width=430px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
       LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=MostActive&Flag=SF&ExpDate=' + document.getElementById('ddlMostActive').value);          
       document.getElementById('aSF').className = "Links";           
    } 
    else
    {
        document.getElementById('TDSO').className = "txtNewsBottomBold";  
        document.getElementById('aSO').style.fontWeight = "bold";        
        document.getElementById('spnMostActive').innerHTML = "<table width=430px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=MostActive&Flag=SO&ExpDate=' + document.getElementById('ddlMostActive').value);           
        document.getElementById('aSO').className = "Links";              
    }
}
// End


function SetMMTabNew(a) 
{
    document.getElementById('TDIF').className = "txtNewsBottom";
    document.getElementById('TDIO').className = "txtNewsBottom";
    document.getElementById('TDSF').className = "txtNewsBottom"; 
    document.getElementById('TDSO').className = "txtNewsBottom";
    document.getElementById('aIF').style.fontWeight = "";  
    document.getElementById('aIO').style.fontWeight = ""; 
    document.getElementById('aSF').style.fontWeight = ""; 
    document.getElementById('aSO').style.fontWeight = "";
    if (a == "IF") 
    {
        document.getElementById('TDIF').className = "txtNewsBottomBold";       
        document.getElementById('aIF').style.fontWeight = "bold";         
        document.getElementById('spnMostActive').innerHTML = "<table width=430px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=MostActiveNew&Flag=IF&ExpDate=' + document.getElementById('ddlMostActive').value);           
        document.getElementById('aIF').className = "Links";      
    }
    else if (a == "IO")
    {
       document.getElementById('TDIO').className = "txtNewsBottomBold"; 
       document.getElementById('aIO').style.fontWeight = "bold";       
       document.getElementById('spnMostActive').innerHTML = "<table width=430px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
       LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=MostActiveNew&Flag=IO&ExpDate=' + document.getElementById('ddlMostActive').value);          
       document.getElementById('aIO').className = "Links";           
    }   
    else if (a == "SF")
    {
       document.getElementById('TDSF').className = "txtNewsBottomBold"; 
       document.getElementById('aSF').style.fontWeight = "bold";       
       document.getElementById('spnMostActive').innerHTML = "<table width=430px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
       LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=MostActiveNew&Flag=SF&ExpDate=' + document.getElementById('ddlMostActive').value);          
       document.getElementById('aSF').className = "Links";           
    } 
    else
    {
        document.getElementById('TDSO').className = "txtNewsBottomBold";  
        document.getElementById('aSO').style.fontWeight = "bold";        
        document.getElementById('spnMostActive').innerHTML = "<table width=430px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=MostActiveNew&Flag=SO&ExpDate=' + document.getElementById('ddlMostActive').value);           
        document.getElementById('aSO').className = "Links";              
    }
}

// Script for making like tabs for Open Interest
function SetMMTab1(a) 
{
    document.getElementById('TDO1').className = "txtNewsBottom";
    document.getElementById('TDO2').className = "txtNewsBottom";
    document.getElementById('TDO3').className = "txtNewsBottom"; 
    document.getElementById('TDO4').className = "txtNewsBottom";
    document.getElementById('a1').style.fontWeight = "";  
    document.getElementById('a2').style.fontWeight = ""; 
    document.getElementById('a3').style.fontWeight = ""; 
    document.getElementById('a4').style.fontWeight = "";
    if (a == "IF") 
    {
        document.getElementById('TDO1').className = "txtNewsBottomBold";       
        document.getElementById('a1').style.fontWeight = "bold";         
        document.getElementById('spnOpenInterest').innerHTML = "<table width=440px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=OpenInterest&Flag=IF&ExpDate=' + document.getElementById('ddlOpenInterest').value);           
        document.getElementById('a1').className = "Links";      
    }
    else if (a == "IO")
    {
       document.getElementById('TDO2').className = "txtNewsBottomBold"; 
       document.getElementById('a2').style.fontWeight = "bold";       
       document.getElementById('spnOpenInterest').innerHTML = "<table width=440px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
       LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=OpenInterest&Flag=IO&ExpDate=' + document.getElementById('ddlOpenInterest').value);          
       document.getElementById('a2').className = "Links";           
    }   
    else if (a == "SF")
    {
       document.getElementById('TDO3').className = "txtNewsBottomBold"; 
       document.getElementById('a3').style.fontWeight = "bold";       
       document.getElementById('spnOpenInterest').innerHTML = "<table width=440px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
       LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=OpenInterest&Flag=SF&ExpDate=' + document.getElementById('ddlOpenInterest').value);          
       document.getElementById('a3').className = "Links";           
    } 
    else
    {
        document.getElementById('TDO4').className = "txtNewsBottomBold";  
        document.getElementById('a4').style.fontWeight = "bold";        
        document.getElementById('spnOpenInterest').innerHTML = "<table width=440px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>"; 
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=OpenInterest&Flag=SO&ExpDate=' + document.getElementById('ddlOpenInterest').value);           
        document.getElementById('a4').className = "Links";              
    }
}
// End

function SetMMTabInterest(a) 
{
    document.getElementById('TDO1').className = "txtNewsBottom";
    document.getElementById('TDO2').className = "txtNewsBottom";
    document.getElementById('TDO3').className = "txtNewsBottom"; 
    document.getElementById('TDO4').className = "txtNewsBottom";
    document.getElementById('a1').style.fontWeight = "";  
    document.getElementById('a2').style.fontWeight = ""; 
    document.getElementById('a3').style.fontWeight = ""; 
    document.getElementById('a4').style.fontWeight = "";
    if (a == "IF") 
    {
        document.getElementById('TDO1').className = "txtNewsBottomBold";       
        document.getElementById('a1').style.fontWeight = "bold";         
        document.getElementById('spnOpenInterest').innerHTML = "<table width=440px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=OpenInterestNew&Flag=IF&ExpDate=' + document.getElementById('ddlOpenInterest').value);           
        document.getElementById('a1').className = "Links";      
    }
    else if (a == "IO")
    {
       document.getElementById('TDO2').className = "txtNewsBottomBold"; 
       document.getElementById('a2').style.fontWeight = "bold";       
       document.getElementById('spnOpenInterest').innerHTML = "<table width=440px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
       LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=OpenInterestNew&Flag=IO&ExpDate=' + document.getElementById('ddlOpenInterest').value);          
       document.getElementById('a2').className = "Links";           
    }   
    else if (a == "SF")
    {
       document.getElementById('TDO3').className = "txtNewsBottomBold"; 
       document.getElementById('a3').style.fontWeight = "bold";       
       document.getElementById('spnOpenInterest').innerHTML = "<table width=440px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
       LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=OpenInterestNew&Flag=SF&ExpDate=' + document.getElementById('ddlOpenInterest').value);          
       document.getElementById('a3').className = "Links";           
    } 
    else
    {
        document.getElementById('TDO4').className = "txtNewsBottomBold";  
        document.getElementById('a4').style.fontWeight = "bold";        
        document.getElementById('spnOpenInterest').innerHTML = "<table width=440px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>"; 
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=OpenInterestNew&Flag=SO&ExpDate=' + document.getElementById('ddlOpenInterest').value);           
        document.getElementById('a4').className = "Links";              
    }
}

// Script for making like tabs for Put Call Ratio

function SetMMTab2(a)
{
    document.getElementById('TD11').className = "txtNewsBottom";
    document.getElementById('a11').style.fontWeight = "";
    
    
    if(a == "IF")
    {
        document.getElementById('TD11').className = "txtNewsBottomBold"
        document.getElementById('a11').style.fontWeight = "bold";
        document.getElementById('spnPutCallRatio').innerHTML = "<table width=440px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=PutCallRatio&Selection=' + document.getElementById('ddlPutCallRatio').value);
        document.getElementById('a11').className = "Links";
    }
}

// END

function SetMMTab2New(a)
{
    document.getElementById('TD11').className = "txtNewsBottom";
    document.getElementById('a11').style.fontWeight = "";
    
    
    if(a == "IF")
    {
        document.getElementById('TD11').className = "txtNewsBottomBold"
        document.getElementById('a11').style.fontWeight = "bold";
        document.getElementById('spnPutCallRatio').innerHTML = "<table width=440px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=PutCallRatioNew&Selection=' + document.getElementById('ddlPutCallRatio').value);
        document.getElementById('a11').className = "Links";
    }
}

//function SetMMTab3(a)
//{
//    document.getElementById('G1').className = "txtNewsBottom";
//    document.getElementById('g1').style.fontWeight = "";
//    if(a == "IF")
//    {
//        document.getElementById('G1').className = "txtNewsBottomBold";
//        document.getElementById('g1').style.fontWeight = "bold";
//        document.getElementById('spnGetQuotes').innerHTML = "<table width=440px height='120px'><tr><td align=center style=padding-left:75px;><img src=images/Progress/up_spinner.gif /><span class='heading_color'>Loading Data.....</span></td></tr></table>";
//        //LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=GetQuotes&Flag=' + document.getElementById('ddlInstrument').value + '&Underlying=' + document.getElementById('ddlUnderlying').value + '&ExpDate=' + document.getElementById('ddlExpiry').value);
//        document.getElementById('g1').className = "Links";
//    }
//}

// Method for Loading Underlying Data
function LoadUnderlying()
{

    if(document.getElementById('ddlInstrument').value == 'SO')
    {
        document.getElementById("OptionStrikeTable").style.display ='block';
//        document.getElementById("ddl_OptionType").style.display ='block';
//        document.getElementById("ddl_StrikePrice").style.display ='block';
//        document.getElementById("txt_option").style.display = 'block';
//        document.getElementById("txt_StrikePrice").style.display = 'block';
        document.getElementById("ddlOptionType").options[0] = new Option("Select","Select");
        document.getElementById("ddlOptionType").options[1] = new Option("PE","PE");
        document.getElementById("ddlOptionType").options[2] = new Option("CE","CE");
    }
    
    if(document.getElementById('ddlInstrument').value == 'IO')
    {
        document.getElementById("OptionStrikeTable").style.display ='block';
//        document.getElementById("ddl_OptionType").style.display ='block';
//        document.getElementById("ddl_StrikePrice").style.display ='block';
//        document.getElementById("txt_option").style.display = 'block';
//        document.getElementById("txt_StrikePrice").style.display = 'block';
        document.getElementById("ddlOptionType").options[0] = new Option("Select","Select");
        document.getElementById("ddlOptionType").options[1] = new Option("PE","PE");
        document.getElementById("ddlOptionType").options[2] = new Option("CE","CE");
    }
    
    if(document.getElementById('ddlInstrument').value == 'SF')
    {
        document.getElementById("OptionStrikeTable").style.display ='none';
//        document.getElementById("ddl_StrikePrice").style.display ='none';
//        document.getElementById("txt_option").style.display = 'none';
//        document.getElementById("txt_StrikePrice").style.display = 'none';
    }
    
    if(document.getElementById('ddlInstrument').value == 'IF')
    {
        document.getElementById("OptionStrikeTable").style.display ='none';
//        document.getElementById("ddl_OptionType").style.display ='none';
//        document.getElementById("ddl_StrikePrice").style.display ='none';
//        document.getElementById("txt_option").style.display = 'none';
//        document.getElementById("txt_StrikePrice").style.display = 'none';
    }
    
    if(document.getElementById('ddlInstrument').selectedIndex != 0)
    {
        var ddlComp = document.getElementById("ddlUnderlying"); 
        ddlComp.innerText = "";        
        ddlComp.options[0] = new Option("Loading...","Loading...");
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=GetQuote&Flag='+document.getElementById('ddlInstrument').options[document.getElementById('ddlInstrument').selectedIndex].value);        
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=Expiry');
        //LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=GetQuotes&Flag=' + document.getElementById('ddlInstrument').options[document.getElementById('ddlInstrument').selectedIndex].value);
    }
    else
    {
        document.getElementById("ddlUnderlying").length = 0;
        document.getElementById("ddlUnderlying").options[0] = new Option("Select","Select");
        document.getElementById("ddlExpiry").length = 0;
        document.getElementById("ddlExpiry").options[0] = new Option("Select","Select");
        //document.getElementById('ddlStrikePRice').length = 0;
        //document.getElementById('ddlStrikePRice').option[0] = new Option("Select","Select");
    }
}
// End



function LoadStrikePrice()
{
    if(document.getElementById('ddlOptionType').selectedIndex != 0)
    {
        var ddlComp = document.getElementById("ddlStrikePRice"); 
        ddlComp.innerText = "";        
        ddlComp.options[0] = new Option("Loading...","Loading...");
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=GetQuotes&Flag=' + document.getElementById('ddlInstrument').options[document.getElementById('ddlInstrument').selectedIndex].value + '&Underlying=' + document.getElementById('ddlUnderlying').value + '&ExpDate=' + document.getElementById('ddlExpiry').value + '&OptionType=' + document.getElementById('ddlOptionType').value);
    }
    else
    {
        document.getElementById('ddlStrikePRice').length = 0;
        document.getElementById('ddlStrikePRice').option[0] = new Option("Select","Select");
    }
}

function LoadwithoughtUnderlying()
{
    if(document.getElementById('ddlOptionType').selectedIndex != "Select" || document.getElementById('ddlStrikePRice').selectedIndex != 0 || document.getElementById('ddlExpiry').selectedIndex != "Select")
    {
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=GetQuotes&Flag=' + document.getElementById('ddlInstrument').options[document.getElementById('ddlInstrument').selectedIndex].value + '&Underlying=' + document.getElementById('ddlUnderlying').value + '&ExpDate=' + document.getElementById('ddlExpiry').value + '&OptionType=' + document.getElementById('ddlOptionType').value);
    }
}

function Loadwithoughtdate()
{
    if(document.getElementById('ddlOptionType').selectedIndex != "Select" || document.getElementById('ddlStrikePRice').selectedIndex != 0 || document.getElementById('ddlUnderlying').selectedIndex != "Select")
    {
        LoadRequest('AJAXMarket/DerivativeAjaxAPI.aspx?PageName=GetQuotes&Flag=' + document.getElementById('ddlInstrument').options[document.getElementById('ddlInstrument').selectedIndex].value + '&Underlying=' + document.getElementById('ddlUnderlying').value + '&ExpDate=' + document.getElementById('ddlExpiry').value + '&OptionType=' + document.getElementById('ddlOptionType').value);
    }
}

function Transfer()
{
//document.getElementById("Button2").click();
    //LoadRequest('AJAXMarket/DerivativeGetQuoteAjaxAPI.aspx?PageName=GetQuote&Flag=' + document.getElementById('ddlInstrument').value + '&Underlying=' + document.getElementById('ddlUnderlying').value + '&ExpDate=' + document.getElementById('ddlExpiry').value + '&OptionType=' + document.getElementById('ddlOptionType').value + '&StrikePrice=' + document.getElementById('ddlStrikePRice').value);
    if(document.getElementById('ddlInstrument').selectedIndex == 0)
    {
        alert("Please Select a Proper Instrument");
    }
    else if(document.getElementById('ddlUnderlying').selectedIndex == 0 || document.getElementById('ddlUnderlying').selectedIndex == "")
    {
        alert("Please Select a Underlying");
    }
    else if(document.getElementById('ddlExpiry').value == "Select" || document.getElementById('ddlExpiry').value == "")
    {
        alert("Please Select a Date");
    }
    else if(document.getElementById('ddlInstrument').selectedIndex == 3 || document.getElementById('ddlInstrument').selectedIndex == 4)
    {
        if(document.getElementById('ddlOptionType').value == "Select" || document.getElementById('ddlOptionType').value == "")
        {
            alert("Please Select a Option Type");
        }
        else if(document.getElementById('ddlStrikePRice').value == "")
        {
            alert("Data Not Present Please Select Other Option");
        }
        else if(document.getElementById('ddlStrikePRice').value == "Select")
        {
            alert("Please Select a Strike Price");
        }
        else
        {
            LoadRequest('GetQuoteClickPage.aspx?PageName=GetQuote&Flag=' + document.getElementById('ddlInstrument').value + '&Underlying=' + document.getElementById('ddlUnderlying').value + '&ExpDate=' + document.getElementById('ddlExpiry').value + '&OptionType=' + document.getElementById('ddlOptionType').value + '&StrikePrice=' + document.getElementById('ddlStrikePRice').value);
        }
    }
    else
    {
        LoadRequest('GetQuoteClickPage.aspx?PageName=GetQuote&Flag=' + document.getElementById('ddlInstrument').value + '&Underlying=' + document.getElementById('ddlUnderlying').value + '&ExpDate=' + document.getElementById('ddlExpiry').value + '&OptionType=' + document.getElementById('ddlOptionType').value + '&StrikePrice=' + document.getElementById('ddlStrikePRice').value);
    }
}

//function PassValue()
//{
//    // 
//     //For geting querystring
//    var qrStr = window.location.search;
//    var spQrStr = qrStr.substring(1);
//    var arrQrStr = new Array();
//    // splits each of pair
//    var arr = spQrStr.split('&');
//    for (var i=0;i<arr.length;i++)
//    {
//        // splits each of field-value pair
//        var index = arr[i].indexOf('=');
//        var key = arr[i].substring(0,index);
//        var val = arr[i].substring(index+1);
//        // saves each of field-value pair in an array variable
//        arrQrStr[key] = val;
//    }   
//    
//    underly=arrQrStr["Underlying"];        
//    
//    if (arrQrStr["Flag"] == "IF")
//    {
//        document.getElementById('ddlInstrument').options[0].selected=true;
//    }
//}
