/*
	Class: 
		
		
	Usage:
		
		
	Parameters:
		
		
	Exemple:
	
	About:
		Profil.js v.1.0 for mootools v1.1 05 / 2007
		
		by Floor SA (http://www.floor.ch) MIT-style license
		
		last modified by Denis Schneiter 
*/
var Profil = new Class({
	Implements : [Options, Events],

	options : {
		'input_profil' 	: 'init_profil',
		field_prefix	: 'contact_'
	},

    /*
	Constructor: initialize
		Constructor
	
		-
	*/
	initialize : function(options) {
		this.setOptions(options)
		
		this._initProfil();
	},
	/*
	Function: _
		Internal method
		
		Parameters:
			
	*/
	_initProfil : function() {
		$$('.' + this.options.input_profil).each(function(el){
			var field_name = el.getProperty('name').replace(/^edit/g,'');
			field_name = this.options.field_prefix + field_name;
			if ($(field_name)) {
				if ($(field_name).get('tag') == 'select') {
					this._initSelect($(field_name),el.getProperty('value'));
				}
			}
		}, this);
	},
	
	_initSelect : function(el,val) {
		el.getElements('option').each(function(el){
			el.removeProperty('selected');
			
			if (el.getProperty('value') == val) {
				el.setProperty('selected','selected');
			}	
		}, this);
	}
});