function createIcon(imgurl, shwurl, imgw, imgh, shww, shwh, ancx, ancy) {
  var ic = new GIcon(G_DEFAULT_ICON);
  ic.image = imgurl;
  ic.shadow = shwurl;
  ic.iconSize = new GSize(imgw, imgh);
  ic.shadowSize = new GSize(shww, shwh);
  ic.iconAnchor = new GPoint(ancx, ancy);
  return ic;
}
var icons = new Object();
icons["airport"] = createIcon("icon_airport_fg.png", "icon_airport_bg.png", 32, 32, 16, 16, 28, 28);
icons["bielefeld"] = createIcon("icon_bielefeld_fg.png", "icon_upright_bg.png", 24, 40, 43, 40, 12, 40);
icons["autobahn"] = createIcon("icon_autobahn_fg.png", "icon_upright_bg.png", 24, 40, 43, 40, 12, 40);
icons["bahnhof"] = createIcon("icon_bahnhof_fg.png", "icon_upright_bg.png", 24, 40, 43, 40, 12, 40);
icons["hotel"] = createIcon("icon_hotel_fg.png", "icon_upright_bg.png", 24, 40, 43, 40, 12, 40);
icons["uni"] = createIcon("icon_uni_fg.png", "icon_uni_bg.png", 92, 58, 130, 58, 12, 58);
icons["line1"] = createIcon("icon_linie1_fg.png", "icon_stadtbahn_bg.png", 7, 7, 7, 7, 4, 4);
icons["line2"] = createIcon("icon_linie2_fg.png", "icon_stadtbahn_bg.png", 7, 7, 7, 7, 4, 4);
icons["line3"] = createIcon("icon_linie3_fg.png", "icon_stadtbahn_bg.png", 7, 7, 7, 7, 4, 4);
icons["line4"] = createIcon("icon_linie4_fg.png", "icon_stadtbahn_bg.png", 7, 7, 7, 7, 4, 4);
icons["line1"].imageMap = [ 0, 0, 0, 6, 6, 6, 6, 0 ];
icons["line2"].imageMap = [ 0, 0, 0, 6, 6, 6, 6, 0 ];
icons["line3"].imageMap = [ 0, 0, 0, 6, 6, 6, 6, 0 ];
icons["line4"].imageMap = [ 0, 0, 0, 6, 6, 6, 6, 0 ];
icons["uni"].imageMap = [ 0, 0, 0, 35, 92, 35, 92, 0 ];

function Place(n, lat, lng, url, nmaps, ic) {
  this.type = "none";
  this.name = n;
  this.latitude = lat;
  this.longitude = lng;
  this.urlHome = url;
  this.nameMaps = nmaps;
  this.icon = ic;
  this.HTMLString = "";
  this.myMap = null;
  this.myMarker = null;
}
Place.prototype.getPoint = function() { return new GLatLng(this.latitude, this.longitude); }
Place.prototype.getHTML = function() { return this.HTMLString; };
Place.prototype.display = function(m) {
  this.myMap = m; 
  var mrk = new GMarker(this.getPoint(), this.icon);
  mrk.myPlace = this;
  GEvent.addListener(mrk, "click", function() { this.openInfoWindowHtml(this.myPlace.getHTML()); });
  m.addOverlay(mrk);
  this.myMarker = mrk;
};
Place.prototype.hide = function() {
  if(this.myMap) {
    this.myMap.removeOverlay(this.myMarker);
    this.myMarker = null;
  }
};

function Airport(n, lat, lng, url, timetrain, timecar, urlrentals, nbahn, nmaps, ic) {
  if(!ic) ic = icons["airport"];
  this.parentConstructor = Place;
  this.parentConstructor(n, lat, lng, url, nmaps, ic);
  delete this.parentConstructor;
  this.type = "airport";
  this.urlCarRentals = urlrentals;
  this.nameBahn = nbahn;
  this.travelTimeTrain = timetrain;
  this.travelTimeCar = timecar;
  this.HTMLString = "<strong>" + this.name + "</strong><br><hr>";
  this.HTMLString += "<table class=\"info\"><tbody>";
  this.HTMLString += "<tr><td class=\"header\" colspan=\"2\">travel time to Bielefeld</td></tr>";
  this.HTMLString += "<tr><td class=\"header\">by train</td><td>" + this.travelTimeTrain + " hours</td></tr>";
  this.HTMLString += "<tr><td class=\"header\">by car</td><td>" + this.travelTimeCar + " hours</td></tr></tbody></table><hr>";
  this.HTMLString += "<a href=\"" + this.urlHome + "\" target=\"_blank\">Airport Homepage</a><br>";
  this.HTMLString += "<a href=\"http://reiseauskunft.bahn.de/bin/query.exe/en?from=" + this.nameBahn + "&to=Bielefeld\" target=\"_blank\">Train Ticket Reservation</a><br>";
  this.HTMLString += "<a href=\"" + this.urlCarRentals + "\" target=\"_blank\">Car Rentals</a><br>";
  this.HTMLString += "<a href=\"http://maps.google.com/maps?f=d&hl=en&saddr=" + this.nameMaps + "&daddr=Bielefeld,+Germany&ie=UTF8&om=1\" target=\"_blank\">Google Maps Route Planner</a>";
}
Airport.prototype = Place.prototype;
function City(n, lat, lng, url, nbahn, nmaps, ic) {
  if(!ic) ic = icons["city"];
  this.parentConstructor = Place;
  this.parentConstructor(n, lat, lng, url, nmaps, ic);
  this.nameBahn = nbahn;
  delete this.parentConstructor;
  this.type = "city";
  this.HTMLString = "<strong>" + this.name + "</strong><br><hr>";
  this.HTMLString += "<a href=\"" + this.urlHome + "\" target=\"_blank\">City Homepage</a><br>";
  this.HTMLString += "<a href=\"http://reiseauskunft.bahn.de/bin/query.exe/en?from=" + this.nameBahn + "\" target=\"_blank\">Train Ticket Reservation</a><br>";
  if(this.urlCarRentals)
    this.HTMLString += "<a href=\"" + this.urlCarRentals + "\" target=\"_blank\">Car Rentals</a><br>";
  this.HTMLString += "<a href=\"javascript:void(0);\" onclick=\"javascript:showBielefeld();\">City Map</a>";
};
City.prototype = Place.prototype;
function Hotel(n, lat, lng, url, ic) {
  if(!ic) ic = icons["hotel"];
  this.parentConstructor = Place;
  this.parentConstructor(n, lat, lng, url, "", ic);
  delete this.parentConstructor;
  this.type = "hotel";
  this.HTMLString = "<strong>" + this.name + "</strong>";
  if(this.urlHome != "")
    this.HTMLString += "<br><hr><a href=\"" + this.urlHome + "\" target=\"_blank\">Homepage</a><br>";
};
Hotel.prototype = Place.prototype;
function Other(n, desc, lat, lng, url, nmaps, ic, urls) {
  if(!ic) ic = icons["other"];
  this.parentConstructor = Place;
  this.parentConstructor(n, lat, lng, url, nmaps, ic);
  delete this.parentConstructor;
  this.type = "other";
  this.description = desc;
  this.moreUrls = urls;
  this.HTMLString = "<strong>" + this.name + "</strong>";
  if(this.description)
    this.HTMLString += "<br>" + this.description;
  if(this.urlHome != "")
    this.HTMLString += "<br><hr><a href=\"" + this.urlHome + "\" target=\"_blank\">Homepage</a><br>";
  for(var n in this.moreUrls) {
    this.HTMLString += "<a href=\"" + this.moreUrls[n] + "\" target=\"_blank\">" + n + "</a><br>";
  }
};
Other.prototype = Place.prototype;
function Stadtbahn(n, clr, thk, opc, ic) {
  this.points = new Array();
  this.stops = new Array();
  this.name = n;
  this.color = clr;
  this.thickness = thk;
  this.opacity = opc;
  this.icon = ic;
  this.myMap = null;
  this.myPolyline = null;
  this.myMarkers = new Array();
};
Stadtbahn.prototype.add = function(lat, lng, n, url1, url2) {
  this.points.push(new GLatLng(lat,lng));
  if(n) {
    var o = new Object();
    o.pIdx = this.points.length - 1;
    o.name = n;
    o.urlSchedule1 = url1 ? "http://www.mobiel.de/Isoli_05/afp/data/" + url1 : "";
    o.urlSchedule2 = url2 ? "http://www.mobiel.de/Isoli_05/afp/data/" + url2 : "";
    o.myLine = this;
    o.getHTML = function() {
      var str = "<strong>" + this.name + "</strong><br>" + this.myLine.name + "<br><hr>";
      if(this.urlSchedule1)
        str += "<a href=\"" + this.urlSchedule1 + "\" target=\"_blank\">Schedule - Direction " + this.myLine.stops[this.myLine.stops.length - 1].name + "</a><br>";
      if(this.urlSchedule2)
        str += "<a href=\"" + this.urlSchedule2 + "\" target=\"_blank\">Schedule - Direction " + this.myLine.stops[0].name + "</a><br>";
      return str;
    };
    this.stops.push(o);
  }
};
Stadtbahn.prototype.display = function(m) {
  this.myMap = m;
  for(var i=0; i<this.stops.length; i++) {
    var mrk = new GMarker(this.points[this.stops[i].pIdx], this.icon);
    mrk.myStop = this.stops[i];
    GEvent.addListener(mrk, "click", function() { this.openInfoWindowHtml(this.myStop.getHTML()); });
    m.addOverlay(mrk);
      this.myMarkers.push(mrk);
  }
  this.myPolyline = new GPolyline(this.points, this.color, this.thickness, this.opacity);
  m.addOverlay(this.myPolyline);
}
Stadtbahn.prototype.hide = function() {
  if(this.myMap) {
    this.myMap.removeOverlay(this.myPolyline);
    for(var i=0;i<this.myMarkers.length;i++) {
      this.myMap.removeOverlay(this.myMarkers[i]);
    }
    this.myPolyline = null;
    this.myMarkers = new Array();
  }
};
    
var map = null;
var places = new Object();
places["bielefeld"] = new City(
  "Bielefeld",
  51.984669,
  8.509254,
  "http://www.bielefeld.de",
  "Bielefeld",
  "Bielefeld",
  icons["bielefeld"]);
places["duesseldorf"] = new Airport(
  "D&uuml;sseldorf Airport",
  51.278025,
  6.76672,
  "http://www.duesseldorf-international.de/e/index.php?type=index&path=04_infos_service/lageplaene",
  1.5,
  2,
  "http://www.duesseldorf-international.de/e/index.php?type=index&path=04_infos_service/lageplaene",
  "Duesseldorf Flughafen (DUS)",
  "Duesseldorf Flughafen, Germany");
places["hannover"] = new Airport(
  "Hanover Airport",
  52.460193,
  9.684792,
  "http://www.hannover-airport.de/index.php?id=5&L=1",
  1,
  1,
  "http://www.hannover-airport.de/103.html?&L=1",
  "Hannover Flughafen",
  "Hannover Flughafen, Germany");
places["frankfurt"] = new Airport(
  "Frankfurt Airport",
  50.040163,
  8.561268,
  "http://www.airportcity-frankfurt.com/cms/default/rubrik/9/9682.airport_city_en.htm",
  3,
  4,
  "http://www.airport-travelnet.de/fra_new/index_en2car.html",
  "Frankfurt(M)Flughafen",
  "Frankfurt Flughafen, Germany");
places["berlin"] = new Airport(
  "Berlin Tegel Airport",
  52.55355,
  13.294272,
  "http://www.berlin-airport.de/PubEnglish/index.php",
  3,
  5,
  "http://www.berlin-airport.de/PubEnglish/PubTegel/PubServiceTXL/PubEinrichtungen/docMietwagenTXL.html",
  "Berlin Tegel",
  "Flughafen, Tegel, Berlin, Germany");
places["paderborn"] = new Airport(
  "Paderborn/Lippstadt Airport",
  51.609702,
  8.615427,
  "http://www.airport-pad.com/index_en.html",
  2,
  1,
  "http://www.airport-pad.com/sites_en/mietwagen_service.htm",
  "Flughafen Paderborn/Lippstadt, Bueren",
  "Flughafen, Bueren, Germany");
places["osnabrueck"] = new Airport(
  "M&uuml;nster/Osnabr&uuml;ck Airport",
  52.13146,
  7.684422,
  "http://www.flughafen-fmo.de/index.php?menu1=0&sprache=e",
  2,
  1,
  "http://www.flughafen-fmo.de/index.php?menu1=6&nid=29",
  "Flughafen Muenster/Osnabrueck, Greven (Westf)",
  "Flughafen, Greven, Germany");
places["koeln"] = new Airport(
  "Cologne/Bonn Airport",
  50.880916,
  7.11678,
  "http://www.koeln-bonn-airport.de/index.php?lang=2",
  2,
  2.5,
  "http://www.koeln-bonn-airport.de/main.php?id=126&lang=2",
  "Koeln Bonn Airport",
  "Flughafen Koeln/Bonn, Germany");
places["dortmund"] = new Airport(
  "Dortmund Airport",
  51.514779,
  7.61301,
  "http://www.flughafen-dortmund.de/index.php?id=airport&L=1",
  1.5,
  1,
  "http://www.flughafen-dortmund.de/38.0.html?&L=1",
  "Airport, Dortmund",
  "Flughafen, Dortmund, Germany");
places["hamburg"] = new Airport(
  "Hamburg Airport",
  53.62745,
  10.005884,
  "http://www.flughafen-hamburg.de/index_en.phtml",
  3,
  3,
  "http://www.flughafen-hamburg.de/en/autovermietung.phtml",
  "Hamburg Flughafen",
  "Flughafen, Fuhlsbuettel, Hamburg, Germany");
places["amsterdam"] = new Airport(
  "Amsterdam Schiphol Airport",
  52.307777,
  4.762498,
  "http://www.schiphol.nl/home/Index.jsp?bmLocale=en",
  4,
  4,
  "http://www.schiphol.nl/_plan_book/AffiliateSearchCar.jsp",
  "AMS Schiphol Airport",
  "Schiphol, Amsterdam, Netherlands");
/* H O T E L S */
places["hotelBartsch"] = new Hotel(
  "Hotel-Restaurant Bartsch",
  52.021286,
  8.542889,
  "http://www.hotel-restaurant-bartsch.de/");
places["hotelDJH"] = new Hotel(
  "Jugendgästehaus und Bildungszentrum",
  52.019721,
  8.540078,
  "http://www.djh.de/jugendherbergen/bielefeld");
places["hotelWali"] = new Hotel(
  "Hotel-Restaurant Wali's",
  52.025247,
  8.54003,
  "");
places["dormotel"] = new Hotel(
  "Dormotel",
  52.019906,
  8.517247,
  "http://www.dormotel-bielefeld.de/");
places["hotelAltstadt"] = new Hotel(
  "Altstadt-Hotel",
  52.022494,
  8.530508,
  "http://www.altstadt-hotel-bielefeld.de/");
places["hotelRavensbergerHof"] = new Hotel(
  "Hotel Ravensberger Hof",
  52.021458,
  8.530712,
  "http://www.ravensberger-hof.de/");
places["hotelMoevenpick"] = new Hotel(
  "M&ouml;venpick Hotel",
  52.028792,
  8.533856,
  "http://www.moevenpick-bielefeld.com/");
places["hotelMercure"] = new Hotel(
  "Hotel Mercure",
  52.018916,
  8.530498,
  "http://www.mercure.com/mercure/frm_fiche_hotel.svlt?liste=1&code_hotel=0897");
places["hotelMercureNiederwall"] = new Hotel(
  "Hotel Mercure am Niederwall",
  52.020104,
  8.5348,
  "http://www.mercure.com/mercure/frm_fiche_hotel.svlt?liste=1&code_hotel=2822");
/* B I E L E F E L D - P L A C E S */
places["bielefeldAutobahn"] = new Other(
  "Bielefeld-Zentrum",
  "A2 Highway Exit",
  51.995444,
  8.619171,
  "",
  "",
  icons["autobahn"]);
places["bielefeldUni"] = new Other(
  "Bielefeld University",
  "ICVS2007 Conference Site",
  52.037419,
  8.494309,
  "http://www.uni-bielefeld.de",
  "University, Bielefeld",
  icons["uni"],
  {"ICVS2007 Homepage" : "http://www.icvs2007.org/"});
places["bielefeldHbf"] = new Other(
  "Bielefeld Hbf",
  "Deutsche Bahn Main Station",
  52.02938,
  8.532879,
  "",
  "",
  icons["bahnhof"]);
var metro = new Object();
metro["line1"] = new Stadtbahn("Linie 1", "#0000ff", 2, 1, icons["line1"]);
metro["line1"].add(51.979177,8.535261, "Senne", "afp_1010__1.pdf", "");
metro["line1"].add(51.980737,8.529553, "Sennefriedhof", "afp_1030__1.pdf", "afp_1020__1.pdf");
metro["line1"].add(51.983519,8.525831, "Rosenh&ouml;he", "afp_1050__1.pdf", "afp_1040__1.pdf");
metro["line1"].add(51.987992,8.514351, "Windelsbleicher Stra&szlig;e", "afp_1070__1.pdf", "afp_1060__1.pdf");
metro["line1"].add(51.987992,8.514351, "Brackwede, Kirche", "afp_1090__1.pdf", "afp_1080__1.pdf");
metro["line1"].add(51.990642,8.510928, "Normannenstra&szlig;e", "afp_1110__1.pdf", "afp_1100__1.pdf");
metro["line1"].add(51.993905,8.506862, "Gaswerkstra&szlig;e", "afp_1130__1.pdf", "afp_1120__1.pdf");
metro["line1"].add(51.998153,8.501905, "Brackwede, Bahnhof", "afp_1150__1.pdf", "afp_1140__1.pdf");
metro["line1"].add(52.00555,8.510252, "Eggeweg", "afp_1170__1.pdf", "afp_1160__1.pdf");
metro["line1"].add(52.009995,8.517505, "Friedrich-List-Stra&szlig;e", "afp_1190__1.pdf", "afp_1180__1.pdf");
metro["line1"].add(52.013198,8.521249, "Bethel", "afp_1210__1.pdf", "afp_1200__1.pdf");
metro["line1"].add(52.017239,8.524071);
metro["line1"].add(52.017133,8.526646, "Adenauerplatz", "afp_1230__1.pdf", "afp_1220__1.pdf");
metro["line1"].add(52.015714,8.531935);
metro["line1"].add(52.017457, 8.533126, "Landgericht", "afp_1250__1.pdf", "afp_1240__1.pdf");
metro["line1"].add(52.020090, 8.534328, "Rathaus", "afp_1290__1.pdf", "afp_1280__1.pdf");
metro["line1"].add(52.021167,8.534403);
metro["line1"].add(52.023339, 8.533266, "Jahnplatz", "afp_1310__1.pdf", "afp_1300__1.pdf");
metro["line1"].add(52.028614, 8.533824, "Hauptbahnhof", "afp_1350__1.pdf", "afp_1340__1.pdf");
metro["line1"].add(52.036007,8.53893, "Sudbrackstra&szlig;e", "afp_1390__1.pdf", "afp_1380__1.pdf");
metro["line1"].add(52.040692,8.543243, "Johannesstift", "afp_1430__1.pdf", "afp_1420__1.pdf");
metro["line1"].add(52.046612,8.543909, "Deciusstra&szlig;e", "afp_1450__1.pdf", "afp_1440__1.pdf");
metro["line1"].add(52.049653,8.543876, "Kattenkamp", "afp_1470__1.pdf", "afp_1460__1.pdf");
metro["line1"].add(52.052662,8.544542, "Heideg&auml;rten", "afp_1490__1.pdf", "afp_1480__1.pdf");
metro["line1"].add(52.055677,8.54525, "Schildesche", "", "afp_1500__1.pdf");
    
metro["line2"] = new Stadtbahn("Linie 2", "#00ff00", 2, 1, icons["line2"]);
metro["line2"].add(52.004798,8.558886, "Sieker", "afp_2010__2.pdf", "");
metro["line2"].add(52.006601,8.548254, "Prie&szlig;allee", "afp_2030__2.pdf", "afp_2020__2.pdf");
metro["line2"].add(52.008384,8.543512, "Mozartstra&szlig;e", "afp_2050__2.pdf", "afp_2040__2.pdf");
metro["line2"].add(52.010735,8.539563, "Teutoburger Stra&szlig;e", "afp_2070__2.pdf", "afp_2060__2.pdf");
metro["line2"].add(52.012762,8.536431, "August-Bebel-Stra&szlig;e", "afp_2090__2.pdf", "afp_2080__2.pdf");
metro["line2"].add(52.015714,8.531935);
metro["line2"].add(52.017417, 8.533276, "Landgericht", "afp_1250__2.pdf", "afp_1240__2.pdf");
metro["line2"].add(52.020085, 8.534428, "Rathaus", "afp_1290__2.pdf", "afp_1280__2.pdf");
metro["line2"].add(52.021167,8.534503);
metro["line2"].add(52.023339, 8.533366, "Jahnplatz", "afp_1310__2.pdf", "afp_1300__2.pdf");
metro["line2"].add(52.028614, 8.533924, "Hauptbahnhof", "afp_1350__2.pdf", "afp_1340__2.pdf");
metro["line2"].add(52.03332,8.543093, "Beckhausstra&szlig;e", "afp_2230__2.pdf", "afp_2220__2.pdf");
metro["line2"].add(52.036066,8.555056, "Stadtheider Stra&szlig;e", "afp_2250__2.pdf", "afp_2240__2.pdf");
metro["line2"].add(52.036891,8.558832, "Schillerstra&szlig;e", "afp_2270__2.pdf", "afp_2260__2.pdf");
metro["line2"].add(52.038099,8.564165, "Finkenstra&szlig;e", "afp_2290__2.pdf", "afp_2280__2.pdf");
metro["line2"].add(52.0393,8.569422, "Ziegelstra&szlig;e", "afp_2310__2.pdf", "afp_2300__2.pdf");
metro["line2"].add(52.043029,8.57676, "Sch&uuml;co", "afp_2330__2.pdf", "afp_2320__2.pdf");
metro["line2"].add(52.048301,8.590708, "Seidenstickerstra&szlig;e", "afp_2350__2.pdf", "afp_2340__2.pdf");
metro["line2"].add(52.049686,8.595707, "Baumheide", "afp_2370__2.pdf", "afp_2360__2.pdf");
metro["line2"].add(52.053104,8.602864, "Schelpmilser Weg", "afp_2390__2.pdf", "afp_2380__2.pdf");
metro["line2"].add(52.057742,8.610878, "Milse", "", "afp_2400__2.pdf");
    
metro["line3"] = new Stadtbahn("Linie 3", "#ffdd00", 2, 1, icons["line3"]);
metro["line3"].add(52.001178,8.588755, "Stieghorst Zentrum", "afp_3010__3.pdf", "");
metro["line3"].add(52.002684,8.583959, "Memeler Stra&szlig;e", "afp_3030__3.pdf", "afp_3020__3.pdf");
metro["line3"].add(52.004804,8.577286, "Elpke", "afp_3050__3.pdf", "afp_3040__3.pdf");
metro["line3"].add(52.007987,8.569711, "Roggenkamp", "afp_3070__3.pdf", "afp_3060__3.pdf");
metro["line3"].add(52.009605,8.562201, "Luther-Kirche", "afp_3090__3.pdf", "afp_3080__3.pdf");
metro["line3"].add(52.012379,8.561965, "Sieker Mitte", "afp_3110__3.pdf", "afp_3100__3.pdf");
metro["line3"].add(52.01333,8.556815, "Hartlager Weg", "afp_3130__3.pdf", "afp_3120__3.pdf");
metro["line3"].add(52.014129,8.551494, "Oststra&szlig;e", "afp_3150__3.pdf", "afp_3140__3.pdf");
metro["line3"].add(52.015456,8.546301, "Krankenhaus Mitte", "afp_3170__3.pdf", "afp_3160__3.pdf");
metro["line3"].add(52.016962,8.539681);
metro["line3"].add(52.018315,8.539714, "Ravensberger Stra&szlig;e", "afp_3190__3.pdf", "afp_3180__3.pdf");
metro["line3"].add(52.019741,8.539295, "August-Schroeder-Stra&szlig;e", "afp_3210__3.pdf", "afp_3200__3.pdf");
metro["line3"].add(52.019721,8.53436);
metro["line3"].add(52.020080, 8.534528, "Rathaus", "afp_1290__3.pdf", "afp_1280__3.pdf");
metro["line3"].add(52.021167,8.534603);
metro["line3"].add(52.023339, 8.533466, "Jahnplatz", "afp_1310__3.pdf", "afp_1300__3.pdf");
metro["line3"].add(52.028614, 8.534024, "Hauptbahnhof", "afp_1350__3.pdf", "afp_1340__3.pdf");
metro["line3"].add(52.032363,8.526367, "Wittekindstra&szlig;e", "afp_3310__3.pdf", "afp_3300__3.pdf");
metro["line3"].add(52.037175,8.523545, "Nordpark", "afp_3330__3.pdf", "afp_3320__3.pdf");
metro["line3"].add(52.041346,8.52303, "Auf der Hufe", "afp_3350__3.pdf", "afp_3340__3.pdf");
metro["line3"].add(52.045186,8.52258, "Lange Stra&szlig;e", "afp_3370__3.pdf", "afp_3360__3.pdf");
metro["line3"].add(52.048987,8.521861, "Koblenzer Stra&szlig;e", "afp_3390__3.pdf", "afp_3380__3.pdf");
metro["line3"].add(52.052807,8.519737, "Voltmannstra&szlig;e", "afp_3410__3.pdf", "afp_3400__3.pdf");
metro["line3"].add(52.055202,8.518395, "Babenhausen S&uuml;d", "", "afp_3420__3.pdf");

metro["line4"] = new Stadtbahn("Linie 4", "#ff0000", 2, 1, icons["line4"]);
metro["line4"].add(52.017377, 8.533426, "Landgericht", "afp_1250__4.pdf", "");
metro["line4"].add(52.020073, 8.534628, "Rathaus", "afp_1290__4.pdf", "");
metro["line4"].add(52.021167,8.534703);
metro["line4"].add(52.023339, 8.533566, "Jahnplatz", "afp_1310__4.pdf", "afp_1300__4.pdf");
metro["line4"].add(52.028614, 8.534124, "Hauptbahnhof", "afp_1350__4.pdf", "afp_1340__4.pdf");
metro["line4"].add(52.028634, 8.522859, "Siegfriedplatz", "afp_3800__4.pdf", "afp_3810__4.pdf");
metro["line4"].add(52.028911, 8.514233, "Rudolf-Oetker-Halle", "afp_3820__4.pdf", "afp_3830__4.pdf");
metro["line4"].add(52.033122, 8.508557, "Graf-von-Stauffenberg-Stra&szlig;e", "afp_3840__4.pdf", "afp_3850__4.pdf");
metro["line4"].add(52.035901, 8.504223, "B&uuml;ltmannshof", "afp_3860__4.pdf", "afp_3870__4.pdf");
metro["line4"].add(52.039478, 8.496659, "Universit&auml;t", "afp_3880__4.pdf", "afp_3890__4.pdf");
metro["line4"].add(52.042441, 8.489889, "Wellensiek", "afp_3900__4.pdf", "afp_3910__4.pdf");
metro["line4"].add(52.044955, 8.485844, "Lohmannshof", "", "afp_3930__4.pdf");

function load() {
  if (GBrowserIsCompatible()) {
    var opts = new Object();
    opts.mapTypes = [G_NORMAL_MAP, G_HYBRID_MAP];
    map = new GMap2(document.getElementById("map"), opts);
    map.addControl(new GSmallMapControl());
    map.addControl(new GScaleControl(), new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(10, 10)));
/*    map.addControl(new GMapTypeControl()); */
    showAirports();
  }
}

function showAirports() {
  if(map != null) {
    hideMetro();
    hideHotels();
    map.setCenter(new GLatLng(51.193115, 10.325391), 5);
    map.clearOverlays();
    map.setMapType(G_HYBRID_MAP);
    setNavi("A");
    for(var n in places) {
      var plc = places[n];
      if(plc.type == "airport" || (plc.type == "city" && plc.name == "Bielefeld")) {
        plc.display(map);
      }
    }
  }
}

function showBielefeld() {
  if(map != null) {
    map.setCenter(new GLatLng(52.02, 8.539254), 12);
    map.clearOverlays();
    map.setMapType(G_NORMAL_MAP);
    setNavi("B");
    for(var n in places) {
      var plc = places[n];
      if(plc.type == "other") {
        plc.display(map);
      }
    }
    showHotels();
    showMetro();
  }
}

var currentNavi = "A";
function setNavi(n) {
  var naviA = document.getElementById("naviAirports");
  var naviB = document.getElementById("naviBielefeld");
  if(n == "A") {
    naviA.style.display = 'block';
    naviB.style.display = 'none';
    currentNavi = 'A';
  } else {
    naviA.style.display = 'none';
    naviB.style.display = 'block';
    currentNavi = 'B';
  }
}

var metroIsVisible = false;
var inAsyncShowMetro = false;
function showMetro() {
  if(inAsyncShowMetro) return;
  var lMsg = document.getElementById("loading");
  var mapElm = document.getElementById("map");
  lMsg.style.display = 'block';
  lMsg.style.left = parseInt(mapElm.offsetLeft) + Math.round((parseInt(mapElm.clientWidth) - parseInt(lMsg.clientWidth)) / 2) + "px";
  lMsg.style.top = parseInt(mapElm.offsetTop) + Math.round((parseInt(mapElm.clientHeight) - parseInt(lMsg.clientHeight)) / 2.1) + "px";
  setTimeout("showMetroAsync()", 10);
}
function showMetroAsync() {
  inAsyncShowMetro = true;
  if(map != null) {
    for(var m in metro) {
      metro[m].display(map);
    }
    metroIsVisible = true;
  }
  var lMsg = document.getElementById("loading");
  lMsg.style.display = 'none';
  inAsyncShowMetro = false;
}
function hideMetro() {
  if(inAsyncShowMetro) return;
  if(map != null) {
    for(var m in metro) {
      metro[m].hide();
    }
    metroIsVisible = false;
  }
}
function toggleMetro() {
  if(inAsyncShowMetro) return;
  if(metroIsVisible) hideMetro();
  else showMetro();
}

var hotelsAreVisible = false;
function showHotels() {
  if(map != null) {
    for(var plc in places) {
      if(places[plc].type == 'hotel') {
        places[plc].display(map);
      }
    }
    hotelsAreVisible = true;
  }
}
function hideHotels() {
  if(map != null) {
    for(var plc in places) {
      if(places[plc].type == 'hotel') {
        places[plc].hide();
       }
    }
    hotelsAreVisible = false;
  }
}
function toggleHotels() {
  if(hotelsAreVisible) hideHotels();
  else showHotels();
}

