// start ehead
// Author  : webcentral@sco
// Date    : 28 October 2000
// Version : 1.0
// Purpose :
//      this script was provided by sabrina from the sco webpages as an example
//      of how timers can control layer visibility within web pages
// ----------------------------------------------------------------------------
// Update  : Robert Scott Elder  <scottel@beingboring.com>
// Date    : 4 November 2000
// Version : 1.1
// Purpose :
//      i removed a bit of the additional functionality specific to the SCO
//      configuration, and began to expand in areas related to my site.  some
//      additional location management features added.
//      also, i have integrated some of her work with 'sniffers', and update
//	the page according to browser type.
// ----------------------------------------------------------------------------
// Update  : Robert Scott Elder  <scottel@beingboring.com>
// Date    : 17 November 2000
// Version : 1.2
// Purpose :
//	script now sniffs browser type, and writes this informaion to a layer
//	in top left corner.  spooky.
// end ehead  

 //Define global variables

    var timerID = null;
    var timerOn = false;
    var timecount = 1000;
    var what = null;
    var newbrowser = true;
    var browserID = "unknown!";
    var check = false;
    var goAhead=false;

    var navY=0;
    var offY=0;
    var Yadjust=10;

    var navX=0;
    var offX=0;
    var Xadjust=10;

// BrowserCheck Object
 
function BrowserCheck() {
        var b = navigator.appName;
        if (b=="Netscape"){ this.b = "ns"; browserID = "netscape"; }
        else if (b=="Microsoft Internet Explorer"){ 
	   this.b = "ie"; browserID = "explorer"; }
        else { this.b = b; browserID = "unknown"; }
 
        this.version = navigator.appVersion;
        this.v = parseInt(this.version);

//	alert (this.b + " " + this.v );
 
        this.ns = (this.b=="ns" && this.v>=4);
        this.ns4 = (this.b=="ns" && this.v==4);
	  if ( this.ns4 ) browserID = browserID + " 4";
        this.ns5 = (this.b=="ns" && this.v==5);
	  if ( this.ns5 ) browserID = browserID + " 5";
	this.ns6 = (this.b=="ns" && this.v==6);
	  if ( this.ns6 ) browserID = browserID + " 6";
 
        this.ie = (this.b=="ie" && this.v>=4);
        this.ie4 = (this.version.indexOf('MSIE 4')>0);
	  if ( this.ie4 ) browserID = browserID + " 4";
        this.ie5 = (this.version.indexOf('MSIE 5')>0);
	  if ( this.ie5 ) browserID = browserID + " 5";

        this.min = (this.ns||this.ie);
          if ( !this.min ) browserID = "unsupported";
}
 
is = new BrowserCheck();


 function kitchenSinkInit(){
   //alert ("Running Init");
   if (is.ns4) {
   //alert ("Running Netscape 4");
     layerRef="document.layers";
     styleSwitch="";
     visibleVar="show";
     sreenSize = window.innerWidth;
     what ="ns4";

    }else if(is.ns5 || is.ns6){
//   alert ("Running Netscape 6");
     layerRef="document.getElementByID";
     styleSwitch="new";
     visibleVar="visible";
     what="ns5+";

   }else if(is.ie){
     alert ("hi.. um, you seem to be running explorer.\n"
      + "that's fine, i promise not to call you any names...\n\n"
      + "however, i must provide the following disclaimer:\n"
      + "due to my primary development environment (linux),\n"
      + "the stylesheets and scripting for the look & feel of\n"
      + "these pages have been built and tested with netscape.\n\n"
      + "I *am* working to make them function appropriately\n"
      + "with explorer, but IMHO, this is simply a lower priority.\n\n"
      + "maybe, someday, this error message will only load\n"
      + "once per visit; however, i haven't yet figured out how\n"
      + "to do that either.  ;)\n\n"
      + "sorry...  scottel" );
     layerRef="document.all";
     styleSwitch=".style";
     visibleVar="visible";
     screenSize = document.body.clientWidth + 18;
     what ="ie";

    }else{
     alert("Older than 4.0 browser.");
     what="none";
     newbrowser = false;
    }
		  
    window.status='experimental - beingboring';
    check = true;

 
  // update window with appropriate browser information ;)

    showLayer("sniffer");
 }



// Turns the layers on and off
 function showLayer(layerName){  //(layerName,yval,xval)
   yval = navY;
   xval = navX;
   if(check){
     if (what =="none"){
 	return;
     }
     else if (what == "ns5+"){
    	document.getElementById(layerName).style.visibility="visible";
     }else{
        eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
        eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.top=yval');
        eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.left=xval');   
    }
   }else{// alert ("Please wait for the page to finish loading.");
      return;}
 }



 function hideLayer(layerName){
   if(check){
     if (what =="none"){
       return;
     }else if (what == "ns5+"){
       document.getElementById(layerName).style.visibility="hidden";
     }else{
       eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');
     }
   }else{// alert ("Please wait for the page to finish loading.");
     return;}
 }


  function hideAll(){
     hideLayer('scooters');
     hideLayer('projects');
     hideLayer('links');
     activeSub=0;
  }


  function startTime() {
    if (timerOn == false) {
      timerID=setTimeout( "hideAll()" , timecount);
      timerOn = true;
    }
  }

  function stopTime() {
    if (timerOn) {
       clearTimeout(timerID);
       timerID = null;
       timerOn = false;
    }
  }

  // Spots the mouse location to locate menus
  function getMouse(evt){
     prevY = navY;
     prevX = navX;
 
     if (navigator.appName == "Netscape"){
         navY = evt.pageY;
         navX = evt.pageX;
     } else {
         navY = 131 + event.offsetY;
         offY = event.offsetY;
 
         navX = 0 + event.offsetX;
         offX = event.offsetX;
     }
  }

  // Turns on the Sub levels
//  function turnOnSub(subname){
//    activeSub= subname;
//    //topBox = nav_Y - 30 + Yadjust;
//    topBox = nav_Y + Yadjust;
//    leftBox = nav_X + Xadjust;
//    showLayer(activeSub);//, topBox, leftBox);
//  }   
 
  // Turns off the Sub levels
//  function turnOffSub() {
//    if (activeSub) {
//       hideLayer(activeSub);
//       activeSub = 0;
//    }
//  }
 
  //Timers on and off
//  function startTime() {
//    if (timerOn == false) {
//      timerID=setTimeout( "turnOffSub()" , timecount);
//      timerOn = true;
//    }
//  } 


function verifyReqs(){
  var html;

  var nwintop=((screen.availHeight-464)/2)-14;
  if (screen.width<760 || screen.height<540) {
        html="This website requires a display resolution of at least<br><b>768</ b> x <b>540</b>.";
        html+="<p>The resolution of your display appears to be <br><b>"+screen.width+"</b> x <b>"+screen.height+"</b>.";
  } else {
        goAhead = true;
        html="click <a href=\"#\" onmouseover=\"window.status=\'enter\'\" onmouseout=\"window.status=\' \'\" onclick=\"if(goAhead)launchcat(); return false\">here</a> to enter";
  }

}

function openWin(words) {
   return window.open('../scooter/main.phtml', 'mn_main', words);
}

function openSB() {
        argstring = 'width=760,height=464,resizable=0,toolbar=0,location=0,directories=0,status=1,menuBar=0,scrollBars=0';
        scooterBrowser = openWin(argstring);

        scooterBrowser.focus();
        self.location="scooters.html";
}

 
 function onLoad(){
    kitchenSinkInit();
 }


// from here on out, we will simply flush out the layers.. fun!


if (document.layers || document.all || document.getElementById){

    //defineLayers();
    document.write("<STYLE TYPE='text/css'>");

    // these layers are created to define the meta info...
    document.write("#sniffer {POSITION: absolute; Z-INDEX: 1; VISIBILITY: hidden; LEFT: 0px; TOP: 0px; WIDTH:100px;}");

    // these are my actual 'active' layers...
    document.write("#scooters {POSITION: absolute; Z-INDEX: 10; VISIBILITY: hidden; LEFT: 0px; TOP: 0px; WIDTH:100px;}");
    document.write("#projects {POSITION: absolute; Z-INDEX: 20; VISIBILITY: hidden; LEFT: 0px; TOP: 0px; WIDTH:100px;}");
    document.write("#links {POSITION: absolute; Z-INDEX: 30; VISIBILITY: hidden; LEFT: 0px; TOP: 0px; WIDTH:100px;}");
    document.write(" ");
    document.write(" ");

    // done defining layers...
    document.write("</STYLE>");



    // these layers are created to define the meta info...
    document.write("<DIV ID='sniffer'>");
    document.write("<table width='400' border='0' cellpadding='0'>");
    document.write("<tr><td>browser: " + browserID + "</td></tr>"); 
    document.write("<tr><td>platform:</td></tr>");
    document.write("</table> ");
    document.write(" ");
    document.write("</DIV>");

  //and these are my menu layers...

document.write("<div id='scooters'>");
document.write("  <table  width=100 border='0' cellspacing='0' cellpadding='0' bgcolor='#FF6600'>");
document.write("    <tr>");
document.write("      <td bgcolor='black' colspan='3'><img src='../images/spacer.gif' width=100 height=2 alt='' border='0'></td>");
document.write("    </tr>");
document.write("    <tr> ");
document.write("      <td bgcolor='black' width='1'><img src='../images/spacer.gif' width=1 height=2 alt='' border='0'></td>");
document.write("      <td width='98'><img src='../images/spacer.gif' width=1 height=3 alt='' border='0'></td>");
document.write("      <td bgcolor='black' width='1'><img src='../images/spacer.gif' width=1 height=2 alt='' border='0'></td>");
document.write("    </tr>");
document.write("");
document.write("    <tr> ");
document.write("      <td bgcolor='black' width='1'>");
document.write("	  <img src='../images/spacer.gif' width=1 height=2 alt='' border='0'>");
document.write("	</td>");
document.write("      <td width='98' align='left' nowrap>");
document.write("         &nbsp;&nbsp;<a href='scooters.html' class='small' onmouseover='stopTime();' onmouseout='startTime();'>introduction</a><br>");
document.write("         &nbsp;&nbsp;<a href='scooters.html' class='small' onmouseover='stopTime();' onmouseout='startTime();' onclick='alert (" + '"warning: under construction"' + "); openSB(); return false'>my collection</a><br>");
document.write("         &nbsp;&nbsp;<a href='.' class='small' onmouseover='stopTime();' onmouseout='startTime();'>misc...</a><br>");
document.write("      </td>");
document.write("      <td bgcolor='black' width='1'>");
document.write("	  <img src='../images/spacer.gif' width=1 height=2 alt='' border='0'>");
document.write("	</td>");
document.write("    </tr>");
document.write("");
document.write("    <tr>");
document.write("      <td bgcolor='black' width='1'><img src='../images/spacer.gif' width=1 height=2 alt='' border='0'></td>");
document.write("      <td width='98'><img src='../images/spacer.gif' width=1 height=3 alt='' border='0'></td>");
document.write("      <td bgcolor='black' width='1'><img src='../images/spacer.gif' width=1 height=2 alt='' border='0'></td>");
document.write("    </tr>");
document.write("");
document.write("    <tr>");
document.write("      <td bgcolor='black' colspan='3'><img src='../images/spacer.gif' width=100 height=2 alt='' border='0'></td>");
document.write("    </tr>");
document.write("  </table>");
document.write("</div>");
document.write("");
document.write("  <div id='links'> ");
document.write("    <table  width=100 border='0' cellspacing='0' cellpadding='0' bgcolor='#FF6600'>");
document.write("      <tr>");
document.write("        <td bgcolor='black' colspan='3'><img src='../images/spacer.gif' width=100 height=2 alt='' border='0'></td>");
document.write("      </tr>");
document.write("");
document.write("      <tr> ");
document.write("        <td bgcolor='black' width='1'><img src='../images/spacer.gif' width=1 height=2 alt='' border='0'></td>");
document.write("        <td width='98'><img src='../images/spacer.gif' width=1 height=3 alt='' border='0'></td>");
document.write("        <td bgcolor='black' width='1'><img src='../images/spacer.gif' width=1 height=2 alt='' border='0'></td>");
document.write("      </tr>");
document.write("");
document.write("      <tr> ");
document.write("        <td bgcolor='black' width='1'>");
document.write("	  <img src='../images/spacer.gif' width=1 height=2 alt='' border='0'>");
document.write("	</td>");
document.write("        <td width='98' align='left'>");
document.write("          &nbsp;&nbsp;");
document.write("	  <a class='small' href='http://www.imagetheory.com' target='new' onmouseover='stopTime();' onmouseout='startTime();'>imagetheory.com</a>");
document.write("	  <br>");
document.write("          &nbsp;&nbsp;");
document.write("	  <a class='small' href='http://www.pocketpig.com' target='new' onmouseover='stopTime();' onmouseout='startTime();'>pocketpig.com</a>");
document.write("	  <br>");
document.write("          &nbsp;&nbsp;");
document.write("	  <a class='small' href='http://www.affe.org' target='new' onmouseover='stopTime();' onmouseout='startTime();'>affe.org</a>");
document.write("	  <br>");
document.write("          &nbsp;&nbsp;");
document.write("	  <a class='small' href='http://www.explodingdog.com' target='new' onmouseover='stopTime();' onmouseout='startTime();'>explodingdog.com</a>");
document.write("	  &nbsp; ");
document.write("        </td>");
document.write("        <td bgcolor='black' width='1'>");
document.write("	  <img src='../images/spacer.gif' width=1 height=2 alt='' border='0'>");
document.write("	</td>");
document.write("      </tr>");
document.write("");
document.write("      <tr>");
document.write("        <td bgcolor='black' width='1'><img src='../images/spacer.gif' width=1 height=2 alt='' border='0'></td>");
document.write("        <td width='98'><img src='../images/spacer.gif' width=1 height=3 alt='' border='0'></td>");
document.write("        <td bgcolor='black' width='1'><img src='../images/spacer.gif' width=1 height=2 alt='' border='0'></td>");
document.write("      </tr>");
document.write("");
document.write("      <tr>");
document.write("        <td bgcolor='black' colspan='3'><img src='../images/spacer.gif' width=100 height=2 alt='' border='0'></td>");
document.write("      </tr>");
document.write("    </table>");
document.write("  </div>");
document.write("");
document.write("");
document.write("  <div id='projects'> ");
document.write("    <table  width=100 border='0' cellspacing='0' cellpadding='0' bgcolor='#FF6600'>");
document.write("      <tr>");
document.write("        <td bgcolor='black' colspan='3'><img src='../images/spacer.gif' width=100 height=2 alt='' border='0'></td>");
document.write("      </tr>");
document.write("");
document.write("      <tr> ");
document.write("        <td bgcolor='black' width='1'><img src='../images/spacer.gif' width=1 height=2 alt='' border='0'></td>");
document.write("        <td width='98'><img src='../images/spacer.gif' width=1 height=3 alt='' border='0'></td>");
document.write("        <td bgcolor='black' width='1'><img src='../images/spacer.gif' width=1 height=2 alt='' border='0'></td>");
document.write("      </tr>");
document.write("");
document.write("      <tr> ");
document.write("        <td bgcolor='black' width='1'>");
document.write("	  <img src='../images/spacer.gif' width=1 height=2 alt='' border='0'>");
document.write("	</td>");
document.write("        <td width='98' align='left'>");
document.write("          &nbsp;&nbsp;");
document.write("	  <a class='small' href='http://www.imagetheory.com' target='new' onmouseover='stopTime();' onmouseout='startTime();'>cinema (imagetheory)</a>");
document.write("	  <br>");
document.write("          &nbsp;&nbsp;");
document.write("	  <a class='small' href='.' onmouseover='stopTime();' onmouseout='startTime();'>2D sketches</a>");
document.write("	  <br>");
document.write("          &nbsp;&nbsp;");
document.write("	  <a class='small' href='.' onmouseover='stopTime();' onmouseout='startTime();'>3D modeling</a>");
document.write("	  &nbsp; ");
document.write("        </td>");
document.write("        <td bgcolor='black' width='1'>");
document.write("	  <img src='../images/spacer.gif' width=1 height=2 alt='' border='0'>");
document.write("	</td>");
document.write("      </tr>");
document.write("");
document.write("      <tr>");
document.write("        <td bgcolor='black' width='1'><img src='../images/spacer.gif' width=1 height=2 alt='' border='0'></td>");
document.write("        <td width='98'><img src='../images/spacer.gif' width=1 height=3 alt='' border='0'></td>");
document.write("        <td bgcolor='black' width='1'><img src='../images/spacer.gif' width=1 height=2 alt='' border='0'></td>");
document.write("      </tr>");
document.write("");
document.write("      <tr>");
document.write("        <td bgcolor='black' colspan='3'><img src='../images/spacer.gif' width=100 height=2 alt='' border='0'></td>");
document.write("      </tr>");
document.write("    </table>");
document.write("  </div>");
}

