// slideshow

function showPic (whichpic) {
 if (document.getElementById) {
  document.getElementById('placeholder').src = whichpic.href;
  if (whichpic.title) {
   document.getElementById('desc').childNodes[0].nodeValue = whichpic.title;
  } else {
   document.getElementById('desc').childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue;
  }
  return false;
 } else {
  return true;
 }
}


// thumbnail popup

function resizePhoto(img){
  photo1= new Image();
  photo1.src=(img);
  controller(img);
}
function controller(img){
  if((photo1.width!=0)&&(photo1.height!=0)){
    viewPhoto(img);
  }
  else{
    altResult="controller('"+img+"')";
    interval=setTimeout(altResult,20);
  }
}
function viewPhoto(img){
  winWidth=photo1.width+20;
  winHeight=photo1.height+20;
  txtString="width="+winWidth+",height="+winHeight;
  postResults=window.open(img,"",txtString);
}


// RandomImage from Javascript Source
var theImages = new Array()

theImages[0] = 'http://www.hickory-hill.org/images/home_slice_quote_01.gif'
theImages[1] = 'http://www.hickory-hill.org/images/home_slice_quote_02.gif'
theImages[2] = 'http://www.hickory-hill.org/images/home_slice_quote_03.gif'
theImages[3] = 'http://www.hickory-hill.org/images/home_slice_quote_04.gif'
theImages[4] = 'http://www.hickory-hill.org/images/home_slice_quote_05.gif'
theImages[5] = 'http://www.hickory-hill.org/images/home_slice_quote_06.gif'
theImages[6] = 'http://www.hickory-hill.org/images/home_slice_quote_07.gif'

var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
   preBuffer[i] = new Image()
   preBuffer[i].src = theImages[i]
}
var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
document.write('<img src="'+theImages[whichImage]+'">');
}

// show-hide datagrid layers

function displayToggle(id) {
	var layer = document.getElementById(id).style;
	if(layer.display == "none") {
		layer.display = "block";
	}
	else if(layer.display == "block") {
		layer.display = "none";
	}
}
