// $Id: tokens.js 8633 2010-04-25 12:57:33Z c_schmitz $

$(document).ready(function(){
   $("#filterduplicatetoken").change(function(){
    if ($("#filterduplicatetoken").attr('checked')==true)
    {
        $("#lifilterduplicatefields").slideDown(); 
    }
    else
    {
        $("#lifilterduplicatefields").slideUp(); 
    }
   }) 
	//Token checkbox toggles
	var tog=false;
	$('#tokencheckboxtoggle').click(function() {
		var selecteditems='';
	    $("input[type=checkbox]").attr("checked",!tog);
		$("input[type=checkbox]").each(function(index) {
			if($(this).attr("name") && $(this).attr("checked")) {
				selecteditems = selecteditems + "|" + $(this).attr("name");
				/* alert(index + ': '+$(this).attr("name")); */
				$('#tokenboxeschecked').val(selecteditems);
				/* alert(selecteditems); */
			}
});
		tog=!tog;
	});
	$('input[type=checkbox]').click(function() {
		var selecteditems='';
		$("input[type=checkbox]").each(function(index) {
			if($(this).attr("name") && $(this).attr("checked")) {
				selecteditems = selecteditems + "|" + $(this).attr("name");
				/* alert(index + ': '+$(this).attr("name")); */
				$('#tokenboxeschecked').val(selecteditems);
				/* alert(selecteditems); */
			}
		});	    
	});
});
