﻿// JScript File

var _xmlHttp = null;
var _hasXmlHttp = true;

function GetXmlHttp()
{
    var xmlHttp = null;
    
    if (!_hasXmlHttp)
        return null;

    if(typeof(XMLHttpRequest) != "undefined")
        return new XMLHttpRequest();

    try
    { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); }
    catch(ex1)
    {
        try
        { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); }
        catch(ex2)
        { xmlHttp = null; }
    }
    
    if (xmlHttp == null)
    {
        _hasXmlHttp = false;
    }

    return xmlHttp;
}

function RequestData(PostData)
{
    if (!_xmlHttp)
        _xmlHttp = GetXmlHttp();

    if (!_xmlHttp)
        return;
    
    _xmlHttp.open('GET', 'http://www.abandonedrails.com/process/request.asp?' + PostData, false);
    _xmlHttp.send(null);
    
    if (_xmlHttp.readyState == 4)
        return _xmlHttp.responseText;
    
    return '';
}

function recordData(postData)
{
    if (!_xmlHttp)
        _xmlHttp = GetXmlHttp();

    if (!_xmlHttp)
        return;
    
    _xmlHttp.open('GET', 'http://www.abandonedrails.com/process/request.asp?' + postData, true);
    _xmlHttp.send(null);
    
    return;
}