var img_sources = new Array(
	"../img/slideshow/business/1.jpg",
	"../img/slideshow/business/2.jpg",
	"../img/slideshow/business/3.jpg",
	"../img/slideshow/business/4.jpg",
	"../img/slideshow/business/5.jpg",
	"../img/slideshow/business/6.jpg",
	"../img/slideshow/business/7.jpg"
	);	
	
var img_text = new Array(
  	"Students visit Barbaritos for the Production/Operations Management course",
	"Students visit Barbaritos for the Production/Operations Management course",
	"Students visit Barbaritos for the Production/Operations Management course",
	"MBA students learn about Operations and Technology as they visit American Water Heater Division of A.O. Smith in Johnson City",
	"MBA students learn about Operations and Technology as they visit American Water Heater Division of A.O. Smith in Johnson City",
	"MBA students learn about Operations and Technology as they visit American Water Heater Division of A.O. Smith in Johnson City",
	"MBA students learn about Operations and Technology as they visit American Water Heater Division of A.O. Smith in Johnson City"
	);

var counter = 0;
var fadeValue = 0;
var fadeInInterval;
var fadeOutInterval;
var imgStopInterval;

function nextImg()
{
	if(counter == img_sources.length)
	  counter = 0;
	document.getElementById("slide").src = img_sources[counter];
	document.getElementById("slideText").innerHTML = img_text[counter];
	counter++;
	if (navigator.appName.indexOf("Microsoft")!= -1  && parseInt(navigator.appVersion)>=4)
      document.getElementById("slide").filters.alpha.opacity=0;
    else
    {
      document.getElementById("slide").style.MozOpacity=0.0;
    }
	fadeInInterval = setInterval("fadeIn(document.getElementById(\"slide\"))", 30);	
}

function prevImg()
{
	if(counter == 0)
		counter = img_sources.length - 1;
    counter--;
	document.getElementById("slide").src = img_sources[counter];
	document.getElementById("slideText").innerHTML = img_text[counter];
}

function fadeIn(img)
{
  if (navigator.appName.indexOf("Microsoft")!= -1  && parseInt(navigator.appVersion)>=4)
  {
    img.filters.alpha.opacity=fadeValue;
  }
  else
  {
    img.style.MozOpacity=fadeValue/100;    
  }
  fadeValue += 2;
  if(fadeValue == 100)
  {
     clearInterval(fadeInInterval);
     //fadeOutInterval = setInterval("fadeOut(document.getElementById(\"slide\"))", 30);
     imgStopInterval = setInterval("imgStop()", 2000);
  }
}

function fadeOut(img)
{
  if (navigator.appName.indexOf("Microsoft")!= -1  && parseInt(navigator.appVersion)>=4)
  {
    img.filters.alpha.opacity=fadeValue;
  }
  else
  { 
      img.style.MozOpacity=fadeValue/100;
  }
  fadeValue -= 2;
  if(fadeValue == 0)
  {
    clearInterval(fadeOutInterval);
    nextImg();
  }
}

function imgStop()
{
  clearInterval(imgStopInterval);
  fadeOutInterval = setInterval("fadeOut(document.getElementById(\"slide\"))", 30);
}


function playSlideShow() {
   nextImg();	
}