

// Origins, anchor positions and coordinates of the marker increase in the X direction to the right and in the Y direction down.

var iconACCOMM = new google.maps.MarkerImage(
  '/qldhols_06/fms/graphics/icons/map-accomm.png',
  new google.maps.Size(40, 40),  // This marker is 20 pixels wide by 32 pixels tall.
  new google.maps.Point(0,0),    // The origin for this image is 0,0.
  new google.maps.Point(0, 40)   // The anchor for this image is the base of the flagpole at 0,32.
);

var iconATTRACTION = new google.maps.MarkerImage(
  '/qldhols_06/fms/graphics/icons/map-attraction.png',
  new google.maps.Size(40, 40),  // This marker is 20 pixels wide by 32 pixels tall.
  new google.maps.Point(0,0),    // The origin for this image is 0,0.
  new google.maps.Point(0, 40)   // The anchor for this image is the base of the flagpole at 0,32.
);

var iconTOUR = new google.maps.MarkerImage(
  '/qldhols_06/fms/graphics/icons/map-tour.png',
  new google.maps.Size(40, 40),  // This marker is 20 pixels wide by 32 pixels tall.
  new google.maps.Point(0,0),    // The origin for this image is 0,0.
  new google.maps.Point(0, 40)   // The anchor for this image is the base of the flagpole at 0,32.
);

var iconEVENT = new google.maps.MarkerImage(
  '/qldhols_06/fms/graphics/icons/map-event.png',
  new google.maps.Size(40, 40),  // This marker is 20 pixels wide by 32 pixels tall.
  new google.maps.Point(0,0),    // The origin for this image is 0,0.
  new google.maps.Point(0, 40)   // The anchor for this image is the base of the flagpole at 0,32.
);

var iconHIRE = new google.maps.MarkerImage(
  '/qldhols_06/fms/graphics/icons/map-hire.png',
  new google.maps.Size(40, 40),  // This marker is 20 pixels wide by 32 pixels tall.
  new google.maps.Point(0,0),    // The origin for this image is 0,0.
  new google.maps.Point(0, 40)   // The anchor for this image is the base of the flagpole at 0,32.
);

var iconTRANSPORT = new google.maps.MarkerImage(
  '/qldhols_06/fms/graphics/icons/map-transport.png',
  new google.maps.Size(40, 40),  // This marker is 20 pixels wide by 32 pixels tall.
  new google.maps.Point(0,0),    // The origin for this image is 0,0.
  new google.maps.Point(0, 40)   // The anchor for this image is the base of the flagpole at 0,32.
);

var iconDESTINFO = new google.maps.MarkerImage(
  '/qldhols_06/fms/graphics/icons/map-destinfo.png',
  new google.maps.Size(40, 40),  // This marker is 20 pixels wide by 32 pixels tall.
  new google.maps.Point(0,0),    // The origin for this image is 0,0.
  new google.maps.Point(0, 40)   // The anchor for this image is the base of the flagpole at 0,32.
);

var iconINFO = new google.maps.MarkerImage(
  '/qldhols_06/fms/graphics/icons/map-info.png',
  new google.maps.Size(40, 40),  // This marker is 20 pixels wide by 32 pixels tall.
  new google.maps.Point(0,0),    // The origin for this image is 0,0.
  new google.maps.Point(0, 40)   // The anchor for this image is the base of the flagpole at 0,32.
);


function createProductInfoWindow (productLabel, summaryImage, summary, friendlyURL, bookMarkLink, bodyClass) {
  var productHTML = '';
  
  productHTML = productHTML + '<div class="mapProductWindow">';
    
    productHTML = productHTML + '<h2>' +productLabel+ '</h2>';
    
    if (summaryImage != '') {
      productHTML = productHTML + '<img src="' +summaryImage+ '" width="100" border="0">';
    }
    
    productHTML = productHTML + '' + summary+ '<br/><br/>';
      productHTML = productHTML + '<a href="' +friendlyURL+ '">More on ' +productLabel+ ' ></a>';
    productHTML = productHTML + '<br clear="all" />';
    
  productHTML = productHTML + '</div>';
  
  return productHTML;
}



function setDirections(toAddress) {
  directions.load("from: " + document.getElementById('fromAddress').value + " to: " + toAddress, { "locale": "en_US" });
}

function onGDirectionsLoad(){ 
  //document.getElementById("getStatus").innerHTML += directions.getStatus().code;  directionsPanel
}

function handleDirectionsErrors(){
  
  if (directions.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
    document.getElementById("route").innerHTML = "<p>Sorry, the addresses entered couldn't be found. This may be due to the fact that the address is relatively new, or it may be incorrect.</p>";
  else if (directions.getStatus().code == G_GEO_SERVER_ERROR)
    document.getElementById("route").innerHTML = "<p>Sorry, there was a problem finding the directions from the address entered.  Please try again.</p>";
  else if (directions.getStatus().code == G_GEO_MISSING_QUERY)
    document.getElementById("route").innerHTML = "<p>Sorry, there was a problem finding the directions from the address entered.  Please try again.</p>";
  else if (directions.getStatus().code == G_GEO_BAD_KEY)
    document.getElementById("route").innerHTML = "<p>Sorry, there was a problem finding the directions from the address entered.  Please try again.</p>";
  else if (directions.getStatus().code == G_GEO_BAD_REQUEST)
    document.getElementById("route").innerHTML = "<p>Sorry, there was a problem finding the directions from the address entered.  Please try again.</p>";
  else
    document.getElementById("route").innerHTML = "<p>Sorry, there was a problem finding the directions from the address entered.  Please try again.</p>";
    
}


function showOtherProductMarkers(productType) {
  
  markerState = document.getElementById("show"+productType).checked;
  
  if (productType == "ACCOMM") {
    if (markerState == true) {
      markerClusterAccomm.addMarkers(productMarkersACCOMM);
      markerClusterAccomm.redraw();
    } else {
      markerClusterAccomm.clearMarkers();
    }
  }
  
  if (productType == "ATTRACTION") {
    if (markerState == true) {
      markerClusterAttraction.addMarkers(productMarkersATTRACTION, 5);
      markerClusterAttraction.redraw();
    } else {
      markerClusterAttraction.clearMarkers();
    }
  }
  
  if (productType == "TOUR") {
    if (markerState == true) {
      markerClusterTour.addMarkers(productMarkersTOUR, 5);
      markerClusterTour.redraw();
    } else {
      markerClusterTour.clearMarkers();
    }
  }
  
  if (productType == "EVENT") {
    if (markerState == true) {
      markerClusterEvent.addMarkers(productMarkersEVENT, 5);
      markerClusterEvent.redraw();
    } else {
      markerClusterEvent.clearMarkers();
    }
  }
  
  if (productType == "HIRE") {
    if (markerState == true) {
      markerClusterHire.addMarkers(productMarkersHIRE, 5);
      markerClusterHire.redraw();
    } else {
      markerClusterHire.clearMarkers();
    }
  }
  
  if (productType == "TRANSPORT") {
    if (markerState == true) {
      markerClusterTransport.addMarkers(productMarkersTRANSPORT, 5);
      markerClusterTransport.redraw();
    } else {
      markerClusterTransport.clearMarkers();
    }
  }
  
  if (productType == "DESTINFO") {
    if (markerState == true) {
      markerClusterDestInfo.addMarkers(productMarkersDESTINFO, 5);
      markerClusterDestInfo.redraw();
    } else {
      markerClusterDestInfo.clearMarkers();
    }
  }
  
  if (productType == "INFO") {
    if (markerState == true) {
      markerClusterInfo.addMarkers(productMarkersINFO, 5);
      markerClusterInfo.redraw();
    } else {
      markerClusterInfo.clearMarkers();
    }
  }
  
  
}
