﻿var TB = {
			c : function (cls, obj){
				if (cls && obj){
					$('#divNews #divNewsTitle a').removeClass('current');
					$(obj).addClass('current');
					$('#divNews #divNewsBody .list').hide();
					$('#divNews #divNewsBody .' + cls).show();
				}
			},
			r : function (cls, obj){
				if (cls && obj){
					$('.ranker_selecter a').add('.rank_table').removeClass('current');
					$(obj).add('.ranker_tables .' + cls).addClass('current');
				}
			},
			m : function (){
				var o = [];
				o[o.length] = '<table class="rank_table r_player current" border="0" cellspacing="0" cellpadding="0"><thead><tr><th width="40">排名</th><th width="90">名称</th><th width="70">王朝</th></tr></thead><tbody>';
				if ((typeof(playerlist) != 'undefined')&&(playerlist.length>0)){
				for (var i = 0; i < playerlist.length; i++)
				{
					o[o.length] = '<tr><th><img src="/images/www2/rank'+(i+1)+'.gif" /></th><th>' + playerlist[i][0] + '</th><th>' + playerlist[i][1] + '</th></tr>';
				}}else{
					o[o.length] = '<tr><th colspan="3">暂无数据</th></tr>'
				}
				o[o.length] = '</tbody></table>';
				o[o.length] = '<table class="rank_table r_city" border="0" cellspacing="0" cellpadding="0"><thead><tr><th width="40">排名</th><th width="90">城市</th><th width="70">人口</th></tr></thead><tbody>';
				if ((typeof(villagelist) != 'undefined')&&(villagelist.length>0)){
				for (var i = 0; i < villagelist.length; i++)
				{
					o[o.length] = '<tr><th><img src="/images/www2/rank'+(i+1)+'.gif" /></th><th>' + villagelist[i][0] + '</th><th>' + villagelist[i][1] + '</th></tr>';
				}}else{
					o[o.length] = '<tr><th colspan="3">暂无数据</th></tr>'
				}
				o[o.length] = '</tbody></table>';
				o[o.length] = '<table class="rank_table r_alliance" border="0" cellspacing="0" cellpadding="0"><thead><tr><th width="40">排名</th><th width="90">联盟</th><th width="70">等级</th></tr></thead><tbody>';
				if ((typeof(alliancelist) != 'undefined')&&(alliancelist.length>0)){
				for (var i = 0; i < alliancelist.length; i++)
				{
					o[o.length] = '<tr><th><img src="/images/www2/rank'+(i+1)+'.gif" /></th><th>' + alliancelist[i][0] + '</th><th>' + alliancelist[i][1] + '</th></tr>';
				}}else{
					o[o.length] = '<tr><th colspan="3">暂无数据</th></tr>'
				}
				o[o.length] = '</tbody></table>';
				$('#divRankFrameBody .panel_c .ranker_tables').html(o.join(''));
			}
		};
		var iL = {
			z:{
				n:5,
				i:4,
				t:null,
				T:null
			},
			g:function(o){
				iL.z = $.extend({}, iL.z, o);
				iL.s();
			},
			c:function(){
				iL.z.t == null ? iL.z.t = null : clearTimeout(iL.z.t);
				iL.z.T == null ? iL.z.T = null : clearTimeout(iL.z.T);
			},
			o:function(){
				iL.c();
				iL.z.T = setTimeout(function(){iL.s();}, 2000);
			},
			s:function(i){
				iL.c();
				if (i != null){iL.z.i = i;}
				iL.z.i = (iL.z.i + 1) % iL.z.n;
				$('.ishows a.current').animate({opacity : 0}, 100, '', function(){
					$(this).removeClass('current');
					$('.ishows a.s' + iL.z.i).addClass('current').animate({opacity : 1}, 200);
				});
				$('.iact a.current').removeClass('current');
				$('.iact a.a' + iL.z.i).addClass('current');
				iL.z.t = setTimeout(function(){iL.s();}, 5000);
				return false;
			}
		};
		$(function(){
			if ($('.ishows').length>0) iL.g();
			if ($('.ranker_tables').length>0) TB.m();
			$('img.vcodeimg').bind('click',function(){
				$(this).attr('src', '<?php echo base_url();?>vcode.php?' + new Date().getTime());
			});
		});
		
		
		function opensm(t)
		{
			var diname = document.getElementById('div1').style;
			if(t == "dis")
			{
				diname.display = "none";
			}
			else
			{
				var topvalue = new Array("900","900","960","960","1020","1020","1080","1080");
				var leftvalue = new Array("80%","80%","80%","80%","80%","80%","80%","80%");
				var textvalue = new Array("回馈《王朝战争》精兵内测的老玩家专用礼包，可在不删档内测中使用，内含功勋成长包、乡有秩受勋包、县令受勋包、感恩包。","参加论坛活动“新版不删档内测活动之集结号”，或者到17173和265g投票获得，每个集结令价值10黄金，可每天投票获取，详情请看新闻公告。",
				"完成县令封爵任务即可使用。","完成乡有秩封爵任务即可使用。","名将录是可以将玩家手下的任一普通英雄转变为史诗英雄的神奇道具，转换后的英雄拥有历史武将属性。","在商城中购买获得，可随机抽取商城中的部分道具，更有概率开到稀有道具《名将录》。","英雄帖内礼包之一，进游戏即可打开成长礼包。","参加各大媒体活动获得，礼包总价值2500黄金，内含英雄成长包、乡有秩受勋包、县令受勋包。每个账号只能使用一次。英雄贴、新浪VIP包、功勋包只能选择一种，不能并用。详情请看新闻公告。");
			
				diname.top = "900";
				diname.left = leftvalue[t];
				document.getElementById('font1').innerHTML = textvalue[t];
				diname.display = "";
			}
		}

		
		
		var onImages=new Array();
		var nImages=new Array();
		function Rollover(imgName, imgSrc, mode)
		{
			if(mode == "hover")
			{
				onImages[imgName] = new Image();
				onImages[imgName].src = imgSrc;
			}
			else if(mode == "normal")
			{
				nImages[imgName] = new Image();
				nImages[imgName].src = imgSrc;
			}			
		}
		
		function turnOn(imgName1, imgName2)
		{			
			document.images[imgName1].offSrc 	= document.images[imgName1].src;
			document.images[imgName1].src    	= onImages[imgName1].src;
			
			document.images[imgName2].offSrc 	= document.images[imgName2].src;
			document.images[imgName2].src    	= nImages[imgName2].src;
			//document.images[imgName2].src = document.images[imgName2].offSrc;
		}

		function turnOff(imgName)
		{
			document.images[imgName].src = document.images[imgName].offSrc;
		}

		//Specify name of participating images, plus paths to their onMouseover replacements:
		Rollover("news",  "images/frontpage/fp_news_title_H.gif", "hover");
		Rollover("events",  "images/frontpage/fp_events_title_H.gif", "hover");
		Rollover("news",  "images/frontpage/fp_news_title_N.gif", "normal");
		Rollover("events",  "images/frontpage/fp_events_title_N.gif", "normal");
		