var g_map_window = null;


function showRemoteMap(id, remote_width, remote_height, x, y, scale)
{
  var extra = "";
  if (x && y && scale)
    extra = "&x=" + x + "&y=" + y + "&s=" + scale / 3
    
  var w = remote_width  + 32;  // Room for slider, etc
  var h = remote_height + 300; // Room for toolbar, etc
  wind_params = "width=" + w + ",height=" + h + ",menubar=no,toolbar=no,location=no,status=no,scrollbars=no";
//  wind_params = "width=" + w + ",height=" + h + ",menubar=1,toolbar=1,location=1,status=1,scrollbars=1";
  url = "http://www.kystatlas.no/Baatmagasinet2/Map2.htm?w=" + remote_width + "&h=" + remote_height + "&id=" + id + extra;
//  url = "/Baatmagasinet/Map2.htm?w=" + remote_width + "&h=" + remote_height + "&id=" + id + extra;
  try { g_map_window.focus(); } catch (e) { }
  g_map_window = window.open(url, "Baatmagasinet", wind_params);
} // end function showRemoteMap()



function insertMap(id, local_width, local_height, remote_width, remote_height)
{
  var anchor_start = '<a href="javascript:showRemoteMap(\'' + id + '\', ' + remote_width + ', ' + remote_height + ');">';
  var anchor_end   = '</a>';
  var img_start    = '<img border="0" alt="Klikk for å få ett nytt vindu der du kan navigere i kartet!" src="http://www.kystatlas.no/GeoServe:GetMap?s=10000&style=KYSTATLAS&user=SuPortNet&app=Baatmagasinet-static&';
  var img_var      = 'w=' + local_width + '&h=' + local_height + '&ids=(bm_' + id + ')';
  var img_end      = '" />';
  document.write(anchor_start + img_start + img_var + img_end + anchor_end);
} // end insertMap()




function OnCountyClicked(county, x, y, scale)
{
  showRemoteMap("", 800, 600, x, y, scale);
} // end OnCountyClicked()