/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Created by: Lee Underwood :: http://javascript.internet.com/ */

var menuPageImg = new Array();
var homePageImg = new Array();
var historyPageImg = new Array();
  // Enter the names of the images below
  homePageImg[0] = "Pics/Summer Vaca and Franklin Grill 1.jpg";
  homePageImg[1] = "Pics/Summer Vaca and Franklin Grill 3.jpg";
  homePageImg[2] = "Pics/Summer Vaca and Franklin Grill 8.jpg";
  homePageImg[3] = "Pics/Summer Vaca and Franklin Grill 12.jpg";
  homePageImg[4] = "Pics/Summer Vaca and Franklin Grill 6.jpg";
  
  historyPageImg[0] = "Pics/Summer Vaca and Franklin Grill 5.jpg";
  historyPageImg[1] = "Pics/Summer Vaca and Franklin Grill 7.jpg";
  historyPageImg[2] = "Pics/Summer Vaca and Franklin Grill 8.jpg"
  historyPageImg[3] = "Pics/Summer Vaca and Franklin Grill 9.jpg";
  historyPageImg[4] = "Pics/Summer Vaca and Franklin Grill 1.jpg";
  historyPageImg[5] = "Pics/Summer Vaca and Franklin Grill 2.jpg";
  historyPageImg[6] = "Pics/Summer Vaca and Franklin Grill 3.jpg";

  
  // Enter the names of the images below
  menuPageImg[0]="Pics/Summer Vaca and Franklin Grill 16.jpg";
  menuPageImg[1]="Pics/Summer Vaca and Franklin Grill 14.jpg";
  menuPageImg[2]="Pics/Summer Vaca and Franklin Grill 13.jpg";
  menuPageImg[3]="Pics/Summer Vaca and Franklin Grill 15.jpg";
  menuPageImg[4]="Pics/Summer Vaca and Franklin Grill 12.jpg";
  menuPageImg[5]="Pics/Summer Vaca and Franklin Grill 11.jpg";
  menuPageImg[6]="Pics/Summer Vaca and Franklin Grill 14.jpg";
  menuPageImg[7]="Pics/Summer Vaca and Franklin Grill 17.jpg";
  menuPageImg[8]="Pics/Summer Vaca and Franklin Grill 6.jpg";
  
var textRotating = new Array();
  textRotating[0] = "Surely not like my mothers. Love your \'gourmet\' meatloaf - it is truly a comfort food! --Chris, Farmington Hills";
  textRotating[1] = "Going to The Franklin Grill on Friday\'s for Fish and Chips is becoming a tradition in our family. Thanks for being here. --Dennis, Village of Franklin";
  textRotating[2] = "We come here after work to unwind for drinks and appetizers. It reminds me of Cheers because the staff is so friendly and the...Clarkston";
  textRotating[3] = "It\'s hard to perfect lamb chops, but Chef Matthews is a master. If you are going to eat here they are phenomenal! --Lee, Fraser, Michigan"; 

var newBanner = 0;
var newText = 0;
var totalBan = menuPageImg.length;
var totalHomePageBan = homePageImg.length;
var totalHistoryPageBan = historyPageImg.length;
var totalText = textRotating.length;

function init() {
 var page;
  page =  document.getElementById("page").value;
  // alert("value " + page);
  if(page=="homepage") {
   // alert("here");
    cycleHomePageBan();
    newText = 0;
  } else if(page=="history") {
    cycleHistoryPageBan();
    newText = 1;
  } else if(page=="menu") {
    cycleMenuBan();    
    newText = 2;
  }
  
   //cycleText();
}


function cycleMenuBan() {
  newBanner++;
  if (newBanner >= totalBan) {
    newBanner = 0;
  }
  document.banner.src=menuPageImg[newBanner];
  // set the time below for length of image display
  // i.e., "4*1000" is 4 seconds
  setTimeout("cycleMenuBan()", 4*1000);
}

function cycleHomePageBan() {
  newBanner++;
  if (newBanner >= totalHomePageBan) {
    newBanner = 0;
  }
  document.banner.src=homePageImg[newBanner];
  // set the time below for length of image display
  // i.e., "4*1000" is 4 seconds
  setTimeout("cycleHomePageBan()", 4*1000);
}

function cycleHistoryPageBan() {
  newBanner++;
  if (newBanner >= totalHistoryPageBan) {
    newBanner = 0;
  }
  document.banner.src=historyPageImg[newBanner];
  // set the time below for length of image display
  // i.e., "4*1000" is 4 seconds
  setTimeout("cycleHistoryPageBan()", 4*1000);
}

function cycleText() {
  newText++;
  if(newText == totalText) {
    newText = 0;
  }
  
  document.getElementById('rotText').innerHTML = textRotating[newText];
  setTimeout("cycleText()", 8*1000);
}

window.onload=init;
