// http://gisweb.azdeq.gov/arcgis/veiareas/
// ADEQ: Arizona Department of Environmental Quality

function HttpGet(url)
{  
    // localhost access denied
    var host = location.host.split(":");  // drop port
    if (host[0] == "localhost") return;

    var http = null;
    if (window.XMLHttpRequest)  // IE7, Mozilla, Safari
    {
        http = new XMLHttpRequest();
    }
    else if (window.ActiveXObject)  // IE6, IE5
    {
        http = new ActiveXObject("Microsoft.XMLHTTP");
    }
    if (http == null) return;

    // send get to url (no response)
    http.open("GET", url, true);  // asynchronous
    http.send(null);
}

function HttpPost(url, params)
{  
    // localhost access denied
    var host = location.host.split(":");  // drop port
    if (host[0] == "localhost") return;

    var http = null;
    if (window.XMLHttpRequest)  // IE7, Mozilla, Safari
    {
        http = new XMLHttpRequest();
    }
    else if (window.ActiveXObject)  // IE6, IE5
    {
        http = new ActiveXObject("Microsoft.XMLHTTP");
    }
    if (http == null) return;

    // send post to url (no response)
    http.open("POST", url, true);  // asynchronous
    http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    http.setRequestHeader("Content-length", params.length);
    http.setRequestHeader("Connection", "close");
    http.send(params);
}

function LogAddress(file, address)
{
    var args = "?file=veiareas";
    var today = new Date();
    args += "-" + today.getFullYear();
    var month = String(today.getMonth() + 1);
    if (month.length == 1) month = "0" + month;
    args += "-" + month;
    args += "-" + file;

    HttpPost(_tempURL + args, "data=" + address);
}

