﻿function getHTTPObject() 
{
    var xmlhttp;
    /*@cc_on
    @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
    @else
    xmlhttp = false;
    @end @*/
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') 
    {
        try 
        {
          xmlhttp = new XMLHttpRequest();
        } 
        catch (e) 
        {
          xmlhttp = false;
        }
    }
    return xmlhttp;
} 
var http = getHTTPObject(); // We create the HTTP Object 
var busy = false;

function getQuote(q)
{	
    if(!busy)
    {
        document.getElementById("div_quote").innerHTML = '<p align="center"><img src="graphics/loader.gif" width="32" height="32" border="0" class="img_loader" alt="Loading..."></p><p>&nbsp;</p><p align="center">Loading...</p><p>&nbsp;</p>';
        busy = true;
        http.open("GET", ("AJAXGetQuote.asp?QuoteRef=" + escape(q)), true);
        http.onreadystatechange = getQuoteResponse;
        http.send(null);
    }
}

function getQuoteResponse() 
{   
    if (http.readyState == 4) 
    {                
        if(http.responseText.length > 0)
        {               
            document.getElementById("div_quote").innerHTML = http.responseText;
        } 
        busy = false;                           
    }
}

function quoteInit()
{            
    getQuote(0);
}

img1 = new Image();
img1.src = "graphics/loader.gif";

window.onload = quoteInit;