/**
* ==============================================
* SFL 后期 JS 扩展文件
* 整理后直接调用方便维护与管理
* @file   sfl_extra.js
* @author jinlong <sclzjl@gamil.com>  
* @date   2010-08-30 11:54
* @Copyright (c) 2008-2010 lanicntech 
* ==============================================
*/

//////////////////////////////////////////////////////////// gold fast order ///////////////////////////////////////////////////////////////
var opt = '<option>......</option>';

// ie firefox 变量定义
var dpc = '', fpc = '';
if (window.ActiveXObject){
	dpc = 'block';
	fpc = 'left';
}else{
	dpc = 'table';
	fpc = 'none';
}

$(function(){
		// 服务器-阵营
		$('#game_gold_server_express').bind('change', function(){
			var gamecategory = $('#game_gold_server_express').val();
			if(gamecategory != ''){
				$.getJSON(
					'/gold_express.php?act=svft&time='+ new Date(),
					{gtag:gamecategory},
					function(msg){
						var sv = '';
						sv += "<select name='server_gold_express_pram' id='server_gold_express' class='infor_select' onchange=GoldAmount(this.value,'server')>";
						sv += "<option value='' selected='selected'>"+msg.lang.server+"</option>";
						$.each(msg.svname, function(i, s){
							sv += '<option value="'+s+'">'+s+'</option>';
						});
						sv += '</select>';
						$('.gold_express_server').html(sv);
						
						var ft = '';
						ft += "<select name='fraction_gold_express' id='fraction_gold_express' class='infor_select' onchange=GoldAmount(this.value,'fraction')>";
						ft += "<option value='' selected='selected'>"+msg.lang.fraction+"</option>";
						$.each(msg.ftname ,function(i, f){
							ft += '<option value="'+f+'">'+f+'</option>';
						});
						ft += '</select>';
						$('.gold_express_fraction').html(ft);
					}
				);
				
				$('#serverTip').attr('class','onCorrect').css('height','20px').html('');
				
			}else{
				$.getJSON(
					'/gold_express.php?act=frck&time='+ new Date(),
					{data:'select_cat'},
					function(msg){
						$('#serverTip').attr('class','onError').css({display:dpc,width:'auto',float:fpc}).html(msg);
					}
				);
			}
			
		});
		
		// trade type
		$('#gold_delevery_method').bind('change', function(){
			$('.trade_method').hide();
			var obj = 'trade_'+$(this).attr('value');
			$('#'+obj).slideDown();
			$('#trade_id').val($(this).attr('value'));
		});
		
		// gold prodcut id
		$('#gold_amount_express').bind('change', function(){
			$('#id').val($('#gold_amount_express').val());
		});
		
	// gold fast order module 
	$("#game_gold_express").bind('change',function(){
			var gamecategory = $('#game_gold_express').val();
			
			if(gamecategory == ''){
				$('#server_gold_expres').html(opt);
				$('#fraction_gold_expres').html(opt);
				$('#gold_amount_express').html(opt);
				
			}else{
				$('#server_id_gold_expres').html(opt);
				$('#product_id_gold_express').html(opt);
				
				$.getJSON(
					'/gold_express.php?act=svft&time='+ new Date(),
					{gtag:gamecategory},
					function(msg){
						var sv = '';
						sv += "<select name=\"server_gold_express\" id=\"server_gold_expres\" onchange=\"GoldAmountModule()\">";
						sv += "<option value='' selected=\"selected\">"+msg.lang.server+"</option>";
						$.each(msg.svname, function(i, s){
							sv += '<option value="'+s+'">'+s+'</option>';
						});
						sv += '</select>';
						$('.gold_express_server').html(sv);
						
						var ft = '';
						ft += "<select name='fraction_gold_express' id='fraction_gold_expres' onchange='GoldAmountModule()'>";
						ft += "<option value='' selected='selected'>"+msg.lang.fraction+"</option>";
						$.each(msg.ftname ,function(i, f){
							ft += '<option value="'+f+'">'+f+'</option>';
						});
						ft += '</select>';
						$('.gold_express_fraction').html(ft);
						$('#gold_frct').css('display','table');
					}
				);
				
			}
			
		});
	
	// 金币快速购买服务器
	$.getJSON(
		'/gold_express.php?act=gmsv&time='+ new Date(),
		function(msg){
			var op = "<option selected=\"selected\" value=\"\" class=\"server_district\">......</option>";
			$.each(msg, function(i, v){
				op += "<option value=\""+v.GameTag+"\">"+v.CatName+"</option>";
			});
			$('.GameGoldExpress').html(op);
			
			// 多语言选择提示
			$.getJSON(
				'/gold_express.php?act=frck&time='+ new Date(),
				{data:'select_cat'},
				function(msg){
					$('.server_district').html(msg);
				}
			);
		}
	);
	
		
});
	
	
	function GoldAmountModule(){
		var gcate = $('#game_gold_express').val();
		var server = $('#server_gold_expres').val();
		var fraction = $('#fraction_gold_expres').val();
		if(gcate != '' && server != '' && fraction != ''){
			$.getJSON(
				'/gold_express.php?act=gdam&time='+ new Date(),
				{gtag:gcate,server_id:server,fraction_id:fraction},
				function(msg){
					var amount = '';
  					amount += "<select name='gold_amount_express' id='gold_amount_express' onchange='FastOrder()'>";
					amount += "<option value=''>"+msg.lang+"</option>";
					$.each(msg.serfrc, function(i, a){
						amount += '<option value="'+a.id+'">WOW '+a.GoldAmount+'Gold('+a.GoldPrice+')</option>';
					});
					amount += '</select>';
					$('.gold_amount').html(amount);				
				}
			);
		}else{
			$('#gold_amount_express').html(opt);
		}
	}
	
	
	function FastOrder(){
		var gcate = $('#game_gold_express').val();
		var server = $('#server_gold_expres').val();
		var fraction = $('#fraction_gold_expres').val();
		var gdam = $('#gold_amount_express').val();
		
		if(gcate != '' || server != '' || fraction != '' || gdam != ''){
			window.location.href="/gold_express.php?act=fast&gtag="+gcate+"&sv="+server+"&ft="+fraction+"&p_id="+gdam;
		}
	}
	
	
	function GoldAmount(sf,br){
		var gcate = $('#game_gold_server_express').val();
		var server = $('select#server_gold_express').val();
		var fraction = $("#fraction_gold_express").val();
		//if (br == 'server' && sf != '') server = sf;
		//if (br == 'fraction' && sf != '') fraction = sf;
		
		// 默认隐藏产品验证提示
		$('#goldproductTip').attr('class','onError').hide();
		
		if(!sf && !br){
			var server = $('select#server_gold_express_param').val();
			var fraction = $("#fraction_gold_express").val();
		}
		
		if(server == '' && fraction != ''){
			$.getJSON(
				'/gold_express.php?act=frck&time='+ new Date(),
				{data:'select_server'},
				function(msg){
					$('#fractionTip').attr('class','onError').css({display:dpc,width:'auto',float:fpc}).html(msg);
				}
			);
			
		}else if(fraction == '' && server != ''){
			$.getJSON(
				'/gold_express.php?act=frck&time='+ new Date(),
				{data:'select_fra'},
				function(msg){
					$('#fractionTip').attr('class','onError').css({display:dpc,width:'auto',float:fpc}).html(msg);
				}
			);
			
		}else if(server != '' && fraction != ''){
			$.getJSON(
				'/gold_express.php?act=gdam&time='+ new Date(),
				{gtag:gcate,server_id:server,fraction_id:fraction},
				function(msg){
					var amount = '';
  					amount += "<select name='gold_amount_express' id='gold_amount_express' class='infor_select' onchange='TradeMethod(this.value)'>";
					amount += "<option value=''>"+msg.lang+"</option>";
					$.each(msg.serfrc, function(i, a){
						amount += '<option value="'+a.id+'">WOW '+a.GoldAmount+'Gold('+a.GoldPrice+')</option>';
					});
					amount += '</select>';
					$('.gold_amount').html(amount);				
				}
			);
			
			$('#fractionTip').attr('class','onCorrect').css('height','20px').html('');
		}
	}
	
	function TradeMethod(gdam){
		if(!gdam)
			var gdam = $('#gold_amount_express').val();
		
		$('#id').val(gdam);
		if(gdam != ''){
			$.getJSON(
				'/gold_express.php?act=trade&time='+ new Date(),
				function(msg){
					var td = '';
					td += "<select name='gold_delevery_method' id='gold_delevery_method' class='infor_select' onchange='TradeType(this.value)'>";
					td += "<option value=''>"+msg.lang+"</option>";
					$.each(msg.trade, function(i, t){
						td += '<option value="'+t.id+'">'+t.trade_type+'</option>';
					});
					td += '</select>';
					
					$('.trade').html(td);
				}
			);
			
			$('#goldproductTip').attr('class','onCorrect').css('height','20px').html('');
			
		}else{
			$.getJSON(
				'/gold_express.php?act=frck&time='+ new Date(),
				{data:'select_product'},
				function(msg){
					$('#goldproductTip').attr('class','onError').css({display:dpc,width:'auto',float:fpc}).html(msg);
				}
			);
		}
		
	}
	
	function TradeType(va){
		$('.trade_method').hide();
		if (va != ''){
			var obj = 'trade_'+va;
			$('#'+obj).slideDown();
			$('#trade_id').val(va);
			$('#tradeTip').attr('class','onCorrect').css('height','20px').html('');
			
		}else{
			$.getJSON(
				'/gold_express.php?act=frck&time='+ new Date(),
				{data:'select_shipping'},
				function(msg){
					$('#tradeTip').attr('class','onError').css({display:dpc,width:'auto',float:fpc}).html(msg);
				}
			);
		}
		
	}
	
	// fast gold submit
	function gold_express_sumbit(){
		if($('#game_gold_server_express').val() == ''){
			$.getJSON(
				'/gold_express.php?act=frck&time='+ new Date(),
				{data:'select_cat'},
				function(msg){
					$('#serverTip').html(msg).css({display:dpc,width:'auto',float:fpc});
				}
			);
			$('#game_gold_server_express').focus();
			return false;
		}
		if($('#server_gold_express').val() == ''){
			$.getJSON(
				'/gold_express.php?act=frck&time='+ new Date(),
				{data:'select_server'},
				function(msg){
					$('#fractionTip').attr('class','onError').html(msg).css({display:dpc,width:'auto',float:fpc});
				}
			);
			$('#server_gold_express').focus();
			return false;
		}
		if($('#fraction_gold_express').val() == ''){
			$.getJSON(
				'/gold_express.php?act=frck&time='+ new Date(),
				{data:'select_fra'},
				function(msg){
					$('#fractionTip').attr('class','onError').html(msg).css({display:dpc,width:'auto',float:fpc});
				}
			);
			$('#fraction_gold_express').focus();
			return false;
		}
		if($('#gold_amount_express').val() == ''){
			$.getJSON(
				'/gold_express.php?act=frck&time='+ new Date(),
				{data:'select_product'},
				function(msg){
					$('#goldproductTip').html(msg).css({display:dpc,width:'auto',float:fpc});
				}
			);
			$('#gold_amount_express').focus();
			return false;
		}
		if($('#gold_delevery_method').val() == ''){
			$.getJSON(
				'/gold_express.php?act=frck&time='+ new Date(),
				{data:'select_shipping'},
				function(msg){
					$('#tradeTip').html(msg).css({display:dpc,width:'auto',float:fpc});
				}
			);
			$('#gold_delevery_method').focus();
			return false;
		}
		if($('#gold_delevery_method').val() == 1){ // Face to Face
			if($('#ftfCharacterName').val() == ''){
				$.getJSON(
					'/gold_express.php?act=frck&time='+ new Date(),
					{data:'please_input_full_info'},
					function(msg){
						$('#ftfnameTip').html(msg).css({display:dpc,width:'auto',float:fpc});
					}
				);
				$('#ftfCharacterName').focus();
				return false;
			}
			if($('#gold_game_onlinefrom').val() == ''){
				$.getJSON(
					'/gold_express.php?act=frck&time='+ new Date(),
					{data:'game_onlinefrom'},
					function(msg){
						$('#ftfonlineTip').html(msg).css({display:dpc,width:'auto',float:fpc});
					}
				);
				$('#gold_game_onlinefrom').focus();
				return false;
			}
			if($('#gold_game_onlinetill').val() == ''){
				$.getJSON(
					'/gold_express.php?act=frck&time='+ new Date(),
					{data:'game_onlineto'},
					function(msg){
						$('#ftfonlineTip').html(msg).css({display:dpc,width:'auto',float:fpc});
					}
				);
				$('#gold_game_onlinetill').focus();
				return false;
			}
		}
		if($('#gold_delevery_method').val() == 2){ // Trusted Trade
			type = $('input:radio:checked').val();
			
			if($('#ttCharacterName').val() == ''){
				$.getJSON(
					'/gold_express.php?act=frck&time='+ new Date(),
					{data:'please_input_full_info'},
					function(msg){
						$('#tsdtnameTip').html(msg).css({display:dpc,width:'auto',float:fpc});
					}
				);
				$('#ttCharacterName').focus();
				return false;
			}
			
			if(type == 1){
				if($('#accountName').val() == ''){
					$.getJSON(
						'/gold_express.php?act=frck&time='+ new Date(),
						{data:'input_email'},
						function(msg){
							$('#namepasseTip').html(msg).css({display:dpc,width:'auto',float:fpc});
						}
					);
					$('#accountName').focus();
					return false;
				}
				if($('#characterPassword').val() == ''){
					$.getJSON(
						'/gold_express.php?act=frck&time='+ new Date(),
						{data:'input_password'},
						function(msg){
							$('#namepasseTip').html(msg).css({display:dpc,width:'auto',float:fpc});
						}
					);
					$('#characterPassword').focus();
					return false;
				}
			}
		}
		if($('#first_name_gold_express').val() == ''){
			$.getJSON(
				'/gold_express.php?act=frck&time='+ new Date(),
				{data:'please_input_first_name'},
				function(msg){
					
					$('#firstnameTip').html(msg).css({display:dpc,width:'100%'});
				}
			);
			
			/*$.ajax({
				type: 'GET',
				url: '/gold_express.php?act=frck&time='+Math.random(),
				dataType: 'JSON',
				data: 'data=please_input_first_name',
				success: function(msg){$('#firstnameTip').html(msg).css({display:dpc,width:'auto',float:fpc});}
			});*/
			
			$('#first_name_gold_express').focus();
			return false;
		}
		if($('#last_name_gold_express').val() == ''){
			$.getJSON(
				'/gold_express.php?act=frck&time='+ new Date(),
				{data:'please_input_last_name'},
				function(msg){
					$('#lastnameTip').html(msg).css({display:dpc,width:'auto',float:fpc});
				}
			);
			$('#last_name_gold_express').focus();
			return false;
		}
		var myreg = /^([a-zA-Z0-9]+[_|\_|-|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,5}$/;
		var temp = $('#email_gold_express').val();
		if($('#email_gold_express').val() == '' || !myreg.test(temp)){
			$.getJSON(
				'/gold_express.php?act=frck&time='+ new Date(),
				{data:'please_input_email_addr'},
				function(msg){
					$('#emailaddresTip').html(msg).css({display:dpc,width:'auto',float:fpc});
				}
			);
			$('#email_gold_express').focus();
			return false;
		}
		if($('#telephone_gold_express').val() == ''){
			$.getJSON(
				'/gold_express.php?act=frck&time='+ new Date(),
				{data:'please_input_tel'},
				function(msg){
					$('#usertelTip').html(msg).css({display:dpc,width:'auto',float:fpc});
				}
			);
			$('#telephone_gold_express').focus();
			return false;
		}
		if($('#country').val() == '0'){
			$.getJSON(
				'/gold_express.php?act=frck&time='+ new Date(),
				{data:'please_input_country'},
				function(msg){
					$('#countryTip').html(msg).css({display:dpc,width:'auto',float:fpc});
				}
			);
			$('#country').focus();
			return false;
		}
		if($('#city_gold_express').val() == ''){
			$.getJSON(
				'/gold_express.php?act=frck&time='+ new Date(),
				{data:'flow_js_city_not_null'},
				function(msg){
					$('#cityTip').html(msg).css({display:dpc,width:'auto',float:fpc});
				}
			);
			$('#city_gold_express').focus();
			return false;
		}
		if($('#post_code_gold_express').val() == ''){
			$.getJSON(
				'/gold_express.php?act=frck&time='+ new Date(),
				{data:'please_input_zip'},
				function(msg){
					$('#codezipTip').html(msg).css({display:dpc,width:'auto',float:fpc});
				}
			);
			$('#post_code_gold_express').focus();
			return false;
		}
		
	is_check=1;
			
	}
	
	
	// onfocus onblur 为了加载流 特意放入fun中 调用方式：onload="FocusBlur()"
	function FocusBlur(){
		$('#accountName,#characterPassword').unbind('blur'); // 删除缓冲
		
		$('#ftfCharacterName').blur(function(){
				if($('#ftfCharacterName').val() == ''){
					$.getJSON(
						'/gold_express.php?act=frck&time='+ new Date(),
						{data:'please_input_full_info'},
						function(msg){
							$('#ftfnameTip').attr('class','onError').css({display:dpc,width:'auto',float:fpc}).html(msg);
						}
					);
					
				}
				else
					$('#ftfnameTip').attr('class','onCorrect').css('height','20px').html('');
			}
		);
		
		$('#gold_game_onlinefrom,#gold_game_onlinetill').bind('change', function(){
			if($('#gold_game_onlinefrom').val() == '' || $('#gold_game_onlinetill').val() == ''){
				$.getJSON(
					'/gold_express.php?act=frck&time='+ new Date(),
					{data:'game_onlinefrom'},
					function(msg){
						$('#ftfonlineTip').attr('class','onError').css({display:dpc,width:'auto',float:fpc}).html(msg);
					}
				);

			}
			else
				$('#ftfonlineTip').attr('class','onCorrect').css('height','20px').html('');
		});
		
		$('#ttCharacterName').blur(function(){
				if($('#ttCharacterName').val() == ''){
					$.getJSON(
						'/gold_express.php?act=frck&time='+ new Date(),
						{data:'please_input_full_info'},
						function(msg){
							$('#tsdtnameTip').attr('class','onError').css({display:dpc,width:'auto',float:fpc}).html(msg);
						}
					);
					
				}
				else
					$('#tsdtnameTip').attr('class','onCorrect').css('height','20px').html('');
			}
		);
		
		//if($('#gold_delevery_method').val() == 2){ // Trusted Trade
		var trades = document.getElementsByName("radioInputAccountNow");
		for(var i=0; i<trades.length; i++){
			if(trades[i].type == 'radio' && trades[i].checked == true){
				tradio = trades[i].value;
			}
		}

	    //  alert(tradio); 
		//if($('input:radio:checked').val() == 1){
			if(tradio == 1){
				$('#accountName,#characterPassword').blur(function(){
						if($('#accountName').val() == ''){
							$.getJSON(
								'/gold_express.php?act=frck&time='+ new Date(),
								{data:'input_email'},
								function(msg){
									$('#namepasseTip').attr('class','onError').css({display:dpc,width:'auto',float:fpc}).html(msg);
								}
							);
							
						}else if($('#characterPassword').val() == ''){
							$.getJSON(
								'/gold_express.php?act=frck&time='+ new Date(),
								{data:'input_password'},
								function(msg){
									$('#namepasseTip').attr('class','onError').css({display:dpc,width:'auto',float:fpc}).html(msg);
								}
							);
							
						}
						else
							$('#namepasseTip').attr('class','onCorrect').css('height','20px').html('');
				});
				
			}else if(tradio == 2)
				$('#namepasseTip').attr('class','onError').css('display','none');
		//}
		
		$('#first_name_gold_express').blur(function(){
			if($('#first_name_gold_express').val() == ''){
				$.getJSON(
					'/gold_express.php?act=frck&time='+ new Date(),
					{data:'please_input_first_name'},
					function(msg){
						$('#firstnameTip').attr('class','onError').css({display:dpc,width:'auto',float:fpc}).html(msg);
					}
				);
				
			}
			else
				$('#firstnameTip').attr('class','onCorrect').css('height','20px').html('');
		});
		
		$('#last_name_gold_express').blur(function(){
			if($('#last_name_gold_express').val() == ''){
				$.getJSON(
					'/gold_express.php?act=frck&time='+ new Date(),
					{data:'please_input_last_name'},
					function(msg){
						$('#lastnameTip').attr('class','onError').css({display:dpc,width:'auto',float:fpc}).html(msg);
					}
				);
				
			}
			else
				$('#lastnameTip').attr('class','onCorrect').css('height','20px').html('');
		});
		
		$('#email_gold_express').blur(function(){
			var myreg = /^([a-zA-Z0-9]+[_|\_|-|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,5}$/;
			var temp = $('#email_gold_express').val();
			if($('#email_gold_express').val() == '' || !myreg.test(temp)){
				$.getJSON(
					'/gold_express.php?act=frck&time='+ new Date(),
					{data:'please_input_email_addr'},
					function(msg){
						$('#emailaddresTip').attr('class','onError').css({display:dpc,width:'auto',float:fpc}).html(msg);
					}
				);
				
			}
			else
				$('#emailaddresTip').attr('class','onCorrect').css('height','20px').html('');
		});
		
		$('#telephone_gold_express').blur(function(){
			if($('#telephone_gold_express').val() == ''){
				$.getJSON(
					'/gold_express.php?act=frck&time='+ new Date(),
					{data:'please_input_tel'},
					function(msg){
						$('#usertelTip').attr('class','onError').css({display:dpc,width:'auto',float:fpc}).html(msg);
					}
				);
				
			}
			else
				$('#usertelTip').attr('class','onCorrect').css('height','20px').html('');
		});
		
		$('#country').bind('change', function(){
			if($('#country').val() == '0'){
				$.getJSON(
					'/gold_express.php?act=frck&time='+ new Date(),
					{data:'please_input_country'},
					function(msg){
						$('#countryTip').attr('class','onError').css({display:dpc,width:'auto',float:fpc}).html(msg);
					}
				);
				
			}
			else
				$('#countryTip').attr('class','onCorrect').css('height','20px').html('');
		});
		
		$('#city_gold_express').blur(function(){
			if($('#city_gold_express').val() == ''){
				$.getJSON(
					'/gold_express.php?act=frck&time='+ new Date(),
					{data:'flow_js_city_not_null'},
					function(msg){
						$('#cityTip').html(msg).css({display:dpc,width:'auto',float:fpc});
					}
				);
				$('#city_gold_express').focus();
				return false;
			}
			else
				$('#cityTip').attr('class','onCorrect').css('height','20px').html('');
		});
		
		$('#post_code_gold_express').blur(function(){
			if($('#post_code_gold_express').val() == ''){
				$.getJSON(
					'/gold_express.php?act=frck&time='+ new Date(),
					{data:'please_input_zip'},
					function(msg){
						$('#codezipTip').attr('class','onError').css({display:dpc,width:'auto',float:fpc}).html(msg);
					}
				);
				
			}
			else
				$('#codezipTip').attr('class','onCorrect').css('height','20px').html('');
		});
	}
	
	
	
////////////////////////////////////////////////////////// powerlevel prodcut ///////////////////////////////////////////////////////////
	$(function(){
		$(".buy_now").bind("click", function(){
			var divHiddenProductForm = $(this).parent().parent().find("div.powerhide");
			$("div.powerhide").hide();
			divHiddenProductForm.slideDown();
		});

	});
	
	
	// 自选代练价格时间
	function power_Level(s){
		var startLevel = $("#startLevel").val();
		var endLevel = $("#endLevel").val();
		
		if(startLevel != '' && endLevel != ''){
			if(startLevel >= endLevel){
				$.getJSON(
					'/power_goods.php?c=frck&time='+ new Date(),
					{data:'error_select_level'},
					function(msg){
						$(".show_price").html('0.00');
						$('#time').html();
						open_dialog("<p class=msg_warning>"+msg+"</p>","");
					}
				);
				return false;
			}
			
			$(".show_price").text('loadding...');
			var price = '';
			$.getJSON(
				"/power_goods.php?c=PowerPrice&ac="+Math.random(),
				{start:startLevel,end:endLevel,sv:s},
				function(msg){
					price += msg.price;
					price += '<br /><span class="need_time">('+msg.reqtime+'h)</span>';
					$(".show_price").html(price);
					$('#cprice').val(msg.reqprice);
					$('#ctime').val(msg.reqtime);
				}
			);
		}
	}
	
	// customize powerlevel
	function cplfrm(){
		if($('#startLevel').val() == ''){
			$.getJSON(
					'/power_goods.php?c=frck&time='+ new Date(),
					{data:'pt_power_start'},
					function(msg){
						open_dialog("<p class=msg_warning>"+msg+"</p>","");
					}
			);
			$('#startLevel').focus();
			return false;
		}
		if($('#endLevel').val() == ''){
			$.getJSON(
					'/power_goods.php?c=frck&time='+ new Date(),
					{data:'pt_power_end'},
					function(msg){
						open_dialog("<p class=msg_warning>"+msg+"</p>","");
					}
			);
			$('#endLevel').focus();
			return false;
		}
		if($('#startLevel').val() >= $('#endLevel').val()){
			$.getJSON(
				'/power_goods.php?c=frck&time='+ new Date(),
				{data:'error_select_level'},
				function(msg){
					$(".show_price").html('0.00');
					$('#time').html();
					open_dialog("<p class=msg_warning>"+msg+"</p>","");
				}
			);
			return false;
		}
		if($('#characterName').val() == ''){
			$.getJSON(
					'/power_goods.php?c=frck&time='+ new Date(),
					{data:'pt_power_nickname_empty'},
					function(msg){
						open_dialog("<p class=msg_warning>"+msg+"</p>","");
					}
			);
			$('#characterName').focus();
			return false
		}
		if($('#gold_game_onlinefrom').val() == ''){
			$.getJSON(
					'/power_goods.php?c=frck&time='+ new Date(),
					{data:'game_onlinefrom'},
					function(msg){
						open_dialog("<p class=msg_warning>"+msg+"</p>","");
					}
			);
			$('#gold_game_onlinefrom').focus();
			return false;
		}
		if($('#gold_game_onlinetill').val() == ''){
			$.getJSON(
					'/power_goods.php?c=frck&time='+ new Date(),
					{data:'game_onlineto'},
					function(msg){
						open_dialog("<p class=msg_warning>"+msg+"</p>","");
					}
			);
			$('#gold_game_onlinetill').focus();
			return false;
		}
		var cpa =  $('input:radio:checked').val();
		if(cpa == 1){
			if($('#accountName').val() == ''){
				$.getJSON(
					'/power_goods.php?c=frck&time='+ new Date(),
					{data:'pt_power_name_empty'},
					function(msg){
						open_dialog("<p class=msg_warning>"+msg+"</p>","");
					}
			);
				$('#accountName').focus();
				return false;
			}
			if($('#accountPassword').val() == ''){
				$.getJSON(
					'/power_goods.php?c=frck&time='+ new Date(),
					{data:'pt_power_pass_empty'},
					function(msg){
						open_dialog("<p class=msg_warning>"+msg+"</p>","");
					}
			);
				$('#accountPassword').focus();
				return false;
			}
		}
		
		$('.buttonI').hide();
		$('#loading').show();
		$('#customizepower').submit();
	}
	
	
	// pack powerlevel
	function plfrm(k){		
		if($('#characterName_'+k).val() == ''){
			$.getJSON(
					'/power_goods.php?c=frck&time='+ new Date(),
					{data:'pt_power_nickname_empty'},
					function(msg){
						open_dialog("<p class=msg_warning>"+msg+"</p>","");
					}
			);
			$('#characterName_'+k).focus();
			return false
		}
		if($('#gold_game_onlinefrom_'+k).val() == ''){
			$.getJSON(
					'/power_goods.php?c=frck&time='+ new Date(),
					{data:'game_onlinefrom'},
					function(msg){
						open_dialog("<p class=msg_warning>"+msg+"</p>","");
					}
			);
			$('#gold_game_onlinefrom_'+k).focus();
			return false;
		}
		if($('#gold_game_onlinetill_'+k).val() == ''){
			$.getJSON(
					'/power_goods.php?c=frck&time='+ new Date(),
					{data:'game_onlineto'},
					function(msg){
						open_dialog("<p class=msg_warning>"+msg+"</p>","");
					}
			);
			$('#gold_game_onlinetill_'+k).focus();
			return false;
		}
		var ajb = document.getElementsByName("radioInputAccountNow_"+k);
		for(var i=0; i<ajb.length; i++){
			if(ajb[i].checked){
				var pa = ajb[i].value;
			}
		}
		
		if(pa == 1){
			if($('#accountName_'+k).val() == ''){
				$.getJSON(
					'/power_goods.php?c=frck&time='+ new Date(),
					{data:'pt_power_name_empty'},
					function(msg){
						open_dialog("<p class=msg_warning>"+msg+"</p>","");
					}
				);
				$('#accountName_'+k).focus();
				return false;
			}
			if($('#accountPassword_'+k).val() == ''){
				$.getJSON(
					'/power_goods.php?c=frck&time='+ new Date(),
					{data:'pt_power_pass_empty'},
					function(msg){
						open_dialog("<p class=msg_warning>"+msg+"</p>","");
					}
				);
				$('#accountPassword_'+k).focus();
				return false;
			}
		}
		
		$('.buttonI').hide();
		$('#loading_'+k).show();
		$('#customizepower_'+k).submit();
	}
	
	
////////////////////////////////////////////////////////// gold prodcut header ///////////////////////////////////////////////////////////
	/**
	*
	* 金币产品添加购物车验证
	* 
	*/
	function addtocart(){
		var gold_trade_idt = $('#gold_trade_id').val();
		
		if(gold_trade_idt == 1){  // Face to Face
			if($('#ftfCharacterName').val() == ''){
				$.getJSON(
					'/gold_express.php?act=frck&time='+ new Date(),
					{data:'please_input_full_info'},
					function(msg){
						$('#ftfnameTip').html(msg).css({display:dpc,width:'auto',float:fpc});
					}
				);
				$('#ftfCharacterName').focus();
				return false;
				
			}else{
				$('#ftfnameTip').css('display','none').html('');
			}
			
			// nickname value
			$('#nick_name').val($('#ftfCharacterName').val());
			
			if($('#gold_game_onlinefrom').val() == ''){
				$.getJSON(
					'/gold_express.php?act=frck&time='+ new Date(),
					{data:'game_onlinefrom'},
					function(msg){
						$('#ftfonlineTip').html(msg).css({display:dpc,width:'auto',float:fpc});
					}
				);
				$('#gold_game_onlinefrom').focus();
				return false;
				
			}else{
				$('#ftfonlineTip').css('display','none').html('');
			}
			
			if($('#gold_game_onlinetill').val() == ''){
				$.getJSON(
					'/gold_express.php?act=frck&time='+ new Date(),
					{data:'game_onlineto'},
					function(msg){
						$('#ftfonlineTip').html(msg).css({display:dpc,width:'auto',float:fpc});
					}
				);
				$('#gold_game_onlinetill').focus();
				return false;
				
			}else{
				$('#ftfonlineTip').css('display','none').html('');
			}
		}
		
		if(gold_trade_idt == 2){ // Comfort Trade
			var obj = document.getElementsByName("radioInputAccount");
			for(var i=0; i<obj.length; i++){
				if(obj[i].checked){
					var type = obj[i].value;
				}
			}
			
			if($('#ttCharacterName').val() == ''){
				$.getJSON(
					'/gold_express.php?act=frck&time='+ new Date(),
					{data:'please_input_full_info'},
					function(msg){
						$('#tsdtnameTip').html(msg).css({display:dpc,width:'auto',float:fpc});
					}
				);
				$('#ttCharacterName').focus();
				return false;
				
			}else{
				$('#tsdtnameTip').css('display','none').html('');
			}
			
			// nickname value
			$('#nick_name').val($('#ttCharacterName').val());
			
			if(type == 1){
				if($('#accountName').val() == ''){
					$.getJSON(
						'/gold_express.php?act=frck&time='+ new Date(),
						{data:'input_email'},
						function(msg){
							$('#namepasseTip').html(msg).css({display:dpc,width:'auto',float:fpc});
						}
					);
					$('#accountName').focus();
					return false;
					
				}else{
					$('#namepasseTip').css('display','none').html('');
				}
				
				if($('#characterPassword').val() == ''){
					$.getJSON(
						'/gold_express.php?act=frck&time='+ new Date(),
						{data:'input_password'},
						function(msg){
							$('#namepasseTip').html(msg).css({display:dpc,width:'auto',float:fpc});
						}
					);
					$('#characterPassword').focus();
					return false;
					
				}else{
					$('#namepasseTip').css('display','none').html('');
				}
				
			}
		}
		
		$('#goldaddcart').hide();
		$('#loading').show();
		$('#glodfrom').submit();
		
	}
	
	/**
	* =========================================
	* jinlong tabs 轮换 <2010-3-28 15:27>
	* @name   控件名称
	* @cursel 当前所处位置-数目
	* @n      总数目
	* @css_li 当前选中的CSS属性
	* =========================================
	*/
	function setTab(name,cursel,n,css_li){
		for(var i=1;i<=n;i++){
			var menu=document.getElementById("b2_"+name+i);
			var con=document.getElementById("b2_Con_"+name+i);
			menu.className=i==cursel?""+css_li+"":"";
			con.style.display=i==cursel?"table":"none";
			if(i == cursel){
				document.getElementById("gold_trade_id").value=i;
			}
		}
		
	}
	
	function closebut(){
		$.nyroModalRemove();
	}
