Index: Dev/trunk/classes/SessionCreationTool.php
===================================================================
--- Dev/trunk/classes/SessionCreationTool.php	(revision 93)
+++ Dev/trunk/classes/SessionCreationTool.php	(revision 94)
@@ -48,48 +48,57 @@
         <script type="text/javascript">
             var pipelineCount = 0;
-                                                                                                                                                                                                                                                                                                                                             
+                                                                                                                                                                                                                                                                                                                                                     
             // =============================================================
-                                                                                                                                                                                                                                                                                                                                                                    
-            function addSurvey() {     
+                                                                                                                                                                                                                                                                                                                                                                            
+            function addSurvey(surveyID) {     
                 var surveysList = document.getElementById("surveysList");
                 var entryType = "s";
                 var color = "#00ccff";
-                
-                addFromList(surveysList, entryType, color);
-            }
-                    
-            function addApplication()
+                        
+                addFromList(surveysList, entryType, color, surveyID);
+            }
+                            
+            function addApplication(applicationID)
             {
                 var applicationsList = document.getElementById("applicationsList");
                 var entryType = "a";
                 var color = "gold";
-                
-                addFromList(applicationsList, entryType, color);
-            }
-                    
-            function addFromList(list, entryType, color)
+                        
+                addFromList(applicationsList, entryType, color, applicationID);
+            }
+                            
+            function addFromList(list, entryType, color, id)
             {
-                if(list.selectedIndex != -1)
+                if(list.selectedIndex != -1 || id != null)
                 {
                     var pipeline = document.getElementById("pipeline");
                     var entry = document.createElement("option");
-                    
+                            
                     pipelineCount++;
-                    
-                    entry.setAttribute("value", list.options[list.selectedIndex].value);
-                    entry.innerHTML = pipelineCount + ". " + list.options[list.selectedIndex].innerHTML;
-                    
+                            
+                    if (id != null)
+                    {
+                        entry.setAttribute("value", id);
+                        entry.innerHTML = pipelineCount + ". " + list.options.namedItem(id).innerHTML;
+                    }
+                    else
+                    {
+                        entry.setAttribute("value", list.options[list.selectedIndex].value);
+                        entry.innerHTML = pipelineCount + ". " + list.options[list.selectedIndex].innerHTML;
+                    }
+                            
+                            
                     entry.style.backgroundColor = color;
                     entry.name = pipelineCount + entryType;
                     entry.entryType = entryType;
-                    
+                            
                     pipeline.appendChild(entry);
                 }
             }
-                                                                                                                                                                                                                                            
+                                                                                                                                                                                                                                                    
             function addDashboard() {
                 pipelineCount++;
                 var pipeline = document.getElementById("pipeline");
-                                                                                                                                                                                                                                                
+                                                                                                                                                                                                                                                        
                 var entry = document.createElement("option");
                 entry.setAttribute("value", "dashboard");
@@ -99,8 +108,8 @@
                 entry.name = pipelineCount + "d";
                 entry.entryType = "d";
-                                                                                                                                                                                                                                                
+                                                                                                                                                                                                                                                        
                 pipeline.appendChild(entry);
             }
-                                                                                            
+                                                                                                    
             function removeFromPipeline() {
                 var pipeline = document.getElementById("pipeline");
@@ -114,5 +123,5 @@
                         pipeline.options[index].selected = true;
                     }
-                                                                                   
+                                                                                           
                     for(var i = index; i < pipeline.length; i++)
                     {
@@ -126,12 +135,12 @@
                 }
             }
-                                                                                                                                                                                                                                                             
+                                                                                                                                                                                                                                                                     
             function submitPipeline()
             {
                 var form = document.getElementById("sessionCreationForm");
-                                                                                                                                                                                                                                
+                                                                                                                                                                                                                                        
                 var pipeline = document.getElementById("pipeline").options;
-                                                                                                                                                                                                                                       
-                                                                                                                                                                                                                                        
+                                                                                                                                                                                                                                               
+                                                                                                                                                                                                                                                
                 for (var i = 0; i < pipeline.length; i++)
                 {
@@ -140,13 +149,13 @@
                     pipelineElem.value = pipeline[i].value;
                     pipelineElem.type = "hidden";
-                                                                                                                                                                                                                                    
+                                                                                                                                                                                                                                            
                     form.appendChild(pipelineElem);
                 }
-                                                                                                                                                                                                                        
+                                                                                                                                                                                                                                
                 var count = document.createElement("input");
                 count.name = "pipelineCount";
                 count.value = pipelineCount;
                 count.type = "hidden";
-                                                                                                                                                                                                                        
+                                                                                                                                                                                                                                
                 form.appendChild(count);
             }
@@ -289,5 +298,13 @@
                     </script>
                     <?php
-                } else if (isset($this->session->pipeline[$i . 'd'])) {
+                } 
+                else if (isset($this->session->pipeline[$i . 'a'])) {
+                    ?>
+                    <script type="text/javascript">
+                        addApplication(<?php echo "'" . $this->session->pipeline[$i . 'a'] . "'"; ?>);
+                    </script>
+                    <?php
+                }
+                else if (isset($this->session->pipeline[$i . 'd'])) {
                     ?>
                     <script type="text/javascript">
