function checkthis()
{
	$$('li.img_holder').each(function(pic){
		//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);
		}
		pic.addEvent('click', function(event){
			toggle(this);
		});
	});
}

function toggle(pic)
{
			var input = pic.retrieve('own:input');
			whichGroup = input.get('id');
		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);
		}
		// for items in more than one group - turn them back on if the other group is checked
		$$('li.img_holder').each(function(turnon){
			if (turnon.retrieve('own:input').get('checked')){
				var input = turnon.retrieve('own:input');
				whichGroup = input.get('id');
				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();
});