


var timeDelay = 40; // change delay time in seconds
timeDelay *= 50;
var upcoming_index = 0;
var playing_index = 0;
var production_index = 0;
var counter = 1;
var current = new Image();

function startPix() {
    setInterval("slideshow()", timeDelay);
}

function slideshow() {
    if (counter == 4) {
        upcoming_index++;
        playing_index++;
        production_index++;
        counter = 1
    }
    if (playing_index == playing.length/2) {
        playing_index = 0;
    }
    if (upcoming_index == upcoming.length/2) {
        upcoming_index = 0;
    }
    if (production_index == production.length/2) {
        production_index = 0;
    }
    display();
    counter++;
}

function set_up () {
   document.getElementById('playing').src = playing[7][0];
   document.getElementById('upcoming').src = upcoming[0][0];
   document.getElementById('production').src = production[0][0]; 
   
   document.getElementById('playing_link').href = ('content.php?sel_page=' + playing[7][1]);
   document.getElementById('upcoming_link').href = ('content.php?sel_page=' + upcoming[0][1]);
   document.getElementById('production_link').href = ('content.php?sel_page=' + production[0][1]);
}


function display () {
  if (counter == 1) {
    current.src = playing[playing_index][0]; 
    document.getElementById('playing').src = current.src;
    document.getElementById('playing_link').href = ('content.php?sel_page=' + playing[playing_index][1]);  
  }
  if (counter == 2 ) {
      current.src = upcoming[upcoming_index][0]; 
      document.getElementById('upcoming').src = current.src;
      document.getElementById('upcoming_link').href = ('content.php?sel_page=' + upcoming[upcoming_index][1]);  
  }
  if (counter == 3 ) {
      current.src = production[production_index][0];
      document.getElementById('production').src = current.src;
      document.getElementById('production_link').href = ('content.php?sel_page=' + production[production_index][1]);  
  }
}

function showImage (id, my_array, element) {
    var current = new Image();
    current.src = my_array[id];
    document.getElementById(element).src = current.src; 
    clearSelected('selected');
    document.getElementById(id).className = 'selected';        
}

function clearSelected (theClass) {
    var allPageTags = new Array(); 
    var allPageTags = document.getElementsByTagName("a");
    for (i=0; i < allPageTags.length; i++) {
        if (allPageTags[i].className == theClass) {
            allPageTags[i].className = 'none';
        }
    }
} 














