﻿
dcs.init.loadRes("codes");

var appForum=new Object();
appForum._data=new Array();

appForum.getData=function(strKey) { return appForum._data[strKey]; }
appForum.setData=function(strKey,strValue) { appForum._data[strKey]=strValue; }


appForum.doSwitch=function(strer)
{
	return dcs.pages.doBlockSwitch(strer,strer+"_icon");
}

appForum.toForumPic=function(strer)
{
	var re=strer;
	if (!isEmpty(re))
	{
		if (strer.substring(0,1)=="$") re=dcs.config.getURL("upload")+"forum.pic/"+strer.substring(1);
		re="<img class=\"icon\" src=\""+re+"\">";
	}
	return re;
}


appForum.toModeratorGradeInfo=function(strGrade,strBBSMod,strTemplate)
{
	var tmpGrade=0;
	if (strGrade==10) tmpGrade=10;
	else tmpGrade=strBBSMod;
	var tmpName=appForum.getData("moderator.grade."+tmpGrade);
	var tmpVar="<font class=\"user-moderator"+tmpGrade+"\">"+tmpName+"</font>";
	if (tmpGrade>8) tmpVar="<img class=\"icon\" src=\""+dcs.config.getURL("skin")+"images/forum/ico_manager.gif\"> "+tmpVar;
	var re="";
	if (!isEmpty(tmpName)) re=dcs.codes.toTemplate(tmpVar,strTemplate);
	return re;
}

appForum.toUserNickname=function(strer,strTemplate)
{
	var re='';
	if (!isEmpty(strer)) re=dcs.code.toTemplate(strer,strTemplate);
	return re;
}

appForum.toUserPrestige=function(strer,strTemplate)
{
	var re='';
	if (!isEmpty(strer)) re=dcs.code.toTemplate(strer,strTemplate);
	return re;
}



appForum.doVoteCheckUp=function()
{
	var tmpDeadline=this.getData("vote.deadline");
	var tmpDisplay="";
	if (this.getData("vote.isoverdue")=="yes") tmpDisplay="none";
	else tmpDisplay="";
	if (tmpDeadline=="" || tmpDeadline=="always") tmpDeadline=this.getData("lang.vote.forover");
	$("forum_vote_deadline").innerHTML=tmpDeadline;
	$("forum_vote_button").style.display=tmpDisplay;
}

appForum.doExpressJump=function(strURL,strObject)
{
	var tmpValue=strObject.options[strObject.selectedIndex].value;
	if(tmpValue!="")
	{
		location.href=dcs.common.toDisp(strURL,"fid",tmpValue);
	}
}/*<a href="http://xmcyberpolice.cn/alert.asp" target=_blank><img src="http://xmcyberpolice.cn/image/gt.gif" width  ="30" border='0'></a>*/