
   function css(aString) { // This version is designed for using CSS formatting; no breaks applied internally
      if (aString != null) {
         window.document.write(aString)
      }
   }

   function w(aString) { // This version includes a break (<br>) at the end of every string, even if empty
      css(aString);
      window.document.write('<br>');
   }
    
  function asLocalURL() {    // returns the "local" part of an URL string
          return this.substring(this.lastIndexOf('/') + 1,this.length);
  }
 
  String.prototype.asLocalURL = asLocalURL;

  function frames(subpage){
     document.writeln('<frameset rows="80,*" frameborder="0" border="0" framespacing="0">');
     document.writeln('<frame src="Header.htm" name="header" scrolling=no>');
     document.writeln('<frameset cols="55%,45%">');
     w('<frameset rows="265,*" frameborder="0" border="0" framespacing="0">');
     document.writeln('<frame src="Resume.htm" name="main" scrolling=no>');
     w('<frame src="selectedaccomplishments.htm" name="accomplishments" scrolling="auto">');
     w('</frameset>');
     document.writeln('<frame src="'+ subpage +'" name="Details" scrolling=auto>');
     document.writeln('</frameset>');
     document.writeln('</frameset>');
  }

  var linksHidden = true;
  
  function checkKeyPress() { // check status of linksHidden and set links accordingly; also set keypress ha
     if (top.header.linksHidden) {
        hideLinks(window);
     }
     else showLinks(window);
     //var body = window.document.getElementsByTagName('body').item(0);
     //body.setAttribute('onkeydown','getKeyChar(event); return false;');
  }
  
  function detect() {// REVISED 3/17/04 to combine checklinks and former detect() functions
     //window.document.body.onkeydown = "getKeyChar(event);";
     detectNotInFrames();
     checkKeyPress();
  }

  function detectNotInFrames() {  // detect whether or not we are in proper frame configuration; if not, correct
     if (top.location !== self.location) { // We are in frames. Nothing more to do
       return;    // was return true
     }
     else { // We are not in frames; reload everything correctly
        framesetpage = "index.htm";
        currentpage = self.location.href;
        subpage = currentpage.asLocalURL(); // the subpage's url is after the last '/'
        if (top.location == self.location) {
           if (subpage == 'Resume.htm') {
              subpage = 'instructions.htm'; // was blank.htm
           }
           top.location.href = framesetpage + '?' + subpage; // Send the subpage url after the '?' in the addressline
        }
     }  
  }

  function centerWindow(myWin,windowWidth,windowHeight){// centers the parameter window on the screen, regardless of screen resolution
     var newTopLeftX = (screen.availWidth - windowWidth) / 2.0;
     var newTopLeftY = (screen.availHeight - windowHeight) / 2.0;
     if (!browserCheck()) { // That is, if not MSIE running under AOL
        myWin.moveTo(newTopLeftX,newTopLeftY);
     }
  }

  function browserCheck() {  // current version returns true if it's IE 4.0 for AOL
     version = navigator.appVersion;
     return (version.indexOf('AOL') != -1) && (version.indexOf('MSIE') != -1);
  }

  function messageBox(url,width,height){ // This method displays url page content in a messageBox centered on the screen
     var settings='toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width='+width+',height='+height+',left=0';
     messageBox = window.open(url,'MessageBox',settings);
     if (screen.availWidth) {
        centerWindow(messageBox,width,height);
     }
  }
  
  function showInstructions() {
     top.Details.location.href="instruction.htm";
  }
  
  // Event (key-press) functions for cross-platform portability. TAKEN FROM resumeKeypress.js

   function getPressedKeyIE() { // no event is passed as an argument, so we get it from the window
      var event = window.event;
      var pressedKey = event.keyCode;
      return pressedKey;
   }

   function getPressedKeyNS(e) { // e is the event
      return pressedKey = e.which;
   }

   var browserName;
   
   if (navigator.appName.indexOf('Microsoft') != -1) {
     getPressedKey = getPressedKeyIE;
     browserName = 'Microsoft';
   } else if (navigator.appName.indexOf('Netscape') != -1) {
          browserName = 'Netscape';
          getPressedKey = getPressedKeyNS;
     }

   function getKeyChar(e) {
      var pressedKey, event, pressedCharacter;
      pressedKey = getPressedKey(e);
      pressedCharacter = String.fromCharCode(pressedKey);
      pressedCharacter = pressedCharacter.toUpperCase();
      switch(pressedCharacter) {
         case "I":
            top.Details.location.href = 'instructions.htm';
         return false;
         case "L":
            toggleLinks();
         return false;
         case "T":
            //enterTransferMode();
         return false;
            default:
               switch(pressedKey) { // use decimal value
                  case 16: // Shift key
                  return false;
                  case 40: // down arrow
                  return false;
                  case 38: // up arrow
                  return false;
                  case 37: // left arrow
                  return false;
                  case 39: // right arrow
                  return false;
                  case 45: // minus ('-') for decrement
                  return false;
                  case 109: // because Mozilla seems to return 109 when it should return 45
                  return false;
                  case 61: // = for plus
                  return false;
                  case 40: // '('
                  return false;
                  case 41: // ')'
                  return false;
               }
            return false;
         }
      }

   linksHidden = true;

   function toggleLinks() { // make links visible or invisible
      top.header.linksHidden = !(top.header.linksHidden);
      linksHidden = top.header.linksHidden;
      if (linksHidden) {
         hideAllLinks();
      }
      else showAllLinks();
      return false; // to prevent text search?
   }

   function hideLinks(aWindow) {
      //if (!aWindow) return;
      linksHidden = true;
      var link;
  //    var linkColor;
      for (var i=0; i < aWindow.document.links.length; i++) {
         link = aWindow.document.links[i];
         link.style.textDecoration = 'none';
     //    linkColor = this.style.backgroundColor;
    //     link.onmouseover = "this.style.backgroundColor = '#F0FFFF'";
    //     link.onmouseout = "this.style.backgroundColor = linkColor";
      }
   }

   function underlineLink(aLink) {
      aLink.style.textDecoration = 'underline';
   }
   
   function showLinks(aWindow) {
      //if (!aWindow) return;
      linksHidden = false;
      var link;
      for (var i=0; i < aWindow.document.links.length; i++) {
         link = aWindow.document.links[i];
         underlineLink(link);
      }
   }

   myFrames = new Array(top.main,top.Header,top.accomplishments,top.Details); // the various frames

   function hideAllLinks() {
      for (var i=0; i < myFrames.length; i++) {
         if (myFrames[i]) hideLinks(myFrames[i]);
      }
   }

   function showAllLinks() {
      for (var i=0; i < myFrames.length; i++) {
         if (myFrames[i]) showLinks(myFrames[i]);
      }
   }

var mouseOverColor = 'AliceBlue';

function mouseOverColor(object) { // This could be more generally useful as mouseOverColor(color), but would require extensive repetition
   if (mouseOverColor) {  link.onmouseover = "this.style.textDecoration = 'underline'";
        object.onmouseover.color = mouseOverColor;
   }
   else object.style.color = 'AliceBlue';
}


