function preloadSlideshow()
{
  if (aPhotos.length > 1) {
    for (i = 0; i < aPhotos.length; i++) {
      a = new Image(275, 175)
      a.src = '/images/properties/' + aPhotos[i][0]
    }
  }
}

function showSlide(photoNum)
{
  imgObj = document.getElementById('photo').childNodes[0]
  imgObj.src = '/images/properties/sml/' + aPhotos[photoNum][0]
  if (aPhotos[photoNum].length == 2) {
    captionText = aPhotos[photoNum][1]
  } else {
    re1 = /[-_]/g
    re2 = / ([a-z])/g
    re3 = /^([a-z])/g
    re4 = /.+\/(.+)\.jpg$/g
    /*captionText = aPhotos[photoNum][0].replace(re4, '$1').replace(re1, ' ').replace(re2, function (str, p1) { return ' ' + p1.toUpperCase() }).replace(re3, function (str, p1) { return p1.toUpperCase() })*/
  }
  aObj = document.getElementById('lb_link')
  /*aObj.href = '/images/properties/tmp/'+aPhotos[photoNum][0]*/
  /*imgObj.alt = captionText
  captionObj = document.getElementById('caption').childNodes[0]
  captionObj.nodeValue = captionText*/
}

function slideShow(aPhotos)
{
  list = ''
	list += '<table class="slides">';
  for (i = 0; i < aPhotos.length; i++) {

   if (i % 4 == 0 ) {
   }
   list += '<td><a href="/images/properties/'+aPhotos[i][0]+'" rel="lightbox[photos]" onmouseover="showSlide(\'' + i + '\')"><img src="/images/properties/th/'+aPhotos[i][0]+'" alt="" /></a></td>';
   if (i % 4 == 3) {
   	list += '</tr>';
   }
  }
	if (aPhotos.length % 4 == 1) {
		list += '<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>'
	}
	if (aPhotos.length % 4 == 2) {
		list += '<td>&nbsp;</td><td>&nbsp;</td></tr>'
	}
	if (aPhotos.length % 4 == 3) {
		list += '<td>&nbsp;</td></tr>'
	}
	list += '</table>';
  if (aPhotos[0].length == 2) {
    altText = aPhotos[0][1]
  } else {
    re1 = /[-_]/g
    re2 = / ([a-z])/g
    re3 = /^([a-z])/g
    re4 = /.+\/(.+)\.jpg$/g
    altText = aPhotos[0][0].replace(re4, '$1').replace(re1, ' ').replace(re2, function (str, p1) { return ' ' + p1.toUpperCase() }).replace(re3, function (str, p1) { return p1.toUpperCase() })

  }
  document.writeln('<a id="lb_link" href="/images/properties/'+aPhotos[0][0]+'" rel="lightbox[photos]" /><div id="photo"><img src="/images/properties/sml/' + aPhotos[0][0] + '"  alt="' + altText + '" /></div></a>')
  document.writeln('<div id="caption">' + altText + '</div>')
  document.writeln('' + list + '')
}

var aPhotos = new Array()
window.onload = preloadSlideshow