﻿$(document).ready(function ($) {
	$("#formModal").modal();
});

$("#yes").click(function() {
	$("#getForm").val("yes");
});

$("#no").click(function() {
	$("#getForm").val("no");
});

$("#formAnwser").submit(function(event) {
	// Prevent original post
	event.preventDefault();
	
	if($("#getForm").val() == "yes") {
		$.post( "survey.php", { fmAction: "anwserForm" } ,
		  function( data ) {
			  $( "#formModal" ).html( data );
		  }
		);
	} else {
		$.post( "survey.php", { fmAction: "closeForm" } );
		$.modal.close();
	}
});
