var totalPhotos = 11;
var currentPhoto = 1;
var directory;
var blankPhoto = '../images/blank.jpg';

function loadPhotos()
{
  photoInit('portfolio/wedding_photos');
  photoInit('portfolio/portrait_photos');
  photoInit('portfolio/fashion_photos');
}

function photoInit(dir)
{
  directory = dir;
  load();
}

function load()
{
   this[0] = new Image();
   this[0].src = directory + '/' + '1.jpg';
   this[1] = new Image();
   this[1].src = directory + '/' + '2.jpg';
   this[2] = new Image();
   this[2].src = directory + '/' + '3.jpg';
   this[3] = new Image();
   this[3].src = directory + '/' + '4.jpg';
   this[4] = new Image();
   this[4].src = directory + '/' + '5.jpg';
   this[5] = new Image();
   this[5].src = directory + '/' + '6.jpg';
   this[6] = new Image();
   this[6].src = directory + '/' + '7.jpg';
   this[7] = new Image();
   this[7].src = directory + '/' + '8.jpg';
   this[8] = new Image();
   this[8].src = directory + '/' + '9.jpg';
   this[9] = new Image();
   this[9].src = directory + '/' + '10.jpg';
   this[10] = new Image();
   this[10].src = directory + '/' + '11.jpg';   
}

function nextPhoto()
{
  //new Effect.Opacity(document.getElementById('photo'), {delay: 0, duration: 1, from:1.0, to: 0});
  
  var prevElementId = String(currentPhoto);
  currentPhoto++;
  
  if (currentPhoto > totalPhotos)
  {
    currentPhoto = 1;
  }
  
  var elementId = String(currentPhoto);
  
  document.getElementById('photo' + prevElementId).style.color = "#666";
  document.getElementById('photo' + elementId).style.color = "#fff";
    
  setTimeout("document.getElementById('photo').src = directory + '/' + currentPhoto + '.jpg'",0);
  
  //new Effect.Opacity(document.getElementById('photo'), {delay: 1, duration: 1, from:0, to: 1.0});
}

function prevPhoto()
{  
  //new Effect.Opacity(document.getElementById('photo'), {delay: 0, duration: 1, from:1.0, to: 0});
  
  var prevElementId = String(currentPhoto);
  currentPhoto--;
  
  if (currentPhoto <= 0)
  {
    currentPhoto = totalPhotos;
  }
      
  var elementId = String(currentPhoto);
  
  document.getElementById('photo' + prevElementId).style.color = "#666";
  document.getElementById('photo' + elementId).style.color = "#fff";
      
  setTimeout("document.getElementById('photo').src = directory + '/' + currentPhoto + '.jpg'",0);
  
  //new Effect.Opacity(document.getElementById('photo'), {delay: 1, duration: 1, from:0, to: 1.0});
}

function changePhoto(toNum)
{  
  //new Effect.Opacity(document.getElementById('photo'), {delay: 0, duration: 1, from:1.0, to: 0});
  
  var prevElementId = String(currentPhoto);
  currentPhoto = toNum;
  var elementId = String(currentPhoto);
  
  document.getElementById('photo' + prevElementId).style.color = "#666";
  document.getElementById('photo' + elementId).style.color = "#fff";
    
  setTimeout("document.getElementById('photo').src = directory + '/' + currentPhoto + '.jpg'",0);
  
  //new Effect.Opacity(document.getElementById('photo'), {delay: 1, duration: 1, from:0, to: 1.0});
}

function loadPhoto(name)
{  
  //new Effect.Opacity(document.getElementById('photo'), {delay: 0, duration: 1, from:1.0, to: 0});
    
  setTimeout("document.getElementById('photo').src = 'patrick_adams.jpg'",0);  
  
  //new Effect.Opacity(document.getElementById('photo'), {delay: 1, duration: 1, from:0, to: 1.0});
}