// JavaScript Document
function makeSublist(parent,child,isSubselectOptional,childVal)
{
	$("body").append("<select style='display:none' id='"+parent+child+"'></select>");
	$('#'+parent+child).html($("#"+child+" option"));
	
		var parentValue = $('#'+parent).attr('value');
		$('#'+child).html($("#"+parent+child+" .sub_"+parentValue).clone());
	
	childVal = (typeof childVal == "undefined")? "" : childVal ;
	$("#"+child+' option[@value="'+ childVal +'"]').attr('selected','selected');
	
	$('#'+parent).change( 
		function()
		{
			var parentValue = $('#'+parent).attr('value');
			$('#'+child).html($("#"+parent+child+" .sub_"+parentValue).clone());
			if(isSubselectOptional) $('#'+child).prepend("<option id='abcdef' value=''> -- Alle -- </option>");
			$('#'+child).trigger("change");
            $('#'+child).focus();
			$('#abcdef').attr('selected','selected');
		}
	);
}

	$(document).ready(function()
	{
		makeSublist('tfi_listKD1Mtgl1_DIVISION','tfi_listKD1Mtgl1_CLUB_NR_K', 1, '');	
	});

