﻿//this is called when the selection is made from the rating page...  
function OnSymbolSelectedR(source, eventArgs) {
    //debugger;
    var results = eventArgs.get_value();
    $get('ctl00_Main_ucETFAutoComplete_txtSymbolControl3').value = results.toString();
    //$get('ctl00_txtSymbolControl31').value = searchText.toString();
    __doPostBack('ctl00$ibtnQuickQuote1', 'OnClick');
}
//this is populating the dropdown combobox in the rating page...  
function acePopulatedR(sender, e) {

    var behavior = $find('ctl00_Main_ucETFAutoComplete_AutoCompleteExtender1');
    if (behavior == null)
        return;
    var target = behavior.get_completionList();
    var children = target.childNodes;
    var childLen;
    var searchText = $get('ctl00_Main_ucETFAutoComplete_txtSymbolControl3').value;
    childLen = children.length;
    for (var i = 0; i < childLen; i++) {
        var child = children[i];
        var value = child.innerHTML;

        // Bold the searchText part of the value
        var lspacer = 0;
        var spacer = "&nbsp;&nbsp;";
        var lspace = value.indexOf(" ")
        lspacer = 8 - lspace;
        while (lspacer--) spacer = spacer + "&nbsp;";
        value = eval("value.replace(/(" + searchText + ")/i, '<b>$1</b>')");

        var sumb = value.split("       ");
        //value = sumb[0] + spacer + "<div style='font-size:x-small;float:left'>" + sumb[1] + "</div>";
        //value = sumb[0] + spacer + "<h6>" + sumb[1] + "</h6>";
        value = sumb[0] + spacer + sumb[1];
        child.innerHTML = value; //eval("value.replace(/(" + " " + ")/i, spacer )");
    }
    //fun5
    if (childLen == 10)
       child.innerHTML = "<i>" + child.innerHTML + "</i>";
}
        
