var load;
function bodyOnLoad() {
  if (load) load();
}

function bodyForPrintOnLoad() {
  bodyOnLoad();
  var anchors = document.getElementsByTagName('a');
  for (var iCnt = 0; iCnt < anchors.length; iCnt++) {
    anchors[iCnt].href = '#';
  }
}

var map;
var unload;
function bodyOnUnload() {
  if (unload) unload();
  else if (map) GUnload();
}

function translate(from, to) {
  var t=((window.getSelection&&window.getSelection())||(document.getSelection&&document.getSelection())||(document.selection&&document.selection.createRange&&document.selection.createRange().text));
  var e=(document.charset||document.characterSet);
  if(t!=''){
    location.href='http://translate.google.com/translate_t?text='+t+'&hl='+from+'&langpair=auto|'+to+'&tbb=1&ie='+e;
  }else{
    location.href='http://translate.google.com/translate?u='+escape(location.href.replace(location.hash, ''))+'&hl='+from+'&langpair=auto|'+to+'&tbb=1&ie='+e;
  };
}

function zones_filterChanged(excursionTypes, isForPrint) {
  clearMarkers();
  var idx;
  var newLocations = new Array();
  var types = new Array();
  for (idx in excursionTypes) {
    if (document.getElementById(excursionTypes[idx]).checked) types.push(excursionTypes[idx]);
  }
  
  for (idx in zoneLocations) {
    var visible = false;
    var idy;
    for (idy in types) {
      if (zoneLocations[idx][types[idy]]) {
        visible = true;
        break;
      }
    }
    if (visible) newLocations.push(zoneLocations[idx]);
  }
  addMarkers(newLocations, isForPrint);
}

function zones_selectAll(excursionTypes, isForPrint) {
  var idx;
  for (idx in excursionTypes) {
    document.getElementById(excursionTypes[idx]).checked = 'checked';
  }
  zones_filterChanged(excursionTypes, isForPrint);
}
	  
function zones_selectNone(excursionTypes, isForPrint) {
  var idx;
  for (idx in excursionTypes) {
    document.getElementById(excursionTypes[idx]).checked = '';
  }
  zones_filterChanged(excursionTypes, isForPrint);
}

AmuntPhoto = function() {
}
AmuntPhoto.prototype.width;
AmuntPhoto.prototype.height;
AmuntPhoto.prototype.url;
AmuntPhoto.prototype.description;

ImageChanger = function() {
  this.current = 0;
};
ImageChanger.prototype.images;
ImageChanger.prototype.imgDescr;
ImageChanger.prototype.imgObj;
ImageChanger.prototype.current;
ImageChanger.prototype.onloaded;
ImageChanger.prototype.nextImage = function() {
  if (!this.onloaded) {
    onloaded = true;
    var changer = this;
    this.imgObj.onload = function () {
      var photo = changer.images[changer.current];
      changer.imgObj.style.display = 'none';
      changer.imgObj.width = photo.width;
      changer.imgObj.height = photo.height;
      changer.imgObj.style.display = '';
      changer.imgDescr.innerHTML = photo.description;
    }
  };
  if (++this.current >= this.images.length) {
    this.current = 0;
  }
  var photo = this.images[this.current];
  this.imgObj.src = photo.url;
}

//Provide the XMLHttpRequest class for IE 5.x-6.x:
//Other browsers (including IE 7.x-8.x) ignore this
//when XMLHttpRequest is predefined
if (typeof XMLHttpRequest == "undefined") {
  XMLHttpRequest = function() {
    try {return new ActiveXObject("Msxml2.XMLHTTP.6.0");
    } catch(e) {}
    try {return new ActiveXObject("Msxml2.XMLHTTP.3.0");
    } catch(e) {}
    try {return new ActiveXObject("Msxml2.XMLHTTP");
    } catch(e) {}
    try {return new ActiveXObject("Microsoft.XMLHTTP");
    } catch(e) {}
    throw new Error("This browser does not support XMLHttpRequest.");
  };
}
