Index: trunk/binaries/data/mods/public/gui/session_new/input.js
===================================================================
--- trunk/binaries/data/mods/public/gui/session_new/input.js	(revision 7765)
+++ trunk/binaries/data/mods/public/gui/session_new/input.js	(working copy)
@@ -24,6 +24,10 @@
 var placementPosition;
 var placementEntity;
 
+//Time in milliseconds in which a double click is recognized
+var doubleclickTime = 400; 
+var doubleclickTimer = 0;
+
 var mouseX = 0;
 var mouseY = 0;
 var specialKeyStates = {};
@@ -477,17 +481,45 @@
 		case "mousebuttonup":
 			if (ev.button == SDL_BUTTON_LEFT)
 			{
-				var ents = Engine.PickEntitiesAtPoint(ev.x, ev.y);
-				if (!ents.length)
+				//is this a double-click?
+				var now = new Date();
+				if (now.getTime()-doubleclickTimer < doubleclickTime)
 				{
+					//this is a double click
+					var ents = Engine.PickSimilarEntitiesOnScreen(ev.x, ev.y, Engine.GetPlayerID());
+								// Remove units if selection is too large
+					if (ents.length > MAX_SELECTION_SIZE)
+						ents = ents.slice(0, MAX_SELECTION_SIZE);
+
+					// Set selection list
+					g_Selection.setHighlightList([]);
 					g_Selection.reset();
-					
-					inputState = INPUT_NORMAL;
-					return true;
+					g_Selection.addList(ents);
+
+					// Create the selection groups
+					g_Selection.createSelectionGroups(ents);
+				
+				
 				}
+				else
+				{
+					//this is no double blick, but it can become one
+					doubleclickTimer = now.getTime();
+					
+					var ents = Engine.PickEntitiesAtPoint(ev.x, ev.y);
+					if (!ents.length)
+					{
+						g_Selection.reset();
+					
+						inputState = INPUT_NORMAL;
+						return true;
+					}
 
-				g_Selection.reset();
-				g_Selection.addList([ents[0]]);
+					g_Selection.reset();
+					g_Selection.addList([ents[0]]);
+					
+				}
+			
 
 				inputState = INPUT_NORMAL;
 				return true;
Index: trunk/source/simulation2/helpers/Selection.h
===================================================================
--- trunk/source/simulation2/helpers/Selection.h	(revision 7765)
+++ trunk/source/simulation2/helpers/Selection.h	(working copy)
@@ -32,7 +32,6 @@
 
 namespace EntitySelection
 {
-
 /**
  * Finds all selectable entities under the given screen coordinates.
  * Returns list ordered by closeness of picking, closest first.
@@ -46,6 +45,12 @@
  */
 std::vector<entity_id_t> PickEntitiesInRect(CSimulation2& simulation, CCamera& camera, int sx0, int sy0, int sx1, int sy1, int owner);
 
+/**
+ * Finds a selectable entity under the given screen coordinate
+ * and returns all units with the same visualActors short name on screen.
+ */
+//std::vector<entity_id_t> PickSimilarEntitiesOnScreen(CSimulation2& simulation, CCamera& camera, int screenX, int screenY);
+std::vector<entity_id_t> PickSimilarEntitiesOnScreen(CSimulation2& simulation, CCamera& camera, int screenX, int screenY, int owner);
 } // namespace
 
 #endif // INCLUDED_SELECTION
Index: trunk/source/simulation2/helpers/Selection.cpp
===================================================================
--- trunk/source/simulation2/helpers/Selection.cpp	(revision 7765)
+++ trunk/source/simulation2/helpers/Selection.cpp	(working copy)
@@ -25,6 +25,7 @@
 #include "simulation2/components/ICmpSelectable.h"
 #include "simulation2/components/ICmpVisual.h"
 
+
 std::vector<entity_id_t> EntitySelection::PickEntitiesAtPoint(CSimulation2& simulation, CCamera& camera, int screenX, int screenY)
 {
 	CVector3D origin, dir;
@@ -117,3 +118,53 @@
 
 	return hitEnts;
 }
+
+std::vector<entity_id_t> EntitySelection::PickSimilarEntitiesOnScreen(CSimulation2& simulation, CCamera& camera, int screenX, int screenY, int owner)
+{
+	std::wstring entVisualActor(L"");
+	std::vector<entity_id_t> hitEnts;
+
+	// Determine a reference unit beneath the cursor
+	std::vector<entity_id_t> entities = EntitySelection::PickEntitiesAtPoint(simulation,camera,screenX,screenY);
+	if (entities.size() > 0) {
+		entity_id_t referenceEntity;
+		referenceEntity = entities[0];
+		CmpPtr<ICmpVisual> cmpVisual(simulation.GetSimContext(), referenceEntity);
+		entVisualActor = cmpVisual->GetActorShortName();
+	}
+
+
+
+	const CSimulation2::InterfaceList& ents = simulation.GetEntitiesWithInterface(IID_Selectable);
+	for (CSimulation2::InterfaceList::const_iterator it = ents.begin(); it != ents.end(); ++it)
+	{
+		entity_id_t ent = it->first;
+
+		// Ignore entities not owned by 'owner'
+		CmpPtr<ICmpOwnership> cmpOwnership(simulation.GetSimContext(), ent);
+		if (cmpOwnership.null() || cmpOwnership->GetOwner() != owner)
+			continue;
+
+		// Find the current interpolated model position.
+		// (We just use the centre position and not the whole bounding box, because maybe
+		// that's better for users trying to select objects in busy areas)
+
+		CmpPtr<ICmpVisual> cmpVisual(simulation.GetSimContext(), ent);
+		if (cmpVisual.null())
+			continue;
+
+		CVector3D position = cmpVisual->GetPosition();
+
+		// Reject if it's not on-screen (e.g. it's behind the camera)
+		if (!camera.GetFrustum().IsPointVisible(position))
+			continue;
+
+		// Take all remaining units, whose actor's short name is the same as the reference unit's
+		if(cmpVisual->GetActorShortName() == entVisualActor) {
+			hitEnts.push_back(ent);
+		}
+
+	}
+
+	return hitEnts;
+}
Index: trunk/source/gui/scripting/ScriptFunctions.cpp
===================================================================
--- trunk/source/gui/scripting/ScriptFunctions.cpp	(revision 7765)
+++ trunk/source/gui/scripting/ScriptFunctions.cpp	(working copy)
@@ -126,6 +126,12 @@
 	return EntitySelection::PickEntitiesInRect(*g_Game->GetSimulation2(), *g_Game->GetView()->GetCamera(), x0, y0, x1, y1, player);
 }
 
+std::vector<entity_id_t> PickSimilarEntitiesOnScreen(void* UNUSED(cbdata), int x, int y, int player)
+{
+	return EntitySelection::PickSimilarEntitiesOnScreen(*g_Game->GetSimulation2(), *g_Game->GetView()->GetCamera(), x, y, player);
+}
+
+
 CFixedVector3D GetTerrainAtPoint(void* UNUSED(cbdata), int x, int y)
 {
 	CVector3D pos = g_Game->GetView()->GetCamera()->GetWorldCoordinates(x, y, true);
@@ -309,6 +315,7 @@
 	// Entity picking
 	scriptInterface.RegisterFunction<std::vector<entity_id_t>, int, int, &PickEntitiesAtPoint>("PickEntitiesAtPoint");
 	scriptInterface.RegisterFunction<std::vector<entity_id_t>, int, int, int, int, int, &PickFriendlyEntitiesInRect>("PickFriendlyEntitiesInRect");
+	scriptInterface.RegisterFunction<std::vector<entity_id_t>, int, int, int, &PickSimilarEntitiesOnScreen>("PickSimilarEntitiesOnScreen");
 	scriptInterface.RegisterFunction<CFixedVector3D, int, int, &GetTerrainAtPoint>("GetTerrainAtPoint");
 
 	// Network / game setup functions
