/*
    Document   : _oomain
    Created on : May 13, 2010, 3:08:34 PM
    Author     : TJ Beatrice <tj@artlabx.com>
    Description:

*/


$(document).ready(function(){
	initFilterToggle();
	//initCheckAllToggle();
 });



function initFilterToggle(){
	// execute function for all elements which match the selector
	$("#OBJ3CT-filter a.filter-toggle").each(function(){
		$(this).siblings(".checkbox-list").hide();
		$(this).html('+ show');
	});

	// assign the toggle handler to all elements which match the selector
	$("#OBJ3CT-filter a.filter-toggle").toggle(function(){
		$(this).siblings(".checkbox-list").show();
		$(this).html('- hide');
	}, function(){
		$(this).siblings(".checkbox-list").hide();
		$(this).html('+ show');
	});

}


function initCheckAllToggle(){

	// *******
	// standard
	// *******

	$("#OBJ3CT-filter a.checkall-toggle").each(function(){
		$(this).siblings().children(".checkbox").attr('checked', false);
		$(this).html('[ check all ]');
	});

	// assign the toggle handler to all elements which match the selector
	// the selecor looks for children of the sibling with the "checkbox" class
	$("#OBJ3CT-filter a.checkall-toggle").toggle(function(){
		$(this).siblings().children(".checkbox").attr('checked', true);
		$(this).html('[ check all ]');
	}, function(){
		$(this).siblings().children(".checkbox").attr('checked', false);
		$(this).html('[ clear ]');
	});


	// *******
	// inverse
	// *******

	$("#OBJ3CT-filter a.checkall-toggleinverse").each(function(){
		$(this).siblings().children(".checkbox").attr('checked', true);
		$(this).html('[ clear ]');
	});

	// assign the toggle handler to all elements which match the selector
	// the selecor looks for children of the sibling with the "checkbox" class
	$("#OBJ3CT-filter a.checkall-toggleinverse").toggle(function(){
		$(this).siblings().children(".checkbox").attr('checked', false);
		$(this).html('[ clear ]');
	}, function(){
		$(this).siblings().children(".checkbox").attr('checked', true);
		$(this).html('[ check all ]');
	});

}
