function changeForm()
{
	//alert("changeForm()");
	
	var membershipType = $("input[@name=membership_type]:checked").next("label:first").text().toLowerCase();
	//alert ("cf("+membershipType+")");	
	
	$("#mf_course").hide();
	$("#mf_course_end").hide();
	$("#mf_title_field").hide();
	$("#member_form_corp_contact").hide();
	$("#mf_reg_notice").hide();
	$("#mf_institution_op").hide();
	$("#non-inst_details").hide();
	$("#institution_details").hide();
	
	if (membershipType == "individual")
	{
		$("#mf_title_field").show();

		$("#mf_new_inst span.asterisk").remove();
		
		$("#non-inst_details").show();

		$("label[@for=name]").text("Your name");
		$("label[@for=email_address]").text("Your email");
		$("label[@for=rel_member]").text("Choose your Institution");
		$("label[@for=password1]").text("Your password");

		$("#member_form_giftaid").show();
		$("#mf_institution_op").hide();

		$("#mf_reg_notice").show();
	
	}
	
	if (membershipType == 'student')
	{
		$("#mf_title_field").show();

		$("#mf_course").show();
		$("#mf_course span.asterisk").remove();
		$("#mf_course label").after('<span class="asterisk">*</span>');
		
		$("#mf_course_end").show();
		$("#mf_course_end span.asterisk").remove();
		$("#mf_course_end strong").after('<span class="asterisk">*</span>');

		$("#non-inst_details").show();

		$("#mf_new_inst span.asterisk").remove();
		$("#mf_new_inst label").after('<span class="asterisk">*</span>');

		$("label[@for=name]").text("Your name");
		$("label[@for=email_address]").text("Your email");
		$("label[@for=rel_member]").text("Choose your Institution");
		$("label[@for=password1]").text("Your password");
		
		$("#member_form_giftaid").show();
		$("#mf_institution_op").hide();

	}
	
	if (membershipType == 'institution')
	{
		$("#institution_details").show();
		$("#inst_postal_info").append(document.getElementById("postal_information_bottom"));
		$("#high_extra_info").append(document.getElementById("field_extra_info"));

		$("#mf_new_inst").show();
		$("#mf_new_inst span.asterisk").remove();
		$("#mf_new_inst label").after('<span class="asterisk">*</span>');

		$("label[@for=name]").text("Contact name");
		$("label[@for=email_address]").text("Contact email");
		$("label[@for=password1]").text("Admin password");
		
		//remove gift aid stuff 
		$("#member_form_giftaid").hide();


		$("#mf_reg_notice").show();

		//show the institutional membership options
		$("#mf_institution_op").show();
		
	}
	else {
		$("#ind_stu_postal_info").append(document.getElementById("postal_information_bottom"))
		$("#low_extra_info").append(document.getElementById("field_extra_info"));
	}

	
}


$(document).ready(function()
{
	$("input[@name=membership_type]").click(changeForm);
	changeForm();

	/*
	var l = $("#postal_information legend:first");
	l.addClass("button up");
	l.attr("title", "Click to reveal the Postal Information form");
	l.toggle
	(
		function() {$(this).next("div.elements").slideUp("fast");},
		function() {$(this).next("div.elements").slideDown("fast");}
	);
	l.click(function()
	{
		l.trigger("toggle");
		l.toggleClass("up");
	});
	// Don't show in general settings, but do when signing up
	if (memberID > 1) l.trigger("click");
	*/
});