function checkthis()
{
	Element.Properties.catRef = {
 
    get: function(){
        return this.catRef;
    },
 
    set: function(value){
        this.catRef = value;
        this.setAttribute('catRef', value);
    }
 
};
i = 0;
	$$('li.cat_holder').each(function(pic){
		pic.set('catRef', i);
		i++;
		//alert(pic.get('catRef'));
		//hide check boxes
		pic.getElement('input').setStyle('display', 'none');
		//check to see if check box is checked
		var input = pic.retrieve('own:input', pic.getElement('input').store('parent', pic));
		if (pic.retrieve('own:input').get('checked')){
			pic.fade(1);
		} else {
			pic.fade(0.3);
			var input = pic.retrieve('own:input');
			whichGroup = input.get('id');
			hideEvents('div.'+whichGroup);
		}
		pic.addEvent('click', function(event){
			toggle(this);
		});
	});
}

function toggle(pic)
{
			var input = pic.retrieve('own:input');
			whichGroup = input.get('id');
			sendToAS(pic.get('catRef'));
		if (pic.retrieve('own:input').get('checked')){
			input.set('checked', false);
			pic.fade(0.3);
			hideEvents('div.'+whichGroup);
		} else {
			var input = pic.retrieve('own:input').set('checked', true);
			pic.fade(1);
			showEvents('div.'+whichGroup);
		}
}
function hideEvents(thisevent)
{
	$$(thisevent).each(function(eventDiv){
			eventDiv.setStyle('display', 'none');
	});
}
function showEvents(thisevent)
{
	$$(thisevent).each(function(eventDiv){
			eventDiv.setStyle('display', 'block');
	});
}




window.addEvent('domready', function(){
	checkthis();
});