//---Parshley Computer Consulting, LLC

if (top.document.title!="Parshley Computer Consulting, LLC") {
  top.location="index.htm";
}

//-- ======= initialize image counter =========== --
var lastidx=0;
var numImages=5;
var timerID = null;

function reDisplay() {
  window.name="parshley";
  window.focus();
  randDisplay('ijpImage');
  randDisplay('lfpImage');
}


//--- set the image and its description (called from getDisplay()-see below)
 function picDisplay(Mimage, Mdesc, Mimgbox) {
    var MVimage=Mimage;
    var MVdesc=Mdesc;
    
    if (Mimgbox.substr(0,3)=="ijp") {
       document.ijpImage.src=MVimage;
       document.ijpImage.title=MVdesc;
    } else {
       document.lfpImage.src=MVimage;
       document.lfpImage.title=MVdesc;
    }  //---select image box
 }


//---select the indexed image to display 
  function getDisplay(Mrnd,imgbox) {
   var getRnd=Mrnd;
   if (imgbox.substr(0,3)=="ijp") { //--- IJP
     switch (getRnd) {
        case 0 : 
          picDisplay('ijp1.jpg','11/1997',imgbox);
          break;
        case 1 :
          picDisplay('ijp2.jpg','06/2000',imgbox);
          break;
        case 2 :
          picDisplay('ijp3.jpg','11/1997',imgbox);
          break;
        case 3 :
          picDisplay('ijp4.jpg','01/2004',imgbox);
          break;
        case 4 :
          picDisplay('ijp5.jpg','06/2006',imgbox);
          break;
        default :
          picDisplay('ijp5.jpg','06/2006',imgbox);
          break;
     }  //--- end of switch
   
   } else { //--- LFP
     switch (getRnd) {
        case 0 : 
          picDisplay('lfp1.jpg','04/1998',imgbox);
          break;
        case 1 :
          picDisplay('lfp2.jpg','10/1998',imgbox);
          break;
        case 2 :
          picDisplay('lfp3.jpg','03/2000',imgbox);
          break;
        case 3 :
          picDisplay('lfp4.jpg','03/2003',imgbox);
          break;
        case 4 :
          picDisplay('lfp5.jpg','04/2005',imgbox);
          break;
        default :
          picDisplay('lfp5.jpg','04/2005',imgbox);
          break;
     }  //--- end of switch

   } //--- select img box
  
  } //--- end of getDisplay()


//---select the next image
   function nextImage(Cimgbox) {
      clearInterval(timerID);
      var MVidx=lastidx;
      if (lastidx==numImages-1)
         MVidx=0;
      else
         MVidx=MVidx+1;
      
      lastidx=MVidx;
      getDisplay(MVidx,Cimgbox);
      setTimer();
   }


//---select the last image
   function lastImage(Cimgbox) {
      clearInterval(timerID);
      var MVidx=lastidx;
      if (lastidx==0)
         MVidx=numImages-1;
      else
         MVidx=MVidx-1;
      
      lastidx=MVidx;
      getDisplay(MVidx,Cimgbox);
   }


//---randomly select an image
   function randDisplay(Cimgbox) {
      clearInterval(timerID);
      var MVrnd=Math.round(Math.random()*numImages);
      if (MVrnd==lastidx) { 
         if (MVrnd>0)
            MVrnd=MVrnd-1;
         else
            MVrnd=MVrnd+1;
      }
      lastidx=MVrnd;
      getDisplay(MVrnd,Cimgbox);
      setTimer();
   }


//---select both next images
   function nextBoth() {
      var Nxt;
      clearInterval(timerID);
      var MVidx=lastidx;
      if (lastidx==numImages-1)
         MVidx=0;
      else
         MVidx=MVidx+1;
      
      lastidx=MVidx;
      getDisplay(MVidx,'ijpImage');
      getDisplay(MVidx,'lfpImage');
      setTimer();
   }

//---stop both images from cycling
   function stopImages() {
      clearInterval(timerID);
   }


   function setTimer(){
     timerID = setInterval("nextBoth()",8000)
   }


   function palmWindow(htmlName) {
      open(htmlName, "demo", "menubar=no,resizable=no,toolbar=no,scrollbars=no,height=390,width=340")
   }


   function copyrightyr() {
     brsrType=navigator.appName;
     brsrMSIE=(navigator.appName == "Microsoft Internet Explorer");
     brsrNS=(navigator.appName == "Netscape");
     var timestamp=document.lastModified;
     var timesecs=Date.parse(timestamp)
     var datetime=new Date();
     datetime.setTime(timesecs);
     if (brsrMSIE) {
        document.write(datetime.getYear());     
     } else {
        document.write(datetime.getYear()+1900);
     }
   }  // end of copyrightyr()


