Index: trunk/webapps/einotebook/scripts/Events.js
===================================================================
--- trunk/webapps/einotebook/scripts/Events.js	(revision 418)
+++ trunk/webapps/einotebook/scripts/Events.js	(revision 468)
@@ -324,5 +324,4 @@
 }
 
-
 /**
  * Finds the Event that was last executed by based on given time.
Index: trunk/webapps/einotebook/scripts/LoadEvents.js
===================================================================
--- trunk/webapps/einotebook/scripts/LoadEvents.js	(revision 434)
+++ trunk/webapps/einotebook/scripts/LoadEvents.js	(revision 468)
@@ -9,5 +9,5 @@
     var xmlDoc = parser.parseFromString(response,"text/xml");
     var eventTags = xmlDoc.getElementsByTagName("SCRIPT_EVENT");
-    console.log("parsing incident xml file");
+    console.log("parsing incident xml file containing "+eventTags.length+" event tags.");
     // Process each SCRIPT_EVENT tag
     for (var i = 0; i < eventTags.length; i++)
@@ -33,8 +33,4 @@
                         break;
                     case "INCIDENT":
-                        incidentNum = Number(currEvt.childNodes[child].attributes["LogNum"].value);
-                        incidentTitle =  currEvt.childNodes[child].textContent;
-                        break;
-                    case "GENERAL_INFO":  
                         /* This tag identifies a new incident.  As long as it appears before any
                         other tags, we can use it to create a new incident. (The alternative is to
@@ -42,11 +38,24 @@
                         we load events.)  Creating an event (below) requires that the incident has already
                         been created. */
+                        incidentNum = Number(currEvt.childNodes[child].attributes["LogNum"].value);
+                        // If this incident number doesn't exist
+                        if (incidents.get(incidentNum) == undefined)
+                        {
+                            incidentTitle =  currEvt.childNodes[child].textContent;
+                            // Construct the incident
+                            var theIncident = new Incident(evtTime, incidentNum, incidentTitle, "");
+                            // Add the incident to the list of incidents
+                            incidents.add(theIncident);
+                        }
+                        break;
+                    case "GENERAL_INFO":  
+                        // Add the summary description to the incident
                         var desc = currEvt.childNodes[child].getElementsByTagName("TEXT")[0].textContent;
-                        var theIncident = new Incident(evtTime, incidentNum, incidentTitle, desc);
-                        incidents.add(theIncident);
-			// Create an entry showing the Incident start description. Fixes ticket #164
+                        incidentToUpdate = incidents.get(incidentNum);
+                        incidentToUpdate.setSummary(desc);                        
+                        // Create an entry showing the Incident start description. Fixes ticket #164
                         var result = new Array();   
                         result.push("Description:");
-			result.push(desc);
+                        result.push(desc);
                         proparray.push(new Property("Incident Start",result));
                         break;
@@ -101,6 +110,6 @@
                 }
             }
-        }
-        //console.log(evtTime.format(), incidentNum, proparray.length, evalarray.length);
+        }//end one event
+        // console.log(evtTime.format(), incidentNum, proparray.length, evalarray.length);
         // Ignore Media Log incident and empty nodes
         if (incidentNum != undefined && incidentNum != 100)
@@ -111,5 +120,9 @@
                 new Evaluations(evalarray)) );
         }
-    }
+    }// end all events
+    console.log("Done parsing xml, " + events.length + " events and " +incidents.length + " incidents saved.");
+    
+    // NOW THAT WE HAVE THE EVENT LIST WE CAN PERFORM SETUP
+    setupNotebook();
 }
 
@@ -208,16 +221,18 @@
     return result;
 }
-// MAIN
-//console.log("starting LoadEvents");
-try {
-    // the script must be located where accessible by the web server
-    var scriptFilename = "../dynamicdata/incident_script.xml";
-    console.log("Attempting to load ", scriptFilename);
-    // Now load the Incident Script and go parse it
-    loadJSON(scriptFilename, parseXml)
-
-    } catch(e) {
-        console.log("Error attempt to parse incident script "+response)
-    }
-
-
+// MAIN ENTRY POINT for this application
+function init()
+{
+    try {
+        // the script must be located where accessible by the web server
+        var scriptFilename = "../dynamicdata/incident_script.xml";
+        console.log("LoadEvents.js main Attempting to load ", scriptFilename);
+        // Now load the Incident Script and go parse it
+        // NB: This is an async function, so all other notebook setup must be in the callback.
+        loadJSON(scriptFilename, parseXml)
+
+        } catch(e) {
+            console.log("Error attempting to parse incident script "+response)
+        }
+}
+
Index: trunk/webapps/einotebook/scripts/Incident.js
===================================================================
--- trunk/webapps/einotebook/scripts/Incident.js	(revision 359)
+++ trunk/webapps/einotebook/scripts/Incident.js	(revision 468)
@@ -17,11 +17,16 @@
 	//========== public methods ==========//
 	this.html = html;
-	this.expandAction = expandAction;
+    this.setSummary = setSummary;
 	
 	//========== private methods ==========//
 	this.formatHeader = formatHeader;
-	this.expandOption = expandOption;
-	this.expandOptionSymbol = expandOptionSymbol;
-	
+
+    /** Setter for summary field */
+	function setSummary(description)
+    {
+        this.summary = description;
+    }
+    
+    /**
 	/**
 	 * @return The html representation of this incident;
@@ -35,5 +40,5 @@
 			   "<tr>" + 
 			   "<td class='incidentSummary' id='summary" + this.number + "'>" + 
-			     (this.expanded ? this.summary : "") + "</td>" +
+			     this.summary + "</td>" +
 			   "</tr>" + 
 			   "</table>";
@@ -50,5 +55,5 @@
 		return "<table class='incidentHeader'>" +
 				"<tr class='incidentHeader'>" +
-				"<td class='incidentExpandOption'>" + this.expandOption() + "</td>" +
+				"<td class='incidentExpandOption'></td>" +
 				"<td class='incidentTime'>Time: " + this.time.format() + "</td>" +
 				"<td class='incidentNumber'>" + this.number + "</td>" +
@@ -58,46 +63,4 @@
 	}
 	
-	/**
-	 * @return The html that for the + or - symbol that expands or collapses the incident.
-	 */
-	function expandOption()
-	{
-		return "<button class='incidentExpandButton' " +
-				"id='expandOption" + this.number + "' onclick='incidents.get(" + 
-				this.number + ").expandAction()'>" + this.expandOptionSymbol() + 
-				"</button>";
-	}
 	
-	/**
-	 * Returns the symbol for the expand option.
-	 * @return Either "+" or "-" depending on whether this incidents is collapsed or 
-	 *         expanded.
-	 */
-	function expandOptionSymbol()
-	{
-		return this.expanded == true ? "&ndash;" : "+";
-	}
-	
-	/**
-	 * Performs the action of clicking on the + or - symbol that expands or collapses 
-	 * the incident.
-	 */
-	function expandAction()
-	{
-		if (this.expanded)
-		{
-			incidents.doc.getElementById("summary" + this.number).innerHTML = "";
-			incidents.doc.getElementById("expandOption" + this.number).innerHTML = "+";
-		}
-		else
-		{
-			incidents.doc.getElementById("summary" + this.number).innerHTML = 
-				this.summary;
-			incidents.doc.getElementById("expandOption" + this.number).innerHTML = 
-				"&ndash;";
-		}
-		
-		this.expanded = !this.expanded;
-		
-	}
 }
Index: trunk/webapps/einotebook/scripts/Incidents.js
===================================================================
--- trunk/webapps/einotebook/scripts/Incidents.js	(revision 359)
+++ trunk/webapps/einotebook/scripts/Incidents.js	(revision 468)
@@ -10,6 +10,4 @@
 //========== public methods ==========//
 incidents.get = incidents_get;
-incidents.collapseAll = incidents_collapseAll;
-incidents.expandAll = incidents_expandAll;
 incidents.add = incidents_add;
 
@@ -38,38 +36,4 @@
 
 /**
- * Collapses each Incident.
- */
-function incidents_collapseAll()
-{
-	// FOR each incident
-	for (var i = 0; i < this.length; i++)
-	{
-		// IF the incident is expanded THEN
-		if (this[i].expanded)
-		{
-			// collapse incident
-			this[i].expandAction();
-		}
-	}
-}
-
-/**
- * Expands each incident.
- */
-function incidents_expandAll()
-{
-	// FOR each incident
-	for (var i = 0; i < this.length; i++)
-	{
-		// IF incident is collapsed THEN
-		if (!this[i].expanded)
-		{
-			// expand incident
-			this[i].expandAction();
-		}
-	}
-}
-
-/**
  * Adds an Incident.
  * @param incident {Incident} The Incident to be added.
