$(document).ready(
  function()
  { 
   x = Math.floor(Math.random()*10) + 1;
   vtoroi = 20 - x;
   y = Math.floor(Math.random()*vtoroi) + 1;

    $("#first").append(x);
	$("#second").append(y);
	
	res = x+y; 
	
  }
);
		
$(function() {	
	$("#slider_1").slider({
		value: 0,
		min: 0,
		max: 20,
		step: 1,
		
     slide: function(event, ui) {
		$("#amount").empty();
		$("#amount").append(ui.value);
		
		if (ui.value == res) {		
		 $("#post").show();
		 $("#note").hide();
		} else {	
		$("#post").hide();
		$("#note").show();
		}
	}	

});
		
$("#post").click(function () {			
	if ($("#slider_1").slider("value") == res) {	       
		  $("#post").hide(); 
		  $("#slider_1").slider("disable"); 
		  $("#chto_post").show("fast");
			}
		});	
	});
	