// showhide.js - code to show or hide elements by id
// and toggle an image associated with this function
//
// Code uploaded by ACP. Any questions, contact Dan
// Barron (dbarron@acponline.org)

// toggle visibility
function toggleVisible( targetId ) {
  if (document.getElementById) {
    target = document.getElementById( targetId );
    if (target.style.display == "none"){
      target.style.display = "";
    } else {
      target.style.display = "none";
    }
  }
} 

// toggle images
function toggleImage(imageId, imageSrc1, imageSrc2) {
	target = document.getElementById(imageId);
  imageName = imageSrc1.substring(imageSrc1.lastIndexOf("/") + 1);
  if (target.src.indexOf(imageName) > 0 ) {
	  target.src = imageSrc2
	} else {
  	target.src = imageSrc1
	}
}