//start observing the checkboxes
//debugger;
//declaring the class
var CheckboxWatcher = Class.create();

//defining the rest of the class implementation
CheckboxWatcher.prototype = {

  initialize: function(chkBox, fieldset){
    this.chkBox = $(chkBox);
    this.fieldset = $(fieldset);
    //assigning our method to the event
    this.chkBox.onclick = this.bindIt.bindAsEventListener(this);
  },
  
  bindIt: function(evt){
	
		//alert(this.chkBox.checked);
		if (this.chkBox.checked) 
		{
			//alert(this.chkBox.checked);
			//this.chkBox.checked=false;
			new Effect.BlindDown(this.fieldset);
		}
		else { 
			//this.chkBox.checked = true; 
			//alert(fe.checked);
			new Effect.BlindUp(this.fieldset);
		}
    }
};

//var watcher = new CheckboxWatcher('myChk', 'Changed');

var chkList = document.getElementsByClassName('toggler');
var checkbxs = $A(chkList);

checkbxs.each(function(checkbox) {

	fe = $(checkbox);
	//checkbox id is like chk_<fieldset_name>
	var fieldset_id = 'fieldset_' + checkbox.id.substring((checkbox.id.indexOf('_') + 1), checkbox.id.length);
	//alert(fe.checked);
	
	new CheckboxWatcher(checkbox, fieldset_id);
	
	/*
	checkbox.onclick = function() {

		if (fe.checked) 
		{
			fe.checked=false;
			new Effect.BlindUp($(fieldset_id));
		}
		else { 
			fe.checked = true; 
			alert(fe.checked);
			new Effect.BlindDown($(fieldset_id));
		}
		
	}
	*/
});

//start Litbox
var lbList = $('antecalculatie').getElementsByTagName('a');
var nodes = $A(lbList);
	
nodes.each(function(node) {
	if(Element.hasClassName(node, 'LITBox')) {	
		node.onclick = function (){
			new LITBox('<img src = "' + node.href + '">', {type:'alert',overlay:false,width:250,height:230,opacity:.85}); 
			return false;
		}
	}	
});
