﻿// JScript 文件
var LastglChk="0",_IsRead=false;LineY=1;
/*热门游戏*/
var LineX=0;
var NewLine=new Array();
NewLine[0]=13;
NewLine[1]=14;
NewLine[2]=13;
NewLine[3]=13;
NewLine[4]=12;
/*热门游戏换行*/


function sGList(id,str){
	if("glChk_"+id!="glChk_"+LastglChk){
	    if(_IsRead)return;
	    if("0"==LastglChk)jQuery("dl.GameList dd.loadList").html("");
	    if(!jQuery("#default-gamelist-"+id).is("div")){
	        jQuery("dl.GameList dd.loadList").append("<div id=\"default-gamelist-"+id+"\"></div>");
	    }
	    if(""!=jQuery("#default-gamelist-"+id).html()){
	        jQuery("#default-gamelist-"+id).show();
	        jQuery("#default-gamelist-"+LastglChk).hide();
	        jQuery("#glChk_"+id).addClass("selectListGame");
	        jQuery("#glChk_"+LastglChk).removeClass();
	        LastglChk=id;
	    }else{
		    var l="hotgame",_Action="catagory",c="";
		    if(null!=str){
		        l="comgame";
		        c=str;
		        if(101==id)_Action="district";
		    }else{
		        switch(id){
		            case 1:l="hotgame";break;
		            case 2:l="ABC";break;
		            case 3:l="DEF";break;
		            case 4:l="GHJ";break;
		            case 5:l="KLM";break;
		            case 6:l="NOP";break;
		            case 7:l="QRS";break;
		            case 8:l="TWX";break;
		            case 9:l="YZ";break;
		            case 10:l="freegame";break;
		            case 100:_Action="characteristics";break;
		        }
		    }
		    //jQuery("div.bodyer2 dd").append("<p id=\"gamelist-loading\">信息加载中... </p>");
		    _IsRead=true;
		    jQuery.get(webpath+"tools/AjaxPage.aspx",{Action:_Action,l:l,c:c,gc:c,js:"y",bm:"y",temp:Math.random()},function(xml){
			    jQuery("#default-gamelist-"+LastglChk).hide();
			    var gameMenu=jQuery("#glChk_"+id);
			    var lastgameMenu=jQuery("#glChk_"+LastglChk);
			    var gameListBody=jQuery("#default-gamelist-"+id);
			    lastgameMenu.removeClass("selectListGame");
			    gameMenu.addClass("selectListGame");
		        var tempxml="暂无任何游戏";
		        if(""!=xml&&"null"!=xml){
		            eval("var gameList=["+xml+"];");
		            tempxml="";LineX=0;LineY=1;
		            for(var i=0;i<gameList.length;i++){
		                //if(0==i)tempxml+=" | ";
		                if(100==id){
		                    tempxml+="<a href=\""+gameList[i][0]+"\">"+gameList[i][1]+"</a>";
		                    var _tempStr="";
		                    if(""==_tempStr&&i!=gameList.length-1)_tempStr=" | ";
		                    tempxml+=_tempStr;	
		                }else if(101==id){
		                    tempxml+="<a href=\""+tradepath+str+"/List-dc-"+gameList[i][0]+topSearch.ModelExt+"\">"+gameList[i][1]+"</a>";
		                    var _tempStr="";
		                    if(""==_tempStr&&i!=gameList.length-1)_tempStr=" | ";
		                    tempxml+=_tempStr;	
		                }else{
		                    tempxml+="<a href=\""+tradepath+gameList[i][0]+"/List"+topSearch.ModelExt+"\">"+gameList[i][1]+"</a>";
		                    var _tempStr="";
		                    if(typeof(NewLine)=="object"){
		                        var _TempNewLine=new Array();
		                        if(l=="hotgame"||l=="freegame"){
		                            _TempNewLine=NewLine;
		                        }
	                            if(_TempNewLine.length<LineX){
	                                _tempStr =" | ";
	                            }else{
	                                if(LineY>1&&(LineY%(_TempNewLine[LineX]))==0){
	                                    _tempStr ="<br />";
	                                    LineX++;LineY=1;
	                                }else{
	                                    if(i!=gameList.length-1)
	                                        _tempStr =" | ";
	                                }
	                            }
		                    }
		                    if(""==_tempStr&&i!=gameList.length-1)_tempStr=" | ";
		                    tempxml+=_tempStr;
		                }
		                LineY++;
		            }
		        }
		        gameListBody.html("<div class=\"list\">"+tempxml+"</div>");
			    LastglChk=id;
			    _IsRead=false;
		    });
		}
	}
}


/*************点卡交易 **************************/
var lastTradeCard=null;
function ShowTradeCardList(o,s){
    if(null!=lastTradeCard)lastTradeCard.className="";
    jQuery.get(webpath+"tools/"+s+"?temp="+Math.random(),null,function(xhtml){
        jQuery("div.tc_Body").html(xhtml);
        o.className="act";
        lastTradeCard=o;
    }); 
}
jQuery(function(){
    jQuery(jQuery("div.tc_Head_ ul li:odd")[0]).trigger("click");
});