function getXMLHTTP() { //fuction to return the xml http object
        var xmlhttp=false;
        try{
            xmlhttp=new XMLHttpRequest();
        }
        catch(e)    {
            try{
                xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch(e){
                try{
                xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
                }
                catch(e1){
                    xmlhttp=false;
                }
            }
        }

        return xmlhttp;
    }

function getXMLHTTP2() { //fuction to return the xml http object
        var xmlhttp2=false;
        try{
            xmlhttp2=new XMLHttpRequest();
        }
        catch(e)    {
            try{
                xmlhttp2= new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch(e){
                try{
                xmlhttp2 = new ActiveXObject("Msxml2.XMLHTTP");
                }
                catch(e1){
                    xmlhttp2=false;
                }
            }
        }

        return xmlhttp2;
    }

function getXMLHTTP3() { //fuction to return the xml http object
        var xmlhttp3=false;
        try{
            xmlhttp3=new XMLHttpRequest();
        }
        catch(e)    {
            try{
                xmlhttp3= new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch(e){
                try{
                xmlhttp3 = new ActiveXObject("Msxml2.XMLHTTP");
                }
                catch(e1){
                    xmlhttp3=false;
                }
            }
        }

        return xmlhttp3;
    }

function getXMLHTTP4() { //fuction to return the xml http object
        var xmlhttp4=false;
        try{
            xmlhttp4=new XMLHttpRequest();
        }
        catch(e)    {
            try{
                xmlhttp4= new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch(e){
                try{
                xmlhttp4 = new ActiveXObject("Msxml2.XMLHTTP");
                }
                catch(e1){
                    xmlhttp4=false;
                }
            }
        }

        return xmlhttp4;
    }

    function getXMLHTTP5() { //fuction to return the xml http object
        var xmlhttp5=false;
        try{
            xmlhttp5=new XMLHttpRequest();
        }
        catch(e)    {
            try{
                xmlhttp5= new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch(e){
                try{
                xmlhttp5 = new ActiveXObject("Msxml2.XMLHTTP");
                }
                catch(e1){
                    xmlhttp5=false;
                }
            }
        }

        return xmlhttp5;
    }

    function getProv(strURL) {

        var reqa = getXMLHTTP5();
        document.getElementById('provdiv').innerHTML='<img src=\'/images/indicator.gif\'>';
        if (reqa) {

            reqa.onreadystatechange = function() {
                if (reqa.readyState == 4) {
                    // only if "OK"
                    if (reqa.status == 200) {
                        document.getElementById('provdiv').innerHTML=reqa.responseText;
                        document.getElementById('citydiv').innerHTML = '<label for="ContactName">City</label><select name="update[scity_id]" class="field" disabled><option value="" selected>--</option></select>';
                        document.getElementById('categorydiv').innerHTML = '<label for="ContactName">Category</label><select name="update[scity_id]" class="field" disabled><option value="" selected>--</option></select>';
                        document.getElementById('suburbdiv').innerHTML = '<label for="ContactName">Suburb</label><select name="update[scity_id]" class="field" disabled><option value="" selected>--</option></select>';
                    } else {
                        alert("There was a problem while using XMLHTTP:\n" + reqa.statusText);
                    }
                }
            }
            reqa.open("GET", strURL, true);
            reqa.send(null);
        }

    }

    function getCity(strURL) {

        var reqa = getXMLHTTP();
        document.getElementById('citydiv').innerHTML='<img src=\'/images/indicator.gif\'>';
        if (reqa) {

            reqa.onreadystatechange = function() {
                if (reqa.readyState == 4) {
                    // only if "OK"
                    if (reqa.status == 200) {
                        document.getElementById('citydiv').innerHTML=reqa.responseText;
                        document.getElementById('categorydiv').innerHTML = '<label for="ContactName">Category</label><select name="update[scity_id]" class="field" disabled><option value="" selected>--</option></select>';
                        document.getElementById('suburbdiv').innerHTML = '<label for="ContactName">Suburb</label><select name="update[scity_id]" class="field" disabled><option value="" selected>--</option></select>';
                    } else {
                        alert("There was a problem while using XMLHTTP:\n" + reqa.statusText);
                    }
                }
            }
            reqa.open("GET", strURL, true);
            reqa.send(null);
        }

    }
    function getCategory(strURL) {

        var reqb = getXMLHTTP2();
        document.getElementById('categorydiv').innerHTML='<img src=\'/images/indicator.gif\'>';
        if (reqb) {

            reqb.onreadystatechange = function() {
                if (reqb.readyState == 4) {
                    // only if "OK"
                    if (reqb.status == 200) {
                        document.getElementById('categorydiv').innerHTML=reqb.responseText;
                        document.getElementById('suburbdiv').innerHTML = '<label for="ContactName">Suburb</label><select name="update[scity_id]" class="field" disabled><option value="" selected>--</option></select>';
                    } else {
                        alert("There was a problem while using XMLHTTP:\n" + reqb.statusText);
                    }
                }
            }
            reqb.open("GET", strURL, true);
            reqb.send(null);
        }

    }

    function getSuburb(strURL) {

        var reqc = getXMLHTTP3();
        document.getElementById('suburbdiv').innerHTML='<img src=\'/images/indicator.gif\'>';
        if (reqc) {

            reqc.onreadystatechange = function() {
                if (reqc.readyState == 4) {
                    // only if "OK"
                    if (reqc.status == 200) {
                        document.getElementById('suburbdiv').innerHTML=reqc.responseText;
                    } else {
                        alert("There was a problem while using XMLHTTP:\n" + reqc.statusText);
                    }
                }
            }
            reqc.open("GET", strURL, true);
            reqc.send(null);
        }

    }

        function getIndicators(strURL) {

        var reqc = getXMLHTTP4();
        document.getElementById('indicatordiv').innerHTML='<img src=\'/images/indicator.gif\'>';
        if (reqc) {

            reqc.onreadystatechange = function() {
                if (reqc.readyState == 4) {
                    // only if "OK"
                    if (reqc.status == 200) {
                        document.getElementById('indicatordiv').innerHTML=reqc.responseText;
                    } else {
                        alert("There was a problem while using XMLHTTP:\n" + reqc.statusText);
                    }
                }
            }
            reqc.open("GET", strURL, true);
            reqc.send(null);
        }

    }
