var xmlHttp;

function createXMLHttpRequest() {
    if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    } 
    else if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();
    }
}

var xmlHttp2;

function createXMLHttpRequest2() {
    if (window.ActiveXObject) {
        xmlHttp2 = new ActiveXObject("Microsoft.XMLHTTP");
    } 
    else if (window.XMLHttpRequest) {
        xmlHttp2 = new XMLHttpRequest();
    }
}

var xmlHttp3;

function createXMLHttpRequest3() {
    if (window.ActiveXObject) {
        xmlHttp3 = new ActiveXObject("Microsoft.XMLHTTP");
    } 
    else if (window.XMLHttpRequest) {
        xmlHttp3 = new XMLHttpRequest();
    }
}


function mapLocationDisplay(locationid) {
    var url = "/cgi-bin/petfriendly/maplocationdisplay.html?locationid=" + locationid;
    createXMLHttpRequest();
    xmlHttp.onreadystatechange = mapLocationDisplayStateChange;
    xmlHttp.open("GET", url, true);
    xmlHttp.send(null);
    //alert (url);
}

function mapLocationDisplayStateChange() {
    if(xmlHttp.readyState == 3) {
    }
    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200) {
            document.getElementById('maplocationdisplay').innerHTML = xmlHttp.responseText;
        }
        else {
            alert("Error accessing search");
        }
    }
}

function mapLocationPhotos(locationid) {
    var url = "/cgi-bin/petfriendly/maplocationphotos.html?locationid=" + locationid;
    createXMLHttpRequest2();
    xmlHttp2.onreadystatechange = mapLocationPhotosStateChange;
    xmlHttp2.open("GET", url, true);
    xmlHttp2.send(null);
    //alert (url);
}

function mapLocationPhotosStateChange() {
    if(xmlHttp2.readyState == 3) {
    }
    if(xmlHttp2.readyState == 4) {
        if(xmlHttp2.status == 200) {
            document.getElementById('maplocationphotos').innerHTML = xmlHttp2.responseText;
        }
        else {
            alert("Error accessing search");
        }
    }
}

function mapLocationInfo(locationid) {
    var url = "/cgi-bin/petfriendly/maplocationinfo.html?locationid=" + locationid;
    createXMLHttpRequest3();
    xmlHttp3.onreadystatechange = mapLocationInfoStateChange;
    xmlHttp3.open("GET", url, true);
    xmlHttp3.send(null);
    //alert (url);
}

function mapLocationInfoStateChange() {
    if(xmlHttp3.readyState == 3) {
    }
    if(xmlHttp3.readyState == 4) {
        if(xmlHttp3.status == 200) {
            document.getElementById('maplocationinfo').innerHTML = xmlHttp3.responseText;
        }
        else {
            alert("Error accessing search");
        }
    }
}


