var highlightedQuoteInfoTab;

function QuoteInfo_Load(container, loadingContainer, symbol, textonly) {
        var params = 'symbol=' + symbol;

        if(textonly)
            params += "&" + "textonly=true";
        
        if(textonly != true)
            QuoteInfo_Loading(true, container, loadingContainer);
            
        var req = new Ajax.Request('/AJAX/PostPages/Quote/QuoteInfoPost.aspx', 
                                   { method: 'post', 
                                     parameters: params, 
                                     onSuccess: function(AJAXResponse) {   
                                        if(textonly)
                                            QuoteInfo_TextOnly(container, AJAXResponse);
                                        else
                                            QuoteInfo_Populate(AJAXResponse, container, loadingContainer); 
                                      } 
                                   });
    }

function QuoteInfo_Loading(show, container, divLoading) {
    if (show) {
        $_(divLoading).style.display = 'block';
        $_(container).style.display = 'none';
    }
    else {
        $_(divLoading).style.display = 'none';
        $_(container).style.display = '';
    }
}

function QuoteInfo_TextOnly(container, AJAXResponse){
    var containers = container.split("&");
    if (AJAXResponse.status == 200) {    
        var results = AJAXResponse.responseText.split("&");
        $_(containers[0]).innerHTML = "$ " + results[0];
        $_(containers[1]).innerHTML = results[1];
    }
    else {
        $_(containers[0]).innerHTML = "-";
        $_(containers[1]).innerHTML = "-";
   }
}
    
function QuoteInfo_Populate(AJAXResponse, container, loadingDiv) {
    QuoteInfo_Loading(false, container, loadingDiv);
    if (AJAXResponse.status == 200) 
        $_(container).innerHTML = AJAXResponse.responseText;
    else 
        $_(container).innerHTML = "Error loading also viewed, please refresh your browser";
}

function QuoteInfo_HiglightTabs(tab, defaultId){
    if(highlightedQuoteInfoTab == null)
        highlightedQuoteInfoTab = $_(defaultId);

    highlightedQuoteInfoTab.style.color = '#2a5a88';
    highlightedQuoteInfoTab.style.fontWeight = '';
    highlightedQuoteInfoTab = tab;
    highlightedQuoteInfoTab.style.color = '#000000';
    highlightedQuoteInfoTab.style.fontWeight = 'bold';
}