var VIEW_IMAGE_PAGE = BASE_HREF + "display.jspx";
var lastItem;
var loaded = 0;

/** Open image window */
function view_image(path, w, h) {
  var image_request_url = VIEW_IMAGE_PAGE + '?path=' + path + '&w=' + w + '&h=' + h;
  var image_win_params = 'width=' + (w+20) + ',height=' + (h+20) + ',directories=0,location=0,menubar=0,resizable=1,scrollbars=0,status=0,toolbar=0';
  window.open(image_request_url, 'viewImage', image_win_params);

  return false; //to stop the browser following the 'actual' link.
}

function preLoad(imageFile) {
  eval(imageFile + "_on = new Image(); " + imageFile + "_on.src = '" + BASE_HREF + "images/map/map_" + imageFile + ".gif?v=2';");
}

function imageSet(item) {
  var mapImg = document.getElementById('mapImg');
  
  oldAnch = document.getElementById('a' + lastItem);
  
  if (oldAnch != null) {
    oldAnch.className = '';
  }
  
  if (loaded) {
    eval("mapImg.src = " + item + "_on.src;");
    
    anch = document.getElementById('a' + item);
    if (anch != null) {
      anch.className += ' hover';
    }
  }
  
  if (item != 'blank') {
    lastItem = item;
  }
}

function formValid() {
    if(document.getElementById('ship').value == 'default') {
        alert('Please Select a Cruise Ship.');
        return false;
    }
    return validateForm(document.getElementById('cruise_form'));
}