var WIDTH = 200;
var Index = 0;
var NextImg = 'next.gif';
var PrevImg = 'prev.gif';

var ArrayOfPhotos = new Array();

function _PhotoDef(_PhotUrl, _PhotoDescription)
{
    this.PhotUrl = _PhotUrl;
    this.PhotoDescription = _PhotoDescription;
}

function AddPhoto(_PhotUrl, _PhotoDescription)
{  
    ArrayOfPhotos[Index] = new _PhotoDef(_PhotUrl, _PhotoDescription);
    Index ++;
}

function PutNavigation(IndexPhoto)
{
  var Next = '<a href="?PhotoNumber=' +  (eval(IndexPhoto) + 1) + '"><img src="' + NextImg + '" border="0"/></a>';
  var Previous = '<a href="?PhotoNumber=' +  (eval(IndexPhoto) - 1) + '"><img src="' + PrevImg + '" border="0"/></a>';
  
  var First = '<a href="?PhotoNumber=' +  (0) + '"><img src="' + NextImg + '" border="0"/></a>';
  var Last = '<a href="?PhotoNumber=' +  (Index - 1) + '"><img src="' + PrevImg + '" border="0"/></a>';
  
  if(eval(IndexPhoto) > 0)
    document.write (Previous);
  else
    document.write (Last);
    
  document.write ('&nbsp;' + (eval(IndexPhoto) + 1) + '/' + (Index) + '&nbsp;');
  
  if((eval(IndexPhoto) + 1) < Index)
    document.write (Next);
  else
    document.write (First);
}

function PutDescription(IndexPhoto)
{
  document.write (ArrayOfPhotos[IndexPhoto].PhotoDescription);
}

function PutPhoto(IndexPhoto)
{
  document.write ('<img src="' + ArrayOfPhotos[IndexPhoto].PhotUrl + /*'" width="' + WIDTH + */'"/>');
}

function querySt(ji) 
{
  hu = window.location.search.substring(1);
  gy = hu.split("&");
  for (i=0;i<gy.length;i++) {
    ft = gy[i].split("=");
    if (ft[0] == ji) {
      return ft[1];
    }
  }
  return 0;
}
