var img_sources = new Array(
	"img/slideshow/home/1.jpg",
	"img/slideshow/home/2.jpg",
	"img/slideshow/home/3.jpg",
	"img/slideshow/home/4.jpg",
	"img/slideshow/home/5.jpg",
	"img/slideshow/home/6.jpg",
	"img/slideshow/home/7.jpg",
	"img/slideshow/home/8.jpg"
	);
	
var img_text = new Array(
  	"Organizational Behavior and Management taught by Dr. Tom Moore",
	"Dr. Phillip E. Miller, Ph. D., Department Chair, discusses options with departmental student worker",
	"Dr. Phillip E. Miller, Ph. D., Department Chair, works at computer-related options in MGMT/MKTG",
	"Dr. Swinehart answers student questions regarding Production/Operations Management",
	"Dr. Beichen Liang teaching Principles of Marketing",
	"Dr. Joel Ryman interacting with students in Policy/Strategy Formulation",
	"Dr. Craig Turner and MBA students in Strategic Management Process",
	"Marketing Management with Dr. Kelly Price includes aspects in virtual marketing"
	);

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();	
}