// 90's Style Teletype.
// Ever since I started creating my own web pages back in 1998, I always used
// these neat little trick. It was cool back then. I had no idea what I was
// doing, I merely copied the script from hackers.com. This is an effort to redo
// that and be cool once again! :D

var run = false;
var delay = 75;

function startTyping() {
    if (run) {
        return;
    }
    "use strict";
    run = true;
    var textToType = document.getElementById("textarea").value;
    var outputElem = document.getElementById("teletype_output");
    var tempText = "";

    var typeTimer = setInterval(function () {
        outputElem.textContent = tempText;
        if (textToType.length > tempText.length) {
            tempText = textToType.substr(0, tempText.length + 1);
        } else {
            run = false;
        }
        if (!run) {
            clearInterval(typeTimer);
        }
    }, delay);
}

function stopTyping() {
    "use strict";
    run = false;
}


@@ -1,8 +1,35 @@
+/* jslint browser:true */%0A%0A
 // 90's 
@@ -382,59 +382,96 @@
     
-if (run) %7B%0A        return;%0A    %7D%0A    %22use strict%22;%0A
+%22use strict%22;%0A    var textToType, outputElem, tempText, typeTimer;%0A%0A    if (!run) %7B%0A    
     
@@ -482,27 +482,27 @@
 = true;%0A    
-var
+   
  textToType 
@@ -550,19 +550,19 @@
 ue;%0A    
-var
+   
  outputE
@@ -615,19 +615,19 @@
 %22);%0A    
-var
+   
  tempTex
@@ -639,19 +639,19 @@
 %22;%0A%0A    
-var
+   
  typeTim
@@ -681,32 +681,36 @@
 on () %7B%0A        
+    
 outputElem.textC
@@ -732,24 +732,28 @@
 xt;%0A        
+  
+  
 if (textToTy
@@ -779,24 +779,28 @@
 t.length) %7B%0A
+    
             
@@ -853,16 +853,20 @@
 h + 1);%0A
+    
         
@@ -882,24 +882,28 @@
             
+    
 run = false;
@@ -915,18 +915,24 @@
     
-%7D%0A
+    %7D%0A  
         
 if (
@@ -923,24 +923,26 @@
 %7D%0A          
+  
 if (!run) %7B%0A
@@ -933,32 +933,36 @@
     if (!run) %7B%0A
+    
             clea
@@ -983,16 +983,20 @@
 Timer);%0A
+    
         
@@ -993,24 +993,28 @@
           %7D%0A
+    
     %7D, delay
@@ -1016,16 +1016,22 @@
 delay);%0A
+    %7D%0A
 %7D%0A%0Afunct
@@ -1086,9 +1086,8 @@
 alse;%0A%7D%0A
-%0A

Fix JSLint errors.