var $e= YAHOO.util.Event, $d = YAHOO.util.Dom;

var rollover = function(e) { 
	var selected = this.src.search(/&type=selected/i);
	if (selected < 0) {
		var highlighted = this.src.search(/&type=highlight/i);
		if (highlighted >= 0) this.src = this.src.substr(this.src, highlighted) + "";
		else this.src = this.src + "&type=highlight";
	} // end if
}

$e.onDOMReady(function() {
	var images = document.getElementsByTagName("img");
	var input = document.getElementsByTagName("input");
	var buttons = new Array();
	for(i=0;i<images.length;i++) if (images[i].src.search(/button.php/) > 0) buttons.push(images[i]);
	for(i=0;i<images.length;i++) if (images[i].src.search(/number.php/) > 0) buttons.push(images[i]);
	for(i=0;i<images.length;i++) if (images[i].src.search(/arrow.php/) > 0) buttons.push(images[i]);
	for(i=0;i<images.length;i++) if (images[i].src.search(/cambridge_papers.php/) > 0) buttons.push(images[i]);
	for(i=0;i<input.length;i++) if (input[i].type == "image" && input[i].src.search(/button.php/) > 0) buttons.push(input[i]);
	if (buttons.length > 0) {
		$e.addListener(buttons, "mouseover", rollover); // end addListener
		$e.addListener(buttons, "mouseout", rollover); // end addListener
	} // end if
}); // end onDOMReady