var rollover_func = {
	init: function() {
		this._rollover = new Image();
		this._rollover.src = this.hi_state();
	},
	
	onmouseover: function(event) {
		this.set_src(this.hi_state());
	},
	onmouseout: function(event) {
		this.set_src(this.lo_state());
	},
	
	hi_state: function() {
		return this.get_state('-hi');
	},
	lo_state: function() {
		return this.get_state('');
	},
	get_state: function(s) {
		return this.basename() + s + this.extension();
	},
	basename: function() {
		if (!this._basename) {
			this._basename = this.get_src().substring(0, this._ext());
		}
		return this._basename;
	},
	extension: function() {
		if (!this._extension) {
			this._extension = this.get_src().substring(this._ext());
		}
		return this._extension;
	},
	_ext: function() {
		return this.get_src().lastIndexOf('.')
	},
	
	get_src: function() {
		if (!this._src) {
			if (this.src) {
				this._src = this.src;
			} else {
			alert(this.id + ' ' + this.style.position);
				this._src = this.style.backgroundImage;
			}
			
		}
		return this._src;
	},
	set_src: function(s) {
		if (this.src) {
			this.src = s;
		} else {
		
		}
	}
}

$(document).ready(function() {
	$('img.hi, #go_search').each(function(i, img) { jQuery.extend(img, rollover_func); img.init(); });

});

