//various scripts for physpics pages

// swap(id, beswapped) 
//    the object at 'id' must have these fields:
//		id   - an identifier
//		src  - probably an image URL
// 		swappic - alternate value for src
//		isswapped - boolean, initially false
//   when isswapped is true, fields src and swappic
//		are given the opposite of their initial value
//   if src and swappic are images of different sizes, 
//	  	the width and height attributes should be omited
// Example: <td ... onmouseout="swap('zf', false)" 
//			onmouseover="swap('zf', true)">...<img ...
//		id="zf" src=twobeers.jpg  swappic="fred.jpg" isswapped="false">
//		...</td>
function swap(id, beswapped) {
    var image=document.getElementById(id)
    if (image.getAttribute("isswapped") != beswapped) {
	    var src = image.getAttribute("src", 0)
	    image.setAttribute("src", image.getAttribute("swappic"))
	    image.setAttribute("swappic", src)
	    image.setAttribute("isswapped", beswapped)
    }
}
