Index: trunk/webapps/einotebook/scripts/Events.js
===================================================================
--- trunk/webapps/einotebook/scripts/Events.js	(revision 363)
+++ trunk/webapps/einotebook/scripts/Events.js	(revision 415)
@@ -304,9 +304,10 @@
  * Finds the Event that was last executed by based on given time.
  * @param time The time in seconds.
- * @return The last execute event if at least one event has executed; otherwise, null.
+ * @return The array of last execute event if at least one event has executed; otherwise, null.
  */
 function events_getLastExecutedEvent(time)
 {
-	var event = null;
+	// var event = null;
+	var event_arr = [];
 	if (this.length == 0)
     {
@@ -317,5 +318,5 @@
 	if (this.length == 1 && this[0].time.getSeconds() <= time)
 	{
-		event = this[0];
+		event.push(this[0]);
 	}
 	else
@@ -323,5 +324,5 @@
 		//NOTE: remember that the events are maintained in ascending order by time
 		
-		// FOR each Event
+		// FOR each Event 
 		for (var i = 0; i < this.length - 1; i++)
 		{
@@ -330,5 +331,12 @@
 			    this[i + 1].time.getSeconds() > time)
 			{
-				event = this[i];
+				event_arr.push(this[i]);
+				/* traverse backward to check if there is an event happen at the same time 
+				with the current event */
+				var k = i - 1;
+				while ( k>=0 && (this[k].time.getSeconds() == this[i].time.getSeconds())) {
+					event_arr.push(this[k]);
+					k--;
+				}
 			}
 		}
@@ -337,9 +345,10 @@
 		if (this[this.length - 1].time.getSeconds() <= time)
 		{
-			event = this[this.length - 1];
+			event_arr.push(this[this.length - 1]);
 		}	
 	}
 	
-	return event;
-}
-
+	// return an array of event 
+	return event_arr;
+}
+
Index: trunk/webapps/einotebook/cad/cad.js
===================================================================
--- trunk/webapps/einotebook/cad/cad.js	(revision 359)
+++ trunk/webapps/einotebook/cad/cad.js	(revision 415)
@@ -15,5 +15,5 @@
 
 /**
- * Updates the CAD screen.
+ * Updates the current event tab.
  */
 function updateCad()
@@ -21,9 +21,18 @@
     // Set timer to do this again in one second
 	setTimeout("updateCad()", 1000);
-
-	var currentEvent = events.getLastExecutedEvent(readCookie("time"));
+    
+    var currentEvent = events.getLastExecutedEvent(readCookie("time"));
+    //console.log("length " + currentEvent.length);
     // Show current event to Current Event Window
     var currDiv = document.getElementById("cadpadcontent");
-	currDiv.innerHTML = currentEvent.html();
+    // empty holder for display current events 
+    var display = "";
+    var evt;
+    
+    // get all the current events 
+    for (evt=0; evt<currentEvent.length; evt++) {
+        display += currentEvent[evt].html();
+    }
 
+    currDiv.innerHTML = display;
 }
Index: trunk/webapps/einotebook/notebook.js
===================================================================
--- trunk/webapps/einotebook/notebook.js	(revision 373)
+++ trunk/webapps/einotebook/notebook.js	(revision 415)
@@ -73,13 +73,17 @@
     if (updateStatus.lastEvent != latestEvent)
     {
-		// IF the new event has evaluations THEN
-    	if (latestEvent.evaluations.evaluations.length == 0)
-    	{
-//    		document.getElementById('updateStatus').innerHTML = "New Event";
-    	}
-    	else
-    	{
-//    		document.getElementById('updateStatus').innerHTML = "New Evaluation";
-    	}
+      var i;
+      for (i=0; i<latestEvent.length; i++) {
+          // IF the new event has evaluations THEN
+        if (latestEvent[i].evaluations.evaluations.length == 0)
+        {
+  //    		document.getElementById('updateStatus').innerHTML = "New Event";
+        }
+        else
+        {
+  //    		document.getElementById('updateStatus').innerHTML = "New Evaluation";
+        }
+      }
+		
     	
 		// fades the text
Index: trunk/webapps/einotebook/script/script.js
===================================================================
--- trunk/webapps/einotebook/script/script.js	(revision 401)
+++ trunk/webapps/einotebook/script/script.js	(revision 415)
@@ -13,10 +13,12 @@
 function jumpToLastExecutedEvent()
 {	
-	var lastEvent = Script.events.getLastExecutedEvent(readCookie("time"));
-	
+	var lastEventArray = Script.events.getLastExecutedEvent(readCookie("time"));
+
 	// IF a current event exists THEN
-	if (lastEvent != null)
-	{
-		lastEvent.focus();
+	if (lastEventArray != null)
+	{
+        // Move window focus to first event of the current ones
+        var last = lastEventArray.length - 1;
+	    lastEventArray[last].focus();
 	}
 	else
@@ -33,51 +35,51 @@
 function highlightLatestEvent() 
 {
-	var currentEvent = Script.events.getLastExecutedEvent(readCookie("time"));
+	var currentEventArray = Script.events.getLastExecutedEvent(readCookie("time"));
 
 	// IF the old event is has not been set THEN
-	if (typeof highlightLatestEvent.oldEvent == 'undefined')
-	{
-		highlightLatestEvent.oldEvent = new Object();
-		highlightLatestEvent.oldEvent.id = Event.invalidID;
-	}
-	
+	if (typeof highlightLatestEvent.oldEventArray == 'undefined')
+	{
+		highlightLatestEvent.oldEventArray = []; /* set up array of old events */
+		var currentEvent = new Object(); 
+		highlightLatestEvent.oldEventArray.push(currentEvent);
+		highlightLatestEvent.oldEventArray[0].id = Event.invalidID;
+	}
+
 	// IF a current event exists THEN
-	if (currentEvent != null)
-	{
-		// IF there is a new current event THEN
-		if (highlightLatestEvent.oldEvent.id != currentEvent.id)
-		{
-			currentEvent.highlight();
-			
-			// IF there was previously a current event THEN
-			if (highlightLatestEvent.oldEvent.id != Event.invalidID && currentEvent.id != 0)
-			{
-				highlightLatestEvent.oldEvent.unhighlight();
+	if (currentEventArray !== null)
+	{
+		var found = false; /* check if a current event is found in the old event array */
+
+		/* traverse the array of current event to check 
+		if there is event already in the old event array */
+		// IF there is a new current event THEN	
+		for (j=0; j<highlightLatestEvent.oldEventArray.length; j++) {
+			var oldEvent = highlightLatestEvent.oldEventArray[j];
+			found = false;
+			for (i=0; i<currentEventArray.length; i++) {
+				var currentEvent = currentEventArray[i];
+				if (oldEvent.id === currentEvent.id)
+				{
+					found = true;	
+					break;		
+				} 
 			}
-			
-			highlightLatestEvent.oldEvent = currentEvent;			
+			/* unhighlight all the events that are no longer current */
+			if (!found && oldEvent.id !== Event.invalidID) {
+				oldEvent.unhighlight();
+			}		
 		}
+
+		/* highlight the current event in the array */
+		for (i=0; i<currentEventArray.length; i++) {
+			currentEventArray[i].highlight();
+		}
+
+		/* update the old events array with current event array */
+		highlightLatestEvent.oldEventArray = currentEventArray;
 	}
 
     // Set timer to do this again in one second
 	setTimeout("highlightLatestEvent()", 1000);
-}
-
-
-/** Change color of text of expired events so they appear disabled.
-  * @param events The list of events
-  * @param currEvent The current event
-  */
-function greyOldEvents(events, currEvent)
-{
-	  // Examine all events
-   for (var evtNum = 0; evtNum < events.length; evtNum++)
-   {
-		// Change color of those before current time and Event
-      if (events[evtNum].time.compareTo(currEvent.time) < 0 && currEvent.id != events[evtNum].id) 
-      {
-			events[evtNum].unhighlight();
-      }
-	}
 }
 
@@ -101,6 +103,6 @@
 		// add the Event's html
 		html += Script.events[i].html();
-	}
-       
+        //console.log(Script.events[i].html());
+	}
 	
 	// display events in iframe
@@ -115,5 +117,4 @@
 	Script.events.win.scrollTo(0, readCookie('scriptScrollY'));
 	
-	greyOldEvents(Script.events, Script.events.getLastExecutedEvent(readCookie("time")));
 	highlightLatestEvent();
 
