$(document).ready(function () {
    $('#gameId').change(function () {
		    $('#price').val('');
		    $('#productQuantity').val('');
				var gid = $(this).val();
				$.ajax({
				    type: 'POST', 
						timeout: 10000, 
						url: 'ajax/fit.gold.server.ajax.php', 
						data: {'gid':gid}, 
						dataType: 'html', 
						error: function (a, b) { 
						    alert('Sorry, request timeout, click confirm to reload this page.');
								window.location.reload(document.URL);
						},
						beforeSend: function () { $('#serverId').attr('disabled', true); }, 
						success: function (data) { 
								$('#serverId').attr('disabled', false);
						    $('#serverId').html(data); 
						}
				});
				$.post('ajax/fit.gold.get.unit.ajax.php', {'gid':gid}, function (data) {$('#fitGoldUnit').html(data);});
		});
		
    $('#serverId').change(function () {
		    $('#price').val('');
		    $('#productQuantity').val('');
				var gid = $('#gameId').val();
				var serverId = $(this).val();
				$.ajax({
				    type: 'POST', 
						timeout: 10000, 
						url: 'ajax/fit.gold.index.package.ajax.php', 
						data: {'gid':gid, 'serverId':serverId}, 
						dataType: 'html', 
						error: function (a, b) { 
						    alert('Sorry, request timeout, click confirm to reload this page.');
								window.location.reload(document.URL);
						},
						beforeSend: function () { $('#fitPackStore').html('Please wait, loading...'); }, 
						success: function (data) { $('#fitPackStore').html(data); }
				});
		});
});