
function mainLoop() {
    var content = "GREETINGS PROFESSOR FALKEN~~";
    document.getElementById("select_options").style.visibility="hidden";    
    document.getElementById("href_item1").innerHTML="Personal Blog";
    document.getElementById("href_item2").innerHTML="Technical Blog";
    document.getElementById("href_item3").innerHTML="Updates on Twitter";
    document.getElementById("href_item4").innerHTML="Photos";
    document.getElementById("maininput").value="";
    
    slowPlay("text1",content,0,40);
    
    content="Hello.";
    setTimeout('slowPlay("text2","'+content+'",0,140);', 1500);
    
    content="~HOW ARE YOU FEELING TODAY?~~";
    setTimeout('slowPlay("text3","'+content+'",0,40);', 3000);

    content="I'm fine. How are you?";
    setTimeout('slowPlay("text4","'+content+'",0,80);', 6000);
    
    content="~EXCELLENT.  SHALL WE PLAY A GAME?";
    setTimeout('slowPlay("text5","'+content+'",0,40);', 8000);
    
    setTimeout('document.getElementById("maininput").style.visibility="visible";document.getElementById("waroption").style.visibility="visible";document.getElementById("select_options").style.visibility="visible";document.getElementById("prompt").style.visibility="visible";document.getElementById("fineprint").style.visibility="visible";document.getElementById("maininput").focus();', 10000);
    
}
loaded("text1",mainLoop);


var brk = '~'; 
var resetTime = 0; 

function slowPlay(id,content,num,delay) {
    if (num <= content.length)  {
        var lt = content.substr(0,num); 
        document.getElementById(id).innerHTML = lt.replace(RegExp(brk,'g'),'<br \/>'); 
        num++; 
        if (num > content.length) delay = resetTime * 1000;
    } else {
        document.getElementById(id).innerHTML = ''; 
        num = 0;
    } 
    if (delay > 0) setTimeout('slowPlay("'+id+'","'+content+'","'+num+'","'+delay+'")',delay);
} 

var pageLoaded = 0; 
window.onload = function() {
    pageLoaded = 1;
}; 

function loaded(i,f) {
    if (document.getElementById && document.getElementById(i) != null) f(); 
    else if (!pageLoaded) setTimeout('loaded(\''+i+'\','+f+')',100);
}

function enteredSomething(e) {
    var keynum;
    var keychar;
    var numcheck;

    if(window.event) // IE
      {
      keynum = e.keyCode;
      }
    else if(e.which) // Netscape/Firefox/Opera
        {
            keynum = e.which;
        }
    keychar = String.fromCharCode(keynum);
    numcheck = /\d/;

    switch (keychar)
    { 
    case "1":
        window.location="http://omgzombies.org";
        break;
    case "2":
        window.location="http://hideandsql.com";
        break;
    case "3":
        window.location="http://twitter.com/ryanthiessen";
        break;
    case "4":
        window.location="http://lol-what.com";
        break;
    case "5":
        alert("THE ONLY WINNING MOVE IS NOT TO PLAY");
        window.location="http://flagwavingbeaver.com";
        break;
    default:
        return false;
    }
        
    return true;
}
