$(document).ready(function(){ 
	$("#ownhome").change(function(){
		if ($(this).val()=='Yes') {
			$(".no-home").hide();
			$(".yes-home").show();
		} else if ($(this).val()=='No') {
			$(".yes-home").hide();
			$(".no-home").show();
		} else {
			$(".no-home").hide();
			$(".yes-home").hide();
		}
	});
	$("#homeyes").click(function(){
		$(".no-home").hide();
		$(".yes-home").show();
	});
	$("#homeno").click(function(){
		$(".yes-home").hide();
		$(".no-home").show();
	});
	
	$("#form_submit").click(function(){
		//alert('dsafsd');
		//$("#ivaform").hide();
		 //document.ivaform.submit();
		//$("#ivaform").submit();
		//return true;
		$.post("form.php",{
			required: $("#required").val(),
			sid: $("#sid").val(),
			redirect: $("#redirect").val(),
			errorpage: $("#errorpage").val(),
			
			name: $("#name").val(),
			house: $("#house").val(),
			postcode: $("#postcode").val(),
			telephone: $("#telephone").val(),
			mobile: $("#mobile").val(),
			alt_phone: $("#alt_phone").val(),
			best_time: $("#best_time").val(),
			email: $("#email").val(),
			ownhome: $("#ownhome").val(),
			property: $("#property").val(),
			mortgage_outstanding: $("#mortgage_outstanding").val(),
			homeowner_type: $("#homeowner_type").val(),
			debts: $("#debts").val(),
			creditors: $("#creditors").val(),
			monthly_income: $("#monthly_income").val(),
			expenditure: $("#expenditure").val(),
			employment: $("#employment").val(),
			marital: $("#marital").val(),
			briefhistory: $("#briefhistory").val()
        },function(data){
			$("form").submit();
		});
		return false;
    });
	
});