// JavaScript Document
addEvent(window, "load", setimageswaps);
addEvent(window, "load", simplePreload);

var currentimage;
var captionarray = new Array('','Laboring in the tub at Sutter Davis Birthing Center. Jenny is using telemetry monitoring: the fetal monitor belts are connected to a small portable device that allows you to be out of bed and is completely safe in water as well as waterproof!','The beautiful results of my waterbirth--adorable, healthy Samantha Jane!', 'Her family after two tub labors! "I feel privileged to have been able to use the birthing tubs at Sutter Davis Hospital for both of my labor and delivery experiences, and I would definitely use the tub again."');

function simplePreload()
{ 
  document.imageArray = new Array('/images/jenny1.jpg','/images/jenny2.jpg','/images/jenny3.jpg');
  args = document.imageArray;
  for(var i=0; i<args.length; i++)
  {
    document.imageArray[i] = new Image;
    document.imageArray[i].src = args[i];
  }
}

function setimageswaps() 
{
	document.getElementById("1").onclick = function() { swapimage(this); }
	document.getElementById("2").onclick = function() { swapimage(this); }
	document.getElementById("3").onclick = function() { swapimage(this); }
 	document.getElementById("1").onclick();
}

function swapimage(what) 
{
	if (currentimage) 
	{
		currentimage.style.fontWeight="normal";
	}
	currentimage = what;
	what.style.fontWeight="bold";	
	document.getElementById("mypicture").src = "/images/jenny" + what.getAttribute("id") + ".jpg";
	document.getElementById("mycaption").innerHTML = captionarray[what.getAttribute("id")];
}
