			$(document).ready(function(){
				/*
				hide div that contains the text for the price
				It will be unhidden once we have a price div to display
				*/
				$(".leftText").hide();
				$("#invoice_details").hide();
				$("#additional_contact_container_1").hide();
				$("#additional_contact_container_2").hide();
				$("#additional_contact_container_3").hide();

				$('#paymentinvoice').click(function(){
					$('#invoice_details').show();
					});
/**
 * INVIVIDUAL REGISTRATIONS LOGIC 
 */

				$('#show_additional_contact1').click(function(){
					$('#additional_contact_container_1').show();
					$('#show_additional_contact1').hide();

					});
				$('#show_additional_contact2').click(function(){
					$('#additional_contact_container_2').show();
					$('#show_additional_contact2').hide();
					});
				$('#show_additional_contact3').click(function(){
					$('#additional_contact_container_3').show();
					$('#show_additional_contact3').hide();
					});
				
				/**
				 * hide price divs 
				 */
				$('#how_did_you_hear_about_tcpa_other,#fee_uk_concessionary,#fee_international_concessionary,#fee_international_standard,#fee_uk_standard').hide();
				$('#uk_overseasuk,#uk_overseasoverseas,#type_individualstandard,#type_individualstudent,#type_individualretired,#type_individualunemployed').click(displayMembershipFeeIndividual);

				$('#address_typehome').click(function(){
					$('#organisation').attr("disabled", true);
					$('#contact_position').attr("disabled", true);
					});
				$('#address_typework').click(function(){
					$('#contact_position').attr("disabled", false);
					$('#organisation').attr("disabled", false);
					});
				$('#how_did_you_hear_about_tcpaother').click(function(){
					$('#how_did_you_hear_about_tcpa_other').show();
					});

				/*
				This function will .show() the div that contains the correct value
				*/
				function displayMembershipFeeIndividual()
				{
					var uk_or_overseas = $('input:radio[name=uk_overseas]:checked', '#register').val();
					var membership_type = $('input:radio[name=type_individual]:checked', '#register').val();

					if ( typeof uk_or_overseas !== "undefined" && uk_or_overseas) {
						switch(uk_or_overseas)
						{
							case "uk":
								if ( typeof membership_type !== "undefined" && membership_type) {
										$(".leftText").show(); //this contains the text that is printed before the acutal price
									switch(membership_type) {
                                    	case "standard":
                                            $("#fee_uk_standard").show();
                                            $("#fee_uk_concessionary").hide();
                                            $("#fee_international_concessionary").hide();
                                            $("#fee_international_standard").hide();
										break;
                                    	case "student":
                                    	case "retired":
                                    	case "unemployed":
                                            $("#fee_uk_standard").hide();
                                            $("#fee_uk_concessionary").show();
                                            $("#fee_international_concessionary").hide();
                                            $("#fee_international_standard").hide();
										break;
									}
								}

							break;
							case "overseas":
								if ( typeof membership_type !== "undefined" && membership_type) {
									$(".leftText").show(); //this contains the text that is printed before the acutal price
									switch(membership_type) {
                                    	case "standard":
                                            $("#fee_uk_standard").hide();
                                            $("#fee_uk_concessionary").hide();
                                            $("#fee_international_concessionary").hide();
                                            $("#fee_international_standard").show();
										break;
                                    	case "student":
                                    	case "retired":
                                    	case "unemployed":
                                            $("#fee_uk_standard").hide();
                                            $("#fee_uk_concessionary").hide();
                                            $("#fee_international_concessionary").show();
                                            $("#fee_international_standard").hide();
										break;
									}
								}
							break;

						}
					}
				}

/*ORGANISATIONS LOGIC*/

				$('#localAuthority_publicBody_extra,#charity_corporate_extra').hide();
				$('#fee_library,#fee_charity_3mil_lt,#fee_charity_3mil_gt,#fee_corporate_3mil_lt,#fee_corporate_3mil_gt,#fee_corporate_public_lt_100,#fee_corporate_public_gt_100,#fee_corporate_public_gt_500,#fee_parish').hide();
/**
 * If charity OR corporate is the value of type_organisation, unhide #charity_corporate_extra 
 */

		$('#type_organisationcharity,#type_organisationcorporate').click(function(){
			var show_divs = [ "#charity_corporate_extra" ];
			toggleCorporateDivDisplay(show_divs);
			$(".leftText").hide(); //this contains the text that is printed before the acutal price
			$('input[name="turnover"]').attr('checked', false);
		});

		$('#type_organisationparish').click(function(){
			var show_divs = [ "#fee_parish",  ".leftText"];
			toggleCorporateDivDisplay(show_divs);
			$('input[name="population"]').attr('checked', false);
		});

// If local authority OR public body is the value of type_organisation, unhide #localAuthority_publicBody_extra
		$('#type_organisationpublic').click(function(){
			var show_divs = [ "#localAuthority_publicBody_extra"];
			toggleCorporateDivDisplay(show_divs);
			$(".leftText").hide(); //this contains the text that is printed before the acutal price
			$('input[name="population"]').attr('checked', false);
		});

// Determine which div that holds the fee to display 
		$('#populationbelow100k').click(function(){
			var show_divs = [ "#localAuthority_publicBody_extra", "#fee_corporate_public_lt_100", ".leftText"];
			toggleCorporateDivDisplay(show_divs);
		});

		$('#populationabove100k').click(function(){
			var show_divs = [ "#localAuthority_publicBody_extra", "#fee_corporate_public_gt_100", ".leftText"];
			toggleCorporateDivDisplay(show_divs);
		});

		$('#populationabove500k').click(function(){
			var show_divs = [ "#localAuthority_publicBody_extra", "#fee_corporate_public_gt_500", ".leftText"];
			toggleCorporateDivDisplay(show_divs);
		});

		$('#turnoverbelow3million').click(function(){

				var corporate_or_charity = $('input:radio[name=type_organisation]:checked', '#register').val();

				if ( typeof corporate_or_charity !== "undefined" && corporate_or_charity) {
					switch(corporate_or_charity)
					{
						case "corporate":
							var show_divs = [ "#charity_corporate_extra", "#fee_corporate_3mil_lt", ".leftText"];
							toggleCorporateDivDisplay(show_divs);
						break;

						case "charity":
							var show_divs = [ "#charity_corporate_extra", "#fee_charity_3mil_lt", ".leftText"];
							toggleCorporateDivDisplay(show_divs);
						break;
					}
				}
		});

		$('#turnoverabove3million').click(function(){

				var corporate_or_charity = $('input:radio[name=type_organisation]:checked', '#register').val();

				if ( typeof corporate_or_charity !== "undefined" && corporate_or_charity) {
					switch(corporate_or_charity)
					{
						case "corporate":
							var show_divs = [ "#charity_corporate_extra", "#fee_corporate_3mil_gt", ".leftText"];
							toggleCorporateDivDisplay(show_divs);
						break;

						case "charity":
							var show_divs = [ "#charity_corporate_extra", "#fee_charity_3mil_gt", ".leftText"];
							toggleCorporateDivDisplay(show_divs);
						break;
					}
				}
		});

		$('#type_organisationlibrary').click(function(){
			var show_divs = [ "#fee_library", ".leftText"];
			toggleCorporateDivDisplay(show_divs);
		});

	function toggleCorporateDivDisplay(show_divs) {

		var hide_divs = [
			"charity_corporate_extra", 
			"fee_corporate_public_lt_100",
			"fee_corporate_public_gt_100",
			"fee_corporate_public_gt_500",
			"fee_corporate_3mil_gt",
			"fee_corporate_3mil_lt",
			"fee_charity_3mil_gt",
			"fee_charity_3mil_lt",
			"fee_library",
			"fee_parish",
			"localAuthority_publicBody_extra"
			];

		$.each(hide_divs, function(id, div){
				$("#" + div).hide();
				});

		$.each(show_divs, function(id, div){
				$(div).show();
				});
		}
});
/**
 *  
 */

