T.OnDOMLoaded.Load(function(){if(parent.InitMainFrame)parent.InitMainFrame()})

//top.window.name=location.href;
if(window!=top)SetTopNameJSON('rurl',location.href)

SetTopNameJSON('lnids','')

var imgpath = "http://imgcache.qq.com/qbar_v1/client/images/";
//*************************************************************************

//*************************************************************************
var _$pStr,func,brdid,pageno,adminMode=0,admin=0;

_$pStr = location.href.replace(/\?.*/,'').replace(/.*\/|\.htm(l*)/gi,'').split('-');
func = _$pStr[0];
brdid = _$pStr[1]||1;
pageno = _$pStr[2]||1;

if(location.search=='?admin=1')admin=1;

function GetURLPath()
{
	return;
    var u = "l,"+brdid;
    if (/\/p\/\?/.test(window.location.href)) u = "p,"+brdid;
	if (/\/all\/\?/.test(window.location.href)) u = "all,"+brdid;
    if (pageno>1) u += ","+pageno;
    return u;
}
//*************************************************************************

if (window==window.top)
{
    T.OnDOMLoaded.Clear();
	
	$(document).ready(function(){
			$('BODY').append("<DIV id='D_footer' style='DISPLAY:block'><P>Copyright 1998 - 2009 TENCENT Inc. All Rights Reserved 腾讯公司 版权所有</P></DIV>")
		});
	}
else
{
    var isphotemode = /\/p\/$/.test(window.location.pathname);
    var G_boards = parent.G_boards;//需要对FF做修正
    var cafetype = null;// parent.G_cafe_info.type;
    var tobeMoveId;
    var ulevel = null;//parent.G_static_selfuser.level;
    var uin = parent.uin;
    var cancelJoin = parent.cancelJoin;

    //保存进入读单个贴之前的最后一个url
    parent.lastBackUrl = window.location.href||'home_.htm';
	//parent.window.name='';
}
//**************************************************************
var ALL_atcls,RRES;
function Init()
{
	var tt;
	var isAll=false;

	if(func=='all'||func=='allzx')
    {
		isAll=true;
		pageno = brdid;
		brdid = 0;
    }



	if(window==top)document.documentElement.style.overflowY='scroll';
	else
	{
		//if(brdid)tt=G_boards[brdid].title;
		//else tt='所有文章';
		parent.document.title=document.title;
	}

	T.$('D_pagerSpan1').innerHTML=T.$('D_pagerSpan2').innerHTML=PagerBBSBar(G_page,func)

	if(parent.listMode==2)
	{
	//	ChangeListMode(2);
	//	parent.listMode=0;
	}

	$('#D_1').attr('href',BASE)
	if(window==top)
	{
		$('#D_1').attr('target','_self')
		$('#D_1').get(0).onclick=function(){window.name=''}		
	}
	else
	{
		$('#D_1').get(0).onclick=function(){
			window.setTimeout(function(){location.href='home_.htm'},3);
			return false}
	}


	if(func!='l'&&func!='all')
	{
		try
		{
			if(T.$('D_dh_l'))T.$('D_dh_l').className='';
			if(T.$('D_dh_all'))T.$('D_dh_all').className='';
			T.$('D_dh_'+func).className='current';	
		}
		catch(e){}
	}

	if(!isAll) ReNewPostTitle();
	T.AutoWinHeight(50);

	window.setTimeout(function(){
		BindDOMEvent();
		if(admin==1)$('button.C_admin').get(0).click()
	},admin==1?1:300);

}

Init();



function BindDOMEvent()
{
	//管理按钮事件
	$('button.C_admin').click(function(){
		var a='C_adminMode';
		var b=$('body');
		if (String(b.attr('class')).indexOf('C_adminMode')>-1)
		{
			b.removeClass(a);
			if(T.isIE)$('table.pl>tbody').css('cursor','pointer');
			if(T.$("brdBulletin"))T.$("brdBulletin").innerHTML=str;
		}
		else {
			if(admin==1){
				if(!adminMode)BindAdminMode();
				b.addClass(a);
				if(T.isIE)$('table.pl>tbody').css('cursor','default')
			}
			else $.ajax({
				url: BASE+'mng-bin/cafecgi_mng_getsystime.cgi',
				dataType:'script',
				async: false,
				success:function(){
					//管理员或者斑竹有权限
					if(RESULT.sys_param.urole>20 || (G_brdself && G_brdself.isowner==1))
					{
						EditBulletin();
						if(!adminMode)BindAdminMode();
						b.addClass(a);
						$('table.pl>tbody').css('cursor','default')
					}
					else
					{
						alert('对不起，你的权限不足，不能做此操作')
					}
				}
			})
			
		}
	});

	//发贴按钮事件
	$('button.C_postnew').click(function(){
		if (!(T.GetUIN()>10000)){top.T.CreateLoginFrameWin();return}
		var url = "brdid="+brdid;
		if(G_brd.title)url+="&brdname="+G_brd.title.URI()

		if (window==window.top)
		{
			window.name=BASE+'ed/?'+url;
			window.location.href=BASE;
		}
		else
		{
			window.location.href='./ed/?'+url;
		}
	});


	/* 设置最近更新的hover */
	if(T.isIE&&window.navigator.appVersion.indexOf('MSIE 6')>0)
	{
		$("table.pl>tbody>tr").hover(function(){
			this.className='hovertr';
		},function(){this.className=''})		
	}

	if(T.isIE)
	{
		$("table.pl>tbody>tr").click(function(i,obj){
			if(event.srcElement.tagName!='TD'||$('table.pl>tbody').css('cursor')!='pointer')return;
			location.href=$('TD.pTitle A',this).attr('href');
		})
		$('table.pl>tbody').css('cursor','pointer')
	}


	/*
	//使用偏好点击事件
	T.$('D_listHabitCtlMenu').onclick=function()
	{
		var d=T.$('D_userListHabit');
		if(d.style.display!='block')
		{
			var pos=GetOffset(T.$('D_listHabitCtlMenu'));
			d.style.top=pos[0]+28+'px';
			d.style.left=pos[1]+5+'px';
			d.style.display='block';
		}
		else d.style.display='none';
	}
	//使用偏好上项目鼠标移动效果
	$("#D_userListHabit A").each(function(){
		$(this).hover( function(){$(this).addClass("hover")},
								function(){$(this).removeClass("hover")})
	});
	*/
	//使用偏好 杂烩模式点击效果
	T.$('D_listModeCtl').onclick=ChangeListMode;
	//管理模式复选框等
	if($('body').get(0).className.indexOf('C_adminMode')>-1)BindAdminMode();
	
}

function ChangeListMode(flag) //flag: 2切换为杂烩，1切换为列表
{
	var a=T.$('D_listModeCtl');
	if (flag==2)T.$('D_listModeCtl').innerText='杂烩模式';
	else if(flag==1)T.$('D_listModeCtl').innerText='平铺模式';
	if (a.innerText=='杂烩模式')
	{
		parent.scrollTo(0,0);
		parent.$('div.bodyLeft').hide();
		
		var h=parent.document.documentElement.clientHeight-30;
		//parent.$('#DOM_mainFrame').attr('scrolling','yes');
		
		parent.document.body.className='dzhlook';
		parent.$('html').css('overflow-y','hidden');
		parent.$('html').css('overflow-x','hidden');
		a.innerText='平铺模式';
		
		//$('html').css('overflow-x','auto');
		
		parent.$('div.bodyiframe>iframe').get(0).setAttribute('id','DOM_mainFrame2');
		parent.$('div.rigRead>iframe').get(0).setAttribute('id','DOM_mainFrame');

		parent.$('#DOM_mainFrame2').css('height',h-1);
		parent.$('#DOM_mainFrame').css('height',h);
		if(parent.document.documentElement.clientWidth>1150)parent.$('div.bodyiframe').css('width',480);
		document.body.className='dzhlook';
		//window.setTimeout(function(){
			$('html').css('overflow-y','scroll');
		//},300);

		$('table.pl td.pAuthor').each(function(){this.style.display='none'});

		window.setTimeout(function(){
		if (parent.T.$('DOM_mainFrame').contentWindow.location.href==BASE+'r/blank.htm')
		{
			var id=null;
			if(G_atcls.length>0)id=G_atcls[0].id;
			else if(G_atcls_top&&G_atcls_top.length>0)id=G_atcls_top[0].id;
			else if(G_atcls_atop&&G_atcls_atop.length>0)id=G_atcls_atop[0].id;
			if(id)parent.MAIN('r,'+G_atcls[0].id);
		}
		},1500);
	}
	else
	{
		$('body').removeClass('dzhlook');
		$('table.pl td.pAuthor').each(function(){this.style.display='inline'});
		$('html').css('overflow-y','hidden');
		window.setTimeout(function(){
		$('div.picList').each(function(){this.style.zoom=0.9;this.style.zoom=1});
		},2000);
		
		a.innerText='杂烩模式';
		parent.ResetNormal();

		T.AutoWinHeight(1,window);
	}
	a.style.display='inline';
	//T.$('D_userListHabit').style.display='none';
}

var isCheckAll_indeterminate=0;
function BindAdminMode()
{
	adminMode=1;
	
	//复选框事件
	var acb = $("table.pl>thead>tr>td.chkbox>input[@type='checkbox']");
	var scb = $("table.pl>tbody>tr>td.chkbox>input[@type='checkbox']");
	acb.get(0).hideFocus = true;
	acb.attr('title','置顶、精华、锁定、有管理权限者(管理员、吧主)发表的贴、48小时之前发表的贴默认均不会被全选按钮钩选');
	acb.get(0).onclick=function(){
	
		var isindet=isCheckAll_indeterminate;
		if(isindet==1)isindet=isCheckAll_indeterminate=2;
		else if(isindet==2)isindet=isCheckAll_indeterminate=3;
		this.indeterminate=false;
		
		scb.each(function(i){
			var tr=$(this).parent().parent();

			var _id=tr.attr('_id');
			var _top=tr.attr('_top');
			var _elite=tr.attr('_elite');
			var _lock=tr.attr('_lock');
			var _ulevel=tr.attr('_ulevel');
			var _time=tr.attr('_time');

			if(isindet<2)
			{
				if(_top>0||_lock>0||_elite>0||_ulevel>10||G_sys_param.sys_time-_time>172800)
				{
					isindet=isCheckAll_indeterminate=1;
					return;
				}
			}
			var ac=acb.get(0).checked;
			this.checked=ac;
		});
		if(isindet==1)this.indeterminate=1;
		else if(isindet==3)isCheckAll_indeterminate=0;
	};
	
	scb.each(function(){
		this.hideFocus=true;
	});
	$('#D_delCheck').get(0).onclick=function(){
		var s = [];
		scb.each(function(i){
			if (this.checked)s.push(this.value);
		});
        ShowRemoveBox(s)
	};
	$('#D_shift').get(0).onclick=function(){
		var s = [];
		scb.each(function(i){if (this.checked)s.push(this.value)});
		if (s.length>0)
		{
			ToMove(s.join(","),this,true);
		}
		else
		{
			alert('请选择您要转移的帖子');
			return;
		}
	};
	SetAdminModeHTML();
	T.AutoWinHeight(1,window);
}
function ShowRemoveBox(s,obj)
{
	    if(s.length==0){
           alert("请选择您要删除的文章");
		   return;
		}
		var delCheck = T.$('D_delCheck');
		var removeBox = T.$('D_removeDIV').parentNode;
        var h5 = removeBox.getElementsByTagName("h5")[0];
        button = removeBox.getElementsByTagName("button")[0];
		checkBox = removeBox.getElementsByTagName("input")[0];
		h5.innerHTML = "您确定要删除这"+(s.length>1?'些':'篇')+"文章吗";
		var p;
		if(obj){
			p = GetPositionOnPage(obj);
			removeBox.style.left = p.x+GetOffset2(obj).width+"px";
			removeBox.style.top = p.y+GetOffset2(obj).height+"px";
		}
		else{
			p=GetPositionOnPage(delCheck);
		    removeBox.style.left = p.x+GetOffset2(delCheck).width+"px";
			removeBox.style.top = p.y+GetOffset2(delCheck).height+"px";
		}
        removeBox.style.display = "block";
		if(s.length) s = s.join(",")
		button.onclick=function(){
         if(checkBox.checked==true)
			 ToDel(0,s);
		 else
			 ToDel(1,s);
		} 
}
function SetAdminModeHTML()
{
	//$.each(ALL_atcls,function(i)
	$('TABLE.pl>TBODY>TR').each(function(i)
	{		
		if (!$('table.pl div.adminOper').get(i)) return;
		/*
		if (G_sys_param.urole<20&&ALL_atcls[i].brdid!=brdid)
		{
		//$('table.pl div.adminOper').get(i).style.display='none';
		
		$('table.pl div.adminOper').eq(i).html("<a class='gray'>本贴是全局置顶，非本版内容，您无权操作</a>");
		$('table.pl input').get(i+1).style.display='none';
		return;
		}
		*/
		/*
		var _atclid = ALL_atcls[i].id;
		var _elite = ALL_atcls[i].elite;
		var _top = ALL_atcls[i].top;
		var _lock = ALL_atcls[i].lock;
		*/
		var _atclid = $(this).attr('_id');
		var _elite = $(this).attr('_elite');
		var _top = $(this).attr('_top');
		var _lock = $(this).attr('_lock');
		
		var str = "";
		if (_elite==0) str += "<a class='href' onClick=\"T.PostData2('http://bbs.qbar.qq.com/cgi-bin/cafe_cgi_bbs_general_article_elite.cgi','elite=1&atclid="+_atclid+"',ReMain)\" title='设置本贴为精华'>加为精华</a>";
		else str += "<a class='href' onClick=\"T.PostData2('http://bbs.qbar.qq.com/cgi-bin/cafe_cgi_bbs_general_article_elite.cgi','elite=0&atclid="+_atclid+"',ReMain)\" title='取消本贴为精华'>取消精华</a>";
		
		//if ((_top==2&&G_sys_param.urole>=20)||_top==1)
		if (_top>0)
		str += "<a class='href' onClick=\"T.PostData2('http://bbs.qbar.qq.com/cgi-bin/cafe_cgi_bbs_general_article_top.cgi','top=0&atclid="+_atclid+"',ReMain)\" title='取消置顶状态'>取消置顶</a>"
		else str += "<a class='gray'>取消置顶</a>";
		
		//--if (G_sys_param.urole>=20)
		{
		if (_top!=2) str += "<a class='href' onClick=\"T.PostData2('http://bbs.qbar.qq.com/cgi-bin/cafe_cgi_bbs_general_article_top.cgi','top=2&atclid="+_atclid+"',ReMain)\" title='设为全局置顶'>总置顶</a>"
			else  str += "<a class='gray'>总置顶</a>";
		}
		if (_top==0) str += "<a class='href' onClick=\"T.PostData2('http://bbs.qbar.qq.com/cgi-bin/cafe_cgi_bbs_general_article_top.cgi','top=1&atclid="+_atclid+"',ReMain)\" title='设置为本版置顶'>置顶</a>"
			else  str += "<a class='gray'>置顶</a>";			
		if (_top==0) str += "<a class='href' onClick=\"T.PostData2('http://bbs.qbar.qq.com/cgi-bin/cafe_cgi_bbs_general_article_lift.cgi','lift=0&atclid="+_atclid+"',ReMain)\" title='将本贴沉到最后'>沉</a>";
		else str += "<a class='gray'>沉</a>";
		
		if (_top==0) str += "<a class='href' onClick=\"T.PostData2('http://bbs.qbar.qq.com/cgi-bin/cafe_cgi_bbs_general_article_lift.cgi','lift=1&atclid="+_atclid+"',ReMain)\" title='将本贴提到最前'>提</a>"
		else  str += "<a class='gray'>提</a>";

		str += "<a class='href' onclick='ShowRemoveBox("+_atclid+",this)' title='删除本贴'>删</a>";
		//--if (G_sys_param.urole>=20)
		{
			str += "<a class='href' onclick='ToMove("+_atclid+",this)' title='转移本贴到其他版面'>移</a>";
		}
		if (_lock==0)
		{
			str += "<a class='href' onclick=\"T.PostData2('http://bbs.qbar.qq.com/cgi-bin/cafe_cgi_bbs_general_article_lock.cgi','lock=1&atclid="+_atclid+"',ReMain)\" title='锁定本贴(锁定后不能回复)'>锁</a>";
		}
		else
		{
			str += "<a class='href' onclick=\"T.PostData2('http://bbs.qbar.qq.com/cgi-bin/cafe_cgi_bbs_general_article_lock.cgi','lock=0&atclid="+_atclid+"',ReMain)\" title='取消锁定状态'>开</a>";
		}
		$('table.pl div.adminOper').eq(i).html(str);
	});
}

function ToClear()
{
}

function ToDel(type,id,obj)
{
	var ismult = String(id).indexOf(',')>0;
	var u='http://bbs.qbar.qq.com/cgi-bin/cafe_cgi_bbs_general_article_del';
	//如果版主删除帖子或者是批删
	//if(G_sys_param.urole<20||ismult)u+='2';
	if(ismult)u+='2';
	u+='.cgi';
	var p=['atclid='+id];

	if(type) p.push('nosub=1');

	//如果仅仅版主删除帖子，必须传递版面ID
	if(brdid>0)p.push('brdid='+brdid);
	
	T.PostData2(u,p,function(){
		//parent.window.name='';
		ReMain()
	})
	/*
	T.PostData2(u,'atclid='+id,
		function(RESULT,P){
			var u='l,'+P.brdid;
			if (P.pageno>1)u+=','+P.pageno;
			
			alert(u)
			
			parent.MAIN(u,1);
			return;
			var tb = window.document.getElementById("artcleListTable");
            //因为atclid在一个页面内可能不是唯一的。所以不能给元素赋ID而直接定位
			for (var i=tb.rows.length-1;i>0;i--)
			{
				if (tb.rows[i].getAttribute("_atclid")==RESULT.atcl.id)
				{
					tb.deleteRow(i);
				}
			}
		},{brdid:brdid,pageno:pageno})
	*/
}
function delAtcboxSubmit()
{
   
}
function delAtcboxCancal()
{
   var removeBox = T.$('D_removeDIV').parentNode;
   removeBox.style.display = "none";
}
function ToMove(id,_$elem,flg)
{
	TryRemoveTipWin();
	tobeMoveId=id;

	if(window==top)T.LoadData("http://qbar.qq.com/cgi-bin/cafe_cgi_index_static_app.cgi?reqlist=6",
		function(RESULT){
        G_boards = RESULT.boards;
        Cb();
    });
	else{
		G_boards=parent.G_boards;
		Cb()
	}
	
	function Cb()
	{
		//OpenTipWin("./TPL/toMoveArticle2.tpl.htm",{elem:_$elem,left:-260,top:0});
		if (!flg) OpenTipWin("./TPL/toMoveArticle2.tpl.htm",{elem:_$elem});
		else OpenTipWin("./TPL/toMoveArticle2.tpl.htm",{elem:_$elem,left:-5,top:-5});
	}
	
}

/**
options: {
    elem: 在哪个对象为焦点出现，不传递则以 event.srcElement 为起点
    left: 左侧离 elem 的左侧的偏移
    top: 顶部离 elem 的顶部的偏移
}
*/

/** 将某个版面的帖子移动到其他版面 普通版面，管理员版面合用 */

function MoveArticleSubmit(_$brdid)
{
	var _$tobeMoveId=tobeMoveId;
    var u='http://bbs.qbar.qq.com/cgi-bin/cafe_cgi_bbs_general_article_move.cgi';
    if (_$brdid==0)
    {
        alert("必须选择移动到的目标版面");
        return;
    }

    T.PostData2(u, 'brdid='+ _$brdid +'&atclid='+ _$tobeMoveId, callback);

    function callback()
    {
		TryRemoveTipWin();
		ReMain();
    }
}

function TryRemoveTipWin()
{
	var _$tipWin = window.document.getElementById(_$tipWinRandomID);
	if (_$tipWin)
	{
		_$tipWin.style.display="none";
		window.setTimeout(function(){_$tipWin.removeNode(true)},200);
	}
}

var _$tipWinRandomID;
function OpenTipWin(_$tplUrl, _$options)
{
    var _$elem, _$left, _$top,_$elemRect;
    //if (!_$options && _$options.elem) _$elem = document.getElementById(_$options.elem); 
        //else _$elem = event.srcElement;
	 _$elem = _$options.elem;
	
	if (_$options && _$options.left) _$left  = Number(_$options.left);
	else _$left = (-284);
	if (_$options && _$options.top) _$top = Number(_$options.top);
	else _$top = (-24);
	if (_$options && _$options.data) _$data = _$options.data;
	_$elemRect = GetOffset(_$elem);

    var tipWin = document.createElement("DIV");
    document.body.appendChild(tipWin); 
    _$tipWinRandomID = T.GetRand();

    tipWin.setAttribute("id", _$tipWinRandomID);
	
    tipWin.style.backgroundColor = "white"; 
    tipWin.style.position = "absolute";

    tipWin.style.left = _$elemRect[1] + document.body.scrollLeft + _$left;
    tipWin.style.top  = _$elemRect[0] + document.body.scrollTop + _$top;

	T.LoadTPL(_$tplUrl,function(html){tipWin.innerHTML = html.process()});
}


function GetParent(_$el, _$pTagName)
{
	if(_$pTagName==null || _$pTagName=="" || _$pTagName==undefined) _$pTagName="|span|div|td|table|body|fieldset|";
	// 返回最近的指定标签的父对象
	if(_$el==null)return null;
	else if(_$el.nodeType==1&&(_$el.tagName.toLowerCase()==_$pTagName.toLowerCase() || _$pTagName.toLowerCase().indexOf("|"+_$el.tagName.toLowerCase()+"|")>-1))
		return _$el;
    else
		return GetParent(_$el.parentNode, _$pTagName);
}

function ParseInt(_$strornum, _$minvalue)
{
    _$strornum = parseInt(_$strornum) || 0;
    _$minvalue = parseInt(_$minvalue) || 1;

    if (_$strornum<_$minvalue) _$strornum = _$minvalue;
    return _$strornum;
}

function GO(obj,fun)
{
    var pn = parseInt(obj.value);
    if (pn!=Number(obj.value)) {obj.value="";return;}
    if (pn==pageno)
    {
        alert("当前已经是第 "+pn+" 页");
        return;
    }
    if (pn<1)
    {
         pn=1;
    }
    else if (pn>G_page.total)
    {
        pn=G_page.total;
    }
	var u=fun;
	if (fun=="all"||fun=='allzx')
	{
		if(pn>1)u+='-'+pn;
		location.href=u+'.htm';
	}
	else
	{
		u+='-'+brdid;
		if(pn>1)u+='-'+pn;
		location.href=u+'.htm';
	}
}


function ToExpandReply(id,img,_$brdid,event)
{
    T.Event(event);
    if (!CheckBrdPriv(_$brdid,event)) return;
    var row = img.parentNode.parentNode;
    
    if (img.src==imgpath+'qbar_iconb13.gif' && row.className=="mainRow")
    {
        //------img.style.visibility = "hidden";
        T.AutoWinHeight();
        return;
    }
    if (row.className=='listbg')
    {
        row.className = "mainRow";
        img.src = imgpath+'qbar_iconb12.gif';
        var allrows = document.getElementById("artcleListTable").rows;
        for (var i=row.rowIndex+1;i<allrows.length;i++)
        {
            if (allrows[i].getAttribute("_atclid")) break;
            document.getElementById("artcleListTable").deleteRow(i);
            i--;
        }
        return;
    }

    img.src = imgpath+'qbar_iconb13.gif';
    row.className = "listbg";
    var u = "http://bbs.qbar.qq.com/cgi-bin/cafe_cgi_bbs_general_richreply_view.cgi?order=1&atclid="+id;
    T.LoadData(u,function(RESULT){
        var replys = RESULT.replys;
        if (replys.length>0)
        {
            for (var i=0;i<replys.length;i++)
            {
                var newrow = document.getElementById("artcleListTable").insertRow(row.rowIndex+i+1);
                newrow.className = 'replyRow';
                var newcell = newrow.insertCell(-1);

                newcell = newrow.insertCell(-1);
                
                if (replys[i].delflag==1)
                {
                    cont = "<i class='gray'>回复已被删除</i>";
                    newcell.innerHTML = "　·"+cont;
                }
                else 
                {
                    var cont = replys[i].cont.toText().left2(70);
                    if (cont!="")
                    {
                        newcell.innerText = "　·"+cont;
                    }
                    else
                    {
                        cont = "<span class='gray'>(该回复没有文字内容)</span>";
                        newcell.innerHTML = "　·"+cont;
                    }
                }
                if (/<img/.test(replys[i].cont))
                {
                    newcell.innerHTML += " <img src='"+imgpath+"qbar_iconb04.gif' width=11 height=10>";
                }

                //newcell.style.borderWidth = 0;
                newcell = newrow.insertCell(-1);
                //var uinfo = "<a href='http://"+replys[i].uin+".qzone.qq.com' style='color:#585858' target='_blank'>";
                //    uinfo += replys[i].unick.toHTML()+"</a>";
                var uinfo = User_Output(replys[i].uin,replys[i].unick);
                newcell.align = "center";
                newcell.innerHTML = uinfo;
                //newcell.style.borderWidth = 0;
                newcell = newrow.insertCell(-1);
                newcell.innerHTML = ShowTime(replys[i].time,1);
                newcell.colSpan = 2;
                newcell.align = "center";
                newcell.style.height = 12;
                //newcell.style.borderWidth = 0;
            }            
        }
        T.AutoWinHeight();
    });
}

function ToCollapseReply(id,row)
{
    row.className = "mainRow";
}



function ToShowArticlePager()
{
    var rowindex = 1, atcl;
    var tb = document.getElementById("artcleListTable");
    if (!tb) return;
    if (RESULT.atcls_atop)
    {
        for (var i=0;i<RESULT.atcls_atop.length;i++,rowindex++)
        {
            setInner(RESULT.atcls_atop[i]);
        }
        for (var i=0;i<RESULT.atcls_top.length;i++,rowindex++)
        {
            setInner(RESULT.atcls_top[i]);
        }
    }
    if (isphotemode) return;

    for (var i=0;i<RESULT.atcls.length;i++,rowindex++)
    {
        setInner(RESULT.atcls[i]);        
    }
    function setInner(atcl)
    {
        tb.rows[rowindex].cells[1].insertAdjacentHTML('beforeEnd',GetArticlePager(atcl));
    }
}

function GetArticlePager(atcl)
{
    var rplcnt = atcl.rplcnt, id = atcl.id;
    var rper = RESULT.brd.rper>1 ? RESULT.brd.rper : 1;
    var page = Math.ceil(rplcnt/rper);
    
    if (page<2) return "";
    var rstr = "&nbsp;&nbsp;<font class=gray>[第</font>&nbsp;";
    for (var i=2;i<=page;i++)
    {
        if (i<7)
        {
             rstr += "<a style='margin-left:1' class=black href='../r/?"+id+","+i+"'>"+i+"</a>&nbsp;";
        }
        else
        {
            if (i==7 && page>7)
            {
                rstr += "<a class=gray>...&nbsp;</a>";
            }
            if (i>page-2)
            {
                rstr += "<a style='margin-left:1' class=black href='../r/?"+id+","+i+"'>"+i+"</a>"+"&nbsp;";
            }
        }
    }
    rstr += "<font class=gray>页]</font>";
    return rstr;
}



function ToWrite(evt)
{
	T.Event(evt);
	if (!(uin>10000)) {top.T.CreateLoginFrameWin();return}
	//if (ulevel==0) {T.MSG("由于您的权限不够，不能进行该操作");return}
    window.location.href = "ed/?brdid="+brdid+"&brdname="+G_brd.title.URI();
}



function ReadInNew(id)
{
window.open(Base('/r/?'+id));
}


function ShowBrdReadMsg(l)
{
    var a = {'8':'00','32':'01','64':'02','128':'03','256':'04','512':'05','1024':'06','2048':'07'};
    var r = {'8':'游客','32':'一','64':'二','128':'三','256':'四','512':'五','1024':'六','2048':'七'};
    l = String(l);
    var msg = "本版面阅读需要等级"+r[l];
    if (l=='8') msg = "游客可浏览本版面";
    msg = "<a class=black href='javascript:LoadShowBrdrule()'>"+msg+"</a>";

    return '<img src="http://imgcache.qq.com/qbar_v1/client/images/qbar_grade'+a[l]+'.gif"> '+msg;
}

function CheckBrdPriv(_$brdid,evt)
{
    //if (!G_boards[_$brdid]) return parent.MAIN("r,"+_$brdid);//解决隐藏版面没有权限信息的问题
    
    var a=T.Event(evt);
    if (!IsHavePriv(brdid))
    {
        if (T.GetUIN()<=10000)
        {
            if (window.confirm('您当前未登录，无法查看有版面权限的内容\n\n如果您是本Q吧成员，请登录后查看\n\n您需要登录吗？'))
            {
                top.T.CreateLoginFrameWin();                
            }
            else
            {
                T.RunOWF('SetUIN','-1');
                uin = -1;
            }
            return false;
        }
		/*
        else if (ulevel==0 && cancelJoin==0)
        {
            if (window.confirm('您不是该Q吧的成员，不能进行该操作\n\n是否需要加入本Q吧？'))
            {
                T.RunOWF('ToJoin');
            }
            else
            {
                T.RunOWF('SetCancelJoin');
                cancelJoin = 1;
            }
            return false;
        }*/
        else T.MSG("该版面有权限限制，您的权限不够，不能进行该操作");
        return false;
    }
    return parent.MAIN("r,"+_$brdid);
}

function EchoG_boardsName(brdid)
{
	if (window.brdid==brdid) return '';
	
    var h = "<span style='font-size:12px;color:#C6C6C6'>[";
    if (G_boards[brdid]) h += G_boards[brdid].title.toHTML();
    else  return "";//h += "<i>未知版面</i>";
    return h + "]</span>";
}

function LoadShowBrdrule()
{
    T.RunJS('/qbar/qbar2/bbs_showBrdrule.js');
}

var reloadTimer;
function ReMain()
{

	var u=location.href.replace('?admin=1','');
	if(adminMode>0)u+='?admin='+adminMode;
	location.href=u;	
}

function Reflow(){ 
	var b = document.body; 
	b.style.zoom = b.style.zoom=="1"?"100%":"1"; 
}
function EditBulletin(){
	$.ajax({
		url:BASE+'mng-bin/cafecgi_mng_getsystime.cgi',
		dataType:'script',
		async: false,
		success:function(){
			if(RESULT.sys_param.urole>20||G_brdself.isowner==1){
				T.$("bn").style.display="block";
				T.$("brdBulletin").innerHTML="<textarea id='textBulletin' class='ta1'>"+G_brd.bulletin+"</textarea><button id='postBulletin' onclick='SubmitBulletin()' class='com_btn'>保 存</button><div class='linkIntro gray'>插入链接格式: [url=http://web.qbar.qq.com]Q吧大杂烩[/url] <span> (限qq.com下的链接)</span></div>";
			}else{
				var btn=T.$("bulletinBtns");
				btn.onclick=null;
				btn.style.color="#ff3c00";
				btn.innerHTML='对不起，你的权限不足，不能做此操作';
				window.setTimeout(function(){btn.style.display="none"},2000);
			}
		}
	})
}
function SubmitBulletin(){
	var ta=T.$("textBulletin");
	T.PostData2("http://bbs.qbar.qq.com/cgi-bin/cafe_cgi_bbs_board_mod.cgi",["brdid="+G_brd.id,"bulletin="+ta.value.substr(0,499)],function(){location.reload(true)},function(R){
		var retcode=R.sys_param.ret_code;
		if (retcode==4324){alert('对不起，您输入的内容超过500字上限，请少输入几个字')}
		else T.PrepResult(RESULT);
	})
}

function GetOwnerDocument(a){return a.nodeType==9?a:a.ownerDocument||a[document]}
function GetDocumentElement(a){
    var b=(a.nodeType==9)?a:GetOwnerDocument(a);
	if(T.isIE&&b.compatMode!="CSS1Compat") return b.body
	return b.documentElement;
}
function GetOffset2(a){
	if(a.style.display!="none"){
        return {
            'width':a.offsetWidth,
            'height':a.offsetHeight
        }
	}
	var b=a.style,c=b.visibility,d=b.position;
	b.visibility="hidden";
	b.position="absolute";
	b.display="";
	var f=a.offsetWidth,e=a.offsetHeight;
	b.display="none";
	b.position=d;
	b.visibility=c;
	return {
        "width:":f,
        "height:":e
    }
}
function GetPositionOnPage(a){
	var b=GetOwnerDocument(a),c={x:0,y:0},d=GetDocumentElement(b),f=null,e;
	if(a==d){return c;}
	if(a.getBoundingClientRect){
		e=a.getBoundingClientRect();
		c.x=e.left+d.scrollLeft;
		c.y=e.top+d.scrollTop;
	}
	else{
		c.x=a.offsetLeft;
		c.y=a.offsetTop;
		f=a.offsetParent;
		if(f!=a){
			while(f){
				c.x+=f.offsetLeft;
				c.y+=f.offsetTop;
				f=f.offsetParent;
			}
		}
	}
	return c;
}