$(document).ready(function(){
	  $("body").append('<div id="popup_overlay" style="display:none;"></div><div id="popup_2" class="popup" style="display:none;"><a href="#"  class="popup_closebox popup_cl">Close</a><div class="pop_box"><div class="pop_up_tl"></div><div class="pop_up_tc">&nbsp;</div><div class="pop_up_tr"></div><div class="pop_up_c"><div class="pop_up_content"><h2 id="feedback_title">&nbsp;</h2><form method="post" action="./members/modules/user/feedback.php" id="feedbackForm"><div id="but_Submit"><p>This is your community and we rely on your feedback to help us improve. Whether you\'ve noticed an error, have a great idea or just want to tell us what you think - we want to know about it!<br /><br />Please select one of the following options and jot down a few details.</p><p><select style="width:200px;" name="category" id="feedback_category"><option value="General feedback">General feedback</option><option value="Complaint">Complaint</option><option value="I have a great idea">I have a great idea</option><option value="I have found a bug!">I have found a bug!</option></select></p><p>Enter your comment:</p><p><textarea class="inp_bord" rows="6" cols="60" name="content" id="feedback_content"></textarea></p><p class="center"><span class="button_bg_1 button_size_1" ><input type="submit" value="Submit feedback" id="but_Submit-1" /></span>&nbsp;&nbsp;<span class="button_bg_5 button_size_1" id="but_Cancel"><input type="reset" value="Cancel" class="popup_closebox" /></span></p></div><div id="but_OK"><p>Thank you for your feedback. Your comments are welcomed. Click \'ok\' to continue</p><p class="center"><span class="button_bg_1 button_size_1"><input type="submit" value="OK" id="popup_feedback_ok" /></span></p></div></form><div class="both"></div></div></div><div class="pop_up_bl"></div><div class="pop_up_bc">&nbsp;</div><div class="pop_up_br"></div></div></div>');
      $('#fdbk_tab').click(function() {
                $('#popup_2').show();
				$('#popup_overlay').show();
                $('#but_Submit').show();
				$("h2#feedback_title").html('Feedback');
                $('#but_OK').hide();
				$('#but_Submit-1').click(function() {
					 $('#but_Submit').hide();
					 $('#but_OK').show();
					 $("h2#feedback_title").html('Feedback sent to the FSI Team');
					return false;
				});
				$('.popup_closebox').click(function() {
					$('#popup_2').hide();
					$('#popup_overlay').hide();
					return false;
				});
				$('#popup_feedback_ok').click(function() {
					var category = $("#feedback_category").val();
					var content = $("#feedback_content").val();
					$.ajax({
          				type: "POST",
          				url: "/members/modules/user/feedback.php",
           				data: "category="+category+"&content="+content,
		   				dataType : "json", 
           				success: function(){}
					});
				$('#popup_2').hide();
				$('#popup_overlay').hide();
				return false;
				});
        return false;
		});
});