    /*
     * Read output from XML file and change entites back to HTML values..
     *
     * @author Matt Evans <matt.evans@sitepoint.com>
     */
function parse2Html(des){
	wow = des.replace("&lt;", "<");
        wow = wow.replace("&gt;", ">");
        wow = wow.replace("&quot;", '"');
        wow = wow.replace("&#39;", "'");
        wow = wow.replace("&amp;", "&");
        return wow;
}

    var markerHTML = [];
    var markerItself = [];

    // Create custom icon for Gmap.
    var iconBlue = new GIcon(); 
    iconBlue.image = 'http://labs.google.com/ridefinder/images/mm_20_blue.png';
    iconBlue.shadow = 'http://labs.google.com/ridefinder/images/mm_20_shadow.png';
    iconBlue.iconSize = new GSize(12, 20);
    iconBlue.shadowSize = new GSize(22, 20);
    iconBlue.iconAnchor = new GPoint(6, 20);
    iconBlue.infoWindowAnchor = new GPoint(5, 1);
    
    var customIcons = [];
    customIcons["aucd"] = iconBlue;

    /*
     * Set Zoom on heading click.
     *
     * @author Matt Evans <matt.evans@sitepoint.com>
     */            
        function zoomClick(show)
        {
            if(show == 'VIC'){
               map.setCenter(new GLatLng(-36.5587997, 145.4689942), 6);
		}
            else if(show == 'NSW'){
                map.setCenter(new GLatLng(-32.8310013, 150.1390075), 6);
            }
            else if(show == 'ACT'){
                map.setCenter(new GLatLng(-35.68407153314097, 151.083984375), 6);
            }
            else if(show == 'TAS'){
                map.setCenter(new GLatLng(-42.27730877423707, 146.07421875), 6);
            }
            else if(show == 'QLD'){
                map.setCenter(new GLatLng(-22.978623970384902, 145.01953125), 5);
            }
            else if(show == 'SA'){
                map.setCenter(new GLatLng(-30.10711788709237, 134.7802734375), 6);
            }
            else if(show == 'WA'){
                map.setCenter(new GLatLng(-26.549222577692028, 122.0361328125), 5);
            }
            else if(show == 'NT'){
                map.setCenter(new GLatLng(-19.31114335506464, 133.6376953125), 6);
            }
            else{
                map.setCenter(new GLatLng(-28.76765910569124, 134.560546875), 4);
            }       
        }

    /*
     * Create Marker on click.
     * 
     * @param point - Coordinates for marker.
     * @param name - Name of town
     * @param state - State of town
     * @param description - Description for marker/town
     * @param domain - domain name of town
     * @param status (int) - 1 (Approved), (2) Live, (3) Under Application
     *
     * @author Matt Evans <matt.evans@sitepoint.com>
     */
    function createMarker(point, name, state, description, domain, status, id) {
      var marker = new GMarker(point, customIcons['aucd']);
	markerItself[id] = marker;
      // if approved, then display custom message in marker.
      if(status == '1'){
        var html = "<b>Approved</b><br /><b>" + name + " (" + state + ")</b><br />" + description;
        markerHTML[id] = html;  
        GEvent.addListener(marker, 'click', function() {
           marker.openInfoWindowHtml(html);
          });
      }
      // if live, then show link to domain
      else if(status == '2'){
         var html = "<b>Live</b><br /><b>" + name + " (" + state + ")</b><br />" + description + "<br /><a href='http://www." + domain + "' target='_blank'>" + domain + "</a>";
        markerHTML[id] = html;  
	GEvent.addListener(marker, 'click', function() {
           marker.openInfoWindowHtml(html);
          });
      }
      // otherwise show custom 'Under App' status.
      else{
         var html = "<b>Under Application</b><br /><b>" + name + " (" + state + ")</b><br />" + description;
            markerHTML[id] = html;
	    GEvent.addListener(marker, 'click', function() {
           marker.openInfoWindowHtml(html);
          });
      }
      
      return marker;
    }
    
    function myClick(i) {
         markerItself[i].openInfoWindowHtml(markerHTML[i]);
    }
