﻿/*
Version:	Joekoe CMS 4.0 for Stage
*/

dcs.config.setValue("url.file.user.view",		"user.asp");
dcs.config.setValue("url.file.user.bookmark",		"bookmark.asp");
dcs.config.setValue("url.file.user.put",		"put.asp");

dcs.config.setValue("url.file.preview",			"preview.asp");

dcs.config.setValue("url.file.verifycode",		"verifycode.asp");

dcs.config.setValue("url.file.url.proxy",		"url.proxy.asp");


dcs.form.SELECT_INPUT_NAME="_select_id";


dcs.init.loadRes("browser");
dcs.init.loadRes("form.select");
dcs.init.loadRes("paging");
dcs.init.loadRes("images");
dcs.init.loadRes("url");



//########################################
//########################################
/*
function doLoginCheck() { return appUser.isLoginCheck(); }
function doBookmarkAdd(strChannel,strName,strURL) { app.doBookmarkAdd(); }
*/



//########################################
//########################################
var app=new Object();
var appPage=new Object();



//########################################
//########################################
var appCommon=new Object();


appCommon.doReport=function()
{
	
}

appCommon.doBookmarkAdd=function(strChannel,strName,strURL)
{
	var re=dcs.config.getURL("account","user.bookmark");
	var strAction="add";
	if (strName==null || strName=="") strName=dcs.browser.getTitle();
	if (strURL==null || strURL=="") strURL=dcs.browser.getURLs();
	if (strChannel) re=dcs.url.toAppend(re,"channel="+strChannel);
	if (strAction) re=dcs.url.toAppend(re,"action="+strAction);
	if (strName) re=dcs.url.toAppend(re,"name="+dcs.url.toEncode(strName));
	if (strURL) re=dcs.url.toAppend(re,"url="+dcs.url.toEncode(strURL));
	window.open(re);
}

appCommon.doPutAdd=function(strChannel,strName,strURL)
{
	var re=dcs.config.getURL("account","user.put");
	var strAction="add";
	if (strName==null || strName=="") strName=dcs.browser.getTitle();
	if (strURL==null || strURL=="") strURL=dcs.browser.getURLs();
	if (strChannel) re=dcs.url.toAppend(re,"channel="+strChannel);
	if (strAction) re=dcs.url.toAppend(re,"action="+strAction);
	window.open(re);
}

appCommon.toUploadPic=function(strer,strwidth,strheight,strm,strtype,strRe)
{
	var re="";
	var tmpDefault='no_pic.gif';
	if (!isEmpty(strRe)) tmpDefault=(strRe=='no') ? '' : strRe;
	if (strer==null || strer=="") strer=tmpDefault;
	if (isEmpty(strer)) return re;
	var tmpURL=dcs.url.isValid(strer) ? strer : dcs.config.getURL("upload")+strer;
	var tmpSize="";
	if (!isNull(strwidth) && !dcs.common.isNumber(strwidth)) strwidth=120;
	if (!isNull(strheight) && !dcs.common.isNumber(strheight)) strheight=90;
	if (!dcs.common.isNumber(strm)) strm=1;
	if (!isNull(strwidth))
	{
		strwidth=strwidth*strm;
		tmpSize+=" width=\""+strwidth+"\"";
	}
	if (!isNull(strheight))
	{
		strheight=strheight*strm;
		tmpSize+=" height=\""+strheight+"\"";
	}
	switch (strtype)
	{
		case 0:
			re="<img class=\"pic\" alt=\"picture\" src=\""+tmpURL+"\" "+tmpSize+"/>";
			break;
		case 10:
			re="<img class=\"pic hand\" alt=\"pichand\" src=\""+tmpURL+"\" "+tmpSize+" onload=\"javascript:dcs.images.doResize(this,0.5);\" onmouseover=\"javascript:dcs.images.doResize(this,0.5);\" onclick=\"javascript:dcs.images.doOpen(this);\" title=\"点击放大\"/>";
			break;
		case 1:
			re=re="<a href=\""+tmpURL+"\" target=\"_blank\"><img class=\"pic\" alt=\"picture\" src=\""+tmpURL+"\" "+tmpSize+" title=\"点击放大\"/></a>";
			break;
		default:
			re=tmpURL;
			break;
	}
	return re;
}

appCommon.getADS=function(strSort,strChannel,strType)
{
	var re="";
	var tmpURL=dcs.config.getURL("xml")+"misc.ad.asp";
	
	re="<script type=\"text/javascript\" language=\"Javascript\" src=\""+tmpURL+"\"></script>";
	return re;
}



//########################################
//########################################
var appUser=new Object();

appUser.isLoginCheck=function()
{
	dcs.init.loadUtil("error");
	var err=new VDCS.utilError();
	if (document.frm_login.username.value=="")
	{
		err.addItem("请输入您在本站注册时的 用户名称 ！");
		document.frm_login.username.focus();
	}
	else if (document.frm_login.password.value=="")
	{
		err.addItem("请输入您在本站注册时的 登陆密码 ！");
		document.frm_login.password.focus();
	}
	err.doPop();
	return err.isCheck();
}

appUser.doMailCheck=function(strNum)
{
	if (strNum<1) return false;
	put("<bgsound src=\""+dcs.config.getURL("skin")+"images/account/newmail.mp3\">");
	$("user_mail_new").style.display="";
	$("user_mail_new_num").innerText=strNum;
}

appUser.toURL=function(strid,strname,strmodule)
{
	var re="";
	re=dcs.config.getURL("account","user.view");
	if (strid) re=dcs.url.toAppend(re,"userid="+strid);
	if (strname) re=dcs.url.toAppend(re,"username="+dcs.url.toEncode(strname));
	if (strmodule) re=dcs.url.toAppend(re,"module="+strmodule);
	return re;
}

appUser.toLinkURL=function(strid,strname,strmodule,strtarget,strtitle,strtext)
{
	var re="";
	var tmpURL;
	var tmpText=strtext;
	if (tmpText==null || tmpText=="") tmpText=strname;
	if (strid>0)
	{
		tmpURL=this.toURL(strid,strname,strmodule);
		re=dcs.url.toHyperLink(tmpURL,tmpText,strtarget,strtitle);
	}
	else
	{
		if (strname.length>0)
		{
			var tmpAry=strname.split(",");
			for (var i=0;i<tmpAry.length;i++)
			{
				tmpURL=this.toURL(0,tmpAry[i],strmodule);
				tmpText=tmpAry[i];
				if (re.length>0) re+=" "+dcs.url.toHyperLink(tmpURL,tmpText,strtarget,strtitle);
				else re=dcs.url.toHyperLink(tmpURL,tmpText,strtarget,strtitle);
			}
		}
		else
		{
			if (strmodule=="moderator") re="<font class=\"gray\">暂无</font>";
			else re="<font class=\"gray\">------</font>";
		}
	}
	return re;
}

appUser.toGroupPower=function(strer)
{
	var re="";
	return re;
}

appUser.toFace=function(strer,strWidth,strHeight)
{
	var re="";
	var tmpURL=strer;
	switch (strer.substring(0,1))
	{
		case "#":
			tmpURL=dcs.config.getURL("upload")+"face/"+strer.substring(1);
			break;
		case "$":
			tmpURL=dcs.config.getURL("upload")+"user.face/"+strer.substring(1);
			break;
	}
	if (dcs.common.isNumber(strWidth) && dcs.common.isNumber(strHeight)) re="<img class=\"user-face\" alt=\"userface\" src=\""+tmpURL+"\" width=\""+strWidth+"\" width=\""+strHeight+"\"/>";
	else re=tmpURL;
	return re;
}







function format_power(u_power,pt)
{
	var fi,pdim,pnum,pdim2,c;
	if (pt==2)
	{ c=0; }
	else
	{ c=""; }
	pdim=web_user_power.split("|");
	pnum=pdim.length;
	for ( fi=0; fi<pnum; fi++ )
	{
		if (pdim[fi]=="" || pdim[fi]==null) continue;
		pdim2=pdim[fi].split(":");
		if (u_power==pdim2[0])
		{
			switch (pt)
			{
				case 1:
					c=pdim2[1];
					fi=pnum;
					break;
				case 2:
					c=fi+1;
					fi=pnum;
					break;
				default:
					c=u_power;
					fi=pnum;
					break;
			}
		}
	}
	return c;
}
function user_view_sex(us,utim)
{
	var a="0",b="离线了",temp1="";
	var t=time_diff("m",utim,now_time);
	if (t<=web_etim)
	{
		a="";
		b="在线哦！有人找吗？";
	}
	if (us=="false" || us=="False")
	{ temp1="<img src='"+web_dir_skin+"small/girl"+a+".gif' align=absmiddle alt='"+web_n_girl+"，"+b+"' border=\"0\"/>"; }
	else
	{ temp1="<img src='"+web_dir_skin+"small/boy"+a+".gif' align=absmiddle alt='"+web_n_boy+"，"+b+"' border=\"0\"/>"; }
	return temp1;
}
function forum_user_power_grade(u_int,u_power)
{
	var si,snum,sdim,sdim2;
	var gp_type="";gp_types="";gp_name="";up_type="";up_name="";
	snum=dim_power.length;
	for (si=0;si<snum;si++)
	{
		sdim=dim_power[si].split(":");
		if (u_power==sdim[0])
		{
			up_type=sdim[0];
			up_name=sdim[1];
			switch (si)
			{
				case 0:
					gp_types=up_type;
					gp_type="p";
					break;
				case 1:
					gp_types=up_type;
					gp_type="p";
					break;
				case 2:
					gp_type="p";
					break;
			}
			break;
		}
	}
	if (up_type=="" || up_name=="")
	{
		sdim=dim_power[0].split(":");
		up_type=sdim[0];
		up_name=sdim[1];
	}
	
	var n_int=0;b=0;
	snum=dim_grade.length;
	for (si=0;si<snum;si++)
	{
		sdim=dim_grade[si].split(":");
		if (si!==snum-1) { sdim2=dim_grade[si+1].split(":"); }
		switch (si)
		{
			case snum-1:
				if (u_int>=sdim[0])
				{
					n_int=si;
					gp_name=sdim[1];
					b=1;
					break;
				}
			default :
				if (u_int<sdim2[0])
				{
					n_int=si;
					gp_name=sdim[1];
					b=1;
					break;
				}
		}
		if (b==1) break;
	}
	
	var gp_type2=gp_type;
	var gp_type3=gp_type+n_int;
	if (gp_types!="" && gp_types!=null)
	{
		//gp_name=up_name;
		gp_type3=gp_types;
	}
	return "<img alt=\"star\" src='"+web_dir_skin+"star/star_"+gp_type3+".gif' border=\"0\"/><br>&nbsp;&nbsp;等级：<img border=\"0\" src='"+web_dir_skin+"small/icon_"+up_type+".gif' alt='"+up_name+"' align=absmiddle/>&nbsp;"+gp_name;
}

