$(document).ready(function(){
	
var startup_finished = function(){
		$('#startup_finished').click(function(){
			$.ajax({
   				type: "POST",
   				url: "initializeuser.php",
   				data: "",
   				success: function(msg){
					$('#startup_finished_notice').html(msg);
   				}
 			});
		});
}

var submit_weight = function (){	
   		$('#startup_weight_submit').click(function(){
			var weight = $(this).siblings('#startup_weight').val();
			$.ajax({
				async:"false",
   				type: "POST",
   				url: "submitweight.php",
   				data: "weight="+weight,
   				success: function(msg){
					//$('#startup_weight_notice').html(msg);
					$.ajax({
						async:"false",
   						type: "POST",
   						url: "middle_column_startup.php",
   						data: "n=12",
   						success: function(msg){
							$('#middle-column').html(msg);
							startup_finished();//make sure the finish startup button will work
							submit_height();//make sure the submit height button will work
   						}
 					});
   				}
 			});
		});
}
	
	
var submit_height = function(){		
		$('#startup_height_submit').click(function(){
			var height = $(this).siblings('#startup_height').val();
			$.ajax({
				async:"false",
   				type: "POST",
   				url: "submitheight.php",
   				data: "height="+height,
   				success: function(msg){
					//$('#startup_height_notice').html(msg);
					$.ajax({
						async:"false",
   						type: "POST",
   						url: "middle_column_startup.php",
   						data: "n=12",
   						success: function(msg){
							$('#middle-column').html(msg);
							startup_finished(); //make sure the finish startup button will work
							submit_weight(); //make sure the submit weight button will work
   						}
 					});
   				}
 			});
		});
}		
		submit_weight();
		submit_height();
		startup_finished();
		
		
		
	
	
});