//
// Copyright (c) 2007 Drew Wilson (http://www.drewwilson.com/)
//
function showImage(dir,img,rell,theid,thearray) {
  for (i=0; i<thearray.length; i++){
    document.getElementById("image_"+i).parentNode.setAttribute("class", "");
    document.getElementById("image_"+i).parentNode.setAttribute("className", "");
  }

  var placeholder = $('placeholder-'+theid);
  var arrayval = parseInt(arrayval);
  if (!$('imgLoading'+theid)){
    var imgLoading = document.createElement("div");
	imgLoading.setAttribute('id','imgLoading'+theid);
	imgLoading.innerHTML='<img src=\'/images/spinner.gif\' alt=\'Loading Next Image\' style=\'margin:35px 0 0 35px;\' />';
	placeholder.appendChild(imgLoading);
	var textHolder = document.getElementById('full_description');							
	textHolder.innerHTML = document.getElementById("image_"+rell).getAttribute("title");
	document.getElementById("image_"+rell).parentNode.setAttribute("class", "active_img");
	document.getElementById("image_"+rell).parentNode.setAttribute("className", "active_img");
  }
  if ($('imageholder-'+theid)) {
    Element.remove('imageholder-'+theid);
  }	
  var d1 = document.createElement('img');
  d1.setAttribute('id','imageholder-'+theid);
  d1.setAttribute('rel',rell);
  d1.style.display='none';
  d1.src = dir+img;

  d1.onload=function(){
    //alert('onload');
	Element.remove('imgLoading'+theid);
	placeholder.appendChild(d1);
	Effect.Appear('imageholder-'+theid);
  }
  return false;						
}