// global variable representing currently selected image header
var old;


// sets an image id to be the currently selected image header
// should be called in the 'onload' of the body tag
function setId(id){
	old = id;
}


// should be triggered when the user clicks on an image header,
// takes image id, location of html to be loaded into iframe, and 'over'
// image url as parameters
function setiFrame(id, loc, img) {
	// first check to see if the current id is the same as the currently
	// selected image hdr... if so, do nothing
	if(old!= id){
		// restore the currently selected image
		document.getElementById(old).src = 'images/studentnews/'+old+'.gif';
		
		// load in iframe content
		document.getElementById("content").src = loc;
		
		// swap in the image's over state
		document.getElementById(id).src = img;
		
		// save the current image id as our global variable
		setId(id);
	}
}


// responsible for swapping a new image url (loc) into
// the given image id (id)
// should be called on 'onmouseover' and 'onmouseout' events on the anchor tag
function mSwap(id, loc){
	if(old != id){
		document.getElementById(id).src=loc;
	}
}


