// JavaScript Document
var timer;

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function launchIMWindow(answer) {

MM_showHideLayers('com_window','','show');
MM_swapImage('status','','imwindow_images/status_furtu.gif',1);
MM_swapImage('signal','','imwindow_images/signal.gif',1);
MM_swapImage('subnet','','imwindow_images/subnet.gif',1);
MM_swapImage('video','','imwindow_images/vid_furtu.gif',1);
clearTimeout(timer);
startTyping(answer, 50, "textDestination");
}

var answer1="No one should be afraid of me. I could not harm anyone. Our people wish only to protect ourselves. That's all we ever wanted. What … you doubt me? The Kimmeroi Council and its member planets are taking terrible risks with some of their research. I use my abilities only to stop them. That's the way it is, believe it or not.";
var answer2="It is a learning computer. I experiment with mathematics and computer design by teaching it new things and trying out theories. It then follows my ideas to their natural conclusions to see if it merits further work. Oh, and it also allows me to hack into any computer in the galaxy.";
var answer3="I don't know anything about Earth, but when I get out of prison I will hack into the Lens network and study your planet. I would be shocked if our computers, which are molecular-based, weren't far superior to yours. The entire galactic encyclopedia is stored on a tiny fraction of my wrist computer's memory; if that helps your small brain put things in perspective.";
var answer4="I don't have time for your illogical questions. These 'warts' as you call them allow me to survive for months without food. Can you do that? But look at you! The solar flares are clouding your transmission, but you look like you're missing an eye. Only two?";
var answer5="It is the foolish practice of cooling down stars so that planets orbiting them are more livable. Wait, the prison guard is coming … oh, yes, whatever. I cannot discuss starforming further with you. The guard said that Cogno's friend, 'Scribo' or whatever his name is sent stories to Earth that explain starforming. I don't care what Scribo says. Starforming is criminal and risky. Anyone who understands mathematics can see the danger!";
var answer6="Yes, I am. It is not bragging. It is simply the truth. There is little about computers that I do not know.";
var answer7="The definition of 'crime' varies greatly from planet to planet. Who knows what you consider a crime? I suspect that you have committed more crimes than I, and you have probably never even left your own planet!";
var answer8="";
var answer9="";
var answer10="";
var answer11="";
var endText="<b>Isagog session timed out: Lens resources reallocated to Kimmeroi Station subnet.</b>";
var delay=50;
var currentChar=1;
var destination="[not defined]";


function type()
{
  if (document.getElementById)
  {
    var dest=document.getElementById(destination);
    if (dest)// && dest.innerHTML)
    {
      dest.innerHTML=text.substr(0, currentChar);
      //dest.innerHTML+=text[currentChar-1];
      currentChar++
      if (currentChar>text.length)
      {
        currentChar=1;
         timer = setTimeout("endKimmeroiLink(endText, 0, 'textDestination')", 90000);
      }
      else
      {
         timer = setTimeout("type()", delay);
      }
    }
  }
}

function startTyping(textParam, delayParam, destinationParam)
{
  text=textParam;
  delay=delayParam;
  currentChar=1;
  destination=destinationParam;
  type();
}
function endKimmeroiLink(textParam, delayParam, destinationParam)
{
  text=textParam;
  delay=delayParam;
  currentChar=1;
  destination=destinationParam;
  MM_swapImage('status','','imwindow_images/status_f2.gif',1);
  MM_swapImage('signal','','imwindow_images/signal_f2.gif',1);
  MM_swapImage('subnet','','imwindow_images/subnet_f2.gif',1);
  MM_swapImage('video','','imwindow_images/video_f2.gif',1);
  type();
}
