﻿
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 re='';
	if (!isEmpty(tmpName)) re=dcs.code.toTemplate('<font class="user-moderator'+tmpGrade+'">'+tmpName+'</font>',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);
	}
}
