
  var browser_type;
  var x_minus = -1;
  var y_minus = -18;
  var strDebug = '';



  window.onload=function() {

    browser_type = "ie";
    if (navigator.userAgent.indexOf("Firefox") != -1) {
      browser_type = "firefox";
    }

    if ( browser_type == "ie" ) {
      x_minus = -1;
      y_minus = -18;
    }
    else {
      x_minus = -2;
      y_minus = -19;
    }



    if ( document.getElementById("country_map_img") ) {
      initWindow();
      window.onresize = resizeWindowOrReload;
    }






  }



  function initWindow() {

    ////////////////////////////////////////////////////////////////
    // Do stuff with map:
    // - get size and position of map image
    // - set size of surrounding div to size of map image
    // - set background of surrounding div to source of map image
    // - hide map image
    ////////////////////////////////////////////////////////////////

    el_imgmap_holder = document.getElementById("country_holder");
    el_imgmap = document.getElementById("country_map_img");

    map_width = el_imgmap.width;
    map_height = el_imgmap.height;
    imgx = getPageOffsetLeft(el_imgmap);
    imgy = getPageOffsetTop(el_imgmap);

    strDebug += "<br><br>Get size and position of map";
    strDebug += "<br>imgx: " + imgx + "<br>imgy: " + imgy;

    el_imgmap.style.display = "none";
    el_imgmap_holder.style.backgroundImage = "url(" + el_imgmap.src + ")";


    if ( browser_type == "ie" ) {
      el_imgmap_holder.style.width = map_width + 2 + 'px';
      el_imgmap_holder.style.height = map_height + 2 + 'px';
    }
    else {
      el_imgmap_holder.style.width = map_width + 'px';
      el_imgmap_holder.style.height = map_height + 'px';
    }

    ////////////////////////////////////////////////////////////////



    ////////////////////////////////////////////////////////////////
    // Loop through images (which names and coords are in hidden fields) and
    // - position them correctly
    // - show them
    ////////////////////////////////////////////////////////////////

    for (var i = 0; i < document.images.length; i++) {

      el_img = document.images[i];
      el_form = document.forms["map_properties"];

      if ( el_img.id.substr(0,20) == "imgmap_popup_marker_" ) {

        img_no = el_img.id.replace("imgmap_popup_marker_", "");
 	      el_img_x = el_form['map_x_' + img_no].value;
        el_img_y = el_form['map_y_' + img_no].value;

        el_img.style.display = 'block';
        el_img.style.position = 'absolute';

        el_img.style.left = imgx + Number(el_img_x)+x_minus;
        el_img.style.top = imgy + Number(el_img_y)+y_minus;

      }

    }

    ////////////////////////////////////////////////////////////////

  }



  function initSmallMap() {

    if ( document.getElementById("tab_2") ) { toggle_tab( 2 ); }

    el_imgmapsmall = document.getElementById("imgmapsmall");
    mapsmall_width = el_imgmapsmall.width;
    mapsmall_height = el_imgmapsmall.height;

    if ( document.getElementById("tab_2") ) { toggle_tab( 1 );  }

    el_markersmall = document.getElementById("imgmapsmall_marker");
    imgmapsmall_marker.style.display = "block";
    imgmapsmall_marker.style.top = Number(imgmapsmall_marker.style.top.replace("px", "")) - Number(mapsmall_height) - 19;


  }






  function resizeWindowOrReload() {

    if ( browser_type == "firefox") {
      window.location = window.location;
    }
    else {
      resizeWindow();
    }

  }






  function resizeWindow() {

    ////////////////////////////////////////////////////////////////
    // Do stuff with map:
    // - get position of map image
    ////////////////////////////////////////////////////////////////

    el_imgmap = document.getElementById("country_map_img");
    imgx = getPageOffsetLeft(el_imgmap);
    imgy = getPageOffsetTop(el_imgmap);

    ////////////////////////////////////////////////////////////////



    ////////////////////////////////////////////////////////////////
    // Loop through images (which names and coords are in hidden fields) and
    // - reposition them correctly
    ////////////////////////////////////////////////////////////////

    for (var i = 0; i < document.images.length; i++) {

      el_img = document.images[i];
      el_form = document.forms["map_properties"];

      if ( el_img.id.substr(0,20) == "imgmap_popup_marker_" ) {

        img_no = el_img.id.replace("imgmap_popup_marker_", "");
 	      el_img_x = el_form['map_x_' + img_no].value;
        el_img_y = el_form['map_y_' + img_no].value;

        el_img.style.left = imgx + Number(el_img_x)+x_minus;
        el_img.style.top = imgy + Number(el_img_y)+y_minus;

      }

    }

    ////////////////////////////////////////////////////////////////

  }


  ////////////////////////////////////////////////////////////////
  //
  ////////////////////////////////////////////////////////////////
  function changeAcco( acco_id ) {

    opener.location = "/accommodaties/index.asp?id=" + acco_id;
    window.close();

  }




  ////////////////////////////////////////////////////////////////
  //
  ////////////////////////////////////////////////////////////////
  function getPageOffsetLeft(el) {

    var x;
    // Return the x coordinate of an element relative to the page.
    x = el.offsetLeft;
    if (el.offsetParent != null) {
      x += getPageOffsetLeft(el.offsetParent);
    }
    return x;
  }
  ////////////////////////////////////////////////////////////////





  ////////////////////////////////////////////////////////////////
  //
  ////////////////////////////////////////////////////////////////
  function getPageOffsetTop(el) {

    var y;
    // Return the x coordinate of an element relative to the page.
    y = el.offsetTop;
    if (el.offsetParent != null) {
      y += getPageOffsetTop(el.offsetParent);
    }
    return y;
  }
  ////////////////////////////////////////////////////////////////


  ////////////////////////////////////////////////////////////////
  //
  ////////////////////////////////////////////////////////////////
  function showAccoDiv( acco_img, acco_ids ) {

    el_acco_marker = document.images["imgmap_popup_marker_" + acco_img];
    el_acco_marker_left = el_acco_marker.style.left.replace("px", "");
    el_acco_marker_top = el_acco_marker.style.top.replace("px", "");

    elAccoDiv = document.getElementById("acco_div")
    elAccoDivContent = document.getElementById("acco_div_content")

    elAccoDiv.style.left = Number(el_acco_marker_left) + 6 + "px";
    elAccoDiv.style.top = Number(el_acco_marker_top) - 6 + "px";

    el_form = document.forms["map_properties"];

    // Just one acco...
    if ( acco_ids.indexOf(",") == -1 ) {

      acco_id = acco_ids;
      el_acco_details_id = "acco_" + acco_ids + "_details";
      el_acco_details = el_form[el_acco_details_id];

      elAccoDivContent.innerHTML =
        el_acco_details.value +
        "&nbsp; <a href='/accommodaties/index.asp?id=" + acco_id + "'>meer info <img src='/i/elements/maps/acco_div_arrow.gif' class='acco_arrow'></a>";

    }

    // More than one acco...
    else {

      elAccoDivContent.innerHTML = "";
      array_acco_ids = acco_ids.split(",");
      for (var i_acco = 0; i_acco < array_acco_ids.length; i_acco++) {

        acco_id = array_acco_ids[i_acco];
        el_acco_details_id = "acco_" + array_acco_ids[i_acco] + "_details";
        el_acco_details = el_form[el_acco_details_id];

        acco_separator = "<div class='acco_separator'><div class='div_hidden'>&nbsp;</div></div>";
        if ( i_acco == array_acco_ids.length-1 ) { acco_separator = ""; }

        elAccoDivContent.innerHTML +=
          el_acco_details.value +
          "&nbsp; <nobr><a href='/accommodaties/index.asp?id=" + acco_id + "'>meer info <img src='/i/elements/maps/acco_div_arrow.gif' class='acco_arrow'></a></nobr>" +
          acco_separator;

      }

    }

    elAccoDiv.style.display = "block";

  }
  ////////////////////////////////////////////////////////////////



  ////////////////////////////////////////////////////////////////
  function hideAccoDiv( accoid ) {

    elAccoDiv = document.getElementById("acco_div")
    elAccoDiv.style.display = "none";

  }
  ////////////////////////////////////////////////////////////////



  ////////////////////////////////////////////////////////////////
  function markerMouseOver( accoid ) {

    el_marker_id = "imgmap_popup_marker_" + accoid;
    el_marker = document.images[el_marker_id];

    if ( el_marker.className == "imgmap_popup_marker_other_more" ) {
      el_marker.src = "/i/elements/maps/map-marker-mo_more.gif"; }
    else {
      el_marker.src = "/i/elements/maps/map-marker-mo.gif"; }


  }
  ////////////////////////////////////////////////////////////////


  ////////////////////////////////////////////////////////////////
  function markerMouseOff( accoid ) {

    el_marker_id = "imgmap_popup_marker_" + accoid;
    el_marker = document.images[el_marker_id];

    if ( el_marker.className == "imgmap_popup_marker_other_more" ) {
      el_marker.src = "/i/elements/maps/map-marker-other_more.gif"; }
    else {
      el_marker.src = "/i/elements/maps/map-marker-other.gif"; }


  }
  ////////////////////////////////////////////////////////////////


  ////////////////////////////////////////////////////////////////
  function toggleMap(img, src_flip, src_orig, state) {

    if ( document.images ) {
      if ( state == 1 ) {
        document[img].src = src_flip;
      }
      else {
        document[img].src = src_orig;
      }
    }

  }
  ////////////////////////////////////////////////////////////////
