var Focus = new Class({
	/*
	focus.js v.1.0 for mootools v1.1
	by Floor SA (http://www.floor.ch) - MIT-style license
	05 / 2007
    Modification by Shakaran (http://www.shakaran.es) 06 / 2009
	*/
	options: 
    {
		form_id :		'mainform',	// Formular ID
		setBorder : 	true,		// Add a class to form fields (except radio and checkbox)
		txtcolor : 		'#000000',	// Txt color when active
		bgcolor : 		'#ffffff',	// Bg color when active
		elementClass : 	'input_f',	// Class to apply to all form element (except radio, checkbox)
		duration : 		742			// Fade duration
	},
	initialize: function(options)
    {
		this.setOptions(options);
        $$('input[type=text], input[type=password], input, textarea, select',this.options.form_id).each(function(el)
        {
			if(this.options.setBorder) el.addClass(this.options.elementClass);
			el.effectC = new Fx.Morph(el, {duration: this.options.duration, wait: false, transition: Fx.Transitions.quartOut});
            el.bgColor = el.getStyle('background-color');
            el.origColor = el.getStyle('color');
            el.addEvents(
            {
                'focus': function(){this.changeBack(el);}.bind(this),
				'blur': function(){this.revertBack(el);}.bind(this)
            })
		}.bind(this));
	},
	changeBack: function(el)
    {
		el.effectC.start({
			'background-color': [el.bgColor,this.options.bgcolor],
			'color': [el.origColor,this.options.txtcolor]
		});
	},
	revertBack: function(el)
    {
		el.effectC.start({
			'background-color': [this.options.bgcolor,el.bgColor],
			'color': [this.options.txtcolor,el.origColor]
		});
	}
});

Focus.implement(new Options);

// window.addEvent('domready', function() {
//	var focus = new Focus({form_id : 'mainform', setBorder : true, txtcolor : '#000000', bgcolor : '#ffffff', elementClass : 'input_f', duration : 742});
// });
