/*
Version:	VDCS Library 1.0
*/

//window.onerror=function(a,b,c){return true;}
var dcs=new Object();

function put(strer) { document.write(strer); }
function isNull(strer) { return (strer==null) ? true : false; }
function isEmpty(strer) { return (strer==null || strer=="") ? true : false; }
function isObject(strer) { return (typeof(strer)=="object" && strer) ? true : false; }
function getType(strer) { return typeof(strer).toString; }

function toReplace(str1,str2,str3) { return str1.replace(str2,str3); }
function toDisp(str1,str2,str3) { return str1.replace("{$"+str2+"}",str3); }


String.prototype.inStr=function(strer) { return this.indexOf(strer); }
String.prototype.inPart=function(strer,strSymbol)
{
	if (!strSymbol) strSymbol=',';
	var tmpVar=strSymbol+this.toString()+strSymbol;
	var tmpStr=strSymbol+strer+strSymbol;
	return tmpVar.indexOf(tmpStr);
}


dcs.config=new Object();
dcs.config._data=new Array();
dcs.config._data=new Array();
dcs.config._data["dir"]				= "/";
dcs.config._data["url"]				= "/";
dcs.config._data["dir.common"]			= "common/";
dcs.config._data["dir.common.smiley"]		= "images/smiley/";
dcs.config._data["dir.common.script"]		= "common/script/";
dcs.config._data["dir.common.editor"]		= "common/script/editor/";
dcs.config._data["dir.account"]			= "account/";
dcs.config._data["dir.passport"]		= "passport/";
dcs.config._data["dir.images"]			= "images/";
dcs.config._data["dir.upload"]			= "upload/";
dcs.config._data["dir.xml"]			= "xml/";
dcs.config._data["dir.skin"]			= "skin/default/";

dcs.config.getValue=function(strKey) { return dcs.config._data[strKey]; }
dcs.config.setValue=function(strKey,strValue) { dcs.config._data[strKey]=strValue; }

dcs.config.setPath=function(strDir,strURL,strSKIN)
{
	if (!isEmpty(strDir)) this._data["dir"]=strDir;
	if (!isEmpty(strURL)) this._data["url"]=strURL;
	if (!isEmpty(strSKIN)) dcs.config._data["dir.skin"]=strSKIN;
}
dcs.config.setDir=function(strKey,strValue) { this._data["dir."+strKey]=strValue; }
dcs.config.getDir=function(strKey) { return this._data["dir."+strKey]; }
dcs.config.setFile=function(strKey,strValue) { this._data["url.file."+strKey]=strValue; }
dcs.config.getURL=function(strKey,strFile)
{
	var re="",tmpBase=this._data["url"];
	if (isEmpty(strKey)) re=tmpBase;
	else
	{
		re=this._data["dir."+strKey];
		if (re.substring(0,1)!="/" && re.indexOf("://")==-1) re=tmpBase+re;
	}
	if (!isEmpty(strFile)) re+=this._data["url.file."+strFile];
	return re;
}



//########################################
//########################################
dcs.browser=new Object();
dcs.browser.userAgent		= navigator.userAgent.toLowerCase();
dcs.browser.appVersion		= navigator.appVersion;

dcs.browser.doInit=function()
{
	this.isIE=this.userAgent.indexOf("msie")!=-1;
	this.isIE5=false; this.isGecko=false; this.isNS=false; this.isMozilla=false; this.isFirefox=false; this.isOpera=false;
	if (this.isIE)
	{
		this.MajorVer=this.appVersion.match(/MSIE (.)/)[1];
		this.MinorVer=this.appVersion.match(/MSIE .\.(.)/)[1];
		this.isIE5=(this.MajorVer>5 || this.MinorVer>=5);
		if (this.isIE5) this.type="ie5";
		else this.type="ie";
		this.typeName="ie";
		//this.typeName=/msie/.test(navigator.userAgent.toLowerCase()) ? 'ie' : 'gecko';
	}
	else
	{
		this.isGecko=true;	
		this.type="gecko";
		this.typeName="gecko";
		this.MajorVer=0; this.MinorVer=0;
		this.isNS=this.userAgent.indexOf("netscape")!=-1;
		if(this.isNS) this.type="ns";
		this.isMozilla=(typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined') && (typeof HTMLDocument!='undefined');
		this.isFirefox=(navigator.userAgent.toLowerCase().indexOf("firefox")!=-1);
		this.isOpera=(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);
	}
}
dcs.browser.doInit();

dcs.browser.getTypeName=function() { return this.typeName; }

function $(strname) { return dcs.browser.getElementById(strname); }
/*function $$(strname) { return dcs.browser.getElementsByName(strname); }*/

dcs.browser.getObject=function(strname) { return this.getElementById(strname); }
dcs.browser.getElementById=function(strname)
{
	if (this.isIE5 || this.isMozilla || this.isFirefox) return document.getElementById(strname);
	if (this.isIE) return document.all(strname);
	if (this.isNS) return document.layers[strname];
}
dcs.browser.getElementsByName=function(strname)
{
	if (this.isIE5 || this.isMozilla || this.isFirefox) return document.getElementsByName(strname);
	if (this.isIE) return document.all(strname);
	if (this.isNS) return document.layers[strname];
}

dcs.browser.toAgent=function(strer,strHtml)
{
	var re,tmpstr,tmp1,tmp2;
	var tmpAry=strer.split(";");
	if (tmpAry.length<3) { re="未知的系统信息"; }
	else
	{
		tmpstr=tmpAry[2];
		tmp1=tmpstr.length-1;
		tmp2=tmpstr.substr(tmp1,1);
		if (tmp2==")") { tmpstr=tmpstr.substr(1,tmp1-1); }
		re="操作系统: "+tmpstr;
		re+=", 浏览器: "+tmpAry[1];
		re=re.replace("MSIE","Internet Explorer");
		re=re.replace("NT 5.0","2000");
		re=re.replace("NT 5.1","XP");
		re=re.replace("NT 5.2","2003");
	}
	if (strHtml!=null && strHtml!="") re=dcs.common.toDisp(strHtml,"agent",re);
	return re;
}

dcs.browser.doRefresh=function() { return window.document.location.reload(); }
dcs.browser.goBack=function() { return history.back(); }

dcs.browser.getDomain=function() { return window.document.domain; }
dcs.browser.getURLs=function() { return window.document.URL; }
dcs.browser.getTitle=function() { return window.document.title; }
dcs.browser.getReferer=function() { return window.document.referrer; }




//########################################
//########################################
dcs.request=new Object();

dcs.request.getQuery=function(strer)
{
	var re="";
	var tmpQuerys=document.location.search;
	if (tmpQuerys.indexOf("?")==0) tmpQuerys=tmpQuerys.substr(1);
	if (tmpQuerys.indexOf("&")>=0)
	{
		var tmpAryQuery=tmpQuerys.split("&");
		var tmpQuery;
		for (var i=0;i<tmpAryQuery.length;i++)
		{
			tmpQuery=tmpAryQuery[i];
			if (tmpQuery.indexOf("=")>=0 && tmpQuery.substring(0,tmpQuery.indexOf("="))==strer)
			{
				re=tmpQuery.substr(tmpQuery.indexOf("=")+1);
				break;
			}
		}
	}
	else
	{
		if (tmpQuerys.indexOf("=")>=0 && tmpQuerys.substring(0,tmpQuerys.indexOf("="))==strer) re=tmpQuerys.substr(tmpQuerys.indexOf("=")+1);
	}
	return re;
}




//########################################
//########################################
var VDCSloader=new Object();
VDCSloader.isLoading=false;
VDCSloader.Queues=new Array();
VDCSloader.addScript=function(scriptPath)
{
	VDCSloader.Queues[VDCSloader.Queues.length]=scriptPath;
	//if (!this.isLoading) this.doCheckQueues();
}
VDCSloader.doCheckQueues=function()
{
	if (this.Queues.length>0)
	{
		this.isLoading=true;
		var sScriptPath=this.Queues[0];
		var oTempArray=new Array();
		for (i=1;i<this.Queues.length;i++) oTempArray[i-1]=this.Queues[i];
		this.Queues=oTempArray;
		var e;
		if (sScriptPath.lastIndexOf('.css')>0)
		{
			e=document.createElement('LINK');
			e.rel='stylesheet';e.type='text/css';
		}
		else
		{
			e=document.createElement("script");
			e.type="text/javascript";
			e.language="javascript";
		}
		document.getElementsByTagName("head")[0].appendChild(e);
		var oEvent=function()
		{
			if (this.tagName=='LINK'||!this.readyState||this.readyState=='loaded') VDCSloader.doCheckQueues();
		}
		if (e.tagName=='LINK')
		{
			if (dcs.browser.isIE) e.onload=oEvent;
			else VDCSloader.doCheckQueues();
			e.href=sScriptPath;
		}
		else
		{
			e.onload=e.onreadystatechange=oEvent;
			e.src=sScriptPath;
		}
	}
	else
	{
		this.isLoading=false;
		if (this.OnEmpty) this.OnEmpty();
	}
	return false;
}
VDCSloader.loadScript=function(strpath)
{
	this.addScript(strpath);
	return this.doCheckQueues();
}




//########################################
//########################################
dcs.queues=new Object();
dcs.queues._Queues=new Array();

dcs.queues.addItem=function(strer)
{
	this._Queues[this._Queues.length]=strer;
}

dcs.queues.isItem=function(strer)
{
	var re=false;
	for (var i=0;i<this._Queues.length;i++)
	{
		if (this._Queues[i]==strer) { re=true; break; }
	}
	return re;
}




//########################################
//########################################
dcs.common=new Object();
dcs.common.NEWLINE='';
dcs.common.VALUE_UNKNOWN='[unknown]';
dcs.common.VALUE_EMPTY_REPLACER='NaN';
dcs.common.VALUE_EMPTY_REPLACER='NaN';
dcs.common.VALUE_EMPTY_REPLACERS='<font class="gray">NaN</font>';

dcs.common.toReplace=function(str1,str2,str3) { return str1.replace(str2,str3); }
dcs.common.toDisp=function(str1,str2,str3) { return str1.replace("{$"+str2+"}",str3); }

dcs.common.isNumber=function(strer,strt,strv)
{
	var tmp_var="0123456789";
	if (strt==1) tmp_var="0123456789.";
	var tmp_value=new Array(1);
	if (strv==null || strv=="") { tmp_value[0]=false; tmp_value[1]=true; }
	else { tmp_value[0]=0; tmp_value[1]=strer; }
	if (strer==null || strer=="") return tmp_value[0];
	for (var i=0;i<strer.length;i++) { if (tmp_var.indexOf(strer.charAt(i))==-1) return tmp_value[0]; }
	return tmp_value[1];
}

dcs.common.getRandNum=function(strnum)
{
	var dd=new Date();
	var ms=dd.getMilliseconds();
	if (ms<1) ms=1;
	for(i=1;i<3;i++)
	{
		if (ms<=strnum) break;
		ms=Math.floor(ms/2);
		i-=1;
	}
	return(ms);
}

dcs.common.toFormatNumber=function(srcStr,nAfterDot)
{
	var re="";
	var srcStr = ""+srcStr+"";
	var strLen = srcStr.length;
	var dotPos = srcStr.indexOf(".",0);
	if (dotPos == -1)
	{
		re = srcStr+".";
		for (i=0;i<nAfterDot;i++) { re = re+"0"; }
	}
	else
	{
		if ((strLen - dotPos - 1) >= nAfterDot)
		{
			nAfter = dotPos + nAfterDot + 1;
			var tmpTen =1;
			for(j=0;j<nAfterDot;j++) { tmpTen = tmpTen*10; }
			re = Math.round(parseFloat(srcStr)*tmpTen)/tmpTen;
		}
		else
		{
			re = srcStr;
			for (i=0;i<(nAfterDot - strLen + dotPos + 1);i++) { re = re+"0"; }
		}
	}
	return re;
}

dcs.common.toPrice=function(strPrice)
{
	var re=strPrice;
	if (!dcs.common.isNumber(re)) re="";
	re=this.toFormatNumber(re,2);
	return re;
}




//########################################
//########################################
dcs.time=new Object();

dcs.time.toConvert=function(strer,strtype)
{
	var re="";
	re=dcs.common.toReplace(strer," ","<br>");
	return re;
}

dcs.time.toDateDiff=function(strType,strDate1,strDate2)
{
	var tmpDate1=Date.parse(strDate1.replace(/-/gi,"/"));
	var tmpDate2=Date.parse(strDate2.replace(/-/gi,"/"));
	var re=tmpDate2-tmpDate1;
	switch (strType)
	{
		case "h":
			re=re/360000;
			break;
		case "m":
			re=re/60000;
			break;
		case "s":
			re=re/1000;
			break;
	}
	return ta;
}




//########################################
//########################################
dcs.code=new Object();

dcs.code.toCuted=function(strer,strlen,strsymbol) { return dcs.code.toCuted(strer,strlen,strsymbol); }
dcs.code.toCuted=function(strer,strlen,strsymbol)
{
	var re="";
	if (strsymbol==null) strsymbol="..";
	var tc=0,cc=0,c_mod=2,tt;
	for (ci=1;ci<=strer.length;ci++)
	{
		//if (strlen<0) { re+=strsymbol; break; }
		tt=strer.charCodeAt(ci-1);
		if (tt>696 || tt<0)
		{
			strlen-=1;
			if (strlen<0) { re+=strsymbol; break; }
			re+=strer.substring(ci-1,ci);
		}
		else
		{
			cc+=1;
			if (cc>c_mod && c_mod>0) { tc+=1; cc=0; }
			tc+=1;
			if (tc>1)
			{
				tc=0;
				strlen-=1;
				if (strlen<0) { re+=strsymbol; break; }
			}
			re+=strer.substring(ci-1,ci);
		}
	}
	return re;
}

dcs.code.toHTML=function(strer,strtype)
{
	var re=strer;
	//re=replace(re," ","&nbsp;")
	//re=replace(re,"&","&amp;")
	re=dcs.common.toReplace(strer,"<","&lt;");
	re=dcs.common.toReplace(strer,">","&gt;");
	//re=dcs.common.toReplace(re,chr(10),"<br>");					'换行
	//re=dcs.common.toReplace(re,chr(12),"");					'回车
	/*
	switch (strtype)
	{
		case 1:
			re=dcs.common.toReplace(re,CHR(9)," ")				'制表符
			re=dcs.common.toReplace(re,CHR(10),"")				'换行
			re=dcs.common.toReplace(re,CHR(13),"")				'回车
		case 2:
			re=dcs.common.toReplace(re,CHR(9),"&nbsp; &nbsp; &nbsp; &nbsp; ")
			re=dcs.common.toReplace(re,CHR(10),"<br>"&vbcrlf)		'换行
			re=dcs.common.toReplace(re,CHR(13),"")				'回车
	}
	*/
	return re;
}

dcs.code.toTemplate=function(strer,strTemplate,strKey)
{
	if (isEmpty(strKey)) strKey='tpl';
	if (isEmpty(strTemplate)) strTemplate='{$'+strKey+'}';
	return dcs.common.toDisp(strTemplate,strKey,strer);
}



//########################################
//########################################
dcs.url=new Object();

dcs.url.isValid=function(strer)
{
	var re=false;
	if (strer.indexOf("://")!=-1 || strer.substring(0,1)=="/") re=true;
	return re;
}

dcs.url.toAppend=function(strBaseURL,strAppend)
{
	var re=strBaseURL;
	if (strAppend)
	{
		if (re.indexOf("?")==-1) { re+="?"; }
		else if (re.substring(re.indexOf("?")).length>0) re+="&";
		re+=strAppend;
	}
	return re;
}

dcs.url.toHyperLink=function(strURL,strTitle,strTarget,strStyle,strTitleNo)
{
	var re="";
	if (strURL=="" || strURL=="http://") { re=strTitleNo; }
	else
	{
		re="<a href=\""+strURL+"\"";
		if (strTarget) re+=" target=\"_blank\"";
		if (strStyle) re+=" "+strStyle;
		re+=">"+strTitle+"</a>";
	}
	return re;
}

dcs.url.toEncode=function(strer) { return encodeURI(strer); }

dcs.url.toDecode=function(strer) { return decodeURI(strer); }



//########################################
//########################################
dcs.form=new Object();

dcs.form.getObject=function(strName,strType)
{
	var reObject=null;
	switch (strType)
	{
		case "parent":
			var tmpObject=this.getElement(strName);
			if (isObject(tmpObject))
			{
				reObject=dcs.browser.isIE ? tmpObject.parentElement : tmpObject.parentNode;
			}
			break;
	}
	return reObject;
}

dcs.form.getElement=function(strName)
{
	var reElement=null;
	try
	{
		if (!isEmpty(strName))
		{
			var tmpTarget="";
			if (strName.indexOf(":")!=-1) { tmpTarget=strName.substring(0,strName.indexOf(":")); strName=strName.substring(strName.indexOf(":")+1); }
			var tmpForm;
			if (tmpTarget=="parent")
			{
				if (strName.indexOf(".")==-1) { reElement=window.parent.document.getElementById(strName); }
				else { if (isObject(tmpForm=window.parent.document.forms[strName.substring(0,strName.indexOf("."))])) reElement=tmpForm.elements[strName.substring(strName.indexOf(".")+1)]; }
			}
			else if (tmpTarget!="") { }
			else
			{
				if (strName.indexOf(".")==-1) { reElement=document.getElementById(strName); }
				else { if (isObject(tmpForm=document.forms[strName.substring(0,strName.indexOf("."))])) reElement=tmpForm.elements[strName.substring(strName.indexOf(".")+1)]; }
			}
		}
	}
	catch(e) { dbg.obj(e); }
	return reElement;
}

dcs.form.getValue=function(strName)
{
	var re="";
	var tmpElement=this.getElement(strName);
	if (isObject(tmpElement))
	{
		if (tmpElement.length)
		{
			var tmpType='';
			for(var i=0;i<tmpElement.length;i++)
			{
				if (isEmpty(tmpType)) tmpType=tmpElement[i].type;
				switch (tmpType)
				{
					case 'radio':
						if (tmpElement[i].checked) re=tmpElement[i].value;
						break;
					case 'checkbox':
						if (tmpElement[i].checked) re+=','+tmpElement[i].value;
						break;
				}
			}
			if (tmpType=='checkbox' && !isEmpty(re)) re=re.substring(2);
		}
		else { re=tmpElement.value; }
	}
	return re;
}

dcs.form.setValue=function(strName,strValue,strMode)
{
	var tmpElement=this.getElement(strName);
	if (isObject(tmpElement))
	{
		if (isEmpty(strValue)) strValue='';
		if (tmpElement.length)
		{
			var tmpType='';
			for(var i=0;i<tmpElement.length;i++)
			{
				if (isEmpty(tmpType))
				{
					tmpType=tmpElement[i].type;
				}
				switch (tmpType)
				{
					case 'radio':
						if (strValue.inPart(tmpElement[i].value)>0 || strMode==('__no'+(i+1))) tmpElement[i].checked=true;
						break;
					case 'checkbox':
						if (strValue.inPart(tmpElement[i].value)>0 || strMode=='__all__') tmpElement[i].checked=true;
						break;
				}
			}
		}
		else
		{
			if (strMode=="append") tmpElement.value+=strValue;
			else tmpElement.value=strValue;
		}
	}
}

dcs.form.element=new Object();
dcs.form.element.radio=new Object();
dcs.form.element.radio.isChecked=function(strObject)
{
	var re=false;
	if (dcs.browser.isIE)
	{
		if (tmpElement[i].status==1) re=true;
	}
	else if (dcs.browser.isMozilla)
	{
		if (tmpElement[i].checked) re=true;
	}
	return re;
}

dcs.form.doOnceSubmit=function(strForm)
{
	var _objForm=strForm;
	if (!isObject(_objForm)) _objForm=document.forms[strForm];
	if (isObject(_objForm))
	{
		if (_objForm._smt) _objForm._smt.disabled=true;
		if (_objForm._sbt) _objForm._sbt.disabled=true;
		if (_objForm._rst) _objForm._rst.disabled=true;
	}
}

dcs.form.doSubmit=function(strForm)
{
	var _objForm=strForm;
	if (!isObject(_objForm)) _objForm=document.forms[strForm];
	if (isObject(_objForm)) _objForm.submit();
}

dcs.form.doQuickSubmit=function(strForm,strEvent)
{
	if (!strEvent) strEvent=event;
	if ((strEvent.keyCode==13 && strEvent.ctrlKey) || (strEvent.keyCode==83 && strEvent.altKey))
	{
		this.doOnceSubmit(strForm);
		this.doSubmit(strForm);
	}
}

dcs.form.SELECT_FORM_NAME="frm_list";
dcs.form.SELECT_INPUT_NAME="_select_id";
dcs.form.SELECT_HANDLE_FORM_NAME="frm_select_handle";

dcs.form.doSelectForm=function()
{
	var _objForm=eval("document."+this.SELECT_FORM_NAME);
	var _nvalue=_objForm._select_data.checked;
	var _ncheckbox;
	for(var i=0;i<_objForm.elements.length;i++)
	{
		var _ncheckbox=_objForm.elements[i];
		if(_ncheckbox.name==this.SELECT_INPUT_NAME) { _ncheckbox.checked=_nvalue; }
	}
}

dcs.form.getSelectID=function()
{
	var re="";
	var _objForm=eval("document."+this.SELECT_FORM_NAME);
	var _ncheckbox;
	for(var i=0;i<_objForm.elements.length;i++)
	{
		var _ncheckbox=_objForm.elements[i];
		if(_ncheckbox.name==this.SELECT_INPUT_NAME && _ncheckbox.checked) re+=","+_ncheckbox.value;
	}
	if (re!="") re=re.substring(1);
	return re;
}

dcs.form.doSelectCheck=function()
{
	var _objForm=eval("document."+this.SELECT_FORM_NAME);
	var _isselect=false;
	var re=false;
	for(var i=0;i<_objForm.elements.length;i++)
	{
		var _ncheckbox=_objForm.elements[i];
		if(_ncheckbox.name==this.SELECT_INPUT_NAME && _ncheckbox.checked) { _isselect=true; break; }
	}
	if (_isselect)
	{
		if (confirm("执行此操作后可能无法恢复！你确定吗？")) { return true; }
		else { return false; }
	}
	else { alert("没有选择任何记录！"); return false; }
}

dcs.form.doSelectClick=function()
{
	if (this.doSelectCheck())
	{
		var _objForm=eval("document."+this.SELECT_FORM_NAME);
		if (_objForm._select_handle.value=="")
		{
			var _objFormHandle=eval("document."+this.SELECT_HANDLE_FORM_NAME);
			if (_objFormHandle)
			{
				var tmpValue=_objFormHandle._select_handle.options[_objFormHandle._select_handle.selectedIndex].value;
				_objForm._select_handle.value=tmpValue;
			}
		}
		_objForm.submit();
	}
}

dcs.form.doSelectParse=function()
{
	var _objForm=eval("document."+this.SELECT_FORM_NAME);
	for(var i=0;i<_objForm.elements.length;i++)
	{
		var _ncheckbox=_objForm.elements[i];
		//alert(_ncheckbox.name+"="+_ncheckbox.value);
		if(_ncheckbox.value=="" || _ncheckbox.value=="0") { _ncheckbox.disabled=true; }
	}
}

dcs.form.doOptionSelectAll=function(strForm,strPrefix)
{
	if (isEmpty(strPrefix)) strPrefix="__is__";
	if (strForm)
	{
		var _objForm=strForm;
		var _objCheck=_objForm.__option_select_all;
		var tmpCheckecd=(_objCheck && _objCheck.checked) ? true : false;
		for(var i=0;i<_objForm.elements.length;i++)
		{
			var _ncheckbox=_objForm.elements[i];
			if(_ncheckbox.name.substring(0,strPrefix.length)==strPrefix) { _ncheckbox.checked=tmpCheckecd; }
		}
		if (_objCheck) _objCheck.checked=tmpCheckecd;
	}
}

dcs.form.toConvertInput=function(strer,strName)
{
	if (isEmpty(strName)) strName=this.SELECT_INPUT_NAME;
	var re="";
	var tmpAry=strer.split(",");
	for (var i=0;i<tmpAry.length;i++)
	{
		re+="<input type=\"hidden\" name=\""+strName+"\" value=\""+tmpAry[i]+"\">";
	}
	return re;
}



//########################################
//########################################
dcs.images=new Object();

dcs.images.doZoom=function(strObject)
{
	var re=true;
	if(event.altKey || event.ctrlKey)
	{
		var zoomSize=parseInt(strObject.style.zoom,10)||100;
		zoomSize+=event.wheelDelta/12;
		if (zoomSize>0) strObject.style.zoom=zoomSize+'%';
		re=false;
	}
	return re;
}

dcs.images.doResize=function(strObject,strType,strTitle)
{
	var tmpWidth=strType;
	if (tmpWidth==null) { tmpWidth=0.5; }
	else { if (tmpWidth<0.1) tmpWidth=0.5; }
	if (tmpWidth<1) tmpWidth=screen.width*tmpWidth;
	if(strObject.width>tmpWidth)
	{
		if (isEmpty(strTitle)) strTitle="点击图片在新窗口中打开.\nCTRL键/ALT键+鼠标滚轮可以放大或缩小图片大小.";
		strObject.resized=true;
		if (strObject.width>tmpWidth) strObject.width=tmpWidth;
		strObject.alt=strTitle;
	}
	return false;
}

dcs.images.doOpen=function(strObject)
{
	window.open(strObject.src);
	return false;
}




//########################################
//########################################
dcs.pages=new Object();

dcs.pages.go=function(strer)
{
	var tmpURL=strer;
	document.location.href=tmpURL;
}

dcs.pages.isClickReturn=function(strvar,strt)
{
	var re=false;
	var tmpvar="";
	switch (strt)
	{
		case 1:
			tmpvar='您确定 '+strvar+' 吗？';
			break;
		case 2:
			tmpvar='您确定要 '+strvar+' 吗？\n\n执行该操作后将不可恢复！';
			break;
		default :
			tmpvar=strvar;
			break;
	}
	var tmptrue=window.confirm(tmpvar);
	if (tmptrue) { re=true; }
	return re;
}

dcs.pages.doOpenWins=function(strurl,strname,strwidth,strheight,strscroll,strContent)
{
	var _left_size=0;
	var _top_size=0;
	if (strwidth==0 || strheight==0) { strwidth=screen.width-8; strheight=screen.height-55; }
	else { _left_size=(screen.width) ? (screen.width-strwidth)/2 : 0; _top_size=(screen.height) ? (screen.height-strheight)/2 : 0; }
	var _open_win=window.open(strurl,strname,'width='+strwidth+',height='+strheight+',left='+_left_size+',top='+_top_size+',toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars='+strscroll+',resizable=yes');
	if (!isEmpty(strContent))
	{
		_open_win.document.write(strContent);
		//_open_win.document.close();
	}
	return _open_win;
}

dcs.pages.doOpenWin=function(strurl,strname,strwidth,strheight,strscroll)
{
	var _left_size=(screen.width) ? (screen.width-strwidth)/2 : 0;
	var _top_size=(screen.height) ? (screen.height-strheight)/2 : 0;
	var _open_win=window.open(strurl,strname,'width='+strwidth+',height='+strheight+',left='+_left_size+',top='+_top_size+',toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars='+strscroll+',resizable=no');
}

// onKeyPress="event.returnValue=dcs.pages.isInputInt(0);"
dcs.pages.isInputInt=function(strer)
{
	var tmpKeyCode=event.keyCode;
	var re=false;
	if (tmpKeyCode>=48 && tmpKeyCode<= 57) { re=true; }
	if (strer==1 && !re && tmpKeyCode==46) { re=true; }
	return re;
}

dcs.pages.doBlockSwitch=function(strBlock,strImages)
{
	var objBlock=dcs.browser.getObject(strBlock);
	if (objBlock)
	{
		var tmpStatus=objBlock.style.display;
		objBlock.style.display=(tmpStatus=="none" ? "" : "none");
		if (strImages==null || strImages=="") strImages=strBlock+"_icon";
		var objImages=dcs.browser.getObject(strImages);
		if (objImages)
		{
			objImages.src=objImages.src.replace((tmpStatus=="none" ? "open" : "close"),(tmpStatus=="none" ? "close" : "open"));
		}
	}
	return false;
}



//########################################
//########################################
dcs.paging=new Object();

dcs.paging.doGO=function(strtxt,strnum,strpage)
{
	if (isEmpty(strtxt)) strtxt="paging_url";
	if (isEmpty(strnum)) strnum="paging_num";
	if (isEmpty(strpage)) strpage="{$page}";
	var tmpurl=dcs.form.getValue(strtxt);
	var tmppage=dcs.form.getValue(strnum);
	tmpurl=dcs.common.toReplace(tmpurl,strpage,tmppage);
	document.location.href=tmpurl;
}

dcs.paging.getQuickLinks=function(strURL,strCounter,strPageNum,strTpl)
{
	var re="";
	if (!dcs.common.isNumber(strPageNum)) strPageNum=10;
	var tmpPageTotal=strCounter/strPageNum;
	tmpPageTotal=Math.round(tmpPageTotal);
	if ((tmpPageTotal*strPageNum)<strCounter) tmpPageTotal++;
	var tmpURL;
	if (isEmpty(strTpl))
	{
		if (tmpPageTotal>1)
		{
			re="<img class=\"icon\" src=\""+dcs.config.getURL("skin")+"images/common/ico_paging_quick.gif\" title=\"快速分页\">"
			for (var i=2;i<4;i++)
			{
				if (i>tmpPageTotal) break;
				tmpURL=dcs.common.toDisp(strURL,"page",i);
				re+=" <a href=\""+tmpURL+"\" alt=\"第 "+i+" 页\">"+i+"</a>";
			}
			if (tmpPageTotal>3)
			{
				if (tmpPageTotal>4) re+=" ..";
				i=tmpPageTotal;
				tmpURL=dcs.common.toDisp(strURL,"page",i);
				re+=" <a href=\""+tmpURL+"\" alt=\"第 "+i+" 页\">"+i+"</a>";
			}
		}
	}
	else
	{
		tmpURL=dcs.common.toDisp(strURL,"page",tmpPageTotal);
		re=dcs.common.toDisp(strTpl,"url",tmpURL);
	}
	return re;
}


//########################################
//########################################
dcs.window=new Object();
dcs.window._QueuesOnLoad=new Array();

dcs.window.addOnLoad=function(strer)
{
	this._QueuesOnLoad[this._QueuesOnLoad.length]=strer;
}

dcs.window.doOnLoad=function()
{
	for (var i=0;i<this._QueuesOnLoad.length;i++)
	{
		eval(this._QueuesOnLoad[i]);
	}
}

dcs.window.getClipBoardData=function(strType)
{
	if (window.clipboardData)
	{
		if (isEmpty(strType)) strType='text';
		return window.clipboardData.getData(strType);
	}
}
dcs.window.setClipBoardData=function(strer)
{
	if (window.clipboardData) window.clipboardData.setData(strer);
}
dcs.window.doClipBoardClear=function()
{
	if (window.clipboardData) window.clipboardData.clearData();
}


window.onload=function()
{
	dcs.window.doOnLoad();
}




//########################################
//########################################
function libError()
{
	this.isCheck=false;
	this._n=0;
	this._data=new Array();
	
	this.isCheck=function() { return (this._n>0) ? false : true; }
	
	this.addItem=function(strer) { this._n++; this._data[this._n]=strer; }
	
	this.toJS=function()
	{
		var re="";
		for (var i=1;i<=this._n;i++) { re+=this._data[i]+"\n"; }
		return re;
	}
	
	this.doPop=function() { if (this._n>0) alert(this.toJS()); }
}




//########################################
//########################################
function libXMLHttp()
{
	this._xmlHttp;
	this._ErrorType=-1;
	this._isLoad=false;
	this._isCheck=false;
	this._isParse=false;
	this._readyState=-1;
	this._status=-1;
	this._ResponseBody=null;
	this._ResponseText=null;
	this._ResponseXML=null;
	this._method="GET";
	this._Async=false;
	this._URL="";
	this._SendData=null;
	
	this.getErrorType=function() { return this._ErrorType; }
	/*
	-1	未初始化
	0	正常
	1	对像初始化错误
	2	数据检测不完整
	3	内容载入不正常
	4	载入状态错误 .readyState!=4
	5	HTTP状态错误 .status!=200
	*/
	
	this.isLoad=function() { return this._isLoad; }
	this.isCheck=function() { return this._isCheck; }
	this.isParse=function() { return this._isParse; }
	
	this.setMethod=function(strer) { if (strer!="POST") strer="GET"; this._method=strer; }
	this.setAsync=function(strer) { this._Async=strer; }
	this.setURL=function(strer) { this._URL=strer; this._isCheck=false; }
	this.setSendData=function(strer) { this._SendData=strer; }
	
	this.doInit=function(strer)
	{
		this._ErrorType=-1;
		this._isLoad=false;
		this._isCheck=false;
		this._isParse=false;
		this._readyState=-1;
		this._status=-1;
		this._ResponseBody=null;
		this._ResponseText=null;
		this._ResponseXML=null;
		if (strer==true)
		{
			this._method="GET";
			this._Async=false;
			this._URL="";
			this._SendData=null;
		}
	}
	
	this.doLoad=function()
	{
		if (!this._isLoad)
		{
			try
			{
				if (window.ActiveXObject)
				{
					this._xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
				}
				else if(window.XMLHttpRequest)
				{
					this._xmlHttp=new XMLHttpRequest();
				}
				this._ErrorType=0;
			}
			catch(exception)
			{
				this._ErrorType=1;
			}
			this._isLoad=true;
		}
	}
	
	this.doCheck=function()
	{
		if (!this._isCheck)
		{
			if (this._URL!="")
			{
				this._isCheck=true;
			}
			if (!this._isCheck)
			{
				this._ErrorType=2;
			}
		}
	}
	
	this.doParse=function(strer)
	{
		if (strer==true) this.doInit(false);
		this.doLoad();
		this.doCheck();
		if (!this._isParse && this._ErrorType==0)
		{
			try
			{
				//this._xmlHttp.onreadystatechange=this.doStateChange;
				this._xmlHttp.open(this._method,this._URL,this._Async);
				this._xmlHttp.send(this._SendData);
			}
			catch(exception)
			{
				this._ErrorType=3;
			}
			if (this._ErrorType!=3)
			{
				this._readyState=this._xmlHttp.readyState;
				this._status=this._xmlHttp.status;
				if(this._readyState==4)
				{
					if (this._status==200 || this._status==0)
					{
						this._ErrorType=0;
					}
					else
					{
						this._ErrorType=5;
					}
				}
				else
				{
					this._ErrorType=4;
				}
			}
			this._isParse=true;
		}
	}
	
	this.doStateChange=function()
	{
		if(this._xmlHttp.readyState==4)
		{		
			if (this._xmlHttp.status==200 || this._xmlHttp.status==0)
			{
				alert("The Local replied with:" + this._xmlHttp.responseBody);
			}
		}
	}
	
	this.getResponseBody=function()
	{
		if (this._ErrorType==0 && this._ResponseBody==null)
		{
			this._ResponseBody=this._xmlHttp.responseBody;
			if (this._ResponseBody==null) this._ResponseBody="";
		}
		var re=this._ResponseBody;
		return (re==null) ? "" : re;
	}
	this.getResponseText=function()
	{
		if (this._ErrorType==0 && this._ResponseText==null)
		{
			this._ResponseText=this._xmlHttp.responseText;
			if (this._ResponseText==null) this._ResponseText="";
		}
		var re=this._ResponseText;
		return (re==null) ? "" : re;
	}
	this.getResponseXML=function()
	{
		if (this._ErrorType==0 && this._ResponseXML==null)
		{
			if (this._xmlHttp.responseXML)
			{
				this._ResponseXML=this._xmlHttp.responseXML.xml;
				if (this._ResponseXML==null) this._ResponseXML="";
			}
			else this._ResponseXML="";
		}
		var re=this._ResponseXML;
		return (re==null) ? "" : re;
	}
	this.getResponseHeader=function(strer) { return this._xmlHttp.getResponseHeader(strer); }
	
	this.getReadyState=function() { return this._readyState; }	//0=uninitialized,1=loading,2=loaded,3=interactive,4=complete
	this.getStatus=function() { return this._status; }
	
	this.getBytes2String=function(strer,strCharset)
	{
		if (strCharset==null || strCharset=="") strCharset="utf-8";
		var re="";
		var objstream;
		objstream=Server.CreateObject("Adodb.Stream");
		objstream.Type=1;
		objstream.Mode=3;
		objstream.Open();
		objstream.Write(strer);
		objstream.Position=0;
		objstream.Type=2;
		objstream.Charset=strCharset;
		re=objstream.Readtext;
		objstream.Close;
		return(re);
	}
}




//########################################
//########################################
var dbg=new Object();

dbg.obj=function(strObject,strMode,strRow)
{
	var _k,_v,_n=1,re="";
	if (isEmpty(strRow) || strRow==-1) strRow=20;
	try
	{
		for(_k in strObject)
		{
			if (_n>=strRow) { alert(re); re=""; _n=1; }
			if (strMode=="key") re+=_k+"\n";
			else
			{
				_v=strObject[_k];
				if (typeof(_v)=="number" || typeof(_v)=="string" || typeof(_v)=="boolean") _v=(_v.length>50) ? _v.substr(0,50)+" ..." : _v;
				else _v="["+typeof(_v)+"]";
				re+=_k+"="+_v+"\n";
			}
			_n++;
		}
		if (re!="") { alert(re); re=""; }
	}
	catch(e) { dbg.e(e); }
}

dbg.objString=function(strObject,strMode,strRow)
{
	var _k,_v,_n=1,re="";
	if (isEmpty(strRow) || strRow==-1) strRow=20;
	try
	{
		for(_k in strObject)
		{
			if (strMode=="key") re+=_k+"\n";
			else
			{
				_v=strObject[_k];
				if (typeof(_v)=="number" || typeof(_v)=="string" || typeof(_v)=="boolean") _v=(_v.length>50) ? _v.substr(0,50)+" ..." : _v;
				else _v="["+typeof(_v)+"]";
				re+=_k+"="+_v+"\n";
			}
			_n++;
		}
	}
	catch(e) { re=dbg.eString(e); }
	return re;
}

dbg.e=function(e) { alert(dbg.eString(e)); }

dbg.eString=function(e)
{
	var re="";
	for(var k in e) { re+=k+"="+e[k]+"\n"; }
	return re;
}

function doTestObject(strObject,strMode,strRow) { dbg.obj(strObject,strMode,strRow); }
