// JavaScript Document



<!-- SIFR 3 -->

var myriad = { src: 'flash/myriadpro-cond.swf' };



sIFR.activate(myriad);



sIFR.replace(myriad, {

  selector: 'h1',

  css: '.sIFR-root { color: #00275A; }', wmode: 'transparent'

});



sIFR.replace(myriad, {

  selector: 'h2',

  css: '.sIFR-root { color: #666666; }', wmode: 'transparent'

});



sIFR.replace(myriad, {

  selector: 'h3',

  css: '.sIFR-root { color: #00275A; }', wmode: 'transparent'

});



sIFR.replace(myriad, {

  selector: '#BenefitsList ul li span',

  css: '.sIFR-root { color: #719102; line-height:1em; }', wmode: 'transparent'

});





$(document).ready(function(){  



   $("#BodyInnerContentBG").corner();



	

    $("#ExpressFormTitle").toggle(

                function () {

                        $("#ExpressFormTitle").attr("src","images/DetailedEnqFormTitle.jpg");

						$("#ExpressForm").css("display","none");

						$("#DetailsForm").css("display","block");

						

                },

                function () {

                        $("#ExpressFormTitle").attr("src","images/EnqFormTitle.jpg");

						$("#ExpressForm").css("display","block");

						$("#DetailsForm").css("display","none");

                }

        ); 

	

		// to toggle health conditions

		$("input.yes").click(function()

		{

				$('#HealthissuesHolder').css("display","block");

		});

		

		$("input.no").click(function()

		{



				$('#HealthissuesHolder').css("display","none");

		});

		

		

		// toggle type of enquiry desc box

		$("select#TypeofEnquiry").change(function()

		{

			var selected = $("#TypeofEnquiry option:selected");       

			var output = "";  

			if(selected.val() == 'Other'){  

				$('#TypeofEnquiryOtherDescHolder').css("display","block");

			} 

			else{

				$('#TypeofEnquiryOtherDescHolder').css("display","none");

			}

		});

		

		// toggle type of enquiry desc box

		$("select#TypeofEnquiryDetailed").change(function()

		{

			var selected = $("#TypeofEnquiryDetailed option:selected");       

			var output = "";  

			if(selected.val() == 'Other'){  

				$('#TypeofEnquiryOtherDescHolderDetailed').css("display","block");

			} 

			else{

				$('#TypeofEnquiryOtherDescHolderDetailed').css("display","none");

			}

		});

		



		

		var container = $('div.ErrorHolder');



		// validate the form when it is submitted

		$("#ExpressCommentForm").validate({

			errorContainer: container,

			errorLabelContainer: $("ul", container),

			wrapper: 'li',

			meta: "validate",

			submitHandler: function() {

			ExpressFormValidated();

		   }

		});

		

		

		function ExpressFormValidated()

		{

			// on submit

			//$('#ExpressCommentForm').submit(function(){

				

				//var action = $(this).attr('action');

				var action  = 'php/sendemailExpressForm.php';

				

				$('#Submit')

					.before('<img src="images/ajax-loader.gif" class="loader" alt="Loading" />')

					.attr('disabled','disabled');

							

				$.post(action, {

					Name: $('#Name').val(),

					Phone: $('#Phone').val(),

					Email: $('#Email').val(),

					State: $('select#State').val(),

					TimetoCall: $('select#TimetoCall').val(),

					TypeofEnquiry: $('select#TypeofEnquiry').val(),

					TypeofEnquiryOtherDesc: $('#TypeofEnquiryOtherDesc').val(),

					Referrer: $('#Referrer').val()

				},

					function(data){	

						$('#ExpressCommentForm #Submit').attr('disabled','');

						$('.response').remove();

						$('#ExpressCommentForm img.loader').fadeOut(500,function(){$(this).remove()});

						if(data=='Message sent!') 

						{

							<!--

							window.location = "EnquiryConfirmation.html";

							//-->

						}

						

					}

				);

				return false;

			//});

		}

		

		

		// validate the Detailed form

		$("#DetailedCommentForm").validate({

			errorContainer: container,

			errorLabelContainer: $("ul", container),

			wrapper: 'li',

			meta: "validate",

			submitHandler: function() {

			DetailedFormValidated();

		   }

		});

	

	

		function DetailedFormValidated()

		{

		// on submit

		//$('#DetailedCommentForm').submit(function(){

			

			//var action = $(this).attr('action');

			var action  = 'php/sendemailDetailedForm.php';

			

			ExistHealthstr = $("input[name=ExistingHealthIssues]:checked").val(); // to get existing health issues

			

			$('#SubmitDetailed')

				.before('<img src="images/ajax-loader.gif" class="loader" alt="Loading" />')

				.attr('disabled','disabled');

						

			$.post(action, {

				NameDetailed: $('#NameDetailed').val(),

				PhoneDetailed: $('#PhoneDetailed').val(),

				EmailDetailed: $('#EmailDetailed').val(),

				StateDetailed: $('select#StateDetailed').val(),

				TimetoCallDetailed: $('select#TimetoCallDetailed').val(),

				ReferrerDetailed: $('#ReferrerDetailed').val(),

				BirthDay: $('#BirthDay').val(),

				BirthMonth: $('#BirthMonth').val(),

				BirthYear: $('#BirthYear').val(),

				Occupation: $('#Occupation').val(),

				SelfEmployed: $('#SelfEmployed').val(),

				CurrentIncome: $('#CurrentIncome').val(),

				ExistingHealthIssues: ExistHealthstr,

				HealthIssueDesc: $('#HealthIssueDesc').val(),

				CurrentIncome: $('#CurrentIncome').val(),

				TypeofEnquiryDetailed: $('select#TypeofEnquiryDetailed').val(),

				TypeofEnquiryOtherDescDetailed: $('#TypeofEnquiryOtherDescDetailed').val(),

				AdditionalInfo: $('#AdditionalInfo').val()

			},

				function(data){	

					$('#DetailedCommentForm #SubmitDetailed').attr('disabled','');

					$('.response').remove();

					$('#DetailedCommentForm img.loader').fadeOut(500,function(){$(this).remove()});

					

					if(data=='Message sent!') 

					{

						<!--

						window.location = "EnquiryConfirmation.html";

						//-->

					}

					

				}

			);

			return false;

		//});

		

		}

		

		

		


			  

 }); //end document loaded





