var OverStyle = Class.create()

OverStyle.prototype = {                       
	initialize : function() {
        $$(".overStyle").each( function (item) {
        	Event.observe(item, 'mouseover', this.over);
		    Event.observe(item, 'mouseout', this.out);
        }.bind(this));
	},
	
	over : function(evt){
		elemento = Event.element(evt);
		if(elemento.getAttribute('applyTo')){
			if ($(elemento.getAttribute('applyTo'))){
				$(elemento.getAttribute('applyTo')).addClassName(elemento.getAttribute('classOver'));
			}
		}else{
			elemento.addClassName = elemento.getAttribute('classOver');
		}
	},
	
	out  :	function(evt){
		elemento = Event.element(evt);
		if(elemento.getAttribute('applyTo')){
			if ($(elemento.getAttribute('applyTo'))){
				$(elemento.getAttribute('applyTo')).removeClassName(elemento.getAttribute('classOver'));
			}
		}else{
			elemento.removeClassName(elemento.getAttribute('classOver'));			
		}
	}
} 

Event.observe(window,"load",function(){ new OverStyle(); });