/* Script client commun à toutes les pages du site dg-neon.fr */

/* Déclaration */

// Pulse V2.0
var Pulse = new Class({
	Implements : Options,
	options : {
		from : '.normal',
		to : '.pulsed',
		duration : 500,
		morph : true
	},
	initialize : function (element,options){
		this.element = $(element);
		this.setOptions(options);
		if (this.options.morph){
			this.element.morph(this.options.to);
		}else{
			if (typeof this.options.to == 'string'){
				this.element.removeClass(this.options.from.replace('.',''));
				this.element.addClass(this.options.to.replace('.',''));
			}else{
				this.element.setStyles(this.options.to);
			}
		}
		setTimeout(function(){
			var tmp = this.options.from;
			this.options.from = this.options.to;
			this.options.to = tmp;
			this.initialize(this.element, this.options);
		}.bind(this),this.options.duration);
	}
});

/* Initialisation */

window.addEvent('domready',function(){

	// Créer un objet "pulse" pour chaque élément ayant la classe "pulse"
	$$('.pulse').each(function(e){
		new Pulse(e,{
			morph:false,
			duration:800
		});
	});

});

