// JavaScript Document
var xpow=new Object;
xpow.m_cfg=new Array();
xpow.m_cfg["m_r"]="m_r";
xpow.m_cfg["m_left"]="m_left";
xpow.m_cfg["dir"]="manage/";
xpow.m_cfg["app"]=".asp";
xpow.m_cfg["l_pre"]="mnu.";
xpow.m_cfg["r_pre"]="manage";
xpow.m_cfg["CHECK_FROM"]="listForm";
xpow.m_cfg["CHECK_INPUT"]="_chk_id";
xpow.m_cfg["menu"]="welcome,group,news,supply";
xpow.m_cfg["ELEMT"]="iframe,table,div,span,a,h4,p,img,textarea";
//document.oncontextmenu=new Function("event.returnValue=false;");
//document.onselectstart=new Function("event.returnValue=false;");

xpow.URLencode=function (sStr)
{   
  return escape(sStr).replace(/\+/g,'%2B').replace(/\"/g,'%22').replace(/\'/g,'%27');   
}

xpow.URLdecode=function (psEncodeString)
{   
	var lsRegExp = /\+/g;   
	return unescape(String(psEncodeString).replace(lsRegExp,"   "));     
}

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 $(str){return document.getElementById(str)}
xpow.window=new Object();
xpow.window._QueuesOnLoad=new Array();

xpow.window.addOnLoad=function(strer)
{
	this._QueuesOnLoad[this._QueuesOnLoad.length]=strer;
}

xpow.window.doOnLoad=function()
{
	for (var i=0;i<this._QueuesOnLoad.length;i++)
	{
		eval(this._QueuesOnLoad[i]);
	}
}

xpow.window.getClipBoardData=function(strType)
{
	if (window.clipboardData)
	{
		if (isEmpty(strType)) strType='text';
		return window.clipboardData.getData(strType);
	}
}
xpow.window.setClipBoardData=function(strer)
{
	if (window.clipboardData) window.clipboardData.setData(strer);
}
xpow.window.doClipBoardClear=function()
{
	if (window.clipboardData) window.clipboardData.clearData();
}


window.onload=function()
{
	xpow.window.doOnLoad();
}

xpow.doParseErr=function(errs)
{
	var _errs=errs;
	var _Ary=new Array();
	var _errMsg="";
	if (_errs.indexOf('$$$')>0){
		_Ary=_errs.split('$$$')
		_errMsg=_Ary[0]
	}else{
		_errMsg=_errs	
	}
	alert(_errMsg)
}

//======== menu parse ============//
xpow.doParseMenu=function(mnupage,mnurank)
{
	var mnuAry=this.m_cfg["menu"].split(",");
	var m_r=document.getElementById(this.m_cfg["m_r"]);
	var m_l=document.getElementById(this.m_cfg["m_left"]);
	var m_css=document.getElementById(mnupage);
	var _app="?module="+mnupage;
	for(var ii=0;ii<mnuAry.length;ii++){document.getElementById(mnuAry[ii]).className=''}
	if (mnurank==''){
		alert('当前Session为空，请刷新本页！')
	}else{
		if (mnupage=='welcome'){
			m_l.src=this.m_cfg["dir"]+this.m_cfg["l_pre"]+mnupage+this.m_cfg["app"];
			m_r.src=this.m_cfg["dir"]+mnupage+".in"+this.m_cfg["app"]+_app;
		}else{
			m_l.src=this.m_cfg["dir"]+this.m_cfg["l_pre"]+mnupage+this.m_cfg["app"];
			m_r.src=this.m_cfg["dir"]+this.m_cfg["r_pre"]+mnupage+this.m_cfg["app"]+_app;
		}
		m_css.className="abc";
	}
}

xpow.goMenu=function(mnupage,mnurank)
{
	var m_r=document.getElementById(this.m_cfg["m_r"])
	var _app="&module="+mnupage;
	var _apps="?module="+mnupage;
	if (mnurank==''){
		alert('当前Session为空，请刷新本页！')
	}else{
		if (mnupage=='welcome'){
			m_r.src=this.m_cfg["dir"]+mnupage+".in"+this.m_cfg["app"]
		}else{
			if (mnupage.indexOf('?')>0){ var _pageAry=mnupage.split('?')
				m_r.src=this.m_cfg["dir"]+this.m_cfg["r_pre"]+_pageAry[0]+this.m_cfg["app"]+'?'+_pageAry[1]+'&module='+_pageAry[0]//+_app
			}else{
				m_r.src=this.m_cfg["dir"]+this.m_cfg["r_pre"]+mnupage+this.m_cfg["app"]+_apps
			}
		}
	}
}

xpow.doSelectAll=function(theform)
{
	var _objForm=theform;
	var _nvalue=_objForm._chk_all.checked;
	var _ncheckbox;
	for(var i=0;i<_objForm.elements.length;i++)
	{
		var _ncheckbox=_objForm.elements[i];
		if(_ncheckbox.name==this.m_cfg["CHECK_INPUT"]) { _ncheckbox.checked=_nvalue; }
	}
}

xpow.goUrl=function(theurl){if(theurl!=''){location.href=theurl}}
xpow.dirUrl=function(theurl){if(theurl!=''){document.getElementById(this.m_cfg["m_r"]).src=theurl}}

xpow.doSelectHandle=function(theform)
{
	var _objform=theform;
	var _ncheckbox='';
	var _objHandle=_objform.opHandle;
	var isChecked=false;
	for(var i=0;i<_objform.elements.length;i++)
	{
		var _ncheckbox=_objform.elements[i];
		if(_ncheckbox.name==this.m_cfg["CHECK_INPUT"]&& _ncheckbox.checked) {isChecked=true; break;}
	}
	if (_objHandle){
		var __handle=_objHandle.value
		if (__handle!=''){
			if (confirm('您确定要执行此操作吗？此操作可能无法恢复！')){
				if (!isChecked){
					alert('没有选择任何记录！\n\n请选择要操作的记录！')
					//_objform.opHandle.select
				}else{
					var _HandleUrl='';
					if (__handle.indexOf('?')>0){ var _pageAry=__handle.split('?')
						_HandleUrl=this.m_cfg["r_pre"]+_pageAry[0]+this.m_cfg["app"]+'?'+_pageAry[1]
					}else{
						_HandleUrl=this.m_cfg["dir"]+this.m_cfg["r_pre"]+__handle+this.m_cfg["app"]
					}
					_objform.action=_HandleUrl;
					_objform.submit();
					
				
//				<option value="<%=xsys.module%>?action=del$$$<%=xsys.getSession("rank")%>">删除选择项</option>
//				if (__handle.indexOf("$$$")>0){
//					var _hadleAry=__handle.split("$$$")
//					this.goMenu(_hadleAry[0],_hadleAry[1])
//				}else{this.dirUrl(__handle)}
				}
			}
		}
	}
}

xpow.doCheckNull=function(inFiled,inMsg,theForm)
{
	_objform=theForm;
	var isNull=false;
	var _br='\n';
	var _reMsg='';
	var _fArray = inFiled.split(",");
	var _mArray = inMsg.split(",");
	for(var i=0;i<_fArray.length;i++)
	{
		var _nElemt=_objform.elements[i];
		if(_nElemt.name==_fArray[i] && _nElemt.value=='') {
			if (_mArray[i]!=''){
				_reMsg+=_br+_mArray[i]+' 不能为空！\n';
				isNull=true;
			}
		}
	}
	if (isNull){alert(_reMsg);return false}else{return true}
}

xpow.doHandleSucc=function(sucMsg)
{
	var _sucAry=sucMsg.split("$$$");
	var m_r=document.getElementById(this.m_cfg["m_r"]);
	var _app="?module="+_sucAry[1];
	alert(_sucAry[0]);
	m_r.src=this.m_cfg["dir"]+this.m_cfg["r_pre"]+_sucAry[1]+this.m_cfg["app"]+_app;
}


//================= parse class ==================//
xpow.dolistSubClass=function(dataId,subid,msg,title)
{
	var dataAry=dataId.split(",");
	var unitAry=subid.split("|");
	var mainIdAry=unitAry[0].split(",");
	var subIdAry=unitAry[1].split(",");
	var subClsIds="";
	if (msg==''){
		msg="<font color=\"red\">没有查询到子分类......！<\/font><button onclick=document.getElementById('sub"+dataAry[1]+"').style.display='none';>确定<\/button>";
	}else{
		var subsImg="<img style=\"cursor:hand\;\" src=\"\/images\/status\/arrow.gif\">  ";
		var subImg="<img style=\"cursor:hand\;\" src=\"\/images\/status\/arrow_a.gif\">  ";
		for (i=0;i<msg.length;i++){
			if (msg.charAt(i)=="*"){ msg=msg.replace(msg.charAt(i),subsImg) }
			if (msg.charAt(i)=="`"){ msg=msg.replace(msg.charAt(i),subImg) }
			}
		var _msgAry=msg.split(",");
		var titImg="<img style=\"cursor:hand\;\" src=\"\/css\/admin\/sysclass\/i_ar01.gif\" >  ";
		msg="";
		for (i=1;i<_msgAry.length;i++){
			msg+="<div id=\""+mainIdAry[i]+"\" style=\"padding-left:10px\"> <img style=\"cursor:hand\;\" src=\"\/images\/status\/i_ar01.gif\" onclick=\"return xpow.showSubClass("+mainIdAry[i]+")\">"  +_msgAry[i]+"<\/div><div id=\"ff\">";
		}
	}
	document.getElementById('sub'+dataAry[1]).style.display='';
	document.getElementById('subClassList'+dataAry[1]).style.display='';
	document.getElementById("scsTitle").innerHTML=title;
	document.getElementById('subClassList'+dataAry[1]).innerHTML=msg;
	document.getElementById('showlistlink'+dataAry[1]).style.display='';
}

xpow.show2hide=function(tag)
{
	if (document.getElementById(tag).style.display==''){
		document.getElementById(tag).style.display='none';
	}else{
		document.getElementById(tag).style.display='';
	}
}


xpow.editor = new Object()
xpow.editor.getEditor = function(eName,edH,edW,type,offset)
{
	var _prop,tAppend;
	var _e = xpow.m_cfg['ELEMT'].split(',');
	tAppend = (offset)?'&offset='+(offset.replace(',','$')):''
	var src = (type == 0) ? '/common/Editor/HtmlEditor/doEdit.main.html?ID='+eName : '/common/xEditor/index/index.html?w='+edW+'&h='+edH+tAppend;
	_prop = 'id=Editor,name=Editor,src='+src+',frameBorder=0,scrolling=no,height='+edH+',width=100%'//+(edW+5)
	xpow.CreateElemt(_e[0],_prop);
	if ($('editors')){$('editors').appendChild($('Editor'))}
	$('Editor').height=edH
}


xpow.editor.setAppendObj = function(obj){ xpow.m_cfg['appendobj'] = obj }
xpow.editor.clearAppendObj = function() { try{xpow.point.popClear(); $('upbtn-a').style.display='none'}catch(e){} /*if (xpow.m_cfg['appendobj']){xpow.m_cfg['appendobj'].Clear()}*/ }

xpow.showSubClass=function(cid)
{
//	if (cid !=''){
//		var _tag=cid+'a';
//		var _tmpOLE=document.getElementsByName(_tag);
//		if(_tmpOLE.length){for(var i = 0 ;i<_tmpOLE.length;i++){_tmpOLE[i].style.display='none'}}else{$(_tmpOLE).style.display='none'}
//	}
}

xpow.doConfirm=function(action)
{
	var _url=action;
	if(!confirm('确实要执行此操作吗?\n\n此操作可能无法恢复！')){return false;} else{location.href=_url}
}

redirect=function(toUrl) 
{
	var _url=toUrl;
	
	if (_url!=''){
		switch (_url){
			case "back":
				history.back();
				break;
			default:
				location.href=_url;
				break;
		}
	} 
}

xpow.CreateElemt=function(objElemt,objPorperty)
{
	var _ary=xpow.m_cfg["ELEMT"].split(',');
	for (i=0;i<_ary.length;i++){
		if (objElemt==_ary[i]){
			var ELEMT=document.createElement(objElemt);
			this.m_cfg["cm"]=i;
			this.setProperty(ELEMT,objPorperty)
			break;
		}
	}
}

xpow.getProperty=function(){ return this.m_cfg["cm"] }
xpow.setProperty=function(theElemt,objPorperty)
{
	var proAry = new Array();
	var Propertys = new Array();
	proAry = objPorperty.split(',');
	for(i=0;i<proAry.length;i++){
		if (proAry[i].indexOf('name=')>=0){
			Propertys['name']=this.getProtParame(proAry[i],'name')
			theElemt.setAttribute('name',Propertys['name']);
		}else if(proAry[i].indexOf('id=')>=0){
			Propertys['id']=this.getProtParame(proAry[i],'id')
			theElemt.id=Propertys['id'];
		}else if(proAry[i].indexOf('display=')>=0){
			Propertys['display'] = this.getProtParame(proAry[i],'display')
		}else if(proAry[i].indexOf('width=')>=0){
			Propertys['width']= this.getProtParame(proAry[i],'width')
			if (Propertys['width']=="document.body.scrollWidth"){ Propertys['width']=document.body.scrollWidth + "px"};
			theElemt.style.width = Propertys['width'];
		}else if(proAry[i].indexOf('height=')>=0){
			Propertys['height']= this.getProtParame(proAry[i],'height')
			if (Propertys['height']=="document.body.scrollHeight"){ Propertys['height']=document.body.scrollHeight + "px"};
			theElemt.style.height = Propertys['height'];
		}else if(proAry[i].indexOf('position=')>=0){
			Propertys['position']= this.getProtParame(proAry[i],'position')
			theElemt.style.position = Propertys['position'];
		}else if(proAry[i].indexOf('zIndex=')>=0){
			Propertys['zIndex']= this.getProtParame(proAry[i],'zIndex')
			theElemt.style.zIndex = Propertys['zIndex'];
		}else if(proAry[i].indexOf('border=')>=0){
			Propertys['border']= this.getProtParame(proAry[i],'border')
			theElemt.style.border = Propertys['border'];
		}else if(proAry[i].indexOf('padding=')>=0){
			Propertys['padding']= this.getProtParame(proAry[i],'padding')
			theElemt.style.padding =  Propertys['padding'];
		}else if(proAry[i].indexOf('top=')>=0){
			Propertys['top']= this.getProtParame(proAry[i],'top')
			if (Propertys['top']=='center'){Propertys['top']=(parseInt(document.body.scrollHeight) - Propertys['height']) / 2 + "px"; };
			theElemt.style.top = Propertys['top'];
		}else if(proAry[i].indexOf('left=')>=0){
			Propertys['left']= this.getProtParame(proAry[i],'left')
			if (Propertys['left']=='center'){Propertys['left']=(parseInt(document.body.scrollWidth) - Propertys['width']) / 2 + "px";}
			theElemt.style.left = Propertys['left'];
		}else if(proAry[i].indexOf('background=')>=0){
			Propertys['background']= this.getProtParame(proAry[i],'background')
			theElemt.style.background = Propertys['background'].toString();
		}else if(proAry[i].indexOf('filter=')>=0){
			Propertys['filter']= this.getProtParame(proAry[i],'filter')
			theElemt.style.filter = Propertys['filter'];
		}else if(proAry[i].indexOf('opacity=')>=0){
			Propertys['opacity']= this.getProtParame(proAry[i],'opacity')
			theElemt.style.background = Propertys['opacity'];
		}else if(proAry[i].indexOf('align=')>=0){
			Propertys['align']= this.getProtParame(proAry[i],'align')
			theElemt.style.background = Propertys['align'];
		}else if(proAry[i].indexOf('textAlign=')>=0){
			Propertys['textAlign']= this.getProtParame(proAry[i],'textAlign')
			theElemt.style.textAlign = Propertys['textAlign'];
		}else if(proAry[i].indexOf('lineHeight=')>=0){
			Propertys['lineHeight']= this.getProtParame(proAry[i],'lineHeight')
			theElemt.style.lineHeight = Propertys['lineHeight'];
		}else if(proAry[i].indexOf('align=')>=0){
			Propertys['align'] = this.getProtParame(proAry[i],'align')
			theElemt.setAttribute("align",Propertys['align']);
		}else if(proAry[i].indexOf('src=')>=0){
			Propertys['src'] = this.getProtParame(proAry[i],'src')
			theElemt.setAttribute("src",Propertys['src']);
		}else if(proAry[i].indexOf('frameBorder=')>=0){
			Propertys['frameBorder'] = this.getProtParame(proAry[i],'frameBorder')
			theElemt.setAttribute("frameBorder",Propertys['frameBorder']);
		}else if(proAry[i].indexOf('scrolling=')>=0){
			Propertys['scrolling'] = this.getProtParame(proAry[i],'scrolling')
			theElemt.setAttribute("scrolling",Propertys['scrolling']);
		}
	}
	theElemt.style.display = ''
	if (Propertys['display']=="none")theElemt.style.display = 'none';
	document.body.appendChild(theElemt);
}

xpow.getProtParame=function (inParame,pars)
{
	var _index = parseInt(inParame.indexOf(pars)+pars.length+1);
	var _last = inParame.length-_index;
	var _parame = inParame.substr(parseInt(_index),parseInt(_last));
	return _parame;
}

xpow.removeElemts=function(type,intRe)
{
	var isMoved=false;
	var iElements = document.getElementsByTagName(type);
	for (i=0; i<iElements.length; i++) {
		var iElement = iElements[i];
		if (intRe){
			var msg = "Found an "+type+" element!";
			var atts = iElement.attributes;
			for (j=0; j<atts.length; j++) {
				var att = atts.item(j);
				msg = msg + "\n  " + att.nodeName + ": '" + att.nodeValue + "'";
			}
			alert(msg)
		}
		document.body.removeChild(iElement);
		isMoved=true;
	}
	if (isMoved && intRe) alert('remove '+i+' elements \"'+type+'\"')
}

xpow.removeElemt=function(eid,intRe)
{
	var isMoved=false;
	var iElement = document.getElementById(eid);
	try{
		if (iElement){ document.body.removeChild(iElement);isMoved=true; }
	}catch(e){
		//alert(iElement.parent)
	}
	if (isMoved && intRe==1){
		var msg = "Found an "+eid+" element!";
		var atts = iElement.attributes;
		for (j=0; j<atts.length; j++) {
			var att = atts.item(j);
			msg = msg + "\n  " + att.nodeName + ": '" + att.nodeValue + "'";
		}
		alert(msg);
	}
	if (isMoved && intRe==2) alert('remove '+eid+' element succesed!"')
}


xpow.common=new Object();
xpow.common.toReplace=function(str1,str2,str3) { return str1.replace(str2,str3); }
xpow.common.toDisp=function(str1,str2,str3) { return str1.replace("{$"+str2+"}",str3); }

xpow.paging=new Object();

xpow.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=xpow.form.getValue(strtxt);
	var tmppage=xpow.form.getValue(strnum);
	tmpurl=xpow.common.toReplace(tmpurl,strpage,tmppage);
	document.location.href=tmpurl;
}

xpow.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=\""+xpow.config.getURL("skin")+"images/common/ico_paging_quick.gif\" title=\"快速分页\">"
			for (var i=2;i<4;i++)
			{
				if (i>tmpPageTotal) break;
				tmpURL=xpow.common.toDisp(strURL,"page",i);
				re+=" <a href=\""+tmpURL+"\" alt=\"第 "+i+" 页\">"+i+"</a>";
			}
			if (tmpPageTotal>3)
			{
				if (tmpPageTotal>4) re+=" ..";
				i=tmpPageTotal;
				tmpURL=xpow.common.toDisp(strURL,"page",i);
				re+=" <a href=\""+tmpURL+"\" alt=\"第 "+i+" 页\">"+i+"</a>";
			}
		}
	}
	else
	{
		tmpURL=xpow.common.toDisp(strURL,"page",tmpPageTotal);
		re=xpow.common.toDisp(strTpl,"url",tmpURL);
	}
	return re;
}
xpow.form=new Object();
xpow.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;
}

xpow.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;
		}
	}
}

xpow.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;
}

xpow.point = new Object;
xpow.emObj = new Object;

xpow.point.dlg = function(){}
xpow.point.dlg.prototype.doInit = function(objName)
{
	this.objName = objName;
	this.mHeight = 'auto';
	this.mWidth = 240;
	this.mLeft = -228;
	this.mTop = 35;
	this.topOffset = 60;
	this.leftOffset = 25;
	
	this.isTitle = 0;
	this.oTitle = '';
	this.mTitleName = 'posTitle'
	this.mTitleColor = '#ffffff';
	this.mTitleBgColor = '#ff7300';
	this.mTitleCursor = 'array';
	this.mTtBorder = 1;
	this.mTitle = '';//CHNdesign.com
	this.mTitleHtml = '';
	this.mTitleHeight = 18;
	this.mTitleWidth = this.mWidth;

	this.isMask = 1;
	this.maskName = this.objName+'.mask'
	this.maskOpacity = 70;
	this.maskBgColor = '#ffffff';
	
	this.mBgColor = '#ffffff';
	this.mBorderColor = '#feb070';
	this.position = 'absolute';
	this.der = 'remarks';
	this.PoPCss = 'pop-msg';
	this.ISEXPORT = false
	this.Button = {}
	
	this.mouseDown = false
	this.canMove = true
	this.event = ''
	this.mx = 0
	this.my = 0
}

xpow.point.dlg.prototype.Export = function (strHTML)
{ 
	if (this.ISEXPORT){return}
	if(typeof(this.objName)=='undefined'){this.objName = 'popmsg'}
	var tInfo = getViewportInfo()
	var dlgObj = $(this.objName),vprop,vfilter,ve = xpow.m_cfg['ELEMT'].split(','),isie=xpow.browser.isIE?'ie':'moz';
	
	if (!$(this.der)){
		if (typeof(this.mWidth)!='number'){
			this.mLeft=(document.body.clientWidth)/2+document.body.scrollLeft;
		}else{
			this.mLeft=(document.body.clientWidth-this.mWidth)/2+document.body.scrollLeft;
		}
	
		if (typeof(this.mHeight)!='number'){
			this.mTop=(document.documentElement.clientHeight-300)/2+document.documentElement.scrollTop;
		}else{
			if(document.documentElement.clientHeight){
				this.mTop=(document.documentElement.clientHeight-this.mHeight)/2+document.documentElement.scrollTop;
			}else{
				this.mTop=(document.body.clientHeight-this.mHeight)/2+document.body.scrollTop;
			}
		}
		
		this.mTop += parseInt(this.topOffset)
		this.mLeft += parseInt(this.leftOffset)
	}else{
		var tOffset = this.getoffset(this.der).split(',')
		this.mTop = parseInt(tOffset[0]) + parseInt(this.topOffset);
		this.mLeft = parseInt(tOffset[1]) + parseInt(this.leftOffset);
	}


	//alert(document.body.clientHeight+'#'+document.body.scrollTop+'#left:'+this.mLeft+'#top:'+this.mTop+'#'+this.mHeight)
	var dH = (document.documentElement.scrollHeight > document.body.clientHeight)?document.documentElement.scrollHeight:document.body.clientHeight
	if (this.isMask){
		vfilter = (xpow.browser.isIE)?'filter=alpha(opacity='+this.maskOpacity+'),opacity=0.40':'filter=alpha(opacity='+this.maskOpacity+'),opacity=0.40,-moz-opacity=0.6'
		vprop = 'id='+this.maskName+",name="+this.maskName+",position=absolute,zIndex=10000,width=document.body.scrollWidth,height=document.body.scrollHeight,top=0px,left=0px,background="+this.maskBgColor+","+vfilter;
		var mask = $(this.maskName); if (!mask) {xpow.CreateElemt(ve[2],vprop);mask = $(this.maskName)}
		mask.style.background = this.maskBgColor;
		if (xpow.browser.isIE){
			//if(document.body.offsetHeight>document.body.scrollHeight) mask.style.height = (document.body.offsetHeight-4)+'px'
		}
		mask.style.height = dH+'px'
		if (!xpow.browser.isIE)mask.className = 'tars'
	}

	//if (this.isTitle){+',width='+(this.mWidth+65)
		vprop = 'id='+this.objName+',name='+this.objName+',border=0px solid '+this.mBorderColor;
	//}else{
	//	vprop = 'id='+this.objName+',name='+this.objName+',width='+(this.mWidth+55)+',height='+this.mHeight+',left='+this.mLeft+',top='+this.mTop+',background='+this.mBgColor+',border=1px solid #666666 ';
	//}
	
	if (!dlgObj){xpow.CreateElemt(ve[2],vprop);dlgObj = $(this.objName)}
	xpow.point.Content.append('<div id="',this.objName,'_dDialog" class="dDialog" style="visibility: visible; top: ',this.mTop,'px; left: ',this.mLeft,'px;  -moz-user-focus: ignore; width:',this.mWidth,'px; height: auto;">')
	xpow.point.Content.append('<div class="frame1" style="-moz-user-focus: ignore;">')
	xpow.point.Content.append('<table cellspacing="0" cellpadding="0" border="0" class="frame2" style="-moz-user-focus: ignore;">')
	
	//if (this.isTitle){
	xpow.point.Content.append('<thead style="-moz-user-focus: ignore; -moz-user-select: none;"><tr style="-moz-user-focus: ignore; -moz-user-select: none;">')
	xpow.point.Content.append('<td class="dialogLeft" style="-moz-user-focus: ignore; -moz-user-select: none;"> </td>')
	xpow.point.Content.append('<td width="100%" canmove="true" xid="',this.objName,'_dDialog" class="content" style="-moz-user-focus: ignore; -moz-user-select: none;">')
	xpow.point.Content.append('<div canmove="true" xid="',this.objName,'_dDialog" class="calBarDialogTitleContainer" style="-moz-user-focus: ignore; -moz-user-select: none;">')
	xpow.point.Content.append('<div class="" canmove="true" xid="',this.objName,'_dDialog" id="titleIcon" style="-moz-user-focus: ignore; -moz-user-select: none; display:none;"/><h1 id="calBarDialogTitle" style="-moz-user-focus: ignore; -moz-user-select: none;">',this.mTitle,'</h1></div></td>')
	xpow.point.Content.append('<td align="right" class="closeBtnContainer" style="-moz-user-focus: ignore; -moz-user-select: none;">')
	xpow.point.Content.append('<div normalclass="close" downclass="close down" overclass="close over" class="close" id="',this.objName,'_dialogCloseBtn" style="-moz-user-focus: ignore; -moz-user-select: none;"><!-- --></div></td>')
	xpow.point.Content.append('<td class="dialogRight" style="-moz-user-focus: ignore; -moz-user-select: none;"> </td></tr></thead>')
	//}

	xpow.point.Content.append('<tbody style="-moz-user-focus: ignore;">')
	xpow.point.Content.append('<tr style="-moz-user-focus: ignore;">')
	xpow.point.Content.append('<td class="dialogLeft" style="-moz-user-focus: ignore; -moz-user-select: none;"> </td>')
	xpow.point.Content.append('<td colspan="2" class="content" style="padding-right: 10px; padding-top:5px; padding-left: 10px; -moz-user-focus: ignore;">')
	/*##########*/
	xpow.point.Content.append(strHTML)
	/*##########*/
	xpow.point.Content.append('</td><td class="dialogRight" style="-moz-user-focus: ignore; -moz-user-select: none;"> </td></tr></tbody>')

	xpow.point.Content.append('<tfoot style="-moz-user-focus: ignore;">')
	xpow.point.Content.append('<tr style="height: 1px; -moz-user-focus: ignore;">')
	xpow.point.Content.append('<td class="dialogLeft" style="-moz-user-focus: ignore; -moz-user-select: none;"> </td>')
	xpow.point.Content.append('<td colspan="2" class="content" style="-moz-user-focus: ignore;">')
	xpow.point.Content.append('<div class="buttons" style="-moz-user-focus: ignore;">')
	xpow.point.Content.append('<button id="',this.objName,'_btnSave" style="-moz-user-focus: normal; display:none;"><div class="btnContent">保存</div></button>')
	xpow.point.Content.append('<button id="',this.objName,'_btnSubmit" style="display:none; -moz-user-focus: normal;"><div class="btnContent">确定</div></button>')
	xpow.point.Content.append('<button id="',this.objName,'_btnCancel" style="display:none; -moz-user-focus: normal;"><div class="btnContent">取消</div></button>')
	xpow.point.Content.append('</div></td>')
	xpow.point.Content.append('<td class="dialogRight" style="-moz-user-focus: ignore; -moz-user-select: none;"> </td></tr>')
	xpow.point.Content.append('<tr style="-moz-user-focus: ignore; -moz-user-select: none;">')
	xpow.point.Content.append('<td class="dialogFooterLeft" style="-moz-user-focus: ignore; -moz-user-select: none;"/>')
	xpow.point.Content.append('<td colspan="2" style="-moz-user-focus: ignore; -moz-user-select: none;">')
	xpow.point.Content.append('<div class="dialogFooterCenter" style="-moz-user-focus: ignore; -moz-user-select: none;"> </div></td>')
	xpow.point.Content.append('<td class="dialogFooterRight" style="-moz-user-focus: ignore; -moz-user-select: none;"/></tr>')
	xpow.point.Content.append('</tfoot></table></div>')
	if (xpow.browser.isIE){
		xpow.point.Content.append('<div class="shadow" id="__shadows" STYLE="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'http://www.chnimg.com/images/common/block/bgfilter.png\', sizingMethod=\'scale\');" ></div>')
	}else{
		xpow.point.Content.append('<img class="shadow" id="__shadows" src="http://www.chnimg.com/images/common/block/bgfilter.png" />')
	}
	var tHtml = document.createElement('div')
	tHtml.innerHTML = xpow.point.Content.toString()
	dlgObj.appendChild(tHtml)
	dlgObj.className=isie+' dDialogCover transparentEvents'
	dlgObj.style.height = dH +'px';
	dlgObj.style.width = document.body.scrollWidth +'px';

	if (this.isTitle!=1){
		$(this.objName+'_dialogCloseBtn').className = 'popmsg-none'
		xpow.osEvent.attEvent(this.objName+'_dialogCloseBtn','ock','return false')
	}else{
		xpow.osEvent.attEvent(this.objName+'_dialogCloseBtn','ock',this.objName+'.Clear()')
	}
	
	if (this.Button.get){
		$(this.objName+'_btnCancel').style.display=''
		$(this.objName+'_btnSubmit').style.display=''
		$(this.objName+'_dialogCloseBtn').style.display=''
		var btns = 'Cancel,Submit',tInner
		if(this.Button.mode){
			switch(this.Button.mode){
			case 'confirm':	btns = 'Cancel,Submit';break
			case 'colse': btns = '_dialogCloseBtn';break
			case 'sign': btns = 'Submit';break
			case 'continue': btns = 'Cancel,Submit';break
			}
			btns = btns.split(',')
			for(var i=0; i<btns.length; i++){
				tInner = this.objName+'.Button.txt'
				if(eval(tInner)){
					if(eval(tInner+'.'+btns[i])){
						$(this.objName+'_btn'+btns[i]).childNodes[0].innerHTML = eval(tInner+'.'+btns[i])
					}
				}
			}
		}
		
		
		this.Button.Cancel = (this.Button.Cancel)? this.Button.Cancel :this.objName+'.Clear()'
		this.Button.Submit = (this.Button.Submit)? this.Button.Submit :this.objName+'.Clear()'
		xpow.osEvent.attEvent(this.objName+'_btnCancel','ock',this.Button.Cancel)
		xpow.osEvent.attEvent(this.objName+'_btnSubmit','ock',this.Button.Submit)
		xpow.osEvent.attEvent(this.objName+'_dialogCloseBtn','ock',this.Button.Cancel)
	}

	if (this.mTop>=( dH-$(this.objName+'_dDialog').clientHeight)){
		$(this.objName+'_dDialog').style.top = dH-$(this.objName+'_dDialog').clientHeight-10+'px'
	}
	
	/*$('test').innerHTML = vprop+'####'+dlgObj.innerHTML.toHTML()
	document.oncontextmenu = new Function('xpow.osEvent.cEvent.returnValue=false');*/
	this.ISEXPORT = true
	this.oDmove = $(this.objName+'_dDialog')
	var mosdon = false,tOmove = this.oDmove
	if (this.canMove){
		document.onmousedown = function(ev){
			var ev=ev||window.event;
			var evt=ev.srcElement||ev.target;
			if(!evt.getAttribute('canmove')){return;}
			mosdon = true;
			mobj = $(evt.getAttribute('xid'));
			tOmove = mobj
			ox = mobj.offsetLeft - ev.clientX;
			oy = mobj.offsetTop - ev.clientY
		}
		document.onmouseup = function(){mosdon=false}
		window.onresize = function(ev){
			var tInfo = getViewportInfo()
			this.Left=(document.body.clientWidth-tOmove.clientWidth)/2+document.body.scrollLeft;
			this.Top=(tOmove.clientHeight)/2+document.documentElement.scrollTop
			tOmove.style.left = this.Left +'px';
			tOmove.style.top = this.Top +'px';
			dH = (document.documentElement.scrollHeight > document.body.clientHeight)?document.documentElement.scrollHeight:document.body.clientHeight
			dlgObj.style.width = document.body.scrollWidth +'px';
			dlgObj.style.height =  dH +'px';
			if(mask){
				mask.style.width = document.body.scrollWidth +'px';
				mask.style.height = dH +'px';
			}
			/*$('__shadows').filters(0).sizingMethod = 'scale'*/
		}
		document.onmousemove = function(ev){
			if(!mosdon){return }
			var ev = ev||window.event;
			this.top = ev.clientY + oy
			this.left = ev.clientX + ox
			
			if ((this.left)*1>1 && this.left<( tInfo.w-mobj.clientWidth)){
				mobj.style.left = this.left +'px';
			}else{
				return false
			}

			if ((this.top*1>1 )&& this.top<=( dH-mobj.clientHeight)){
				mobj.style.top = this.top+'px';
			}else{
				return false
			}
			
/*			$('test').innerHTML = 'mosdon：'+mosdon+'<br>ev.clientY：'+ev.clientY+'#oy：'+oy+'#mobj.Top：'+mobj.style.top+'<br>'
			$('test').innerHTML += 'ev.clientX：'+ev.clientX+'#ox：'+ox+'#mobj.left：'+mobj.style.left+'<br>'
			$('test').innerHTML += '#screen：'+window.screen.availHeight+' #screenTop：'+window.screenTop+'<br>'
			$('test').innerHTML += 'body.clientHeight：'+document.body.clientHeight+' #body.clientWidth：'+document.body.clientWidth+'<br>'
			$('test').innerHTML += 'body.scrollHeight：'+document.body.scrollHeight+' #body.scrollWidth：'+document.body.scrollWidth+'<br>'
			$('test').innerHTML += 'body.scrollTop：'+ document.body.scrollTop
*/		}
	}
}

xpow.point.dlg.prototype.Moveto = function(offx,offy){
	var tleft = this.oDmove.style.left.replace('px','')*1 - offx
	var ttop = this.oDmove.style.top.replace('px','')*1 - offy
	this.oDmove.style.left = tleft +'px';
	this.oDmove.style.top = ttop +'px';
}

xpow.point.dlg.prototype.adjustment = function(){
	var tl = this.oDmove.style.left.replace('px','')*1
	var tt = this.oDmove.style.top.replace('px','')*1
	if ((document.body.clientWidth-this.oDmove.clientWidth)<tl){
		this.oDmove.style.left = (document.body.clientWidth-this.oDmove.clientWidth-50) +'px';
	}
	if ((document.body.clientHeight-this.oDmove.clientHeight)<tt){
		this.oDmove.style.top = (document.body.clientHeight-this.oDmove.clientHeight-20) +'px';
	}
}

function getViewportInfo()
{
	var w = (window.innerWidth) ? window.innerWidth : (document.documentElement && document.documentElement.clientWidth) ? document.documentElement.clientWidth : document.body.offsetWidth;
	var h = (window.innerHeight) ? window.innerHeight : (document.documentElement && document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.body.offsetHeight;
//	if (h < document.body.scrollHeight)h = document.body.scrollHeight
//	if (w < document.body.scrollWidth)w = document.body.scrollWidth
	return {w:w,h:h};
}

xpow.point.dlg.prototype.setTitleWidth = function(w){
	var twidth = this.oDmove.style.width.replace('px','')*1
	var tleft = this.oDmove.style.left.replace('px','')*1
	var ttop = this.oDmove.style.top.replace('px','')*1
	this.oDmove.style.width=w
	if(tleft>=(document.body.clientWidth-this.oDmove.clientWidth)){
		this.oDmove.style.left = (tleft - w + twidth) +'px';
	}
}

xpow.point.dlg.prototype.getTitleWidth = function(w){
	return this.oDmove.clientWidth
}

xpow.point.dlg.prototype.getoffset = function(e)
{
	if (!$(e)){
		alert('xpow.point.dlg.prototype.getoffset：\n\n['+this.der+'] object not exist!')
	 	return
	}
	
	var et=e.offsetTop,el=e.offsetLeft;
	while(e=e.offsetParent)
	{
		et+=e.offsetTop;
		el+=e.offsetLeft;
	}
	var reOffset = new Array(1);     
	reOffset[0] = et;
	reOffset[1] = el;
	return reOffset.toString()
	/*
	oRect = obj.getBoundingClientRect();     
	oRect.left
	*/      
}

xpow.point.dlg.prototype.Clear = function ()
{
	xpow.point.clear(this.objName);	
	this.ISEXPORT = false
}

xpow.point.setPop = function (iJSONParmas){xpow.emObj._PMS_.POPITEM = iJSONParmas}
xpow.point.getPop = function (key){ return eval('xpow.emObj._PMS_.POPITEM.'+key)}
xpow.point.doPop = function (inner,type)
{
	var re = '',_imgs = '',tPitm = xpow.emObj._PMS_.POPITEM,tIsbutton = false
	if(xpow.emObj._PMS_.COMMONPOP.ISEXPORT){xpow.emObj._PMS_.COMMONPOP.Clear()}
	xpow.emObj._PMS_.COMMONPOP = xpow.Use('dlg')
	xpow.emObj._PMS_.COMMONPOP.doInit('xpow.emObj._PMS_.COMMONPOP')
	xpow.emObj._PMS_.COMMONPOP.isMask = (tPitm.isMask)?tPitm.isMask:0;
	xpow.emObj._PMS_.COMMONPOP.der = (tPitm.der!='' && tPitm.der!=undefined)?tPitm.der:'';
	xpow.emObj._PMS_.COMMONPOP.isTitle = (!isEmpty(tPitm.isTitle) || tPitm.isTitle==0)?tPitm.isTitle:1;
	xpow.emObj._PMS_.COMMONPOP.topOffset = (tPitm.topOffset)?tPitm.topOffset:0;
	xpow.emObj._PMS_.COMMONPOP.leftOffset = (tPitm.leftOffset)?tPitm.leftOffset:0;
	xpow.emObj._PMS_.COMMONPOP.mWidth = (tPitm.mWidth)?tPitm.mWidth:478;
	xpow.emObj._PMS_.COMMONPOP.mHeight = (tPitm.mHeight)?tPitm.mHeight:120;
	xpow.emObj._PMS_.COMMONPOP.PoPCss = (tPitm.PoPCss!=''&& tPitm.PoPCss!=undefined)?'pop-msg':'popmsg';
	xpow.emObj._PMS_.COMMONPOP.canMove = (tPitm.canMove)?tPitm.canMove:true
	xpow.emObj._PMS_.COMMONPOP.maskBgColor = (tPitm.maskBgColor)?tPitm.maskBgColor:'#fff'
	if (xpow.browser.isIE){
		xpow.emObj._PMS_.COMMONPOP.mHeight = (tPitm.mHeight!=''&& tPitm.mHeight!=undefined)?tPitm.mHeight:100
	}else{
		//xpow.emObj._PMS_.COMMONPOP.mHeight = 'auto';
	}
	
	switch(type){
	default :
	case 0 : _imgs = 'point'; break //仅提示，带关闭
	case 1 : _imgs = 'error'; xpow.emObj._PMS_.COMMONPOP.isMask = 1; tIsbutton = 1; break //错误，带确定
	case 2 : _imgs = 'sigh'; break //提示+确定+取消(！)
	case 3 : _imgs = 'confirm'; break //确定+取消
	case 4 : //单确定
		_imgs = 'submit';
		xpow.emObj._PMS_.COMMONPOP.isMask = 1;
		xpow.emObj._PMS_.COMMONPOP.isTitle = 2
		tIsbutton = 1
		break
	case 5 : //仅提示(p)
		_imgs = 'point';
		xpow.emObj._PMS_.COMMONPOP.isTitle = 2
		xpow.emObj._PMS_.COMMONPOP.isMask = 1;
		break;
	case 6 : _imgs = 'point'; tIsbutton = 1; break; //提示，带确定+取消
	}

	if (tPitm.isButton || tIsbutton){
		xpow.emObj._PMS_.COMMONPOP.Button={
			get:true,
			Submit:(tPitm.Submit)?tPitm.Submit:'xpow.emObj._PMS_.COMMONPOP.Clear()',
			Cancel:(tPitm.Cancel)?tPitm.Cancel:'xpow.emObj._PMS_.COMMONPOP.Clear()',
			mode : (tPitm.mode)?tPitm.mode:'',
			txt : (tPitm.txt)?tPitm.txt:''
		}
	}
	xpow.emObj._PMS_.COMMONPOP.Export(inner)
	//xpow.emObj._PMS_.COMMONPOP.adjustment()

//	if (tPitm.isButton || tIsbutton){
//		$('xpow.emObj._PMS_.COMMONPOP_btnSubmit').style.display=''
//		$('xpow.emObj._PMS_.COMMONPOP_btnCancel').style.display=''
//		
//		xpow.osEvent.attEvent('xpow.emObj._PMS_.COMMONPOP_btnCancel','ock',(tPitm.Cancel)?tPitm.Cancel:'xpow.emObj._PMS_.COMMONPOP.Clear()')
//		xpow.osEvent.attEvent('xpow.emObj._PMS_.COMMONPOP_btnSubmit','ock',(tPitm.Submit)?tPitm.Submit:'xpow.emObj._PMS_.COMMONPOP.Clear()')
//	}

	xpow.Try.these(
		function (){
			xpow.osEvent.attEvent('xpow.emObj._PMS_.COMMONPOP_dialogCloseBtn','ock',(tPitm.Cancel)?tPitm.Cancel:'xpow.emObj._PMS_.COMMONPOP.Clear()')
		}
	)||false
	xpow.emObj._PMS_.POPITEM=''
}


xpow.point.popClear = function(){xpow.Try.these(function(){xpow.emObj._PMS_.COMMONPOP.Clear()})}
var xsClick = function(obj) { return function() { eval(obj).clear(obj)}}

xpow.point.clear = function(obj)
{
	switch(obj){
	case 'alert':

	case 'pop':
		if (xpow.emObj._PMS_.COMMONPOP)xpow.emObj._PMS_.COMMONPOP.Clear()
		break;
	default:
		xpow.removeElemt(obj,0);
		xpow.removeElemt(obj+'.mask',0)
		break;
	}
	document.oncontextmenu = new Function('xpow.osEvent.cEvent.returnValue=true');
}

xpow.Try = {
	sn : 0,
	emssage : '',
	isreport : 0,
	_err_ : {location:'',line:0,name:''},
	foundErr : false,
	these: function() {
		var returnValue
		this.Clear()
		for (var i = 0, length = arguments.length; i < length; i++) {
			var lambda = arguments[i];
			if(i==0){if(lambda==1){this.isreport=1}}
			if(i==1 && this.isreport){this._err_ = lambda }
			if (typeof lambda == 'function'){
				try {
					returnValue = lambda();
					break;
				} catch (e) {
					this.sn += 1
					this.foundErr = true
					this.emssage += 'error #'+this.sn+': '+e.message+'\n'
				}
			}
		}
		if (this.isreport){this.outErr()}
		return returnValue;
	},
	outErr : function(){
		var tMsg = '[xpow.Try] catch these errors:\n'
		if (this.foundErr){
			for (var i in this._err_){
				tMsg += i+': '+this._err_[i]+'\n'	
			}
			this.emssage = tMsg+'=================\n'+this.emssage
			alert(this.emssage)
		}
		this.Clear()
	},
	Clear : function(){
		this.emssage = ''
		this._err_ = {location:'',line:0,name:''}
		this.isreport = 0
		this.sn = 0
		this.foundErr = false
	}
}

xpow.osEvent = {
	aEvent : '',
	debug : 0,
	aFunc : '',
	cEvent : '',
	cSrcElmt : '',
	cKeyCode : '',
	aElement : '',
	cButton : '',
	cX : '',
	cY : '',
	attEventList : function(regElement,Event,Func){
		if (this.debug)alert(regElement + '#' + $(regElement))
		this.aEvent = Event;var tAct = ($(regElement))?$(regElement).value : regElement ,
		tAct = tAct.toReSymbol('，',',')
		tAry = tAct.split(',')
		for (var i=0; i<tAry.length; i++){if (this.debug){alert(tAry[i]+' ==> '+$(tAry[i])+'  '+Func+' ')};if(tAry[i]!=''&&$(tAry[i]))eval('$(\''+tAry[i]+'\').'+this.getEvent()+' = function(){'+Func+'}')}
	},
	attEvent : function(regElement,Event,Func){
		if (!regElement){return}
		this.aEvent = Event
		this.aFunc = Func
		this.aElement = regElement
		/*if (!isObject($(regElement))){return};*/
		xpow.Try.these(
			xpow.osEvent.debug,{Location:'http://www.chnimg.com/js/xpow.js',Line:354,CallBackName:'xpow.osEvent.attEvent()'},
			function(){
				if (xpow.osEvent.debug)alert(xpow.osEvent.aElement + $(xpow.osEvent.aElement)+'#['+ xpow.osEvent.getEvent()+']' +'==>' + xpow.osEvent.aFunc);
				eval('$(\''+xpow.osEvent.aElement+'\').'+xpow.osEvent.getEvent()+' = function(){'+xpow.osEvent.aFunc+'}')
			}
		)
	},
	setEvent : function(t){try{window.event.keyCode=t}catch(e){}},
	attEvents : function(regElement,Event,Func){
		this.aEvent = Event;
		if (this.debug)alert(regElement + ' =*>' + regElement+' **>'+Func);
		eval(regElement+'.'+this.getEvent()+' = function(){'+Func+'}')
	},
	Search : function(){
		func=this.Search.caller;
		while(func!=null){
			var arg0=func.arguments[0];
			if(arg0){
				if(arg0.constructor==MouseEvent) return arg0;
				if(arg0.constructor==KeyboardEvent){this.cKeyCode=arg0.which; return arg0}
				if (this.debug)alert('event:\n'+arg0.constructor+'=='+Event+'+'+(arg0.constructor==MouseEvent)+' **which='+arg0.which)
			}
			func=func.caller;
		}
		return null;
	},
	Catch : function(){ if (window.event){this.cEvent = window.event; this.cButton=window.event.button ;this.cKeyCode = window.event.keyCode}else{this.cEvent = this.Search(); this.cButton=this.cEvent.button }; return this.cEvent },
	catchSrc : function(){ this.Catch(); if (this.cEvent.srcElement){this.cSrcElmt = this.cEvent.srcElement}else{this.cSrcElmt = this.cEvent.target}; return this.cSrcElmt},
	getX : function(){ this.cX = (window.event)?event.x:this.cEvent.pageX; return this.cX },
	getY : function(){ this.cY = (window.event)?event.y:this.cEvent.pageY; return this.cY },
	testXY : function(){
		var re = 'window X Y test ##in browser\''+xpow.browser.userAgent+'\' :\n==================================='
		if (xpow.browser.isIE5){
			re += '\n\nwindow.event.[x,y]:'+window.event.x+','+window.event.y
			re += '\n\nevent.[clientX,clientY]:'+event.clientX+','+event.clientY
			re += '\n\nevent.[offsetX,offsetY]:'+event.offsetX+','+event.offsetY
			re += '\n\nwindow.event.[screenX,screenY]:'+window.event.screenX+','+window.event.screenY
		}else{
			var evt = this.cEvent
			re += '\n\nevent.[pageX,pageY]:'+evt.pageX+','+evt.pageY
			re += '\n\nevent.[clientX,clientY]:'+evt.clientX+','+evt.clientY
			/*re += '\n\nevent.[offsetX,offsetY]:'+evt.offsetX+','+evt.offsetY*/
			re += '\n\nevent.[screenX,screenY]:'+evt.screenX+','+evt.screenY
		}
		alert(re)
	},
	getElmtXY : function(obj){
		if(!obj){return}
		var t=parseInt(obj.offsetTop);
		var l=parseInt(obj.offsetLeft);
		var h=parseInt(obj.offsetHeight);
		var w=parseInt(obj.offsetWidth);
		
		alert("左上:("+l+","+t+")");
		alert("右上:("+(l+w)+","+t+")");
		alert("左下:("+l+","+(t+h)+")");
		alert("右下:("+(l+w)+","+(t+h)+")");
	},
	getEvent : function(){
		var tE;switch (this.aEvent){
		case 'ock' : tE = 'onclick'; break;
		case 'okp' : tE = 'onkeyup'; break;
		case 'okd' : tE = 'onkeydown'; break;
		case 'ofc' : tE = 'onFocus'; break;
		case 'omv' : tE = 'onmouseover'; break;
		case 'omm' : tE = 'onmousemove'; break;
		case 'omt' : tE = 'onmouseout'; break;
		case 'omd' : tE = 'onmousedown'; break;
		case 'omp' : tE = 'onmouseup'; break;
		case 'obl' : tE = 'onblur'; break;
		case 'ocg' : tE = 'onchange'; break;
		default : tE = this.aEvent; break;
		}return tE
	}
}

xpow.point.Content={
	cArray : new Array(),
	append : function(){
		this.cArray.push.apply(this.cArray,arguments)
	},
	toString : function(){
		var str = this.cArray.join('')
		this.cArray = new Array()
		return str
	}
} 
xpow.upload = function(){}
xpow.upload.prototype.doInit = function()
{
	this.VERSION = '1.3.2'
	this.objName = 'xUploader';
	this._dir = '/';
	this._path = 'common/xpow/xpow.upLoad.asp';
	this._form = 'upform';
	this._vFileSize = '_vFileSize';
	this._vFileExt = '_vFileExt';
	this._vFileName = '_vFileName';
	this._vElemt = 'velemt';
	this._vsElemt = 'vselemt';
	this._upPath = '';
	this._showElemt = 'showpic';
	this.img_h = 'img_h';
	this.img_w = 'img_w';
	this._parent = 'edtparent';
	this._frameid = 'uploaderframe';
	this._framename = 'uploaderframe';
	this.exportObj = '';
	this._channel='';
	this._isResize = 0;
	this._resizeMode = 0;
	this._filename = '';
	this._maxsize = 150;
	this._re_maxw = 180;
	this._re_maxh = 180;
	this._re_size = '|';
	this.width = 340;
	this.height = 30;
	this.bodyWidth = 580;
	this.bodyHeight = 220;
	this._cursorPos_start = 0;
	this._cursorPos_end = 0;
	this._editorObjname = '';
	this._vimg = 'vimg';//当actmode=1时,记录最后输出的文件名
	this._focus = 'vimg';//当actmode=1时,上传后输出焦点名
	this.isRecycle = 1;
	this.actmode = 0;
	this.allowExt = 'jpg,gif'
}

xpow.upload.prototype.getUploader = function()
{
	var _prop;
	var _e = xpow.m_cfg['ELEMT'].split(',');
	_prop = "id="+this._frameid+",name="+this._framename+",frameBorder=0,scrolling=no,width="+this.width+",height="+this.height
	xpow.CreateElemt(_e[0],_prop);
	_prop = this._dir+this._path+'?filesize='+this._maxsize+'&vselemt='+this._vsElemt;
	_prop += '&velemt='+this._vElemt+'&filepath='+this._upPath+xpow.getDater.Get('toPath',1)+'&isresize='+this._isResize+'&maxh='+this._re_maxh;
	_prop += '&maxw='+this._re_maxw+'&showpic='+this._showElemt+'&remode='+this._resizeMode+'&formname='+this._form+'&channel='+this._channel+'&domainapp='+xpow.point.Path.getApp();
	_prop += '&v_reimg_h='+this.img_h+'&v_reimg_w='+this.img_w+'&allowext='+this.allowExt+'&r_sz='+this._re_size+'&filename='+this._filename
	$(this._frameid).height=this.height+'px'
	if ($(this._frameid)){$(this._frameid).src=_prop}
}

xpow.upload.prototype.Body = function()
{
	this.SetButton()
	var tc = xpow.point.Content
	tc.append('<FORM id="'+this._form+'">')
	tc.append('<TABLE height="160" align="center" class="uplbox" cellSpacing=0 cellPadding=0 width="580" border=0>')
	tc.append('<TBODY><TR>')
	tc.append('<TD width=378 height=10 class="title">选择文件进行上传 </TD>')
	tc.append('<TD width=202 class="title">上传后预览图</TD>')
	tc.append('</TR><TR><TD vAlign=top bgcolor="#FFFFFF" class="uplitem">')
	tc.append('<div id="edtparent"></div><div class="space"></div>')
	tc.append('<div class="tips">上传须知：文件大小 ≤',this._maxsize,' K，',this.allowExt,' 文件格式</div>')
	tc.append('<div class="tips">* 如果上传后无法看到预览图，请检查是否上传了 CMYK 色的图片，如果是请调整为 RGB 色重新上传</div><div class="space"></div>')
	tc.append('<div class="sizebox"><div id="file_size"><B>图片大小：</B></div><div id="file_ext"><B>文件格式：</B></div>')
	tc.append('<div id="file_width"><B>图片宽度：</B></div><div id="file_height"><B>图片高度：</B></div></div></TD>')
	tc.append('<TD><div class="review" id="showpic"></div></TD>')
	tc.append('<input type="hidden" id="',this.img_h,'"><input type="hidden" id="',this.img_w,'"><input type="hidden" id="',this._vElemt,'"><input type="hidden" id="',this._vsElemt,'">')
	tc.append('<input type="hidden" id="',this._vFileName,'"><input type="hidden" id="',this._vFileSize,'"><input type="hidden" id="',this._vFileExt,'">')
	tc.append('</TR></TBODY></TABLE></FORM>')
	return tc.toString();
}

xpow.upload.prototype.SetButton = function(){
	this.enterAction = (this.actmode == 0)?'window.frames[\'Editor\'].'+this._editorObjname+'.'+this.objName+'.getContent()':this.objName+'.setImg2E()'
	this.objName = (this.actmode == 0)?'window.frames[\'Editor\'].'+this._editorObjname+'.'+this.objName:this.objName
}

xpow.upload.prototype.GetCursorPsn = function(txb) 
{ 
    var slct = document.selection;
    var rng = slct.createRange();
    txb.select();
    rng.setEndPoint('StartToStart', slct.createRange());
    var psn = rng.text.length;
    rng.collapse(false);
    rng.select();
    return psn;
}

xpow.upload.prototype.setUploader = function(){this.getUploader(); if ($(this._parent)){$(this._parent).appendChild($(this._frameid));}}
xpow.upload.prototype.doDel = function()
{
	var imgpth=$(this._vElemt).value+'$$$'+$(this._vsElemt).value;
	var timer
	
	if ($(this._vElemt).value != '' || $(this._vsElemt).value != ''){
		if (confirm('您确实要取消吗？\n\n取消将删除此次上传的文件！')){
		}else{return}
	}
	if (this.exportObj !=''){
		setTimeout(this.exportObj+'.Clear()',300)
	}else{
		try{
			setTimeout('window.frames[\'Editor\'].'+this._editorObjname+'.edtDlg.Clear()',300)
		}catch(e){
			alert(e.message)
		}
	}
	//clearTimeout(timer)
	try{
		window.frames['Editor'].focus()
	}catch(e){
		$(this._focus).focus()
	}
}


xpow.upload.prototype.test = function(inRe)
{
	var tbr = '\n'
	var str = this.objName + ' is here!' + tbr;
	str += 'version : ' + this.VERSION + tbr;
	str += 'parent : ' + this._parent + tbr;
	str += 'frameid : ' + this._frameid + tbr;
	str += 'width : ' + this.width + tbr;
	str += 'height : ' + this.height + tbr;
	str += 'editorObjname : ' + this._editorObjname + tbr;
	str += 'allowExt : ' + this.allowExt + tbr;
	str += 'isResize : ' + this._isResize + tbr;
	str += 'uploadPath : ' + this._upPath;
	if (inRe){alert(str)}
	return true;
}

xpow.upload.prototype.getContent = function()
{
	var w_e_h = window.frames['Editor'].window.frames['HtmlEditor'];
	var w_e = window.frames['Editor'];
	var tbr = '<br><br>';
	var imgurl = $(this._vElemt).value
	if (imgurl == ''){alert('请上传一张图片或者文件!');return}
	try{
		w_e_h.document.body.innerHTML += tbr+'<br><img width='+$(this.img_w).value+' height='+this.img_h.value+' src=\"'+this._vElemt.value+'\"></BR>';
	}catch (e){
		var ext = $(this._vFileExt).value.toLowerCase(),tT = false;
		var extAry = 'jpg,gif,png,bmp'.split(',')
		for (i=0;i<extAry.length;i++){if (ext == extAry[i]){tT = true;break;}}
		var fileName = $(this._vFileName).value
		var filesize = $(this._vFileSize).value
		//if (!tT){
		//	w_e.eval(this._editorObjname).insertFile('<br><a style="PADDING-LEFT: 20px; height:20px; line-height:20px; BACKGROUND: url(http://www.chnimg.com/images/common/linkicons/'+ext+'.png) no-repeat left 50%" href="'+imgurl+'" title="点击下载">'+fileName+' ['+filesize+' K]</a><br>');
		///}else{
			w_e.eval(this._editorObjname).insertImage(imgurl,$(this.img_w).value,$(this.img_h).value,0,'',0,0,0);
		//}
	}
	if (this.exportObj !=''){this.exportObj+'.Clear()'}
	else{eval('window.frames[\'Editor\'].'+this._editorObjname+'.edtDlg.Clear()')}
}

xpow.upload.prototype.setImg2E = function()
{
	var imgurl = $(this._vElemt).value
	if (imgurl == ''){alert('请上传一张图片或者文件');return}
	$(this._vimg).value=imgurl
	if (this.exportObj !=''){setTimeout(this.exportObj+'.Clear()',500)}
	else{setTimeout("xpow.point.clear('alert')",500)}
	var tObjArray=new Array()
	tObjArray['img'] = $('img_'+this._vimg)
	tObjArray['imgs'] = $('img_'+this._vimg+'s')
	tObjArray['img_w'] = $('_g_'+this.img_w)
	tObjArray['img_h'] = $('_g_'+this.img_h)
	tObjArray['img_m'] = $('_g_'+this._vFileSize)
	tObjArray['img_ext'] = $('_g_'+this._vFileExt)
	if (tObjArray['img']){
		if (tObjArray['img'].tagName.toLowerCase()=='img' ){
			tObjArray['img'].style.display='block';tObjArray['img'].src=imgurl+'?'+ new Date().getTime()
		}else{
			tObjArray['img'].background=imgurl+'?'+ new Date().getTime()
			if(tObjArray['imgs'])tObjArray['imgs'].style.background='url('+imgurl+'?'+ new Date().getTime()+') left repeat-y'
		}
		if (tObjArray['img_w'])tObjArray['img_w'].value=$(this.img_w).value
		if (tObjArray['img_h'])tObjArray['img_h'].value=$(this.img_h).value
	}
	if (tObjArray['img_m'])tObjArray['img_m'].value=$(this._vFileSize).value
	if (tObjArray['img_ext'])tObjArray['img_ext'].value=$(this._vFileExt).value
	if ($(this._focus) && $(this._focus).style.display !='none'){$(this._focus).focus()}else{window.focus()}
}

function doParseUpJSON(j){
	var JSON = j
	if (JSON.showpic!=''&&JSON.filemode==0){
		if (JSON.isresize>1){
			$(JSON.showpic).innerHTML = (JSON.smallimg!='')?'<a href="'+JSON.domain+JSON.smallimg+'" target="_blank"><img src="'+JSON.domain+JSON.smallimg+'?'+ new Date().getTime()+'"></a>':''
		}else{
			$(JSON.showpic).innerHTML = (JSON.smallimg!='')?'<a href="'+JSON.domain+JSON.bigimg+'" target="_blank"><img src="'+JSON.domain+JSON.smallimg+'?'+ new Date().getTime()+'"></a>':''
		}
	}else{
		$(JSON.showpic).innerHTML = '<a class="linkchna" target="_blank" title="点击下载" style="PADDING-LEFT: 20px; BACKGROUND: url('+JSON.domain+JSON._vFileExt+'image.gif) no-repeat" href="'+JSON.domain+JSON.velemt+'">'+JSON.sourcename+' ['+JSON._vFileSize+' K]</a>'
	}
	
	if(JSON._vFileSize==''&& JSON.velemt )JSON._vFileSize='< 1'
	$('file_size').innerHTML = (JSON._vFileSize!='')?' <B>文件大小：</B>'+JSON._vFileSize+' k':' <B>文件大小：</B>'
	$('file_ext').innerHTML = (JSON._vFileExt!='')?' <B>文件类型：</B>.'+JSON._vFileExt:' <B>文件类型：</B>'
	$('_vFileSize').value = parseInt(JSON._vFileSize)
	$('_vFileExt').value = JSON._vFileExt
	$('_vFileName').value = JSON.sourcename
	if ($(JSON.velemt$v)){
		$(JSON.velemt$v).value=''
		if(JSON.velemt!='')$(JSON.velemt$v).value=JSON.domain+JSON.velemt
	}

	xpow.Try.these(
		0,{location:'common.js',line:905,args:JSON.velemt$v+','+JSON.v_reimg_h$v+','+JSON.velemt},
		function(){
			if (JSON.filemode==0){
				$('file_width').innerHTML = (JSON.v_reimg_w)?' <B>图片宽度：</B>'+JSON.v_reimg_w+' dpi':' <B>图片宽度：</B>'
				$('file_height').innerHTML = (JSON.v_reimg_h)?' <B>图片宽度：</B>'+JSON.v_reimg_h+' dpi':' <B>图片宽度：</B>'
				$(JSON.v_reimg_w$v).value = JSON.v_reimg_w
				$(JSON.v_reimg_h$v).value = JSON.v_reimg_h
			}else{

			}

		}
	)
}


xpow.browser=new Object();
xpow.browser.userAgent		= navigator.userAgent.toLowerCase();
xpow.browser.appVersion		= navigator.appVersion;
xpow.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.MajorVer;
		//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);
	}
}
xpow.browser.doInit();

xpow.browser.getObject=function(strname) { return this.getElementById(strname); }
xpow.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];
}
xpow.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];
}
xpow.getDater=function(vElemt,inDate,intYear,sn,isshort)
{
	var reDate,sYear,sMonth,sDay,datAry=inDate.split('-')
	var tmpSl='',_ddate = new Date(),tName = vElemt
	var tmpShortAry = (isshort)? eval(isshort) : new Array('年','月','日')//new Array('','','')
	if (!sn){sn=''}
	var dElemAry = 'stryear'+sn+',strmonth'+sn+',strdate'+sn+'',isSet = false,starYear=1
	vElemt += 'ξ'
	reDate = '<select id="stryear'+sn+'">'// name="stryear"
	reDate += '<option style="color:#999999" value=""> 年</option>'
	intYear = intYear.toString()
	if (datAry.length > 1){if (datAry[2].length > 5) {datAry[2] = datAry[2].split(' ')[0]	}}
	if (!intYear){
		intYear=1800
	}else if(intYear.indexOf('now+')>=0 || intYear.indexOf('now-')>=0 ){
		var tYear = intYear.substr(3,1),tVal = intYear.substr(4,intYear.length)
		intYear = eval(_ddate.getYear()+tYear+tVal)
		isSet = true
	}
	intYear = parseInt(intYear)
	var ddYear = _ddate.getYear()
	ddYear = (ddYear<1900?(1900+ddYear):ddYear).toString(); 
	var _strInt=intYear,_strMax=parseInt(ddYear - _strInt) + 1
	if (isSet){
		if (intYear > _ddate.getYear()){
			_strInt = _ddate.getYear()
		}else{
			_strInt = intYear
		}
		_strInt = (_strInt<1900?(1900+_strInt):_strInt).toString();
		
		for (i=0;i<=tVal;i++){
			tmpSl=''
			if (parseInt(datAry[0])==parseInt(_strInt*1+i*1)){tmpSl='selected="Selected"'}
			reDate+='<option '+tmpSl+' value='+(_strInt*1+i*1)+'>'+(_strInt*1+i*1)+'</option>'
		}
	}else{
		for (i=starYear;i<_strMax;i++){
			tmpSl=''
			if (parseInt(datAry[0])==parseInt(_strInt*1+i*1)){tmpSl='selected="Selected"'}
			reDate+='<option '+tmpSl+' value='+(_strInt*1+i*1)+'>'+(_strInt*1+i*1)+'</option>'
		}
	}
	
	reDate+='</select> '+tmpShortAry[0]+' '
	reDate+='<select id="strmonth'+sn+'">'// name="strmonth"
	reDate+='<option style="color:#999999" value=""> 月</option>'
	for (i=1;i<13;i++){
		tmpSl=''
		if (parseInt(datAry[1])==parseInt(i)){tmpSl='selected="Selected"'}
		reDate+='<option '+tmpSl+' value='+i+'>'+i+'</option>'
	}
	reDate+='</select> '+tmpShortAry[1]+' '
	reDate+='<select id="strdate'+sn+'">'// name="strdate"
	reDate+='<option style="color:#999999" value="">  日</option>'
	for (i=1;i<32;i++){
		tmpSl=''
		if (parseInt(datAry[2])==parseInt(i)){tmpSl='selected="Selected"'}
		reDate+='<option '+tmpSl+' value='+i+'>'+i+'</option>'
	}
	reDate+='</select> '+tmpShortAry[2]+' <input value="1" type="hidden" id="'+tName+'" name="'+tName+'">'
	if($(vElemt)){$(vElemt).innerHTML=reDate;$(tName).value=$('stryear'+sn).value + '-' + $('strmonth'+sn).value + '-' +$('strdate'+sn).value}
	if (sn==''){
		xpow.osEvent.attEventList(dElemAry,'ocg','xpow.getDater.Change(\''+tName+'\')')
	}else{
		xpow.osEvent.attEventList(dElemAry,'ocg','xpow.getDater.Change(\''+tName+'\','+sn+')')
	}
}
xpow.getDater.Change = function(e,sn){if (!sn){sn=''}; $(e).value = $('stryear'+sn).value + '-' + $('strmonth'+sn).value + '-' +$('strdate'+sn).value; }
xpow.getDater.Time = function(mode,parent,css)
{
	var Digital,_tIMe
	if (!Digital){Digital=new Date()}
	var hours=Digital.getHours(),minutes=Digital.getMinutes(),seconds=Digital.getSeconds(),dn='AM'
	var year=Digital.getYear(),month=parseInt(Digital.getMonth())+1,day=Digital.getDate()
	year = (year<1900?(1900+year):year).toString(); 
	if(parseInt(minutes)<=9){minutes='0'+minutes}
	if(parseInt(seconds)<=9){seconds='0'+seconds}
	if(parseInt(hours)>12){dn='PM';hours=hours-12}
	if(parseInt(hours)==0){hours=12}
	if(parseInt(day)<=9){day='0'+day}
	if(parseInt(month)<=9){month='0'+month}
	switch(mode){
	case 0 : _tIMe = hours+':'+minutes+':'+seconds+'  '+dn;break
	case 1 : _tIMe = year+'年'+month+'月'+day+'日 '+hours+':'+minutes+':'+seconds+'  '+dn;break
	case 2 : _tIMe = year.substr(2,2)+'.'+month+'.'+day+' '+hours+':'+minutes+':'+seconds+'  '+dn;break
	case 3 : _tIMe = year.substr(2,2)+'.'+month+'.'+day;break
	}
	if (!$(parent)){return _tIMe}
	$(parent).innerHTML = '<span class="'+css+'">'+_tIMe+'</span>'
	setTimeout('xpow.getDater.Time('+mode+',\''+parent+'\',\''+css+'\')',1000)
}

xpow.getDater.Get = function(mode,tf)
{
	var d = new Date();
	m = (d.getMonth() + 1)
	t = d.getDate()
	y = d.getYear()*1
	m = (m<10)?'0'+m.toString():m
	t = (t<10)?'0'+t.toString():t
	y<1900?y +=1900:y
	y = y.toString().substr(2)
	switch(mode){
	case 'toPath' : return (tf)?(y+'-'+m+'/'):(m+'-'+t+'/'); break;
	case 'toName' : return (tf)?(y+m+t):(m+t); break;
	case 'toDate' : return (tf)?(y+'.'+m+'.'+t):(m+'.'+t); break;
	case 'toFile' : return (tf)?(y+m+t):''; break;
	case undefined : return (tf)?(y+'.'+m+t):(m+'.'+t); break;
	}
}

xpow.point.Path = {
	path : '',
	letter : '',
	timer : '',
	target : '_self',
	pathTree : '',
	pathPre : '\\\\',
	isSet : false,
	delay : 1000,
	pthApp :'.xpm',
	init : function(){
		this.setPathTree()
		this.letter = xpow.Use('letter')
	},
	parsePath : function(pth){
		var tPthAry,rePath = '',reDir='',tUrl;
		if (!this.isSet)this.path = pth;
		this.letter = xpow.Use('letter')
		this.path = this.path.toString()
		this.ReplaceItem()
		if (this.path.Right(4).toLowerCase()=='http'){}
		switch(this.path.Right(1)){
		case '?':
//			tUrl = location.href.toString()
//			if(location.href.Left(4)!='.asp' || location.href.Left(5)!='.html'){
//				tUrl = tUrl.split('/')
//			}else{

//			}
			this.path = location.href+this.path
			return
		case '.':
			for (var i=0; i<this.path.length; i++){
				if (this.path.charAt(i)=='/'||this.path.charAt(i)=='?'){
					reDir={dir:this.path.Right(i),path:this.path.toRight(i),ary:'',repath:'',isSpy :false}
					if (this.path.charAt(i)=='/'){reDir.isSpy=1}
					break
				}	
			}
			reDir.ary = location.href.split('/')
			for (i=0; i<(reDir.ary.length-reDir.dir.length); i++){
				reDir.repath += reDir.ary[i]+'/'
			}
			if (reDir.isSpy){reDir.repath=reDir.repath.toLeft(1)}
			reDir.repath += reDir.path
			this.path = reDir.repath
		}
		
		if (this.path.indexOf(xpow.m_cfg['quto'])>0){
			tPthAry = this.path.split(xpow.m_cfg['quto']);
			for(var i=0; i<tPthAry.length; i++){
				rePath+=tPthAry[i].toString();
				if (!tPthAry[i].isApp(0)){
					if (i<tPthAry.length-1 && tPthAry.length>1)rePath+=this.pthApp+xpow.m_cfg['quto']
				}else{
					if (i<tPthAry.length-1 && tPthAry.length>1)rePath+=xpow.m_cfg['quto']
				}
			}
			if (rePath.Left(1)==xpow.m_cfg['quto'])rePath = rePath.toLeft(1)
		}else{
			if (!this.path.isApp(1)){
				this.path += this.pthApp
			}
			rePath = this.path
		}
		this.path = rePath
	},
	ReplaceItem : function(){
		this.setPathTree()
		if (this.path.Right(2)==this.pathPre){
			this.path = this.path.toRight(2)
			xpow.point.RegExps.init(/\{\$(.+?)\}/ig,this.path,0)
			var tDir = xpow.point.RegExps.Match()
			for (var i=0; i<tDir.length;i++){
				if (typeof tDir[i]!='function' && typeof tDir[i]!='object'){
					if (this.getQuItem(tDir[i])){
						this.path = this.path.replace(tDir[i],this.getQuItem(tDir[i]))
					}
				}
			}
		}
	},
	getQuItem : function(key){return this.getPT(key.replace('{$','').replace('}',''))},
	setPathTree : function(){
		if (this.pathTree==''){this.pathTree = xpow.Use('tree')}
		if (this.letter==''){this.letter = xpow.Use('letter')}
		this.setPT(this.letter.get(23,12),this.letter.get(26,2,12))
		this.setPT(this.letter.get(2,7,13),this.letter.get(27,2,7))
		this.setPT(this.letter.get(23,15),this.letter.get(23,15,14,22))
		this.setPT(this.letter.get(0,3,12),this.letter.get(0,3,12,8,13))
		this.setPT(this.letter.get(12,25),this.letter.get(12,24,25,14,13,4))
		this.setPT(this.letter.get(12,13,6),this.letter.get(12,0,13,0,6,4))
		this.setPT(this.letter.get(20,15,27,3,14,12,0,8,13),this.letter.get(2,12,27,23,15,27,23,20,15,27,7,19,12,11))
		this.setPT(this.letter.get(20,15,27,12,20,11,19),this.letter.get(2,12,27,23,15,27,23,12,20,15,27,7,19,12,11))
		this.setPT(this.letter.get(2,7,13,8,12,6),this.letter.get(7,19,19,15,28,26,26,22,22,22,27,2,7,13,8,12,6,27,2,14,12))/*,26*/
	},
	setPT : function(key,val){this.pathTree.addItem(key,val)},
	getPT : function(key){ return this.pathTree.getItem(key)},
	setDaliy : function (tim){ this.delay = tim * 1000},
	setApp : function(pth){this.pthApp=pth},
	setPath : function(pth){this.path = pth;this.isSet = true},
	getFPath : function(pth){ if(pth){this.Clear()}; this.parsePath(pth); return this.path },
	getPath : function(pth){ return this.getFPath() },
	Redirect : function(pth){ if(pth){this.isSet = false; this.parsePath(pth)};this.delay = 100;this.timer = setTimeout('xpow.point.Path.doOpen(1)',this.delay)},
	RedirNew : function(pth){
		if (!pth&&!this.isSet){return}
		if (pth){this.isSet=false}
		this.parsePath(pth);clearTimeout(this.timer)
		var tWin = window.open(this.path,'_blank')
		if (!tWin){this.isSet = true;this.Redirect(this.path)}
	},
	getDomain : function(t){
		xpow.point.RegExps.init('^http:\/\/[a-zA-Z]{1,10}',location.href,1)/*^http:\/\/[a-zA-Z\.]{1,50}*/
		var domain = xpow.point.RegExps.Match()
		domain = domain.toString().replace('http://','')
		if (t)domain = 'http://'+location.hostname.toString()
		return domain
	},
	getApp : function(){
		var tPath = location.hostname.toString().split('.')
		return tPath[tPath.length-1]
	},
	Clear : function(){this.Path='';this.isSet = false},
	doOpen : function(t){
		var tTarget = (t)?'_self':'_parent';
		var tWin = window.open(this.path,tTarget);
		if (!tWin)location.href=this.path
		clearTimeout(this.timer)
	},
	OpenParent : function(pth){this.parsePath(pth); this.timer = setTimeout('xpow.point.Path.doOpen()',this.delay)}
}


xpow.point.RegExps={
	patrn : '',
	regStr : '',
	regMode : 0,
	result : '',
	res : '',
	reArry : '',
	oReg : '',
	debug : 0,
	init : function(p,re,md){
		this.patrn = p
		this.regStr = re
		this.regMode = md
	},
	Create : function(){
		if (this.regMode){
			this.oReg = new RegExp(this.patrn,'ig')
		}else{
			this.oReg = this.patrn
		}
	},
	Match : function(re){
		this.Create()
		if (isEmpty(re)){re='$1'}
		if (re.indexOf(',')>0){
			this.oReg.exec(this.regStr)
			this.reArry = re.split(',')
			for (i=0; i<this.reArry.length; i++){this.result += eval(this.oReg+'.'+re) + ','}
		}else{
			this.result = this.regStr.match(this.patrn)// eval('RegExp.'+re)
		}
		if (this.debug)this.test()
		return (this.result==null)?'':this.result
	},
	Replace : function(strReg,fstr,tostr){
		return strReg.replace(strReg,tostr)
	},
	test : function(){
		var re = '',tBr='\n\n'
		re += 'regMode : '+ this.regMode + tBr
		re += 'patrn : '+ this.patrn + tBr
		re += (this.regMode)?'express : RegExp("'+this.patrn+'","ig")':''
		re += tBr + 'result : '+this.result + tBr
		re += 'regStr : '+ this.regStr
		alert(re)
	}
}

