Author: cfinck
Date: Sat Feb 16 01:22:18 2008
New Revision: 32384
URL: 
http://svn.reactos.org/svn/reactos?rev=32384&view=rev
Log:
- Add an option to use circles instead of markers for the users on the map
- Add information about the added users, all users with location data and all users in
total
- Always enable scroll-wheel zoom, but add an event handler to not scroll the window when
the mouse is over the map
- Don't close the DB connections implicitly at the end of the scripts, always close
them when they are not needed anymore
- Firefox doesn't reset the check marks on a reload, so do that manually in some cases
BTW, Translators, feel free to translate the People Map UI!
Added:
    
trunk/web/reactos.org/htdocs/peoplemap/images/circle_blue.png   (with props)
    
trunk/web/reactos.org/htdocs/peoplemap/images/circle_cyan.png   (with props)
    
trunk/web/reactos.org/htdocs/peoplemap/images/circle_green.png   (with props)
    
trunk/web/reactos.org/htdocs/peoplemap/images/circle_lightgrey.png   (with props)
    
trunk/web/reactos.org/htdocs/peoplemap/images/circle_red.png   (with props)
    
trunk/web/reactos.org/htdocs/peoplemap/images/circle_violet.png   (with props)
    
trunk/web/reactos.org/htdocs/peoplemap/images/circle_white.png   (with props)
    
trunk/web/reactos.org/htdocs/peoplemap/images/circle_yellow.png   (with props)
Modified:
    
trunk/web/reactos.org/htdocs/peoplemap/ajax-deletelocation.php
    trunk/web/reactos.org/htdocs/peoplemap/ajax-getuser.php
    trunk/web/reactos.org/htdocs/peoplemap/ajax-setlocation.php
    trunk/web/reactos.org/htdocs/peoplemap/ie6-fixes.css
    trunk/web/reactos.org/htdocs/peoplemap/index.php
    trunk/web/reactos.org/htdocs/peoplemap/lang/de.inc.php
    trunk/web/reactos.org/htdocs/peoplemap/lang/en.inc.php
    trunk/web/reactos.org/htdocs/peoplemap/peoplemap.css
    trunk/web/reactos.org/htdocs/peoplemap/peoplemap.js.php
Modified: 
trunk/web/reactos.org/htdocs/peoplemap/ajax-deletelocation.php
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/peoplemap/a…
==============================================================================
--- 
trunk/web/reactos.org/htdocs/peoplemap/ajax-deletelocation.php (original)
+++ 
trunk/web/reactos.org/htdocs/peoplemap/ajax-deletelocation.php Sat Feb 16 01:22:18
2008
@@ -30,6 +30,7 @@
        // Delete the location entry
        $query = "DELETE FROM $DB_PEOPLEMAP.user_locations WHERE roscms_user_id =
$userid;";
        mysql_query($query, $db) or die("<error>Query failed
#2!</error>");
+       mysql_close($db);
        // Just return a success state
        echo "<deleted />";
Modified: 
trunk/web/reactos.org/htdocs/peoplemap/ajax-getuser.php
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/peoplemap/a…
==============================================================================
--- 
trunk/web/reactos.org/htdocs/peoplemap/ajax-getuser.php (original)
+++ 
trunk/web/reactos.org/htdocs/peoplemap/ajax-getuser.php Sat Feb 16 01:22:18 2008
@@ -81,5 +81,6 @@
                echo "</user>";
        }
+       mysql_close($db);
        echo "</userinformation>";
 ?>
Modified: 
trunk/web/reactos.org/htdocs/peoplemap/ajax-setlocation.php
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/peoplemap/a…
==============================================================================
--- 
trunk/web/reactos.org/htdocs/peoplemap/ajax-setlocation.php (original)
+++ 
trunk/web/reactos.org/htdocs/peoplemap/ajax-setlocation.php Sat Feb 16 01:22:18 2008
@@ -43,6 +43,7 @@
        $query = "SELECT user_name, user_fullname FROM $DB_ROSCMS.users WHERE user_id
= $userid LIMIT 1;";
        $result = mysql_query($query, $db) or die("<error>Query failed
#3!</error>");
        $row = mysql_fetch_row($result);
+       mysql_close($db);
        echo "<userinformation>";
        echo "<user>";
Modified: 
trunk/web/reactos.org/htdocs/peoplemap/ie6-fixes.css
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/peoplemap/i…
==============================================================================
--- 
trunk/web/reactos.org/htdocs/peoplemap/ie6-fixes.css (original)
+++ 
trunk/web/reactos.org/htdocs/peoplemap/ie6-fixes.css Sat Feb 16 01:22:18 2008
@@ -12,8 +12,16 @@
 }
 /* Show PNG's with alpha transparency through the AlphaImageLoader filter */
-#toolbox0_image, #toolbox1_image, #toolbox2_image {
+#icon_marker, #icon_circle, #toolbox0_image, #toolbox1_image, #toolbox2_image {
        background: none;
+}
+
+#icon_marker {
+
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src="images/marker_white.png");
+}
+
+#icon_circle {
+
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src="images/circle_white.png");
 }
 #toolbox0_image {
Added: 
trunk/web/reactos.org/htdocs/peoplemap/images/circle_blue.png
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/peoplemap/i…
==============================================================================
Binary file - no diff available.
Propchange: 
trunk/web/reactos.org/htdocs/peoplemap/images/circle_blue.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream
Added: 
trunk/web/reactos.org/htdocs/peoplemap/images/circle_cyan.png
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/peoplemap/i…
==============================================================================
Binary file - no diff available.
Propchange: 
trunk/web/reactos.org/htdocs/peoplemap/images/circle_cyan.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream
Added: 
trunk/web/reactos.org/htdocs/peoplemap/images/circle_green.png
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/peoplemap/i…
==============================================================================
Binary file - no diff available.
Propchange: 
trunk/web/reactos.org/htdocs/peoplemap/images/circle_green.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream
Added: 
trunk/web/reactos.org/htdocs/peoplemap/images/circle_lightgrey.png
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/peoplemap/i…
==============================================================================
Binary file - no diff available.
Propchange: 
trunk/web/reactos.org/htdocs/peoplemap/images/circle_lightgrey.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream
Added: 
trunk/web/reactos.org/htdocs/peoplemap/images/circle_red.png
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/peoplemap/i…
==============================================================================
Binary file - no diff available.
Propchange: 
trunk/web/reactos.org/htdocs/peoplemap/images/circle_red.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream
Added: 
trunk/web/reactos.org/htdocs/peoplemap/images/circle_violet.png
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/peoplemap/i…
==============================================================================
Binary file - no diff available.
Propchange: 
trunk/web/reactos.org/htdocs/peoplemap/images/circle_violet.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream
Added: 
trunk/web/reactos.org/htdocs/peoplemap/images/circle_white.png
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/peoplemap/i…
==============================================================================
Binary file - no diff available.
Propchange: 
trunk/web/reactos.org/htdocs/peoplemap/images/circle_white.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream
Added: 
trunk/web/reactos.org/htdocs/peoplemap/images/circle_yellow.png
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/peoplemap/i…
==============================================================================
Binary file - no diff available.
Propchange: 
trunk/web/reactos.org/htdocs/peoplemap/images/circle_yellow.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream
Modified: 
trunk/web/reactos.org/htdocs/peoplemap/index.php
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/peoplemap/i…
==============================================================================
--- 
trunk/web/reactos.org/htdocs/peoplemap/index.php (original)
+++ 
trunk/web/reactos.org/htdocs/peoplemap/index.php Sat Feb 16 01:22:18 2008
@@ -88,7 +88,7 @@
 <table width="100%" cellspacing="0" cellpadding="0">
        <tr>
-               <td>
+               <td id="map_td">
                        <div class="bubble_bg">
                                <div class="rounded_ll">
                                <div class="rounded_lr">
@@ -110,6 +110,51 @@
                        </div>
                </td>
                <td id="toolbox_td">
+                       <div class="bubble_bg">
+                               <div class="rounded_ll">
+                               <div class="rounded_lr">
+                               <div class="rounded_ul">
+                               <div class="rounded_ur">
+
+                               <div class="bubble">
+                                       <div id="counttext">
+                                               <?php
+                                                       $db = mysql_connect($DB_HOST,
$DB_USER, $DB_PASS) or die("Could not connect to the database!");
+
+                                                       $query = "SELECT COUNT(*)
FROM $DB_ROSCMS.users;";
+                                                       $result = mysql_query($query,
$db);
+                                                       $user_count =
mysql_result($result, 0);
+
+                                                       $query = "SELECT COUNT(*)
FROM $DB_PEOPLEMAP.user_locations;";
+                                                       $result = mysql_query($query,
$db);
+                                                       $location_count =
mysql_result($result, 0);
+
+                                                       echo
$peoplemap_langres["count1"] . "0" .
$peoplemap_langres["count2"] . $location_count .
$peoplemap_langres["count3"] . $user_count .
$peoplemap_langres["count4"];
+
+                                                       echo "<script
type=\"text/javascript\">";
+                                                       echo "LocationCount =
$location_count;";
+                                                       echo "UserCount =
$user_count;";
+                                                       echo "</script>";
+                                               ?>
+                                       </div><br>
+
+                                       <table>
+                                               <tr>
+                                                       <td><?php echo
$peoplemap_langres["icons"]; ?>:</td>
+                                                       <td><input
type="radio" name="icon" value="marker"
checked="checked" onclick="SwitchIcon(this.value);"></td>
+                                                       <td
id="icon_marker"></td>
+                                                       <td><input
type="radio" name="icon" value="circle"
onclick="SwitchIcon(this.value);"></td>
+                                                       <td><div
id="icon_circle"></div></td>
+                                               </tr>
+                                       </table>
+                               </div>
+
+                               </div>
+                               </div>
+                               </div>
+                               </div>
+                       </div>
+
                        <div class="bubble_bg"
id="toolbox0_bubble">
                                <div class="rounded_ll">
                                <div class="rounded_lr">
@@ -128,8 +173,6 @@
                                                <?php
                                                        echo
$peoplemap_langres["filter_intro"] . "<br><br>";
-                                                       // We need a DB connection for
getting the user groups and checking if the user is logged in
-                                                       $db = mysql_connect($DB_HOST,
$DB_USER, $DB_PASS) or die("Could not connect to the database!");
                                                        $query = "SELECT
usrgroup_name_id, usrgroup_name FROM $DB_ROSCMS.usergroups WHERE usrgroup_visible =
1;";
                                                        $result = mysql_query($query, $db)
or die("Query failed #1!");
@@ -141,7 +184,7 @@
                                                        while($row =
mysql_fetch_row($result))
                                                        {
                                                                echo
"<tr>";
-                                                               echo
"<td><input type=\"checkbox\" onclick=\"ToggleUserGroup(this,
'" . $row[0] . "');\"></td>";
+                                                               echo
"<td><input type=\"checkbox\" name=\"usergroups\"
onclick=\"ToggleUserGroup(this, '" . $row[0] .
"');\"></td>";
                                                                echo
"<td><div class=\"colorbox\" style=\"background: " .
current($MARKERS) . "\"></div></td>";
                                                                echo
"<td>" . $row[1] . "</td>";
                                                                echo
"<td><img id=\"ajaxloading_" . $row[0] . "\"
style=\"visibility: hidden;\" src=\"images/ajax_loading.gif\"
alt=\"\"></td>";
Modified: 
trunk/web/reactos.org/htdocs/peoplemap/lang/de.inc.php
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/peoplemap/l…
==============================================================================
--- 
trunk/web/reactos.org/htdocs/peoplemap/lang/de.inc.php (original)
+++ 
trunk/web/reactos.org/htdocs/peoplemap/lang/de.inc.php Sat Feb 16 01:22:18 2008
@@ -44,4 +44,10 @@
        $peoplemap_langres["nousers"] = "Keinen Benutzer mit Ortsdaten
gefunden.";
        $peoplemap_langres["activatejs"] = "Sie müssen JavaScript
aktivieren, um die Personen-Karte zu benutzen!";
        $peoplemap_langres["unsupportedbrowser"] = "Die Personen-Karte wird
von Ihrem Browser nicht unterstützt.";
+
+       $peoplemap_langres["count1"] = "<strong>";
+       $peoplemap_langres["count2"] = " von ";
+       $peoplemap_langres["count3"] = "</strong> Personen mit
Positionsdaten werden angezeigt (von ";
+       $peoplemap_langres["count4"] = " Benutzern insgesamt)";
+       $peoplemap_langres["icons"] = "Symbol benutzen";
 ?>
Modified: 
trunk/web/reactos.org/htdocs/peoplemap/lang/en.inc.php
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/peoplemap/l…
==============================================================================
--- 
trunk/web/reactos.org/htdocs/peoplemap/lang/en.inc.php (original)
+++ 
trunk/web/reactos.org/htdocs/peoplemap/lang/en.inc.php Sat Feb 16 01:22:18 2008
@@ -13,7 +13,7 @@
        $peoplemap_langres["header"] = '<a
href="http://www.reactos.org/">Home</a> > ReactOS People
Map';
        $peoplemap_langres["title"] = "ReactOS People Map";
-       $peoplemap_langres["intro"] = "The following map shows the
locations of ReactOS Developers and Users";
+       $peoplemap_langres["intro"] = "The following map shows the
locations of ReactOS Developers and Users.";
        $peoplemap_langres["filter"] = "Filter by User Groups";
        $peoplemap_langres["filter_intro"] = "Click a Checkbox next to a
User Group to add all Users of this Group to the Map or remove them.";
@@ -44,4 +44,10 @@
        $peoplemap_langres["nousers"] = "No user with location data
found!";
        $peoplemap_langres["activatejs"] = "You have to activate JavaScript
to use the People Map!";
        $peoplemap_langres["unsupportedbrowser"] = "The People Map is not
supported by your Browser.";
+
+       $peoplemap_langres["count1"] = "Showing <strong>";
+       $peoplemap_langres["count2"] = " of ";
+       $peoplemap_langres["count3"] = "</strong> users with location
data (of ";
+       $peoplemap_langres["count4"] = " users in total)";
+       $peoplemap_langres["icons"] = "Icon to use";
 ?>
Modified: 
trunk/web/reactos.org/htdocs/peoplemap/peoplemap.css
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/peoplemap/p…
==============================================================================
--- 
trunk/web/reactos.org/htdocs/peoplemap/peoplemap.css (original)
+++ 
trunk/web/reactos.org/htdocs/peoplemap/peoplemap.css Sat Feb 16 01:22:18 2008
@@ -20,10 +20,6 @@
 a:hover {
        color: #000000;
-}
-
-tr, td {
-       vertical-align: top;
 }
 h1 {
@@ -191,9 +187,25 @@
        background: transparent url(images/lr.gif) no-repeat scroll right bottom;
 }
+#map_td, #toolbox_td {
+       vertical-align: top;
+}
+
 #toolbox_td {
        width: 300px;
        padding-left: 7px;
+}
+
+#icon_marker {
+       height: 31px;
+       width: 19px;
+       background: url(images/marker_white.png) no-repeat;
+}
+
+#icon_circle {
+       height: 10px;
+       width: 10px;
+       background: url(images/circle_white.png) no-repeat center;
 }
 #toolbox0_image, #toolbox1_image, #toolbox2_image {
Modified: 
trunk/web/reactos.org/htdocs/peoplemap/peoplemap.js.php
URL:
http://svn.reactos.org/svn/reactos/trunk/web/reactos.org/htdocs/peoplemap/p…
==============================================================================
--- 
trunk/web/reactos.org/htdocs/peoplemap/peoplemap.js.php (original)
+++ 
trunk/web/reactos.org/htdocs/peoplemap/peoplemap.js.php Sat Feb 16 01:22:18 2008
@@ -10,6 +10,27 @@
 var IconTable;
 var MarkerTable;
 var MyLocationMarker = null;
+var MarkerCount = 0;
+
+var CircleIcon;
+var CurrentIcon;
+var CurrentIconPrefix;
+var MarkerIcon;
+
+function UpdateCounts()
+{
+       document.getElementById("counttext").innerHTML = "<?php echo
$peoplemap_langres["count1"]; ?>" + MarkerCount + "<?php echo
$peoplemap_langres["count2"]; ?>" + LocationCount + "<?php echo
$peoplemap_langres["count3"]; ?>" + UserCount + "<?php echo
$peoplemap_langres["count4"]; ?>";
+}
+
+function GetIconPath(UserGroup)
+{
+       if(!UserGroup)
+               IconColor = "white";
+       else
+               IconColor = IconTable[UserGroup];
+
+       return "images/" + CurrentIconPrefix + "_" + IconColor +
".png";
+}
 function AddUserToMap(UserId, UserName, FullName, Latitude, Longitude, UserGroup)
 {
@@ -20,15 +41,10 @@
        var IconColor;
        if(!UserGroup)
-       {
                UserGroup = "";
-               IconColor = "white";
-       }
-       else
-               IconColor = IconTable[UserGroup];
-
-       var Icon = new GIcon(G_DEFAULT_ICON, "images/marker_" + IconColor +
".png");
-       var Marker = new GMarker( new GLatLng(Latitude, Longitude), Icon );
+
+       CurrentIcon.image = GetIconPath(UserGroup);
+       var Marker = new GMarker( new GLatLng(Latitude, Longitude), CurrentIcon );
        var html;
        html  = "<strong><a
href=\"http://reactos.org/roscms/?page=user&sec=profil&sec2=&q… + UserId +
"\" target=\"_blank\">" + UserName +
"</a></strong><br>";
@@ -38,19 +54,21 @@
        html += "<?php echo $peoplemap_langres["latitude"]; ?>:
" + parseFloat(Latitude) + "°<br>";
        html += "<?php echo $peoplemap_langres["longitude"]; ?>:
" + parseFloat(Longitude) + "°<br><br>";
-       html += "<a href=\"javascript:RemoveUserFromMap(" + UserId +
")\"><?php echo $peoplemap_langres["removefrommap"];
?></a>";
-
-       GEvent.addListener( Marker, "click", function()
{Marker.openInfoWindowHtml(html);} );
+       html += "<a href=\"javascript:RemoveUserFromMap(" + UserId +
"); UpdateCounts();\"><?php echo
$peoplemap_langres["removefrommap"]; ?></a>";
        MarkerTable[UserId] = new Object();
+       MarkerTable[UserId].click = GEvent.addListener( Marker, "click",
function() {Marker.openInfoWindowHtml(html);} );
        MarkerTable[UserId].group = UserGroup;
+       MarkerTable[UserId].html = html;
        MarkerTable[UserId].marker = Marker;
+       MarkerCount++;
        Map.addOverlay(Marker);
 }
 function RemoveUserFromMap(UserId)
 {
+       MarkerCount--;
        Map.removeOverlay(MarkerTable[UserId].marker);
        delete MarkerTable[UserId];
 }
@@ -167,7 +185,7 @@
                                var Longitude =
users[i].getElementsByTagName("longitude")[0].firstChild.data;
                                html += "<li>";
-                               html += "<a
href=\"javascript:AddUserToMap(" + UserId + ", '" + UserName +
"', '" + FullName + "', " + Latitude + ", " +
Longitude + ");\">";
+                               html += "<a
href=\"javascript:AddUserToMap(" + UserId + ", '" + UserName +
"', '" + FullName + "', " + Latitude + ", " +
Longitude + "); UpdateCounts();\">";
                                html += UserName;
                                html += "</a>";
@@ -209,6 +227,8 @@
                        AddUserToMap(UserId, UserName, FullName, Latitude, Longitude,
UserGroup);
                }
+
+               UpdateCounts();
        }
        SetLoading(UserGroup, false);
@@ -235,31 +255,46 @@
        }
 }
+// Cancel scrolling the window, when the mouse wheel is used while the mouse is in the
map
+function OnMapMouseScroll(event)
+{
+       // First hack to get this to work with IE
+       if(!event)
+               event = window.event;
+
+       if(event.preventDefault)
+       {
+               // The DOM Level 2 way
+               event.preventDefault();
+       }
+       else
+       {
+               // As always, IE also needs an extra handler here.. :-/
+               return false;
+       }
+}
+
 function OnWindowResize()
 {
        var MinMapHeight = 300;
-       var MinWndScrollHeight = 800;
        var MinMapWidth = 500;
        var SubtractHeight = 300;
        var SubtractWidth = 500;
        var MapBox = document.getElementById("map");
        var MapHeight;
-       var WndHeight;
        var MapWidth;
        // Set the height
        if(window.innerHeight)
        {
                // All browsers except IE
-               WndHeight = window.innerHeight;
                MapHeight = window.innerHeight - SubtractHeight;
                MapWidth = window.innerWidth - SubtractWidth;
        }
        else
        {
                // IE in Strict Mode
-               WndHeight = document.documentElement.clientHeight;
                MapHeight = document.documentElement.clientHeight - SubtractHeight;
                MapWidth = document.documentElement.clientWidth - SubtractWidth;
        }
@@ -270,20 +305,14 @@
        if(MapWidth < MinMapWidth)
                MapWidth = MinMapWidth;
-       if(Map)
-       {
-               if(WndHeight < MinWndScrollHeight)
-                       Map.disableScrollWheelZoom();
-               else
-                       Map.enableScrollWheelZoom();
-       }
-
        MapBox.style.height = String(MapHeight) + "px";
        MapBox.style.width = String(MapWidth) + "px";
 }
 function Load()
 {
+       var i;
+
        // Exclude IE 5.5 as well, because it has problems with the CSS cursor attribute
and various other stuff
        if( !GBrowserIsCompatible() || navigator.userAgent.indexOf("MSIE 5.5")
>= 0)
        {
@@ -301,11 +330,33 @@
        Map.addControl(new GMapTypeControl());
        Map.addControl(new GOverviewMapControl(new GSize(150,150)));
        Map.setCenter(new GLatLng(0, 0), 1);
-
-       // Call it again for enabling/disabling scroll wheel zoom
-       OnWindowResize();
+       Map.enableScrollWheelZoom();
+
+       // There is no standard way for capturing mouse wheel events
+       //   - The "DOMMouseScroll" event is XUL-specific, so it only works with
Gecko browsers
+       //   - onmousewheel works with Safari/WebKit, Opera and IE
+       if(Map.getContainer().addEventListener)
+               Map.getContainer().addEventListener("DOMMouseScroll",
OnMapMouseScroll, false);
+
+       Map.getContainer().onmousewheel = OnMapMouseScroll;
        MarkerTable = new Object();
+
+       // Set up the icons
+       MarkerIcon = new GIcon(G_DEFAULT_ICON);
+       CircleIcon = new GIcon(G_DEFAULT_ICON);
+       CircleIcon.shadow = "";
+       CircleIcon.iconSize = new GSize(10, 10);
+       CircleIcon.shadowSize = null;
+       CircleIcon.iconAnchor = new GPoint(5, 5);
+
+       // Firefox doesn't reset check marks on a reload, so do that manually here
+       document.getElementsByName("icon")[0].checked = "checked";
+
+       for(i = 0; i < document.getElementsByName("usergroups").length; i++)
+               document.getElementsByName("usergroups")[i].checked =
"";
+
+       SwitchIcon("marker");
 }
 function Unload()
@@ -313,6 +364,41 @@
        delete IconTable;
        delete MarkerTable;
        GUnload();
+}
+
+function SwitchIconCreateMarker(id)
+{
+       // For some reason, this needs to be done in a separate function. Otherwise all
markers will always open the info window of the last marker.
+       var Marker = new GMarker(MarkerTable[id].marker.getLatLng(), CurrentIcon);
+
+       MarkerTable[id].click = GEvent.addListener(Marker, "click", function()
{Marker.openInfoWindowHtml(MarkerTable[id].html);} );
+       MarkerTable[id].marker = Marker;
+       Map.addOverlay(Marker);
+}
+
+function SwitchIcon(prefix)
+{
+       if(CurrentIconPrefix == prefix)
+               return;
+
+       // Change the current icon and icon prefix
+       if(prefix == "circle")
+               CurrentIcon = CircleIcon;
+       else
+               CurrentIcon = MarkerIcon;
+
+       CurrentIconPrefix = prefix;
+
+       // Change the icons of all existing markers (we have to recreate them all :-/)
+       for(id in MarkerTable)
+       {
+               GEvent.removeListener(MarkerTable[id].click);
+               Map.removeOverlay(MarkerTable[id].marker);
+
+               CurrentIcon.image = GetIconPath(MarkerTable[id].group);
+               SwitchIconCreateMarker(id);
+       }
+
 }
 function ToggleToolbox(id)
@@ -372,6 +458,8 @@
                        if(MarkerTable[id].group == UserGroup)
                                RemoveUserFromMap(id);
                }
+
+               UpdateCounts();
        }
 }