
// ----------------------------------------------------------------
// clase ToggleCheckBox
//      en un grupo de botones radio se adjudica un div para cada boton.
//      si esta activado se muestra el div, sino pues no.
// __________________________
// argumentos:    ids  -  array asociativo multiple con el siguiente par (id_input, id_div)
// ----------------------------------------------------------------

var ToggleCheckBox = Class.create();

ToggleCheckBox.prototype = {
  
  initialize:   function (ids) {
             		this.input = ids[0];
              	this.div = ids[1];
								
								if (typeof this.input == 'string')
									this.input = [this.input];
								for (var i = 0 ; i < this.input.length ; i++)
								{
									Event.observe ($(this.input [i]), 'click', this.actua.bindAsEventListener (this), true);
								}
								this.actua ();
            },
            
  actua:      	function (e) {
								var checked = false;
								for (var i = 0 ; i < this.input.length ; i++)
										if ($(this.input [i]).checked == true)
											checked = true;
              	if (checked)
                	$(this.div).style.display = 'block';
              	else
                	$(this.div).style.display = 'none';
            }
};



var CheckBox_Input_Validate = Class.create();

CheckBox_Input_Validate.prototype = {
  
  initialize:   function (checkbox, input, class_name) {
             		this.checkbox = checkbox;
              	this.input = input;
              	this.class_name = class_name;
								Event.observe ($(this.checkbox), 'click', this.make.bindAsEventListener (this), true);
								this.make ();
            },
            
  make:      	function (e) {
								var checked = false;
								if( $( this.checkbox).checked == true)
								  $(this.input).addClassName( this.class_name)
								else
								  $(this.input).removeClassName( this.class_name)
            }
};