var IconFlipper = Class.create();
IconFlipper.prototype = {
	initialize:function(options){
		this.options = {
			favs: '.FavBtn',
			favMouseOver: 'icon_favs_red_sm.jpg',
			favMouseOut: 'icon_favs_green_sm.jpg',
			request: '.RequestBtn',
			reqMouseOver: 'icon_addInfo_red_sm.jpg',
			reqMouseOut: 'icon_addInfo_green_sm.jpg',
			schedule: '.SchedBtn',
			schedMouseOver: 'icon_sched_red_sm.jpg',
			schedMouseOut: 'icon_sched_green_sm.jpg'
		}
		Object.extend(this.options, options || {});
		
		$$(this.options.favs).each( function(iter)  {
			Event.observe(iter, 'mouseover', this.flipFavIcon.bindAsEventListener(this));
			Event.observe(iter, 'mouseout', this.unflipFavIcon.bindAsEventListener(this));
		}.bind(this));
		$$(this.options.request).each( function(iter)  {
			Event.observe(iter, 'mouseover', this.flipRequestIcon.bindAsEventListener(this));
			Event.observe(iter, 'mouseout', this.unflipRequestIcon.bindAsEventListener(this));
		}.bind(this));
		$$(this.options.schedule).each( function(iter)  {
			Event.observe(iter, 'mouseover', this.flipScheduleIcon.bindAsEventListener(this));
			Event.observe(iter, 'mouseout', this.unflipScheduleIcon.bindAsEventListener(this));
		}.bind(this));
	},
	
	flipFavIcon: function(event){
		var element = Event.element(event);
		element.previous('img').src="/images/search_view_icons/" + this.options.favMouseOver;
	},
	unflipFavIcon: function(event){
		var element = Event.element(event);
		element.previous('img').src="/images/search_view_icons/" + this.options.favMouseOut;
	},
	flipRequestIcon: function(event){
		var element = Event.element(event);
		element.previous('img').src="/images/search_view_icons/" + this.options.reqMouseOver;
	},
	unflipRequestIcon: function(event){
		var element = Event.element(event);
		element.previous('img').src="/images/search_view_icons/" + this.options.reqMouseOut;
	},
	flipScheduleIcon: function(event){
		var element = Event.element(event);
		element.previous('img').src="/images/search_view_icons/" + this.options.schedMouseOver;
	},
	unflipScheduleIcon: function(event){
		var element = Event.element(event);
		element.previous('img').src="/images/search_view_icons/" + this.options.schedMouseOut;
	}
}