var PulseFade = new Class({
      
  //implements
  Implements: [Options,Events],

  //options
  options: {
    min: 0,
    max: 1,
    duration: 200,
    times: 5
  },
  
  //initialization
  initialize: function(el,options) {
    //set options
    this.setOptions(options);
    this.element = $(el);
    this.times = 0;
  },
  
  //starts the pulse fade
  start: function(times) {
    if(!times) times = this.options.times * 2;
    this.running = 1;
    this.fireEvent('start').run(times -1);
  },
  
  //stops the pulse fade
  stop: function() {
    this.running = 0;
    this.fireEvent('stop');
  },
  
  //runs the shizzle
  run: function(times) {
    //make it happen
    var self = this;
    var to = self.element.get('opacity') == self.options.min ? self.options.max : self.options.min;
    self.fx = new Fx.Tween(self.element,{
      duration: self.options.duration / 2,
      onComplete: function() {
        self.fireEvent('tick');
        if(self.running && times)
        {
          self.run(times-1);
        }
        else
        {
          self.fireEvent('complete');
        }
      }
    }).start('opacity',to);
  }
});

Element.implement({
  flash: function(to,from,reps,prop,dur) {
    
    //defaults
    if(!reps) { reps = 1; }
    if(!prop) { prop = 'background-color'; }
    if(!dur) { dur = 250; }
    
    //create effect
    var effect = new Fx.Tween(this, {
        duration: dur,
        link: 'chain'
      })
    
    //do it!
    for(x = 1; x <= reps; x++)
    {
      effect.start(prop,from,to).start(prop,to,from);
    }
  }
});

window.addEvent('domready', function() {
	var myAccordion = new Accordion($('menus_accordion'), 'a.accordionLink', 'div.submenu', {
		opacity: false,
		alwaysHide: true,
		display:myId
	});
	/*
	var pf = new PulseFade('item_321',{
		min: .50,
		max: 1,
		duration: 400,
		times: 100
	})

	pf.start();
	*/
	$('item_321').flash('#00aeef','#006e97',50,'background-color',500);

});

	
	
