$('.col1 dl dt').each(function()
{
	$(this).click(function(){
		if(!this.parentNode.getElementsByTagName('DD').length>0)return ;
		var alink=this.getElementsByTagName('A')[0];
		var state=alink.className!='on'?true:false;
		alink.className=state?'on':'';
		this.parentNode.getElementsByTagName('DD')[0].style.display=state?'block':'none';			
	});
});
$('.myShowBtn').click(function(){
	$('#col2L').attr('class','col2L');
});
$('.showBtn').click(function(){
	$('#col2L').attr('class','col2L col2L02');
});
$('.videoBtn').click(function(){
	$('#col2L').attr('class','col2L col2L03');
});
$('#goldLink_hook').bind('mouseover',function(){
	$('#goldLink_block').css('display','block');
});
$('#goldLink_hook').bind('mouseout',function(){
	$('#goldLink_block').css('display','none');
});
$('.col1 em').each(function(i){
								
});

GuideFlash(true);

function rlist(e)
{
	e=$(e);
	e.parent().find(".on").removeClass("on");
	e.addClass("on");
	var minn = e.attr("in");
	var maxn = e.attr("maxin");
	$("#hotLive").html("");
	$.get("/Handle/GetRoomList.asp",{ac:"GetRoomList",top:60,ps:60,inum:minn,maxin:maxn,t:GetSendTime},function(){
		var dataObj = eval("("+RoomListRe+")");
		$.each(dataObj.data,function(i,e){
			if(e.roompic==""){e.roompic="/images/defaultroompic.jpg";}
			if(parseInt(e.onlinenum)>parseInt(e.maxnum)){e.onlinenum=e.maxnum;}
			$("#hotLive").append($.format(tRoomListStr,e.onlinenum,e.maxnum,e.roomid,e.roompic,e.incomeclass,e.usernick,e.livetime));
		});
		$("#hotLiveMore").css("display","none");
	},"script");
}

function rlist_top(e)
{
	e=$(e);
	e.parent().find(".on").removeClass("on");
	e.addClass("on");
	$("#hotLive").html("");
	$.get("/Handle/GetRoomList.asp",{ac:"GetRoomTopList",top:60,ps:60,t:GetSendTime},function(){
		var dataObj = eval("("+RoomListRe+")");
		$.each(dataObj.data,function(i,e){
			if(e.roompic==""){e.roompic="/images/defaultroompic.jpg";}
			if(parseInt(e.onlinenum)>parseInt(e.maxnum)){e.onlinenum=e.maxnum;}
			$("#hotLive").append($.format(tRoomListStr,e.onlinenum,e.maxnum,e.roomid,e.roompic,e.incomeclass,e.usernick,e.livetime));
		});
		$("#hotLiveMore").css("display","none");
	},"script");
}

var tRoomListStr='<li><div class="l"><p class="pic"><em class="state"></em><em class="rc">{0}/{1}</em><a href="/{2}" target="_blank"><img src="{3}"></a></p><p class="point"><img class="{4} userLevelSmall" src="/images/pixel.gif"><a href="/{2}" target="_blank">{5}</a></p><p class="t"><span>开播:</span><em class="hit">{6}</em></p></div></li>';
var tNoticeList='<li><a target="_blank" href="{0}">{1}</a></li>';
var tTopStr='<li><div class="l"><a target="_blank" href="/{0}">{1}</a><strong class="hit">({0})</strong></div><div class="r"><img src="/images/pixel.gif" class="{2} userLevelSmall"></div></li>';
$(function(){
	//onlinenum,maxnum,roomid,roompic,incomeclass,usernick,livetime
	$.get("/Handle/GetRoomList.asp",{ac:"GetRoomList",top:20,ps:20,inum:1000,maxin:999900000,t:GetSendTime},function(){
		var dataObj = eval("("+RoomListRe+")");
		$.each(dataObj.data,function(i,e){
			if(e.roompic==""){e.roompic="/images/defaultroompic.jpg";}
			if(parseInt(e.onlinenum)>parseInt(e.maxnum)){e.onlinenum=e.maxnum;}
			$("#hotLive").append($.format(tRoomListStr,e.onlinenum,e.maxnum,e.roomid,e.roompic,e.incomeclass,e.usernick,e.livetime));
		});
	},"script");
	$.get("/Handle/GetNotice.asp",{ac:"GetNotice",top:50,ps:50,t:GetSendTime},function(){
		var NdataObj = eval("("+NoticeRe+")");
		$.each(NdataObj.data,function(i,e){
			$("#NoticeList").append($.format(tNoticeList,e.noticehref,e.noticename));
		});
	},"script");
	
	
	////
});
CD1();
function CD1()
{
	//toplist day
	if(typeof(TopListReDay)!="undefined")
	{
		var DayObj = eval("("+TopListReDay+")");
		var Ct = DayObj.CreatTime;
		if(countTimeLength('M',Ct,nowTime())>60*24)
		{
			GetAjaxTopList1("Day");
			return false;
		}
		$.each(DayObj.data,function(i,e){
			$("#TopListOne").append($.format(tTopStr,e.roomid,e.nick,e.iclass));
		});
		$.each(DayObj.datatwo,function(i,e){
			$("#TopListTwo").append($.format(tTopStr,e.roomid,e.nick,e.iclass));
		});
	}
	else
	{
		GetAjaxTopList1("Day");
	}
}
function CD(y,c)
{
	//toplist day
	if(typeof(TopListReDay)!="undefined")
	{
		var DayObj = eval("("+TopListReDay+")");
		var Ct = DayObj.CreatTime;
		if(countTimeLength('M',Ct,nowTime())>60*24)
		{
			GetAjaxTopList1("Day");
			return false;
		}
		if(y){
		$("#TopListOne").html("");
		$.each(DayObj.data,function(i,e){
			$("#TopListOne").append($.format(tTopStr,e.roomid,e.nick,e.iclass));
		});
		}
		else{
		$("#TopListTwo").html("");
		$.each(DayObj.datatwo,function(i,e){
			$("#TopListTwo").append($.format(tTopStr,e.roomid,e.nick,e.iclass));
		});}
	}
	else
	{
		GetAjaxTopList1("Day");
	}
	$(c).parent().parent().find(".on").removeClass("on");
	$(c).addClass("on");
}

function CW(y,c)
{
	//toplist week
	if(typeof(TopListReWeek)!="undefined")
	{
		var WeekObj = eval("("+TopListReWeek+")");
		var Ct = WeekObj.CreatTime;
		if(countTimeLength('M',Ct,nowTime())>60*24*7)
		{
			GetAjaxTopList2("Week");
			return false;
		}
		if(y){
		$("#TopListOne").html("");
			$.each(WeekObj.data,function(i,e){
				$("#TopListOne").append($.format(tTopStr,e.roomid,e.nick,e.iclass));
			});
		}
		else{
		$("#TopListTwo").html("");
			$.each(WeekObj.datatwo,function(i,e){
				$("#TopListTwo").append($.format(tTopStr,e.roomid,e.nick,e.iclass));
			});
		}
	}
	else
	{
		GetAjaxTopList2("Week");
	}
	$(c).parent().parent().find(".on").removeClass("on");
	$(c).addClass("on");
}

function CM(y,c)
{
	//toplist month
	if(typeof(TopListReMonth)!="undefined")
	{
		var MonthObj = eval("("+TopListReMonth+")");
		var Ct = MonthObj.CreatTime;
		if(countTimeLength('M',Ct,nowTime())>60*24*30)
		{
			GetAjaxTopList3("Month");
			return false;
		}
		if(y){
		$("#TopListOne").html("");
			$.each(MonthObj.data,function(i,e){
				$("#TopListOne").append($.format(tTopStr,e.roomid,e.nick,e.iclass));
			});
		}
		else{
		$("#TopListTwo").html("");
			$.each(MonthObj.datatwo,function(i,e){
				$("#TopListTwo").append($.format(tTopStr,e.roomid,e.nick,e.iclass));
			});
		}
	}
	else
	{
		GetAjaxTopList3("Month");
	}
	$(c).parent().parent().find(".on").removeClass("on");
	$(c).addClass("on");
}

function CS(y,c)
{
	//toplist supper
	if(typeof(TopListReSupper)!="undefined")
	{
		var SupperObj = eval("("+TopListReSupper+")");
		var Ct = SupperObj.CreatTime;
		if(countTimeLength('M',Ct,nowTime())>60*24*7)
		{
			GetAjaxTopList4("Supper");
			return false;
		}
		if(y){
		$("#TopListOne").html("");
			$.each(SupperObj.data,function(i,e){
				$("#TopListOne").append($.format(tTopStr,e.roomid,e.nick,e.iclass));
			});
		}
		else{
		$("#TopListTwo").html("");
			$.each(SupperObj.datatwo,function(i,e){
			$("#TopListTwo").append($.format(tTopStr,e.roomid,e.nick,e.iclass));
			});
		}
	}
	else
	{
		GetAjaxTopList4("Supper");
	}
	$(c).parent().parent().find(".on").removeClass("on");
	$(c).addClass("on");
}

function GetAjaxTopList1(str)
{
	$.get("/f/CreatTopUser.asp",{ac:str,t:GetSendTime},function(){
		var DayObj = eval("("+TopListReDay+")");
		$("#TopListOne").html("");
		$.each(DayObj.data,function(i,e){
			$("#TopListOne").append($.format(tTopStr,e.roomid,e.nick,e.iclass));
		});
		$("#TopListTwo").html("");
		$.each(DayObj.datatwo,function(i,e){
			$("#TopListTwo").append($.format(tTopStr,e.roomid,e.nick,e.iclass));
		});
	},"script");
}

function GetAjaxTopList2(str)
{
	$.get("/f/CreatTopUser.asp",{ac:str,t:GetSendTime},function(){
		var WeekObj = eval("("+TopListReWeek+")");
		$("#TopListOne").html("");
		$.each(WeekObj.data,function(i,e){
			$("#TopListOne").append($.format(tTopStr,e.roomid,e.nick,e.iclass));
		});
		$("#TopListTwo").html("");
		$.each(WeekObj.datatwo,function(i,e){
			$("#TopListTwo").append($.format(tTopStr,e.roomid,e.nick,e.iclass));
		});
	},"script");
}

function GetAjaxTopList3(str)
{
	$.get("/f/CreatTopUser.asp",{ac:str,t:GetSendTime},function(){
		var MonthObj = eval("("+TopListReMonth+")");
		$("#TopListOne").html("");
		$.each(MonthObj.data,function(i,e){
			$("#TopListOne").append($.format(tTopStr,e.roomid,e.nick,e.iclass));
		});
		$("#TopListTwo").html("");
		$.each(MonthObj.datatwo,function(i,e){
			$("#TopListTwo").append($.format(tTopStr,e.roomid,e.nick,e.iclass));
		});
	},"script");
}

function GetAjaxTopList4(str)
{
	$.get("/f/CreatTopUser.asp",{ac:str,t:GetSendTime},function(){
		var SupperObj = eval("("+TopListReSupper+")");
		$("#TopListOne").html("");
		$.each(SupperObj.data,function(i,e){
			$("#TopListOne").append($.format(tTopStr,e.roomid,e.nick,e.iclass));
		});
		$("#TopListTwo").html("");
		$.each(SupperObj.datatwo,function(i,e){
			$("#TopListTwo").append($.format(tTopStr,e.roomid,e.nick,e.iclass));
		});
	},"script");
}

function LoadAcc()
{
	GuideFlash(false);
}

function SetAllUserNum(e)
{
	$("#SumUserNum").text(formatNum(e));
}

function GuideFlash(e)
{
	if(e)
	{
		var strtime = getDataTimes();
		var swfVersionStr = "11.1.0";
		var xiSwfUrlStr = "/swf/playerProductInstall.swf";
		var flashvars = {};
		var params = {};
		params.quality = "high";
		params.wmode = "transparent";//transparent";
		params.bgcolor = "#ffffff";
		params.allowscriptaccess = "sameDomain";
		params.allowfullscreen = "true";
		var attributes = {};
		attributes.id = "iFlashGuide";
		attributes.name = "iFlashGuide";
		attributes.align = "middle";
		swfobject.embedSWF("/swf/Guide.swf?"+strtime, "TFlashGuideDiv","100%", "100%", swfVersionStr, xiSwfUrlStr, flashvars, params, attributes);
	}
	else
	{
		$("#FlashGuideDiv").css({width:"1px",height:"1px"});
	}
}

function LargeGuide()
{
	var bc = $("#FlashGuideDiv").css("background");
	$("#FlashGuideDiv").css("background","none");
	$("#FlashGuideDiv").css({width:"100%",height:"100%"});
	setTimeout(function(){$("#FlashGuideDiv").css("background",bc)},100);
}

function formatNum(num) 
{
  if(!/^(\+|-)?\d+(\.\d+)?$/.test(num)){return num;}
  var re = new RegExp().compile("(\\d)(\\d{3})(,|\\.|$)");
  num += ""; 
  while(re.test(num))
    num = num.replace(re, "$1,$2$3")
  return num;
} 
