var Menu = new Class({
 Implements: [Options, Events],
 options:{},
 initialize:function(el,options){
	 this.el = $(el);
	 this.setOptions(options);
     
     this.el.addEvent('mouseleave',function(){
		  this.sheets.fireEvent('hide');
		  this.tabs.getElements('ul li.current').each(function(li){ li.removeClass('current'); });
     }.bind(this));
	 
	 this.tabs = this.el.getElement('#alinks-tabs');
	 this.tabs.getElements('ul li').each(function(item){
        item.removeEvents('mouseenter','mouseleave');
        item.addEvent('mouseenter',function(oItem){
          
		
		  var id = oItem.get('alt'); 
		  this.sheets.fireEvent('hide'); 
		  this.sheets.getElement('div#'+id).setStyle('display','block'); 
		  oItem.getParent().getElements('li.current').each(function(oli){ oli.removeClass('current'); }); 
		  oItem.addClass('current');
		  
        }.bind(this, item));
     }.bind(this));
	 
	 this.sheets = this.el.getElement('#sheets');
	 this.sheets.addEvent('hide',function(){
	   this.getElements('.sheet').each(function(item){ item.setStyle('display','none'); });
     }.bind(this.sheets));
   this.links();
 },
 links:function(){
   this.sheets.getElements('li').each(function(item){

   }.bind(this));
 }
});

var Galeria = new Class({
	Implements: [Options, Events],
	 options:{contenido:null},
	 initialize:function(el,options){
	   this.setOptions(options);
	   this.el = $(el);
	   this.el.getElements('li.gal img').each(function(item){
	      item.addEvent('click',function(e){
		    e = new Event(e);
			window.open('popup.php?_imagen='+e.target.get('dir'),'', 'width='+e.target.get('alt')+'px, height='+e.target.get('rel')+'px, resizable=0, status=0');
		  }.bind(this));
	   }.bind(this));
	 }
});

var Multimedia = new Class({
	Implements: [Options, Events],
	 options:{contenido:null},
	 initialize:function(id,options){
	   this.setOptions(options);
	   this.el = new Element('div',{'id':id,'class':'mul'});
	   

	        this.el.getElements('a.video').each(function(video){
			  video.addEvent('click',function(ovideo){
			     vid = this.getElement('#muestravideo');
				 vid.getElements('param')[0].set('value',ovideo.get('rel'));
				 vid.getElement('embed').set('src',ovideo.get('rel'));
			  }.bind(this, video));
			}.bind(this));
				
	 }
});

var Vehiculos = new Class({
	Implements: [Options, Events],
	 options:{contenido:null},
	 initialize:function(el,options){
	   this.setOptions(options);
	   this.el = $(el);
	   this.el.getElements('img.foto').each(function(item){
		  item.setOpacity(.6); 
		  item.addEvent('mouseleave',function(){ this.setOpacity(.6); });
		  item.addEvent('mouseenter',function(){ this.setOpacity(1); });
	      item.addEvent('click',function(e){
		    e = new Event(e);
			window.open('popup.php?_imagen='+e.target.get('dir'),'', 'width='+e.target.get('alt')+'px, height='+e.target.get('rel')+'px, resizable=0, status=0');
		  }.bind(this));
	   }.bind(this));
	 }
});

var Contacto = new Class({
	Implements: [Options, Events],
	 options:{contenido:null},
	 initialize:function(el,options){
	   this.setOptions(options);
	   this.el = $(el);
	   this.form = this.el.getElement('#fcotizacion');
	   this.form.addEvent('submit',function(){
	     var requeridos = this.el.getElements('input.req').filter(function(item){
		   return item.value.trim()=='';
		 });
		 if(requeridos.length > 0){ 
		    alert('Faltan completar campos requeridos.');
		    return false;
		 };
	   }.bind(this));
	 }
});