Index: Dev/trunk/js/ajax.js
===================================================================
--- Dev/trunk/js/ajax.js	(revision 188)
+++ 	(revision )
@@ -1,39 +1,0 @@
-function loadContent (query, url, target, callback) {
-    newAjaxRequest(query, url, target, handleResponse());
-    return false;
-}
-
-// Waar is bovenstaande tussenstap voor nodig..? Hij doet niets anders dan redirecten naar loadExternalContent en false returnen.
-
-function newAjaxRequest(query, url, target, callback) {
-    var xmlhttp;
-    document.getElementById(target).innerHTML = 'Fetching data...';
-    if (window.XMLHttpRequest) {
-        xmlhttp = new XMLHttpRequest();
-    }
-    else if (window.ActiveXObject) {
-        xmlttp = new ActiveXObject("Microsoft.XMLHTTP");
-    }
-    else {
-        document.getElementById(target).innerHTML = "AJAX not supported!";
-    }
-    
-    if (xmlhttp !== undefined) {
-        xmlhttp.onreadystatechange = handleResponse(xmlhttp, url, target, callback);
-        xmlhttp.open("POST", url, true);
-        xmlhttp.send(query);
-    }
-}
-
-//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, callback) {
-    if (xmlhttp.readyState == 4) {
-        if (xmlhttp.Status == 200) {
-            callback(xmlhttp, target);
-            //document.getElementById(target).innerHTML = xmlhttp.responseText;
-        }
-        else {
-            //document.getElementById(target).innerHTML = "loadExternalContent error: \n" + xmlhttp.status + "\n" + xmlhttp.statusText;
-        }
-    }
-}
Index: Dev/trunk/js/creation.js
===================================================================
--- Dev/trunk/js/creation.js	(revision 188)
+++ 	(revision )
@@ -1,53 +1,0 @@
-function handleFocus(input)
-{
-    /* this is such ugly code it makes me sad */
-    /* because it is hard coded. */
-    if (input.clicked == null && 
-        (input.value == "Untitled Survey"
-            || input.value == "Write a helpful description for this survey here."
-            || input.value == "Write a question description here."
-            || input.value == "Untitled Question"
-            || input.value == "Untitled Session"
-            || input.value == "Write a description for this session here."
-            || input.value == "Untitled Application"
-            || input.value == "Write a description for this application here."))
-            {
-        input.value = "";
-        input.style.color = "black";   
-        input.clicked = true; 
-    }
-}
-                                                                                                                                                                                                                                                                                                                                                                                    
-function handleBlur(input)
-{                                                                                                                                                                                                                                                                                                                                                                           
-    if (input.value == "")
-    {
-        input.style.color = "#555";
-        input.clicked = null;
-        if (input.id == "surveyTitle")
-        {
-            input.value = "Untitled Survey";
-        }
-        else if (input.id == "surveyDescription")
-        {
-            input.value = "Write a helpful description for this survey here.";
-        }
-        else if (input.id == "sessionTitle")
-        {
-            input.value = "Untitled Session";
-        }
-        else if (input.id == "sessionDescription")
-        {
-            input.value = "Write a description for this session here.";
-        }
-        else if (input.id == "applicationTitle")
-        {
-            input.value = "Untitled Application";
-        }
-        else if (input.id == "applicationDescription")
-        {
-            input.value = "Write a description for this application here.";
-        }
-            
-    }                           
-}
Index: Dev/trunk/js/generalScripts.js
===================================================================
--- Dev/trunk/js/generalScripts.js	(revision 188)
+++ Dev/trunk/js/generalScripts.js	(revision 191)
@@ -76,4 +76,16 @@
 }
 
+// Function that handles updating of info panel via AJAX getInfo.php. Currently operates on HTML to paste into #infoPanelContent, should eventually involve JSON arrays, to have more control over formatting.
+function ajaxInfoRequest(uid, el, type) {
+    // Info panel update.
+    
+    var c = "uid="+uid;
+    c += "&type="+type;
+    var u = "getInfo.php";
+    newAjaxRequest(c, u, function(result) {
+        el.innerHTML = result.responseText;
+    }, true);
+}
+
 // Function to save the object currently being edited.
 // !! Still needs to be generalized !!
Index: Dev/trunk/js/menu.js
===================================================================
--- Dev/trunk/js/menu.js	(revision 188)
+++ 	(revision )
@@ -1,36 +1,0 @@
-function loadSurvey()
-{
-    var form = document.getElementById('loadForm');
-    var select = document.getElementById('surveysToLoad');
-    var surveyUID = select.valueOf().value; 
-    
-    if (surveyUID != '')
-    {
-        var surveyInput = document.createElement('input');
-        surveyInput.name = "UID";
-        surveyInput.value = surveyUID;
-        surveyInput.type = "hidden";
-
-        form.appendChild(surveyInput);
-
-        form.submit();
-    }
-}
-
-function loadApplication()
-{
-    var form = document.getElementById('loadApplicationForm');
-    var select = document.getElementById('applicationsToLoad');
-    var applicationUID = select.valueOf().value;
-    
-    if (applicationUID != '')
-    {
-        var applicationInput = document.createElement('input');
-        applicationInput.name = 'applicationUID';
-        applicationInput.value = applicationUID;
-        applicationInput.type = "hidden";
-       
-        form.appendChild(applicationInput);
-        form.submit();
-    }
-}
Index: Dev/trunk/js/sequencerScripts.js
===================================================================
--- Dev/trunk/js/sequencerScripts.js	(revision 188)
+++ Dev/trunk/js/sequencerScripts.js	(revision 191)
@@ -73,5 +73,5 @@
         // settings fields first
         initSequencer();
-        
+        debugger;
         switch (sequencer.settings.content.contentType.toLowerCase()) {
             case "session":
@@ -230,4 +230,5 @@
         requestString = "args="+JSON.stringify(args);
         newAjaxRequest(requestString, "returnObjectDisplay.php", function(result){
+            console.log(result.responseText);
             insertNewObjects(result.responseText, needsUpdating);
         }, true);
@@ -290,5 +291,4 @@
 
         // This means that one or more steps are being added, not an entire pipeline's worth of them
-        debugger;
         needsUpdating = new Array();
         args = [];
@@ -305,4 +305,5 @@
         requestString = "args="+JSON.stringify(args);
         newAjaxRequest(requestString, "returnObjectDisplay.php", function(result){
+            //console.log(result.responseText);
             insertNewObjects(result.responseText, needsUpdating);
         }, true);
@@ -388,4 +389,5 @@
 
 function insertNewObjects(responseText, needsUpdating) {
+    //console.log(responseText);
     // Container function that calls different insertNewX() functions depending on content type. Called from updateSequencer().
     var response = JSON.parse(responseText);
@@ -520,4 +522,9 @@
     // Loop through returned question objects
     for (var i = 0; i < response.length; i++) {
+        
+        /*
+         * The following block of code defines the layout and composition of the question display
+         */
+        
         // Define the outer frame
         var frameDiv = ce("div");
@@ -570,6 +577,10 @@
         frameDiv.appendChild(controlsDiv);
         
+        /* 
+         * This is where the layout code ends
+         * We proceed to insertion of the created DIV into the document
+         */ 
+        
         // We now have a full question display DIV contained in the frameDiv variable. We should now add this to the sequencer content.
-        debugger;
         for (var j = needsUpdating.length - 1; j >= 0; j--) {
             if (needsUpdating[j][1] != response[i].uid) continue;
@@ -587,4 +598,33 @@
     
     sequencer.state.updating = false;   //re-enable user commands
+}
+
+function saveSurvey(confirmSave) {
+    // Sends an AJAX request to the PHP server that saves the current object.
+    var answer = (confirmSave == true) ? confirm("Save changes?") : true;
+    if (answer == false) return;
+    
+    // Check for object type being edited, adjust requestString and target URL to this information.
+    var request = new Object(), url, requestString;
+    switch (sequencer.settings.content.contentType.toLowerCase()) {
+        case "survey":
+            url = "saveSurvey.php";
+            request.title = sequencer.survey.title;
+            request.uid = sequencer.survey.uid;
+            request.description = sequencer.survey.description;
+            request.questions = new Object();
+            request.questions.uids = sequencer.survey.questions.uids;
+            requestString = "args="+JSON.stringify(request);
+            console.log(request);
+            newAjaxRequest(requestString, url, function(result){
+                console.log(result.responseText);
+            }, true);
+            break;
+        case "blaaaat":
+            url = "savesession.php";
+            request.pipeline.uids = sequencer.session.pipeline.uids;
+            request.pipeline.types = sequencer.session.pipeline.types;
+            break;
+    }
 }
 
@@ -648,14 +688,5 @@
 }
 
-function ajaxInfoRequest(uid, el, type) {
-    // Info panel update.
-    
-    var c = "uid="+uid;
-    c += "&type="+type;
-    var u = "getInfo.php";
-    newAjaxRequest(c, u, function(result) {
-        el.innerHTML = result.responseText;
-    }, true);
-}
+
 
 function savePipeline (confirmSave) {
@@ -784,4 +815,5 @@
 
 // Temp function that creates a dummy question to test the insertNewQuestions function.
+// NOTE: CAN BE REMOVED!
 function debug_addQuestion() {
     // Derp, natuurlijk werkt de addQuestion call niet twee keer. Hij creeert twee keer exact hetzelfde object. Bottom line: het werkt. Nu de editing code voor deze questions gaan schrijven!
@@ -803,4 +835,5 @@
 
 // Temp function that articially switches content type when the page is already loaded, to easily test layout changes and content flow.
+// NOTE: CAN BE REMOVED!
 function debug_switchType() {
     var content = ge("seqContent");
Index: Dev/trunk/js/surveyEditorScripts.js
===================================================================
--- Dev/trunk/js/surveyEditorScripts.js	(revision 188)
+++ 	(revision )
@@ -1,80 +1,0 @@
-/* 
- * Scripts needed for operation of the survey editor
- */
-
-var surveyEditor = {
-    uid: "",                        // the uid of the currently opened survey
-    title: "No title",         // the name of the currently opened survey
-    description: "No description",  // the description of the currently opened survey
-    numQuestions: 0,                // the number of questions contained in this survey
-    questions: [],             // the array containing question objectliterals/uids
-    state: {                        // used for checks in onClick events
-        editing: false,             // whether or not a question is currently being edited
-        editUid: ""                 // the uid of the question being edited, if any
-    }
-}
-
-
-
-function loadSurvey() {
-    
-    /*
-     * Take the values from the hiddenfields on the page, load them into the object literal defined at the top of this script,
-     * Then delete these fields from the HTML page, since they are not needed anymore.
-     * This is possibly more secure than leaving them on the page, and results in cleaner HTML markup
-     */
-
-    debugger;
-    var fTitle = document.getElementById("surveyTitle");
-    if (fTitle != undefined && fTitle.value != "") {
-        surveyEditor.title = fTitle.value;
-    }
-    else {
-        surveyEditor.title = "Undefined title";
-    }
-    
-    var fNumQuestions = document.getElementById("numQuestions");
-    if (fNumQuestions != undefined && fNumQuestions.value != "") {
-        surveyEditor.numQuestions = fNumQuestions;
-    }
-    else {
-        surveyEditor.numQuestions = 0;
-        return;
-    }
-    
-    var fQuestions = document.getElementById("questionUids");
-    if (fQuestions != undefined && surveyEditor.numQuestions > 0) {
-        surveyEditor.questions = stringToArray(fQuestions.value, ",");
-        if (surveyEditor.questions.length != surveyEditor.numQuestions) {
-            alert("numQuestions and the questions array passed do not match!");
-            return;
-        }
-    }
-    else {
-        alert("Questions field not found!");
-        return;
-    }
-}
-
-function drawQuestions(firstTime) {
-    var length = surveyEditor.questions.length;
-    if (length <= 0) return;
-    
-    var container = document.getElementById("surveyEditorContent");
-    
-    
-    if (firstTime == true) {
-        // Loop through questions, add a new smallFrame div for each question with id=question->uid
-        // do this via AJAX calls, returnQuestion.php
-        // dependencies: stringToArray/arrayToString
-        var requestString = "uids=";
-        requestString += arrayToString(surveyEditor.questions, ",");
-        newAjaxRequest(requestString, "returnQuestionDisplay.php", function(result) {
-            //var holderDiv = document.createElement("div");
-            //holderDiv.innerHTML = result.responseText;
-            container.innerHTML = result.responseText;
-        });
-    }
-    
-    
-}
