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.jpg");
                about_over = newImage("images/about-over.jpg");
                calculators_over = newImage("images/calculators-over.jpg");
                contact_over = newImage("images/contact-over.jpg");
                listings_over = newImage("images/listings-over.jpg");
                buyer_over = newImage("images/buyer-over.jpg");
                seller_over = newImage("images/seller-over.jpg");
                neighborhoods_over = newImage("images/neighborhoods-over.jpg");
                schools_over = newImage("images/schools-over.jpg");
                triangle_over = newImage("images/triangle-over.jpg");
                payment_over = newImage("images/payment-over.jpg");
                /*mortgage_over = newImage("mortgage-over.jpg");*/

                map_02_over = newImage("mapimages/map_02-over.jpg");
                map_03_over = newImage("mapimages/map_03-over.jpg");
                map_06_over = newImage("mapimages/map_06-over.jpg");
                map_12_over = newImage("mapimages/map_12-over.jpg");
                
                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 */
    for(i=0;i<totalMLS;i++)
      {
       myPreload[i] = newImage(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 = 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()
    }
    

  /*********************************
  Amir Pirzadeh
  Tisfoon.com
  12/6/01
  *********************************/
  function OpenMap(map_addr, map_city, map_zip)
  {
     window.open("http://www.mapquest.com/cgi-bin/ia_free?width=500&height=500&level=8&streetaddress="+map_addr+"&city="+map_city+"&state=nc&zip="+map_zip, "Map", "location=no,scrollbars,resizable,height=500,width=500");
  }

  /*********************************
  04/22/03
  *********************************/
  function Open_CalcWindow(house_price)
  {
     window.open("http://shahla.com/mortgage_calculator.asp??branch=Mortgage&houseprice="+house_price, "", "location=no,scrollbars,height=500,width=400");
  }


