/*
Home JS pour Moto85
Copyright(c) 2009, Skalpel.

Author : Michael
michael@skalpel.fr

Note : 
	-
ToDo :
	- 
*/

window.addEvent('domready', function() {
    new SKjs.Faq();
});


/* 
Class : RechercheRapide
	Gestion de la recherche rapide
	
Arguments : 
	options {object} - Objet Options

Options :
	elmSelType {String} - Id du Select correspondant aux Types de vehicules
	elmSelMarque {String} - Id du Select correspondant aux Marques
	elmSelModele {String} - Id du Select correspondant aux Modeles
*/
SKjs.Faq = new Class ({
	Implements: [Events, Options],
	options: {
		questions:                'dt.FAQToggler a',
		answers:                'dd.FAQYou'
	},

	initialize: function(options) {
		this.setOptions(options);
		
		this.dom 		= {};
		
        this.initDom();
        
        if (this.dom.questions.length > 0) {
	        this.initEvents();
	        this.initFx();
        }
	},
    
    initDom: function() {
		this.dom.questions 	= $$(this.options.questions);
		this.dom.answers 	= $$(this.options.answers);
    },
    
    initEvents: function() {
    	this.dom.questions.each(function (e) {
    		e.addEvent('click', this.cancelEvent.bindWithEvent(this));
    	}, this);
    },
    
    initFx: function() {
        new Accordion(this.dom.questions, this.dom.answers, {
        	opacity: true
        });
    },
	
	cancelEvent: function(e) {
		if(e) var e = new Event(e).stop();
	}
});
