Index: Dev/trunk/js/sequencerScripts.js
===================================================================
--- Dev/trunk/js/sequencerScripts.js	(revision 150)
+++ Dev/trunk/js/sequencerScripts.js	(revision 152)
@@ -29,45 +29,130 @@
 }
 
-
-
-/*
- * Selection code
- * 
- */
-
-function checkSelectedStep(number){
-    document.sequencer.selectedStep.value = number;
-    var step = document.getElementById("seqContent")
-    document.refresh();
-}
-
-function highlightSelectedStep() {
-    
-}
-
-
-
-
-
-
-
-
-
-
 // Class manipulation
 
 function hasClass(ele,cls) {
-	return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
+    return ele.className.match(new RegExp('(\\s|^)'+cls+'(\\s|$)'));
 }
  
 function addClass(ele,cls) {
-	if (!this.hasClass(ele,cls)) ele.className += " "+cls;
+    if (!this.hasClass(ele,cls)) ele.className += " "+cls;
 }
  
 function removeClass(ele,cls) {
-	if (hasClass(ele,cls)) {
-    	var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
-		ele.className=ele.className.replace(reg,' ');
-	}
+    if (hasClass(ele,cls)) {
+        var reg = new RegExp('(\\s|^)'+cls+'(\\s|$)');
+        ele.className=ele.className.replace(reg,' ');
+    }
 }
 
+//new scripts!
+//start here!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+function selectStep(uid) {
+    document.getElementById(uid).addClass("selected");
+    document.sequencer.controls.selectedStep.value = uid;
+}
+                                                                            
+                                                                            
+/*
+ * ajaxStepRequest gets  the markup for displaying a step in the sequencer from returnStep.php
+ * Using ajax principle allows for editing of pipeline without constantly refreshing the page.
+ */
+
+function ajaxStepRequest(UID) {
+    var c = "uid="+UID;
+    var u = "returnStep.php";
+    newAjaxRequest(c, u, function(result) {
+        var newDiv = result.responseText;
+        document.getElementById("seqContent").appendChild(newDiv);
+    });
+}
+
+function ajaxInfoRequest(id, el) {
+    var uid = id;
+    var c = "uid="+uid;
+    var u = "getInfo.php";
+    newAjaxRequest(c, u, function(result) {
+        el.innerHTML = result.responseText;
+    });
+}
+
+/*
+ * This function allows for simple use of AJAX requests.
+ * Calling format:
+ * 
+ * var c[] = "uid=123";
+ *  var c[] = "name=tschipper";
+ *  var u = "getResult.php";
+ *  newAjaxRequest(c, u, function(xml) {
+ *      <!--Do something-->
+ *  });
+ *  
+ *  It is of course also possible to refer to an external function instead of 
+ *  defining function(xml){} in the call itself, as below:
+ *  
+ *  newAjaxRequest(c, u, externalFunction(xml));
+ */
+
+function newAjaxRequest(c, u, cb) {
+    
+    var xml;
+    var content = c;    //an array of strings, in "key=value"  format.
+    // assign a compatible request format
+    if (window.XMLHttpRequest) {    //Not IE5, IE6
+        xml = new XMLHttpRequest();
+    }
+    else {                          //IE5, IE6
+        xml = new ActiveXObject("Microsoft.XMLHTTP");
+    }
+    // subscribe the callback function to a response event
+    xml.onreadystatechange = function() {
+        if (xml.readyState == 4 && xml.status == 200) {
+            //alert("Received!");
+            cb(xml);
+        }
+    };
+    // initialize XMLRequest
+    xml.open("POST", u, true);
+    xml.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+    var contentString = "";
+    //iterate through parameters passed in variable c
+    if (typeof(content)=='object'&&(input instanceof Array)) {    // parameters were passed as an array of key=value strings
+        for (var i = 0; i < content.length; i++) {
+            contentString += content[i];
+            if (i != (content.length - 1)) {
+                contentString += "&";
+            }
+        }
+    }
+    else {                      // single parameter or string already formatted by calling function
+        contentString = content;
+    }
+    // finally send the formatted request
+    //alert(contentString);
+    xml.send(contentString);
+}
+                            
+
+function drawSteps() {
+    var sequencer = document.getElementById("sequencer");
+    var seqContent = document.getElementById("seqContent");
+                
+    // first delete all current children of seqContent (to reset the sequencer).
+    while (seqContent.childNodes.length > 0) {
+        var step = seqContent.childNodes[0];
+        step.parentNode.removeChild(step);
+    }
+                
+    // get pipeline contents from hidden form inputs.
+    var pipeline = sequencer.controls.pipeline.value;
+    var pipeline = pipeline.split(", ");
+                
+    // then do an xmlhttp request for each step to be added to the sequencer
+    var numberOfSteps = pipeline.length;
+    for (var i = 0; i > numberOfSteps; i++) {
+        ajaxStepRequest(pipeline[i]);
+    }
+                
+}
+
