var NosotrosInfo = Behavior.create({
  initialize:function() {
    this.layers=$$('#nosotrosInfo div.info');
    this.hideAll();
    this.links=$$('#map_trayectoria area');
    this.links.each(function(element){
      Event.observe(element, 'click', function(event) {
        this.hideAll();
        var element = Event.element(event);
        this.showInfo($('info_'+element.id.split('_')[1]));
        Event.stop(event);
      }.bind(this));      
    }.bind(this));  
    
    this.close_links=$$('a.close');
    this.close_links.each(function(element){
      Event.observe(element, 'click', function(event) {
        this.hideAll();
        Event.stop(event);
      }.bind(this));
    }.bind(this));  
 
  },
  
  showInfo:function(element) {
    element.setStyle('left:'+(parseInt(element.getStyle('left'))+10000)+'px');
  },
  
  hideAll:function() {
    this.layers.each(function(element){
      if (parseInt(element.getStyle('left'))>0) {
        element.setStyle('left:'+(parseInt(element.getStyle('left'))-10000)+'px');
      } 
    });
  }    

});

Event.onReady(function() {
  Event.addBehavior({'#nosotrosInfo':NosotrosInfo});
});