
var forms = {
							
	inicialize: function(options){
		
		this.options = Object.extend({
			container: document.body,
			url: ''
		}, options || {});
		
		
		if( $('contact_form') ) {
			
			/*$('radio_email').addEvent('click', function() {
				$('text_email').focus();
				if ( $('text_email').value == 'email' )
					$('text_email').value = '';
				this.activateTimeRadios(false);
			}.bind(this));
			
			$('text_email').addEvent('click', function() {
				$('radio_email').checked = true;
				if ( $('text_email').value == 'email' )
					$('text_email').value = '';
				this.activateTimeRadios(false);
			}.bind(this));*/
			
			$('radio_tel').addEvent('click', function() {
				$('text_tel').focus();
				if ( $('text_tel').value == 'teléfono' )
					$('text_tel').value = '';
				this.activateTimeRadios(true);
			}.bind(this));
			
			$('text_tel').addEvent('click', function() {
				$('radio_tel').checked = true;
				if ( $('text_tel').value == 'teléfono' )
					$('text_tel').value = '';
				this.activateTimeRadios(true);
			}.bind(this));
			
			$('contact_form').addEvent('submit', function(e) {
				new Event(e).stop();

				this.submitForm();							   
			}.bind(this));
	
		}

	},
	
	
	activateTimeRadios: function (activate) {
		this.timeRadios = $('contact_form').getElements('input[name=contact_time]')
		var num_options = this.timeRadios.length;
		if (activate) {
			for (i=0; i<num_options; i++) {
				this.timeRadios[i].disabled = false;
			}
		}
		else {
			for (i=0; i<num_options; i++) {
				this.timeRadios[i].disabled = true;
			}
		}
	},
	
	submitForm: function () {
		
		
		var inicialize = this.inicialize.bind(this);
		$('contact_form').send({
			update: $('content'),
			onComplete: inicialize
		});
		
		return false;
		
	}
		
};
