﻿// JScript File
var imagePath = "slideshow/"
src = [imagePath + "Resources.jpg", imagePath + "Slideshow2.jpg", imagePath + "Slideshow3.jpg", imagePath + "Slideshow4.jpg", imagePath + "Services.jpg", imagePath + "Partners.jpg", imagePath + "Privacy.jpg"]
//set duration for each image
duration = 4;

//Please do not edit below
ads=[]; 
ct=0;

function switchAd(pSourceName) {
//set image paths
var n=(ct+1)%src.length;

if (pSourceName != "IMSC Home")
    setImageSource(pSourceName); 
else
{       
    if (ads[n] && (ads[n].complete || ads[n].complete==null)) {
    document["Ad_Image"].src = ads[ct=n].src;
    }
    ads[n=(ct+1)%src.length] = new Image;
    ads[n].src = src[n];
    setTimeout("switchAd('" + pSourceName + "')",duration*1200);
}
}
function setImageSource(pageTitle) {
  var imgObj = document.getElementById("Ad_Image");

  if (pageTitle == "IMSC Home")
      imgObj.src = imagePath + "Resources.jpg";
  else if (pageTitle == "IMSC Our Services")
      imgObj.src = imagePath + "Services.jpg";    
  else if (pageTitle == "IMSC About Us")
      imgObj.src = imagePath + "AboutUs.jpg";
  else if (pageTitle == "IMSC Biographies")
      imgObj.src = imagePath + "Partners.jpg";
  else if (pageTitle == "IMSC Contact Us")
      imgObj.src = imagePath + "Slideshow1.jpg";
  else if (pageTitle == "IMSC Business Solutions")
      imgObj.src = imagePath + "Slideshow1.jpg";     
  else if (pageTitle == "IMSC Careers")
      imgObj.src = imagePath + "Slideshow2.jpg";                   
  else if (pageTitle == "IMSC Privacy")
      imgObj.src = imagePath + "Privacy.jpg";
  else
      imgObj.src = imagePath + "Privacy.jpg";    
}
