$(function(){
	$('#confirmSend1').dialog({
	    autoOpen: false,
	    width: 400,
	    modal: true,
	    resizable: false,
	    buttons: {
	        "Versenden": function() {
             document.formular1.submit();
	        },
	        "Abbrechen": function() {
	            $(this).dialog("close");
	        }
	    }
	});

	$('#confirmSend2').dialog({
	    autoOpen: false,
	    width: 400,
	    modal: true,
	    resizable: false,
	    buttons: {
	        "Versenden": function() {
	            document.formular2.submit();
	        },
	        "Abbrechen": function() {
	            $(this).dialog("close");
	        }
	    }
	});

	$('form#formular1').submit(function(){
	    $('#confirmSend1').dialog('open');
	    return false;
	});

	$('form#formular2').submit(function(){
	    $('#confirmSend2').dialog('open');
	    return false;
	});
	
    $('#ummeldedatum').datepicker({showOn: 'both', buttonImageOnly: true, buttonImage: template_path+'/media/calendar.png'});
    $('#ummeldedatum2').datepicker({showOn: 'both', buttonImageOnly: true, buttonImage: template_path+'/media/calendar.png'});
});


function showLForm(part){
	if(part == 1){
		$('table#form2').hide();
		$('table#form1').fadeIn('slow');
	}
	else{
		$('table#form1').hide();
		$('table#form2').fadeIn('slow');
	}
}

function clear_form_elements(ele) {

    $(ele).find(':input').each(function() {
        switch(this.type) {
            case 'password':
            case 'select-multiple':
            case 'select-one':
            case 'text':
            case 'textarea':
                $(this).val('');
                break;
            case 'checkbox':
            case 'radio':
                this.checked = false;
        }
    });

}

