/*------------------------------------------------------------------------------------------
site.page.init.first.dir.js
da peng
dp165137419@163.com
------------------------------------------------------------------------------------------*/

/*------------------------------------------------------------------------------------------
site.page.init.first.dir.js
田鸿端
117119949@163.com

增加功能：	初始化游戏金币快速购买部分的游戏列表
			构建游戏服务器
			改变form中action的值，使页面顺利跳转到对应的checkout.html
			当字母被选中，构建以该字母开头的游戏服务器列表
			改变form中action的值，使页面顺利跳转到对应的checkout.html
			当服务器被选中时，构建 product 列表
------------------------------------------------------------------------------------------*/

(function ($) {
    $(document).ready(function () {

	


		
				var gameTypeIdGold = $('#gameTypeIdGold').val();
				var action;
				
				switch (gameTypeIdGold){
					case '1':
					case '2':
					
						$('.select_v').show();
						$('#serverIdGold').width(300);
						$.post('configs/ajax/fit.gold.server.ajax.php',{'gameTypeIdGold':gameTypeIdGold},function(data){
							$('#serverIdGold').html(data);
						});
						break;
					case '0':
					case  0 :
					case  '':
							$('.select_v').hide();
							$('#serverIdGold').width(300);
							$('#serverIdGold').html('<option>---Please select the server--- </option>');
						break;
					default:
						$('.select_v').hide();
						$('#serverIdGold').width(300);
						$.post('configs/ajax/fit.gold.server.ajax.php',{'gameTypeIdGold':gameTypeIdGold},function(data){
							$('#serverIdGold').html(data);
						});
						break;						
				}
				
				
					
					
					var productHtml = '<option>---Please select the product--- </option>';
					
					$('#ProductNameListID').html(productHtml);
					
							
			/* 改变form中action的值，使页面顺利跳转到对应的checkout.html */
			/* GoldAction为site.page.name.js 中方法 */
				
			
							
		
			
			/* 当字母被选中，构建以该字母开头的游戏服务器列表，此功能暂时针对魔兽世界 */
			
			
			/* 当服务器被选中时，构建 product 列表 */
			$('#serverIdGold').change(function(){
					var serverIdGold = $(this).val();
					var type = true;
					var gameTypeIdGold = $('#gameTypeIdGold').val();
					$.post('configs/ajax/fit.gold.bag.ajax.php',{'serverIdGold':serverIdGold,'type':type,'gameTypeIdGold':gameTypeIdGold},function(data){
							$('#ProductNameListID').html(data);
					});
			});
			
			
		});
})(jQuery);


