Index: /issm/trunk-jpl/src/m/classes/clusters/generic.js
===================================================================
--- /issm/trunk-jpl/src/m/classes/clusters/generic.js	(revision 20597)
+++ /issm/trunk-jpl/src/m/classes/clusters/generic.js	(revision 20598)
@@ -50,16 +50,13 @@
 		$(".run-button").html("CONNECTING...").prop("disabled", true);
 		request.position = 0; //Keep track of current parsing position in repsonseText
-		//TODO: Test timeout conditions (timeout will trigger even if ocnnection is successful, if computation takes too long)
-		request.timeout = 3000;
-		request.ontimeout = function (event) {
+		request.timeout = 30000;
+		request.ontimeout = function (event) { //{{{
 			$(".run-button").html("RUN").prop("disabled", false);
-		}
-		
-		request.upload.onprogress = function(event) {
+		} //}}}
+		request.upload.onprogress = function(event) { //{{{
 			var progress = (event.loaded / event.total * 100).toFixed(0);
 			$(".run-button").html("UPLOADING: " + progress + "%");
-        }
-
-		request.onprogress = function (event) {
+        } //}}}
+		request.onprogress = function (event) { //{{{
 			//Receive updates by parsing message length as a 32-bit hex string of form 0x*09ABCDEF))
 			var startIndex = request.position;
@@ -78,8 +75,8 @@
 				}
 			}
-		};
-		
-		request.onload = function (event) {
+		}; //}}}
+		request.onload = function (event) { //{{{
 			//get context to this.str2ab to avoid duplciation
+			console.log(event);
 			function str2ab(str) {
 				var buf = new Uint8Array(str.length);
@@ -88,11 +85,10 @@
 				}
 				return buf;
-			} //}}}
-			//if (request.responseText.slice(request.position, request.position + 1) == "0x") request.position = request.position + 10;
+			}
 			var buffer2 = str2ab(window.atob(request.responseText.slice(request.position + 10)));			
 			var returnBuffer = new Uint8Array(buffer2);
-			var returnBuffer_size=returnBuffer.byteLength;
+			var returnBuffer_size = returnBuffer.byteLength;
 			try {
-				md.results= parseresultsfrombuffer(returnBuffer,returnBuffer_size);
+				md.results = parseresultsfrombuffer(returnBuffer,returnBuffer_size);
 			}
 			catch (e) {
@@ -101,5 +97,5 @@
 			$(".run-button").html("RUN").prop("disabled", false);
 			callbackfunction();
-		};
+		}; //}}}
 		
 		var npbuffer = this.str2ab(md.cluster.np.toString());
@@ -124,11 +120,8 @@
 		
 		var binbuffer = new Uint8Array(fid.rawbuffer()); //seems that 16 array bytes length could be incompatible.
-
-
 		var binlength = new Uint32Array(1);
 		binlength[0] = binbuffer.byteLength;
 		
 		var data = new Blob([nplength,npbuffer,runtimenamelength,runtimenamebuffer,namelength,namebuffer,toolkitslength,toolkitsbuffer,solutionlength,solutionbuffer,binlength,binbuffer]);
-		//if (typeof(download) != "undefined") download(fid.rawbuffer());
 	
 		request.open("POST", this.url, true);
@@ -136,11 +129,9 @@
 		request.send(data);
 		
-		return;
-
 	} //}}}
 	this.ab2str = function(buf) { //{{{
 		return String.fromCharCode.apply(null, new Uint16Array(buf));
-	}
-	this.str2ab = function(str) {
+	} //}}}
+	this.str2ab = function(str) { //{{{
 		var buf = new Uint8Array(str.length);
 		for (var i=0, strLen=str.length; i < strLen; i++) {
