

var sort = {
	act: 1,
	server: 9,   //服务器，默认为 9 (世外桃源)，8(纵横无疆)
	classType: 1,
	repType: 1,   //默认好名声，0为怀名声
	
	//获得数据
	getClassSort:function(server,classType,act,repType){
		if(act != 0){this.act = act;}
		if(server != 0){this.server = server;}
		if(classType != 0){this.classType = classType;}
		if(repType != 0){this.repType = repType;}
		if(this.act == 3){
			var url = weburl + "sort/sort_index.php?act=" + this.act + "&server=" + this.server + "&type=" + this.repType;
		}else {
			var url = weburl + "sort/sort_index.php?act=" + this.act + "&server=" + this.server + "&class=" + this.classType;
		}   
		
		if(server == 9){$("server_title").update("世外桃源");}
		if(server == 8){$("server_title").update("纵横无疆");}
		if(this.act == 1){
			$("right_title_top").update("武林十大高手");
			$("right_content_3").hide();
			$("right_content_list2").hide();
			$("right_content_5").hide();			
			$("right_content_list").hide();
			$("right_content_list1").show();
			jupaointerface.sendCommond(url, this.getSortAction);	
		}else if(this.act == 7){
			$("right_title_top").update("各职业十大高手");
			$("right_content_list1").hide();
			$("right_content_list2").hide();
			$("right_content_5").hide();
			$("right_content_list").show();
			$("right_content_3").show();
			jupaointerface.sendCommond(url, this.getClassSortAction);
		}else if(this.act == 3){
			$("right_title_top").update("好名声/坏名声");
			$("right_content_list1").hide();
			$("right_content_3").hide();
			$("right_content_list").hide();
			$("right_content_list2").show();
			$("right_content_5").show();
			jupaointerface.sendCommond(url, this.getReputationSortAction);
		}

	},
	
	//武林十大高手
	getSortAction: function(parm){
		var sorts = JSON.parse(parm);
		//var sorts = eval(parm);
        var html = '<table width="100%" height="100%">'; 
		for(var i=0;  i < sorts.length; i ++){
			html += '<tr>';
			html += '<td width="20%" align="center">' + (i + 1) + '</td>';
			html += '<td width="20%" align="center">' + sorts[i]['name'] + '</td>';
			html += '<td width="20%" align="center">' + sorts[i]['class'] + '</td>';
			html += '<td width="20%" align="center">' + sorts[i]['level'] + '</td>';
			html += '<td width="20%" align="center">' + sorts[i]['guild'] + '</td>';
			html += '</tr>';
        }
        html += '</table>';
        
        $("right_content_table").innerHTML = html ;		
	},
	
	//各职业武林十大高手
	getClassSortAction: function(parm){//alert(parm);
		var sortlist = JSON.parse(parm);
        var html = '<table width="100%" height="100%">'; 
		for(var i=0;  i < sortlist.length; i ++){
			html += '<tr>';
			html += '<td width="24%" align="center">' + (i + 1) + '</td>';
			html += '<td width="24%" align="center">' + sortlist[i]['name'] + '</td>';
			html += '<td width="24%" align="center">' + sortlist[i]['level'] + '</td>';
			html += '<td width="24%" align="center">' + sortlist[i]['guild'] + '</td>';
			html += '</tr>';
        }
        html += '</table>';
        
        $("right_content_table").update(html);	
	},
	
	//好、坏名声值
	getReputationSortAction: function(parm){//alert(parm);
		var reputation = JSON.parse(parm);
        var html = '<table width="100%" height="100%">'; 
		for(var i=0;  i < reputation.length; i ++){
			html += '<tr>';
			html += '<td width="20%" align="center">' + (i + 1) + '</td>';
			html += '<td width="20%" align="center">' + reputation[i]['name'] + '</td>';
			html += '<td width="20%" align="center">' + reputation[i]['class'] + '</td>';
			html += '<td width="20%" align="center">' + reputation[i]['level'] + '</td>';
			html += '<td width="20%" align="center">' + reputation[i]['reputation'] + '</td>';
			html += '</tr>';
        }
        html += '</table>';
        
        $("right_content_table").update(html);	
	},
	
	//职业按钮切换
	activemenu: function(objnum){
		$("activemenu_" + objnum).className = 'activemenu';
		
		var num = document.getElementsByTagName("a");
		var $prevHot=null;
		for(var i=0; i < num.length;i++) {
			var x = num[i];
			if(x.className == "activemenu") $prevHot=x;
			x.onclick=function(){
				if($prevHot)
					$prevHot.className='sysmenu';
				this.className='activemenu';
				$prevHot=this;
			}
		}
	}
}

