Index: Dev/trunk/classes/SurveyCreationTool.php
===================================================================
--- Dev/trunk/classes/SurveyCreationTool.php	(revision 18)
+++ Dev/trunk/classes/SurveyCreationTool.php	(revision 19)
@@ -19,4 +19,5 @@
                 SurveyCreationTool::questionCreationForm();
                 SurveyCreationTool::addQuestionButton();
+                SurveyCreationTool::removeLastQuestionButton();
                 SurveyCreationTool::submitButton();
                 ?></form></div>
@@ -28,5 +29,5 @@
         <script type="text/javascript">
             var questionCount = 1;           
-                                                                                    
+                                                                                                            
             function getNewQuestion()
             {
@@ -51,10 +52,10 @@
                     "<div id='answersDiv" + questionCount + "'></div>" +
                     "</div>";
-                                                                                
+                                                                                                        
                 questionDiv.innerHTML = htmlStr;
-                                                                                
+                                                                                                        
                 return questionDiv;
             }
-                                                                                    
+                                                                                                            
             function handleFocus(input)
             {
@@ -66,15 +67,15 @@
                 }
             }
-                                                                                                                    
+                                                                                                                                            
             function handleBlur(input)
             {        
                 var surveyTitle = document.getElementById('surveyTitle');
                 var surveyDescription = document.getElementById('surveyDescription');
-                                                                                                    
+                                                                                                                            
                 if (input.value == "")
                 {
                     input.style.color = "gray";
                     input.clicked = null;
-                                                                                                                            
+                                                                                                                                                    
                     if (input == surveyTitle)
                     {
@@ -87,5 +88,5 @@
                 }                           
             }
-                                                                    
+                                                                                            
             function handleType(select)
             {
@@ -94,10 +95,10 @@
                 answersDiv.answerCount = 1;
                 answersDiv.clicked = null;
-                        
+                                                
                 switch (type) {
                     case 'mc':
                         answersDiv.innerHTML = "";
                         addOption(select.id);
-                                                        
+                                                                                
                         break;
                     case 'text':
@@ -116,4 +117,5 @@
                         answersDiv.innerHTML = ""; 
                         //what scale (min max incr)
+                        minMaxIncr(select.id);
                         break;
                     default:
@@ -122,6 +124,6 @@
 
             }
-                                                    
-                                            
+                                                                            
+                                                                    
             function addOption(questionNumber)
             {        
@@ -130,8 +132,8 @@
                 var answerDiv = document.createElement("div");
                 answerDiv.className = "answerDiv";
-                                                
+                                                                        
                 var htmlStr = "<input type='text' name='q" + 
                     questionNumber + "ans" + answerCount + "' value='Option " + answerCount + "' />";
-                        
+                                                
                 if (answersDiv.clicked == null)
                 {
@@ -140,33 +142,67 @@
                     answersDiv.clicked = true;
                 }
-                                                       
+                                                                               
                 answerDiv.innerHTML = htmlStr;
-                                                       
+                                                                               
                 answersDiv.appendChild(answerDiv);
                 answersDiv.answerCount++;
             }
-            
+                                    
             function minMax(questionNumber)
             {
-               var answersDiv = document.getElementById("answersDiv" + questionNumber);
-               
-               var answerDiv = document.createElement("div");
-               answerDiv.className = "answerDiv";
-               answerDiv.innerHTML = "<label for='min'>Min</label><input type='text' name='min" + questionNumber + "' />" +
-               "<label for='max'>Max</label><input type='text' name='max" + questionNumber + "' />";
-           
+                var answersDiv = document.getElementById("answersDiv" + questionNumber);
+                                       
+                var answerDiv = document.createElement("div");
+                answerDiv.className = "answerDiv";
+                answerDiv.innerHTML = "<label for='min'>Min</label><input type='text' name='min" + questionNumber + "' />" +
+                    "<label for='max'>Max</label><input type='text' name='max" + questionNumber + "' />";
+                                   
                 answersDiv.appendChild(answerDiv);
-            }            
-                                                                 
+            }  
+                                    
+            function minMaxIncr(questionNumber)
+            {
+                minMax(questionNumber);
+                var answersDiv = document.getElementById("answersDiv" + questionNumber);
+                                       
+                var answerDiv = document.createElement("div");
+                answerDiv.className = "answerDiv";
+                answerDiv.innerHTML = "<label for='incr'>Increment by</label><input type='text' name='incr" + questionNumber + "' />";
+                                   
+                answersDiv.appendChild(answerDiv);
+            }         
+                                                                                         
+                                                                                                 
             function addQuestion()
             {
                 var questionsDiv = document.getElementById('questionsDiv');
                 var newQuestion = getNewQuestion();
-                                                                                
+                                
+
+                newQuestion.prev = document.lastQuestion;
+                document.lastQuestion = newQuestion;
+
                 questionsDiv.appendChild(newQuestion);
                 questionCount++;
             }
-            
-                                                                                                                                                                                            
+                            
+            function removeLastQuestion()
+            {
+                var questionsDiv = document.getElementById('questionsDiv');
+                                
+                if (document.lastQuestion.prev != null)
+                {
+                    questionsDiv.removeChild(document.lastQuestion);
+                    document.lastQuestion = document.lastQuestion.prev;
+                    questionCount--;  
+                }
+                else
+                {
+                    // do nothing
+                }               
+            }
+                          
+                                    
+                                                                                                                                                                                                                    
         </script>
         <?php
@@ -199,4 +235,10 @@
     }
 
+    private static function removeLastQuestionButton() {
+        ?>
+        <input type="button" onclick="removeLastQuestion()" value="x" class="surveyButton" />
+        <?php
+    }
+
     private static function submitbutton() {
         ?>
