
/* Gesto V7 - ALL RIGHTS RESERVED Gabriel Andrei - email: gabrielandrei@yahoo.it
 * COPIA CONCESSA IN USO ALLA SEMAR SRL di Prato(PO)
 * */
/* Effetti su Menu
 * Sviluppatore: Gabriel Andrei - email: gabrielandrei@yahoo.it
 * Credits to David Walsh: http://davidwalsh.name/snook-navigation-mootools - If you will read this, thank you very much for inspire "my" implementation
 * */

window.addEvent('domready', function() {
		/* example b:  right left */
		$$('.overanimati').each(function(el) {
			//css
			var reset = false;
			var fx = new Fx.Tween(el,{
				duration: 500,
				link: 'cancel',
				onComplete:function() {
					if(reset) {
						el.setStyle('background-position','0 center');
					}
				}
			});
			var fx2 = new Fx.Tween(el,{
				duration: 600,
				link: 'cancel',
				onComplete:function() {
					if(reset) {
						el.setStyle('color','#fff');
					}
				}
			});
			var fx3 = new Fx.Tween(el,{
				duration: 600,
				link: 'cancel',
				onComplete:function() {
					if(reset) {
						el.setStyle('padding-left','8px');
					}
				}
			});
			//events
			el.setStyle('background-position','0 center').setStyle('color','#fff').setStyle('padding-left','8px').addEvents({
				'mouseenter': function(e) {
					e.stop();
					fx.start('background-position','-230px center');
					fx2.start('color','#c00');
					fx3.start('padding-left','25px');
					reset = false;
				},
				'mouseleave': function(e) {
					reset = true;
					fx.start('background-position','-460px center');
					fx2.start('color','#fff');
					fx3.start('padding-left','8px');
				}
			});
		});
		$$('.overanimati2').each(function(el) {
			//css
			var reset = false;
			var fx = new Fx.Tween(el,{
				duration: 300,
				link: 'cancel',
				onComplete:function() {
					if(reset) {
						el.setStyle('background-position','0px center');
					}
				}
			});
			var fx2 = new Fx.Tween(el,{
				duration: 400,
				link: 'cancel',
				onComplete:function() {
					if(reset) {
						el.setStyle('color','#000');
					}
				}
			});
			//events
			el.setStyle('background-position','0 center').setStyle('color','#000').addEvents({
				'mouseenter': function(e) {
					e.stop();
					fx.start('background-position','-120px center');
					fx2.start('color','#fff');
					reset = false;
				},
				'mouseleave': function(e) {
					reset = true;
					fx.start('background-position','0px center');
					fx2.start('color','#000');
				}
			});
		});
});
