    function getCenters(query) {
        if (VEGlobal.zip.length == 0)return;
        document.getElementById('tblDirections').style.display = 'none';
        document.getElementById('tblResult').style.display = 'none';
        document.getElementById('tblLoading').style.display = 'inline';

        if (!VEGlobal.map) {
            VEGlobal.map = new VEMap('divMap');
            var initLatLong = new VELatLong(53.7141478406381, -1.69011163382114, 0, VEAltitudeMode.Default);
            VEGlobal.map.LoadMap(initLatLong);
            VEGlobal.map.SetScaleBarDistanceUnit(VEDistanceUnit.Kilometers)
        }
        VEGlobal.map.DeleteAllShapes();

        var url = '/proxy/http/business.dermalogica.com/WSDRMLocator/locator.asmx';
        var pl = new SOAPClientParameters();
        pl.add("XmlParams", query);
        SOAPClient.invoke(url, "GetAResultPage", pl, true, populateResult);

    }
   
    function doSearch() {
        with(document.getElementById('formFindLocation')){
            // save entered address in global VEGlobal object
            if(zip.value.replace(/ /g,'').length == 0) return;
            VEGlobal.zip = zip.value;
        }
        VEGlobal.country = 'United Kingdom';
        getCenters(buildQueryXml(1));
    }
    function ShowChannelIslandCenters() {
        document.getElementById('tblDirections').style.display = 'none';
        document.getElementById('tblResult').style.display = 'none';
        document.getElementById('tblLoading').style.display = 'inline';

        VEGlobal.map = new VEMap('divMap');
        var initLatLong = new VELatLong(49.1912580439582, -2.10731271509533, 0, VEAltitudeMode.Default);
        VEGlobal.map.LoadMap(initLatLong);
        VEGlobal.map.DeleteAllShapes();

        var url = 'http://business.dermalogica.com/WSDRMLocator/locator.asmx';
        var pl = new SOAPClientParameters();
        SOAPClient.invoke(url, "GetChannelIsland", pl, true, populateCIResult);
        return false;
    }
    function populateCIResult(r){
   // the result returned by the web service is a string, a "end record" is represented by \n\n
   // a field is delimited by |
   // layout of a record (representing a skin care center)
   // center_no|center_name|center_address|address_2|center_city|center_state|center_zip|center_phone|
   // center_distance
   
       clearResultTable();
       //alert('result: ' + r);
       if (r == null) {
            document.getElementById('tblResult').style.display = 'inline';
            document.getElementById('tblLoading').style.display = 'none';
            return;
       }
       var regX = /{~}/g; // escaped the | in the data, restore it here
       var res = r.replace(regX, '|');
       VEGlobal.aryLines = res.split('\n\n');
       var tblBRes = document.getElementById('tblBodyResult');
       
       var tr = document.createElement('tr');
       tblBRes.appendChild(tr);
       var td = document.createElement('td');
       tr.appendChild(td);
       td.colSpan = '3';
       td.vAlign = 'top';
       td.className = 'style11';
       td.innerHTML = 'Skin treatment centers,salons or spas in the English Channel Islands';
       
       for (var l = 0; l < VEGlobal.aryLines.length; l++) {
           var aryFld = VEGlobal.aryLines[l].split('|');
           if (aryFld.length < 2) break;
           // row center number and name, address
           tr = document.createElement('tr');
           tblBRes.appendChild(tr);
           // cell center number
           td = document.createElement('td');
           tr.appendChild(td);
           td.vAlign = 'top';
           td.innerHTML = '<div style="background-image:url(images/results.gif); ' +
                        'color:white; font-family:Arial; ' +
                        'width:20px; height:17px; font-size:12px;font-weight: normal; ' +
                        'text-decoration: none; padding-top:3px; ' +
                        'vertical-align: middle; text-align: center;">' +
                        aryFld[0] + '</div>';
                                
            // cell center name
           td = document.createElement('td');
           tr.appendChild(td);
           td.innerHTML =  '<span class="style25">' + aryFld[1] + '</span><br/><span class="style29">' +
            aryFld[2] + '<br/>' + 
            aryFld[3] + ', ' + aryFld[4] + ' ' + aryFld[5] + '<br/>' +
            aryFld[6] + '</span>';
            // cell icons
           td = document.createElement('td');
           tr.appendChild(td);
           td.style.width = '130px';
            // separator row
           tr = document.createElement('tr');
           tblBRes.appendChild(tr);
           td = document.createElement('td');
           tr.appendChild(td);
           td = document.createElement('td');
           tr.appendChild(td);
           td.colSpan = 2;
           td.className = 'style13';
           td.innerHTML = '.................................................................................';
       }
        document.getElementById('tblResult').style.display = 'inline';
        document.getElementById('tblLoading').style.display = 'none';

   }

