$(document).ready(function() {
  $('.button').hover(function() {
	$(this).addClass('hover');
  }, function() {
	$(this).removeClass('hover');
  });


  $('#btn-ok').click(function() {

	  if ($('input:checked').length == 0)
	  {
		alert("需要至少回答一个问题才能提交问卷。");	
		return false;
	  }

		$.post('ouremployee.jsp', $("#form1").serialize(), 
				function(data) {
					if (data.success) {
						window.location = 'ouremployee_succ.html';
					} else {
						alert("抱歉，你的问卷没有提交成功，请稍后重试。");
					}
		},	'json');

  });


  $('#btn-report').click(function() {
	  if (! window.confirm('查看投票情况需要授权，如果你不是管理员请点取消返回。')) {
		return false;
	  }
		window.location = 'ouremployee_report.html';
  });

});
