Index: Dev/trunk/js/ajax.js
===================================================================
--- Dev/trunk/js/ajax.js	(revision 169)
+++ Dev/trunk/js/ajax.js	(revision 175)
@@ -20,5 +20,5 @@
     
     if (xmlhttp !== undefined) {
-        xmlhttp.onreadystatechange = callback(xmlhttp, url, target);
+        xmlhttp.onreadystatechange = handleResponse(xmlhttp, url, target, callback);
         xmlhttp.open("POST", url, true);
         xmlhttp.send(query);
@@ -27,11 +27,12 @@
 
 //Handle response is een soort standaard response functie, is het nodig om deze te kunnen overriden met een custom callback functie?
-function handleResponse(xmlhttp, url, target) {
+function handleResponse(xmlhttp, url, target, callback) {
     if (xmlhttp.readyState == 4) {
         if (xmlhttp.Status == 200) {
-            document.getElementById(target).innerHTML = xmlhttp.responseText;
+            callback(xmlhttp, target);
+            //document.getElementById(target).innerHTML = xmlhttp.responseText;
         }
         else {
-            document.getElementById(target).innerHTML = "loadExternalContent error: \n" + xmlhttp.status + "\n" + xmlhttp.statusText;
+            //document.getElementById(target).innerHTML = "loadExternalContent error: \n" + xmlhttp.status + "\n" + xmlhttp.statusText;
         }
     }
Index: Dev/trunk/js/editorScripts.js
===================================================================
--- Dev/trunk/js/editorScripts.js	(revision 169)
+++ 	(revision )
@@ -1,28 +1,0 @@
-/* 
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-
-function IsItemSelected(check, target) {
-    if (check.value) {
-        target.disabled = false;
-    }
-    else {
-        target.disabled = true;
-    }
-}
-
-function IsCheckEnabled(check, target) {
-    if (check.checked) {
-        target.disabled = false;
-    }
-    else {
-        target.disabled = true;
-    }
-}
-
-function SubmitToolbox() {
-    document.forms['toolbox'].submit();
-}
-
-
Index: Dev/trunk/js/questionEditorScripts.js
===================================================================
--- Dev/trunk/js/questionEditorScripts.js	(revision 175)
+++ Dev/trunk/js/questionEditorScripts.js	(revision 175)
@@ -0,0 +1,101 @@
+var qUID, parentObjectUID, qName, qTag, qType, qAnswerLength;
+
+function selectAnswerType(){
+    
+    var selectBox = document.getElementById("questionType");
+    if (selectBox.value != undefined && selectBox.value != "") {
+        qType = selectBox.value;
+    }
+    else {
+        return;
+    }
+    
+    removeWrongAnswerFields(selectBox);
+    
+    switch (qType) {
+        case "int":
+            selectIntType();
+            break;
+        case "scale":
+            selectScaleType();
+            break;
+        case "choice":
+            //selectChoiceType();
+            break;
+        case "text":
+            //selectTextType();
+            break;
+        default:
+            alert("Invalid answer type selected!");
+            break;
+    }
+    
+}
+
+function createNewElement(tag, type, id, cl, value) {
+    var newElement = document.createElement(tag);
+    if (type != undefined) newElement.type = type;
+    if (id != undefined) newElement.id = id;
+    if (cl != undefined) newElement.className = cl;
+    if (value != undefined) newElement.value = value;
+    return newElement;
+}
+
+function removeWrongAnswerFields(el) {
+    while (el.nextSibling) {
+        el.parentNode.removeChild(el.nextSibling);
+    }
+}
+
+
+
+
+function selectIntType() {
+    var selectBox = document.getElementById("questionType");
+    var content = document.getElementById("questionEditor_questionParams");
+    var minValueBox = createNewElement("input","text","minValueBox", "questionParamField", null);
+    content.innerHTML += "<br />Min value: ";
+    content.appendChild(minValueBox);
+    var maxValueBox = createNewElement("input", "text", "maxValueBox", "questionParamField", null);
+    content.innerHTML += "<br />Max value: ";
+    content.appendChild(maxValueBox);
+    
+    // set the selected value, because adding a DOM element to the parent element resets the selected value.
+    for (var i = 0; i < selectBox.options.length; i++) {
+        if (selectBox.options[i].value == "int") {
+            selectBox.selectedValue = i;
+            selectBox.selectedText = "Integer";
+        // DIT WERKT NOG NIET, HIJ SELECTEERT HEM NIET, OOK AL IS SELECTED = TRUE
+        // MET ANDERE WOORDEN: WTF.
+        }
+    }
+}
+
+
+
+function selectScaleType() {
+    debugger;
+    var selectBox = document.getElementById("questionType");
+    var content = document.getElementById("questionEditor_questionParams");
+    var numChoicesBox = createNewElement("select", null, "numChoicesBox","questionParamField",null);
+    content.innerHTML += "<br />Scale size: ";
+    for (var i = 0; i < 10; i++) {
+        var option = createNewElement("option");
+        option.text = i+1;
+        option.value = i+1;
+        numChoicesBox.appendChild(option);
+    }
+    content.appendChild(numChoicesBox);
+    numChoicesBox.addEventListener("change", selectScaleSize, false);
+}
+
+function selectScaleSize() {
+    var numChoicesBox = document.getElementById("numChoicesBox");
+    var content = document.getElementById("questionEditor_questionParams");
+    for (var i = 0; i < numChoicesBox.value; i++) {
+        var newBullet = createNewElement("input", "radio", "bullet"+i, "questionParamField","i");
+        content.appendChild(newBullet);
+    }
+    
+}
+
