<!--

function photograph_newGallery( iGallery, iCount, sPath )
{
  this.aCount[ iGallery ] = iCount;
  this.aPath[ iGallery ]  = sPath;
}

function photograph_setGallery( iGallery )
{
  this.iGallery   = iGallery;
  this.iPhoto     = 1;
  count.innerText = this.aCount[ iGallery ];
}

function photograph_selGallery( iGallery )
{
  for (g = 0; g < gallery.length; g++)
  {
    if ( gallery.options[g].value == iGallery )
      gallery.selectedIndex = g;
  }

  index.value     = 1;
  count.innerText = this.aCount[ iGallery ];
}

function photograph_pickGallery( sGallery )
{
  if ( sGallery == "0" )
    exit;

  index.value     = 1;
  count.innerText = this.aCount[ parseInt(sGallery) ];

  this.setGallery( parseInt( sGallery ) );
  this.updtPhoto();
}

function photograph_pickPhoto( sPhoto )
{
  this.iPhoto = parseInt( sPhoto );

  this.updtPhoto();
}

function photograph_prevPhoto()
{
  if ( this.iPhoto == 1 )
    this.iPhoto = this.aCount[ this.iGallery ];
  else
    this.iPhoto = this.iPhoto - 1;

  this.updtPhoto();
}

function photograph_nextPhoto()
{
  if ( this.iPhoto == this.aCount[ this.iGallery ] )
    this.iPhoto = 1;
  else
    this.iPhoto = this.iPhoto + 1;

  this.updtPhoto();
}

function photograph_updtPhoto()
{
  this.iIndex = this.getPhoto( this.iGallery, this.iPhoto );

  photo_table.width   = this.aSize[ iIndex ].substr(0,this.aSize[ iIndex ].indexOf(','));
  photo_table.height  = this.aSize[ iIndex ].substr(this.aSize[ iIndex ].indexOf(',')+1);

  photo_small.width   = this.aSize[ iIndex ].substr(0,this.aSize[ iIndex ].indexOf(','));
  photo_small.height  = this.aSize[ iIndex ].substr(this.aSize[ iIndex ].indexOf(',')+1);
	
  photo_small.src     = this.aPath[ this.iGallery ] + this.sView  + this.aFile[ iIndex ];
  photo_large.href    = this.aPath[ this.iGallery ] + this.sPrint + this.aFile[ iIndex ];

  text_head.innerText = this.aHead[ iIndex ];
  text_body.innerText = this.aBody[ iIndex ];
  text_foot.innerText = this.aFoot[ iIndex ];

  index.value = this.iPhoto;
}

function photograph_bldGallery()
{
  this.iIndex = this.getPhoto( this.iGallery, this.iPhoto );

  sThin   = "<td width='5%'></td>";
  sWide   = "<td width='90%'>";
	
  sWidth  = this.aSize[ iIndex ].substr(0,this.aSize[ iIndex ].indexOf(','));   
  sHeight = this.aSize[ iIndex ].substr(this.aSize[ iIndex ].indexOf(',')+1);

  document.writeln("<table border='0' cellpadding='0' cellspacing='0' align='center' width='100%'>");
  document.writeln("<tr>" + sThin + sWide + "&nbsp;</td>"  + sThin + "</tr>");
  document.writeln("<tr align='center'>" + sThin + sWide + "<b><font id='text_head' face='Arial' size='2'>" + this.aHead[ this.iIndex ] + "</font></b></td>"  + sThin + "</tr>");
  document.writeln("<tr align='center'>" + sThin + sWide + "<em><font id='text_foot' face='Arial' size='2'>" + this.aFoot[ this.iIndex ] + "</font></em></td>" + sThin + "</tr>");
  document.writeln("<tr>" + sThin + sWide + "&nbsp;</td>"  + sThin + "</tr>");
  document.writeln("<tr><td width='100%' colspan='3'>");
  document.writeln("<table id='photo_table' border='4' cellpadding='0' cellspacing='0' align='center' width='" + sWidth + "' height='" + sHeight + "'><tr><td>");
  document.writeln("<a     id='photo_large' href='" + this.aPath[ this.iGallery ] + this.sPrint + this.aFile[ this.iIndex ] + "' target='_blank'>");
  document.writeln("<img name='photo_small' src='"  + this.aPath[ this.iGallery ] + this.sView  + this.aFile[ this.iIndex ] + "' alt ='Click to Enlarge' border='0' width='" + sWidth + "' height='" + sHeight + "'></a>");
  document.writeln("</td></tr></table>");
  document.writeln("</td></tr>");
  document.writeln("<tr>" + sThin + sWide + "&nbsp;</td>"  + sThin + "</tr>");
  document.writeln("<tr align='center'>" + sThin + sWide + "<font id='text_body' face='Arial' size='2'>" + this.aBody[ this.iIndex ] + "</font></td>"    + sThin + "</tr>");
  document.writeln("</table>");
}

function photograph_setPhoto( iGallery, iPhoto, sSize, sFile, sHead, sFoot, sBody )
{
  iIndex = this.aGallery.length;

  this.aGallery[ iIndex + 1 ] = iGallery;
  this.aPhoto[ iIndex + 1 ]   = iPhoto;
  this.aFile[ iIndex + 1 ]    = sFile;
  this.aSize[ iIndex + 1 ]    = sSize;
  this.aHead[ iIndex + 1 ]    = sHead;
  this.aFoot[ iIndex + 1 ]    = sFoot;
  this.aBody[ iIndex + 1 ]    = sBody;
}

function photograph_getPhoto( iGallery, iPhoto )
{
  iIndex = 0;

  while ( iIndex < this.aGallery.length ) 
  {
    if ( iGallery == this.aGallery[ iIndex ] && iPhoto == this.aPhoto[ iIndex ] )
      return iIndex;
    iIndex++;
  }

  return -1;
}

function photograph()
{
  this.aCount      = new Array();
  this.aPath       = new Array();

  this.aGallery    = new Array();
  this.aPhoto      = new Array();
  this.aFile       = new Array();
  this.aSize       = new Array();
  this.aHead       = new Array();
  this.aFoot       = new Array();
  this.aBody       = new Array();

  this.iGallery    = 0;
  this.iPhoto      = 0;
  this.iIndex      = 0;

  this.sView       = "view/";
  this.sPrint      = "print/";

  this.fontName    = "Arial";
  this.fontSize    = "2";

  this.setPhoto    = photograph_setPhoto;
  this.getPhoto    = photograph_getPhoto;

  this.setGallery  = photograph_setGallery;
  this.selGallery  = photograph_selGallery;

  this.newGallery  = photograph_newGallery;
  this.bldGallery  = photograph_bldGallery;

  this.pickGallery = photograph_pickGallery;
  this.pickPhoto   = photograph_pickPhoto;

  this.prevPhoto   = photograph_prevPhoto;
  this.nextPhoto   = photograph_nextPhoto;
  this.updtPhoto   = photograph_updtPhoto;
}

//-->