$(document).ready(function () {

	//ANMELDUNG
	$('#confirmRegistration').click( function(t){
	var type = "anmeldung";
		if($('#getNewsletter').attr('checked')){
			
		};
		//$.post("/ajax.php?id="+type, { func: "sendMsg" },
		if(!$('#confirmit').attr('checked')){
			if(!confirm("Wollen Sie sich wirklich anmelden?")){
			return false;
			};	
			$('#confirmit').attr('checked', 'checked');
		};
		$('#confirmRegistration').html('Bitte warten...');
		$.post("/ajax.php?id="+type, { func: "sendConfirm", getnewsletter:$('#getNewsletter').attr('checked'), setcookie:$('#setcookie').attr('checked'), which:$('#which').val(), geschlecht:$('#geschlecht').val(), vname:$('#vname').val(), nname:$('#nname').val(), firma:$('#firma').val(), email:$('#email').val(), telefon:$('#telefon').val(), strasse:$('#strasse').val(), plz:$('#plz').val(), ort:$('#ort').val() },
		function(data){
			if(data.trace){ alert(data.trace)};
			if(data.success){
				$('#confirmRegistration').after('Danke!');
				$('#confirmRegistration').remove();
			}else{
				$('#confirmRegistration').html('erneut senden');
			}
			if(data.msg){
				if($('.respondMsg').length){
					$('.respondMsg').html(data.msg);
				}else{
					$('#lasthr').after('<div class="respondMsg">'+data.msg+'</div>');
				}
				
			};
		}, "json");
		return false;
	});

	//Magic Moments
	$('.mmdelete').click( function(t){
	id = $(this).attr('id');
	$.post("/ajax.php?id=magicmoments", { func: "addEvent", id:$(this).attr('id'), check:false },
		function(data){
			if(data.trace){ alert(data.trace)};
			$('#'+id).parent().slideUp('normal',function(){location.reload();});
		}, "json");
		return false;
	});

		
});
