myPix = new Array(
  "tusimages/image0.gif",
  "tusimages/image1.gif",
  "tusimages/image2.gif",
  "tusimages/image3.gif",
  "tusimages/image4.gif",
  "tusimages/image5.gif",
  "tusimages/image6.gif");
  
myAlt = new Array(
  "Custom Software Design",
  "Industrial Machinery Automation",
  "locoMotion",
  "Motion Engineering, Inc.",
  "Web Page Design",
  "Machine Vision",
  "Database Design");
  
myURL = new Array(
  "customsoftware.html",
  "industrialmachinery.html",
  "locomotion.html",
  "motionengineering.html",
  "webpagedesign.html",
  "machinevision.html",
  "database.html");
  
myVisits = new Array(
  false,
  false,
  false,
  false,
  false,
  false,
  false);

myPreload = new Array();

imgCt = myPix.length; 
imgShow = -1;
pauseSlide = false;
randomNum = Math.floor((Math.random() * imgCt));
totalMLS = 0;
currentMLS = 0;
MLSNo = 0;

/**************************
**************************/
function newImage(arg) {
        if (document.images) {
                rslt = new Image();
                rslt.src = arg;
                return rslt;
        }
}

/**************************
**************************/
function changeImages() {
        if (document.images && (preloadFlag == true)) {
                for (var i=0; i<changeImages.arguments.length; i+=2) {
                        document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
                }
        }
}

/**************************
**************************/
var preloadFlag = false;
function preloadImages() {
        if (document.images) {
                home_over = newImage("images/home-over.gif");
                about_over = newImage("images/about-over.gif");
                contact_over = newImage("images/contact-over.gif");
                inventory_over = newImage("images/inventory-over.gif");
                back_over = newImage("images/back-over.gif");
                back_main = newImage("images/back.gif");
                
                preloadFlag = true;
        }
}

/*********************************
Amir Pirzadeh
Tisfoon.com
1/6/2000

if all images are shown, then will
reset the marker so that they are
reshown
*********************************/
function checkAllShown()
  {
  for(i=0;i<imgCt;i++)
    if(myVisits[i] == false)
      return false;
      
  for(i=0;i<imgCt;i++)
    myVisits[i] = false;
    
  return true;
  }

/*********************************
Amir Pirzadeh
Tisfoon.com
1/6/2000
*********************************/
function getNewRandomKiosk(oldRandomNum) 
  {
  checkAllShown();
  
  firstIt = true;
  
  while(firstIt || (myVisits[aRandomNum] == true) || (aRandomNum == oldRandomNum))
    {
    aRandomNum = Math.floor((Math.random() * imgCt));
    firstIt = false;
    }
    
  myVisits[aRandomNum] = true;
    
  return aRandomNum;
  }
  
/*********************************
Amir Pirzadeh
Tisfoon.com
1/6/2000
*********************************/
function showRandomKiosk() 
  {
  if(document.images)
    {
    imgShow = randomNum;
    
    document.Kiosk.src = myPix[imgShow];
    document.Kiosk.alt = myAlt[imgShow];
    myVisits[imgShow] = true;
    
    if(document.Kiosk.complete && !pauseSlide)
      randomNum = getNewRandomKiosk(imgShow);
    
    setTimeout("showRandomKiosk()", 3000);
    }
  }
  
/*********************************
Amir Pirzadeh
Tisfoon.com
1/6/2000
*********************************/
function showKiosk() 
  {
  if(document.images)
    {
    if(document.Kiosk.complete && !pauseSlide)
      {
      imgShow = (imgShow + 1) % imgCt
      document.Kiosk.src = myPix[imgShow];
      document.Kiosk.alt = myAlt[imgShow];
      }
      
    setTimeout("showKiosk()", 5000);
    }
  }
  
/*********************************
Amir Pirzadeh
Tisfoon.com
1/6/2000
*********************************/
function showMLS(t_totalMLS, t_MLSNo) 
  {
  if(document.images)
    {
    totalMLS = t_totalMLS;
    currentMLS = 0;
    MLSNo = t_MLSNo;

    /* Preload Images */
    if (document.images) 
      {
      for(i=0;i<totalMLS;i++)
        {
         myPreload[i] = newImage();
         myPreload[i].src = "id/" + MLSNo + "/" + i + ".jpg";
        }
      }

    setTimeout("showMLS2()", 3000);
    }
  }
  
/*********************************
Amir Pirzadeh
Tisfoon.com
1/6/2000
*********************************/
function showMLS2() 
  {
  if(document.images)
    {
    if(document.Kiosk.complete && !pauseSlide)
      {
      currentMLS = (currentMLS + 1) % totalMLS;
      document.Kiosk.src = "id/" + MLSNo + "/" + currentMLS + ".jpg"; 
      }
      
    setTimeout("showMLS2()", 3000);
    }
  }
  
/*********************************
Amir Pirzadeh
Tisfoon.com
1/6/2000
*********************************/
function ChangeSlide(aNum) 
  {
  if(document.images)
    {
    if(document.Kiosk.complete)
      {
      imgShow = aNum;
      document.Kiosk.src = myPix[imgShow];
      document.Kiosk.alt = myAlt[imgShow];
      pauseSlide = true;
      }
    }
  }
  
/*********************************
Amir Pirzadeh
Tisfoon.com
1/6/2000
*********************************/
function ResumeSlides()
  {
  pauseSlide = false;
  }
  
/*********************************
Amir Pirzadeh
Tisfoon.com
1/6/2000
*********************************/
function newLocation()
  {
  document.location.href = myURL[imgShow];
  }
  











  JulMonth = 1;
  JulDay = 5;
  JulYear = 2000;
  
  JulMonthName = new Array(
    "January",
    "February",
    "March",
    "April",
    "May",
    "June",
    "July",
    "August",
    "September",
    "October",
    "November",
    "December");
  
  /*********************************
  Amir Pirzadeh
  Tisfoon.com
  1/6/2000
  *********************************/
  function UpdateJul()
    {
    now = new Date;
    
    JulMonth = now.getMonth() + 1;
    JulDay = now.getDate();
    JulYear = now.getFullYear();
    
    return JulDay.toString() + ' ' + 
           JulMonthName[JulMonth - 1] + ' ' +
           JulYear.toString();
    }
  
  /*********************************
  Amir Pirzadeh
  Tisfoon.com
  1/6/2000
  *********************************/
  function UpdateTime()
    {
    now = new Date;
    
    return now.getHours() + ':' + now.getMinutes() + ':' + now.getSeconds()
    }
    

