/**
 * Rollovers
 *
 * <img src="../matchbox/ui/..." oversrc="..." selected="selected" />
 *
 * If you need this to validate, add the following to your DTD:
 *
 * <!ATTLIST img oversrc CDATA #IMPLIED>
 * <!ATTLIST img selected CDATA #IMPLIED>
 *
 * @author Nick Nettleton / nick@plumdigitalmedia.com
 * @copyright 2005
 * @package UI
 * @version 0.1
 */

// auto-init
window.attachEvent ? window.attachEvent("onload", rollovers_auto) : 
window.addEventListener ? window.addEventListener("load", rollovers_auto, false) :
null ;
window.onload = rollovers_auto ;
/**
 * Sets up rollovers for images with an oversrc attribute
 Creates problems for dreamweaver!
 */
function rollovers_auto()
{
	var ims = document.images ;
	if(!ims) return ;
	for(var i=0, l=ims.length; i<l; i++){
		var im = ims[i] ;
		if(im.getAttribute('oversrc')){
			if(im.getAttribute('selected')){
				im.src			= im.getAttribute('oversrc')  ;
			} else {
				im.oversrc		= im.getAttribute('oversrc') ;
				im.outsrc		= im.src ;
				im.onmouseout	= function(){ this.src = this.outsrc } ;
				im.onmouseover	= function(){ this.src = this.oversrc } ;
				im.pd			= new Image() ;
				im.pd.src		= im.oversrc ;
			}
		}
	}
}