Event.observe(window,'load',cargaEventosBotonesProductos);

var botones_productos = new Array();
var botones_productos_labels = new Array();
var botones_productos_inputs = new Array();

function cargaEventosBotonesProductos() {
	$$('.ficha_productos label ').each(function(s,index) {
/*		botones_productos_labels.push(s);*/
		botones_productos_labels[parseInt(s.getAttribute('n_label'))-1] = s;
	});	
	$$('.ficha_productos label span').each(function(s,index) {
		s.innerHTML = 'Seguro de <br/>'+s.innerHTML;
		//s.style.display='none';
	});	
	$$('.ficha_productos').each(function(s,index) {
/*		botones_productos.push([s,false,(index+1)]);
		botones_productos_labels[index].addClassName('fondo_productos_off'+(index+1));*/
		botones_productos[parseInt(s.getAttribute('n_ficha'))-1] = [s,false,(parseInt(s.getAttribute('n_ficha')))];
		botones_productos_labels[parseInt(s.getAttribute('n_ficha'))-1].addClassName('fondo_productos_off'+(parseInt(s.getAttribute('n_ficha'))));
	});
	$$('.ficha_productos label input').each(function(s,index) {
/*		botones_productos_inputs.push(s);
		botones_productos_inputs[index].style.marginLeft='-100px';
		botones_productos_inputs[index].style.marginTop='-20px';
		botones_productos[index][1]=s.checked;
		Event.observe(s,'click',function(e) {
			if ( botones_productos[index][1] ) {
				botones_productos_labels[index].removeClassName('fondo_productos_on'+(index+1));
				botones_productos_labels[index].addClassName('fondo_productos_off'+(index+1));
			}
			else {
				botones_productos_labels[index].removeClassName('fondo_productos_off'+(index+1));
				botones_productos_labels[index].addClassName('fondo_productos_on'+(index+1));
			}
			botones_productos[index][1]=s.checked;
		});*/
		botones_productos_inputs[parseInt(s.value)-1] = s;
		botones_productos_inputs[parseInt(s.value)-1].style.marginLeft='-100px';
		botones_productos_inputs[parseInt(s.value)-1].style.marginTop='-20px';
		botones_productos[parseInt(s.value)-1][1]=s.checked;
		Event.observe(s,'click',function(e) {
			if ( botones_productos[parseInt(s.value)-1][1] ) {
				botones_productos_labels[parseInt(s.value)-1].removeClassName('fondo_productos_on'+(parseInt(s.value)));
				botones_productos_labels[parseInt(s.value)-1].addClassName('fondo_productos_off'+(parseInt(s.value)));
			}
			else {
				botones_productos_labels[parseInt(s.value)-1].removeClassName('fondo_productos_off'+(parseInt(s.value)));
				botones_productos_labels[parseInt(s.value)-1].addClassName('fondo_productos_on'+(parseInt(s.value)));
			}
			botones_productos[parseInt(s.value)-1][1]=s.checked;
		});
	});
}