var timerId = -1;
var interval = 12000;

var imageSrcArray = new Array(
    "./Bombay/manoj_nikh.jpg", 
    "./Bombay/manoj_rach_khy1.jpg", 
    "./Bombay/manoj_rach_vib.jpg", 
    "./Bombay/nikh_may_manoj2.jpg", 
    "./Bombay/nikh_nik.jpg", 
    "./Bombay/nikh_rach_gaurav.jpg", 
    "./Bombay/niku_riku.jpg", 
    "./Bombay/am_vibh_manoj.jpg",
    "./Bombay/manoj_nik.jpg",
    "./Bombay/am_vib_rach_nit_shrv1.jpg",
    "./Bombay/mm_an_rach_khy_am.jpg",
    "./Bombay/vib_manoj_nands.jpg",
    "./Bombay/vib_n_boys.jpg",
    "./Bombay/vib_urv_manoj.jpg",
    "./Bombay/vib_niki_rach_rik.jpg",
    "./Bombay/puns_nikh.jpg",
    "./Bombay/manoj_vib_pun.jpg",
    "./Bombay/rach_vib_nit.jpg"
    );

var imageNameArray = new Array(
    "To the Brotherhood",
    "Me Rachna and Khyati", 
    "Me Rachna and Vibhas",
    "The band of three", 
    "Nikhil and Nikita", 
    "Nikhil Rachna and Gaurav", 
    "The Married Couple", 
    "Amit Vibhas and Me", 
    "She's the best",
    "The Gang", 
    "Another Gang", 
    "Vibhas, Me and Nandini", 
    "At Urvi's", 
    "Vibhas Urvi and Me",
    "Uno Doe Tres Quatro",
    "Punita and Nikhil",
    "Me Vibhas and Punita",
    "Three great friends"
    );

var imageDescArray = new Array(
    "Nikhil and I - to the future I say! :)",
    "Celebrating friendships, old and new", 
    "Two people who made Bombay super - Vibhas and Rachna - if she smiles any harder, her jaw will pop out <wink>", 
    "The more brothers, the merrier - with or without colour, we're brilliant!", 
    "Nikhil with a beaming Nikita - she's happy again...", 
    "Can u take me higher...", 
    "Let's hope they hug like this five years into their marriage ;)",
    "Amit, Vibhas and I sharing a moment of levity", 
    "With Nikita, I'll let the picture tell the story!",
    "Amit, Vibhas, Rachna, Nitya and Shravan - inse bachhke rehna re baba!",
    "Amit and me flanking the girls - Aneesha, Rach and Khyati", 
    "Vibhas, Nandini and Me - To more revels like tonight!",
    "During the farewell at Urvi's - check out Vibhas' hat!",
    "Vibhas, Urvi and me soaking in the elements.",
    "The clash of ethnic and chic - Vibhas n Nikita Rach n Rikin",
    "All smiles for the camera - Punita dwarfed by Nikhil",
    "Geez, I got tired of smiling but Vibhas and Punita are naturals!",
    "Did we spare any combination of ppl? Vibhas Rach and Nitya pose - Flash!"
    );

var imageWidthArray = new Array(
    "552",
    "521",
    "630",
    "640",
    "528",
    "519",
    "594",
    "639",
    "640",
    "638",
    "622",
    "640",
    "614",
    "640",
    "640",
    "640",
    "637",
    "639"
    );

var imageHeightArray = new Array(
    "420",
    "477",
    "445",
    "480",
    "449",
    "441",
    "437",
    "420",
    "480",
    "394",
    "396",
    "455",
    "444",
    "480",
    "403",
    "480",
    "390",
    "432"
    );

var totalPictures = 18;
var currentPicture = 0;

function reverseshow() {
  if( timerId != -1) {
    window.clearInterval( timerId);
  }
  timerId = window.setInterval('previousImage();', interval);
}

function startshow() {
  if( timerId != -1) {
    window.clearInterval( timerId);
  }
  timerId = window.setInterval('nextImage();', interval);
}

function stopshow() {
  window.clearInterval( timerId);
  timerId = -1;
}

function loadCurrentPicture() {
  document.getElementById('image_title').innerHTML = 
    imageNameArray[ currentPicture];

  document.getElementById('image_desc').innerHTML = 
    imageDescArray[ currentPicture];
  
  /*
  document.getElementById('image_url').innerHTML = 
    "<img src=\"" + imageSrcArray[ currentPicture] + "\" width=" + imageWidthArray[ currentPicture] + " height=" + imageHeightArray[ currentPicture] + " class=\"photo\" name=mainimage />";
    */
  document.getElementById('image_url').innerHTML = 
    "<img class=\"photo\" src=\"" + imageSrcArray[ currentPicture] + 
    "\" width=" + imageWidthArray[ currentPicture] + 
    " height=" + imageHeightArray[ currentPicture] + 
    " name=mainimage title=\"" + 
    imageNameArray[ currentPicture] + "\"alt=\"" + 
    imageNameArray[ currentPicture] + "\"/>";
  //document.mainimage.src = imageSrcArray[ currentPicture];

}

function previousImage() {
  if ( currentPicture == 0) {
    currentPicture = totalPictures;
  } 

  currentPicture--;
  
  loadCurrentPicture();

}

function nextImage() {
  currentPicture++;
  if ( currentPicture == totalPictures) {
    currentPicture = 0;
  }
  
  loadCurrentPicture();
}

/*

function createTable() {
  currentPicture = 0;
  var isNS = ((navigator.appName.indexOf("Netscape") >=0) ? 1 : 0);
  var toReturn;
  if( isNS == 0 || isNS == 1) {
    
    toReturn = 
      '<td id=1 align="center"><br><font size="+1"><b>' + 
      imageNameArray[currentPicture] + '</b></font><p></td></tr>' +
      '<tr align="center" valign="middle"><td id=2><img src="' + 
      imageSrcArray[ currentPicture] + '" width="' + 
      imageWidthArray[ currentPicture] + '" height="' + 
      imageHeightArray[currentPicture] + 
      '" name=mainimage border=1 bgcolor="#000000"></td></tr>' +
      '<td id=3 align="center"><br><em>' + 
      imageDescArray[ currentPicture] + '</em><br></td></tr>';
    
  } else {
    width = 480; height = 360;
    if( currentPicture == 0) {
      width = 360; height = 480;
    }
    toReturn = '<td bgcolor="#ffffff"><img src="./images/bellybutton1.jpg" width="' + width + '" height="' + height + '" name=mainimage></td>';
  }
  //window.setInterval('nextImage();', interval);
  return toReturn;
}

*/
