﻿// 游戏冲值JScript 文件
function SelectGame() {
$( "#dialog-modal" ).dialog({width:580,height: 300,modal: true,resizable:false});
getGameNameList("");
return false;
}	
function getGameNameList(key){
$.ajax({url: '../scripts/ajax/GameNameList.ashx?key='+key,type: 'GET',dataType: 'xml',timeout: 40000,cache:true, error: function(){alert('获取数据异常，请稍候再试');},
  success: function(xml){var htmlstr="<p>";var doc = xml.documentElement.childNodes;
    for(i=0;i<doc.length;i++){var node = doc.item(i);htmlstr+="<span style='padding:8px;display:inline-block; cursor:pointer' onclick='selectGoods(\""+node.childNodes[0].childNodes[0].nodeValue+"\",\""+node.childNodes[1].childNodes[0].nodeValue+"\")'>"+node.childNodes[1].childNodes[0].nodeValue+"</span>";}
    htmlstr+="</p>";$("#dialog-namelist").html(htmlstr);}});
}
function selectGoods(id,name){
$("#divGameGoodslist").html("");
document.getElementById("lblGameName").childNodes[0].childNodes[0].nodeValue=name;
document.getElementById("selGameName").value=id;
$( "#dialog-modal" ).dialog( "destroy" );
$.ajax({url: '../scripts/ajax/goodslist.ashx?cid='+id,type: 'GET',dataType: 'xml',timeout: 40000,cache:true,error: function(){alert('获取数据异常，请稍候再试');},
    success: function(xml){var htmlstr="<div class='ui-state-active' style='height:120px;overflow-y:auto;display:block'>";var doc = xml.documentElement.childNodes;
     for(i=0;i<doc.length;i++){var node = doc.item(i);htmlstr+="<span style='padding:8px;display:block'><span style='padding-right:5px;'>"+node.childNodes[1].childNodes[0].nodeValue+"</span><span style='padding:5px;'>面值："+node.childNodes[2].childNodes[0].nodeValue+"</span><span style='padding:5px;color:red'>售价："+node.childNodes[3].childNodes[0].nodeValue+"</span><span style='padding:5px;'><a href='/games/BuyCard.aspx?gid="+node.childNodes[0].childNodes[0].nodeValue+"&tid="+id+"' style='color:#6699cc;' target='_blank'>购买</a></span></span>";}htmlstr+="</div>"; $("#divGameGoodslist").html(htmlstr);}
});
}


