
// Create our "tiny" marker icon
var ltBlueIcon = new GIcon();
ltBlueIcon.image = "/qldhols_06/fms/images/global/map_icons/icon_ltblue.png";
ltBlueIcon.shadow = "/qldhols_06/fms/images/global/map_icons/icon_shadow.png";
ltBlueIcon.iconSize = new GSize(12, 20);
ltBlueIcon.shadowSize = new GSize(22, 20);
ltBlueIcon.iconAnchor = new GPoint(6, 20);
ltBlueIcon.infoWindowAnchor = new GPoint(5, 1);

// Create our "tiny" marker icon
var ltGreenIcon = new GIcon();
ltGreenIcon.image = "/qldhols_06/fms/images/global/map_icons/icon_ltgreen.png";
ltGreenIcon.shadow = "/qldhols_06/fms/images/global/map_icons/icon_shadow.png";
ltGreenIcon.iconSize = new GSize(12, 20);
ltGreenIcon.shadowSize = new GSize(22, 20);
ltGreenIcon.iconAnchor = new GPoint(6, 20);
ltGreenIcon.infoWindowAnchor = new GPoint(5, 1);

// Create our "tiny" marker icon
var redIcon = new GIcon();
redIcon.image = "/qldhols_06/fms/images/global/map_icons/icon_red.png";
redIcon.shadow = "/qldhols_06/fms/images/global/map_icons/icon_shadow.png";
redIcon.iconSize = new GSize(12, 20);
redIcon.shadowSize = new GSize(22, 20);
redIcon.iconAnchor = new GPoint(6, 20);
redIcon.infoWindowAnchor = new GPoint(5, 1);

// Create our "tiny" marker icon
var yellowIcon = new GIcon();
yellowIcon.image = "/qldhols_06/fms/images/global/map_icons/icon_yellow.png";
yellowIcon.shadow = "/qldhols_06/fms/images/global/map_icons/icon_shadow.png";
yellowIcon.iconSize = new GSize(12, 20);
yellowIcon.shadowSize = new GSize(22, 20);
yellowIcon.iconAnchor = new GPoint(6, 20);
yellowIcon.infoWindowAnchor = new GPoint(5, 1);

// Create our "tiny" marker icon
var dkGreenIcon = new GIcon();
dkGreenIcon.image = "/qldhols_06/fms/images/global/map_icons/icon_dkgreen.png";
dkGreenIcon.shadow = "/qldhols_06/fms/images/global/map_icons/icon_shadow.png";
dkGreenIcon.iconSize = new GSize(12, 20);
dkGreenIcon.shadowSize = new GSize(22, 20);
dkGreenIcon.iconAnchor = new GPoint(6, 20);
dkGreenIcon.infoWindowAnchor = new GPoint(5, 1);

// Create our "tiny" marker icon
var dkBlueIcon = new GIcon();
dkBlueIcon.image = "/qldhols_06/fms/images/global/map_icons/icon_dkblue.png";
dkBlueIcon.shadow = "/qldhols_06/fms/images/global/map_icons/icon_shadow.png";
dkBlueIcon.iconSize = new GSize(12, 20);
dkBlueIcon.shadowSize = new GSize(22, 20);
dkBlueIcon.iconAnchor = new GPoint(6, 20);
dkBlueIcon.infoWindowAnchor = new GPoint(5, 1);

// Set up our GMarkerOptions object literal
markerOptionsDESTINFO = { icon:ltBlueIcon };
markerOptionsACCOMM = { icon:redIcon };
markerOptionsATTRACTION = { icon:ltGreenIcon };
markerOptionsTOUR = { icon:ltGreenIcon };
markerOptionsEVENT = { icon:yellowIcon };
markerOptionsHIRE = { icon:dkBlueIcon };
markerOptionsTRANSPORT = { icon:dkBlueIcon };
markerOptionsINFO = { icon:dkGreenIcon };

markerOptions = { icon:ltBlueIcon };


function createProductInfoWindow (productLabel, summaryImage, summary, friendlyURL, bookMarkLink, bodyClass) {
  var productHTML = '';
  
  productHTML = productHTML + '<div style="width:300px">';
  productHTML = productHTML + '<div class="search_results" style="width:300px; padding:10px; text-align:left;">';
    
    if (bookMarkLink != '') {
      productHTML = productHTML + '<span class="iconSelection">';
        productHTML = productHTML + '<a href="' +bookMarkLink+ '" target="tpWindow" onclick="return openWinSized(this.href, this.target, 200, 200);" title="Add to Travel Pack"><img src="/qldhols_06/fms/images/global/buttons_icons/gr_travelpack_add_' +bodyClass+ '.gif" alt="Add to Travel Pack" width="26" height="39" border="0" /></a>';
      productHTML = productHTML + '</span>';
    }
    
    productHTML = productHTML + '<h4 class="results_header">' +productLabel+ '</h4>';
    
    if (summaryImage != '') {
      productHTML = productHTML + '<div class="results_image" style="width:100px;"><img src="' +summaryImage+ '" width="100" border="0"></div>';
    }
    
    productHTML = productHTML + '<p style="margin-left:0px; padding-left:0px; color:#000;">' + summary+ '<br/><br/>';
      productHTML = productHTML + '<a href="' +friendlyURL+ '">More on ' +productLabel+ ' ></a>';
    productHTML = productHTML + '</p><br clear="all" />';

  productHTML = productHTML + '</div>';
  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).value;
  
  if (productType == "ACCOMM") {
    if (markerState == "Show") {
      mgrACCOMM.addMarkers(productMarkersACCOMM, 5);
      mgrACCOMM.refresh();
    } else {
      mgrACCOMM.clearMarkers();
    }
  }
  
  if (productType == "ATTRACTIONTOUR") {
    if (markerState == "Show") {
      mgrATTRACTION.addMarkers(productMarkersATTRACTION, 5);
      mgrATTRACTION.refresh();
      mgrTOUR.addMarkers(productMarkersTOUR, 5);
      mgrTOUR.refresh();
    } else {
      mgrATTRACTION.clearMarkers();
      mgrTOUR.clearMarkers();
    }
  }
  
  if (productType == "EVENT") {
    if (markerState == "Show") {
      mgrEVENT.addMarkers(productMarkersEVENT, 5);
      mgrEVENT.refresh();
    } else {
      mgrEVENT.clearMarkers();
    }
  }
  
  if (productType == "HIRETRANSPORT") {
    if (markerState == "Show") {
      mgrHIRE.addMarkers(productMarkersHIRE, 5);
      mgrHIRE.refresh();
      mgrTRANSPORT.addMarkers(productMarkersTRANSPORT, 5);
      mgrTRANSPORT.refresh();
    } else {
      mgrHIRE.clearMarkers();
      mgrTRANSPORT.clearMarkers();
    }
  }
  
  if (productType == "DESTINFO") {
    if (markerState == "Show") {
      mgrDESTINFO.addMarkers(productMarkersDESTINFO, 5);
      mgrDESTINFO.refresh();
    } else {
      mgrDESTINFO.clearMarkers();
    }
  }
  
  if (productType == "INFO") {
    if (markerState == "Show") {
      mgrINFO.addMarkers(productMarkersINFO, 5);
      mgrINFO.refresh();
    } else {
      mgrINFO.clearMarkers();
    }
  }
  
  
  if (markerState == "Show") {
    document.getElementById("show"+productType).value = "Hide";
    document.getElementById("show"+productType).checked = true;
  } else {
    document.getElementById("show"+productType).value = "Show";
    document.getElementById("show"+productType).checked = false;
  }
  
}