var EDWIN = new Object();
if(window.dialogArguments && window.dialogArguments.length > 0 && window.dialogArguments[0].EIIP)
{
	var EIIP = window.dialogArguments[0].EIIP;
}
else
{
var EIIP = window.EIIP || {};
Object.extend(EIIP, {
	isIE:(navigator.appVersion.indexOf("MSIE") != -1),
	lunarCalendar:{},defaultCompany:"中药材天地网",defaultUrl:"http://www.zyctd.com/",defaultDomain:".zyctd.com",
	current: {user: '来宾', userID: 0, perName: '来宾', perID: 0, account: '', info: '', 
		types:["免费会员","普通会员","专营商","信息站会员","企业会员"], ftypeID: 0, leftDays: 0, cnflag: 0},
	products: [],
	online: {total: 0, count: 0, userIns: 0},
	menus: ",", styleIdx: 1, productClass: 255,
	clipCenter:
	{
		user:{id:0, name:'未知'}, infoCata:{id:0, name:'未知'}, info:{id:0, name:'未知'}, file:null, file2:null, 
		birthday:{dt:null, info:''}, tidings:{maxid:0, t1:[], theid1:0, all:[], theid:0, busy:false},
		pca:[],treenode:[]
	},
	
	_WinMenuEvents: [],
	_WinPosY: 0,
	_exit: "",
	_msg: "",
	_RefreshLunarCalendar: true,
	_activePage: ["前台", null],
	_activePage2: [null, null],
	_isBusySetPage: false,
	
	_pwdLevel : ["高强度","较强","弱"],
	_pwdLevelValue : [30, 20, 0],
	_pwdFactor : [1, 2, 5],
	_pwdKindFactor : [0, 0, 10, 20],
	_pwdRegex : [/[a-zA-Z]/g, /\d/g, /[^a-zA-Z0-9]/g],
	
	_bClsWinCnfm: true,
  	_getDetectorParam: function() 
	{
		var para = "_n=0";
		if(this._RefreshLunarCalendar)
		{	
			para += "&do=f";
			this._RefreshLunarCalendar = false;
		}
		
		var ary = this._activePage;
		if(ary[0] != this._activePage2[0] || ary[1] != this._activePage2[1])
		{
			if(ary[0] && ary[0] != "")	para += "&txtAtInfo=" + escape(ary[0]);
			if(ary[1])	para += "&txtAtHref=" + escape(encodeURI(ary[1]));
			
			this._activePage2 = ary;
		}
		
		ary = null;
		return para;
	},
	
	chooseDocFormat: function(objWin, objPara)
	{
		return EL.showDialog(this.homeUrl + "Tools/DocFormat.aspx?", objPara, 810, 550, true);
	},

	findChildElement: function(element, tagName)
	{
		if(!element || !tagName)	return null;
		if(element.tagName == tagName)	return element;
		
		var isFounded = false;
		var elements = element;
		var result = element;

		while(!isFounded && elements && result && result.tagName != tagName)
		{
			elements = elements.childNodes;
			for(var i=0; (elements && i<elements.length); i++)
			{
				result = elements.item(i);
				if(!result)	continue;
				if(result.tagName == tagName)
				{
					isFounded = true;
					break;
				}
				
				var result2 = this.findChildElement(result, tagName);
				if(!result2)	continue;

				if(result2.tagName == tagName)
				{
					result = result2;
					isFounded = true;
					break;
				}
			}
		}
		
		elements = null;
		
		return isFounded ? result : null;
	},
	findParentElement: function(element, tagName)
	{
		if(!element || !tagName)	return null;
		do
		{
			element = element.parentElement;
		}
		while(element && element.tagName != tagName)
		
		return element;
	},
	isAbsoluteMoveOver: function(elmt)
	{
		if(event)
		{
			var tagName = elmt.tagName;
			var to = findParentElement(event.toElement, tagName);
			var from = findParentElement(event.fromElement, tagName);
			if(elmt === to && from === to)
			{
				tagName = to = from = null;
				return false;
			}
			
			tagName = to = from = null;
		}
		return true;
	},
	
	checkBoxValue: function(obj) 
	{
		if(obj == null)	return;

		var objSpan = this.findChildElement(this.findParentElement(obj, "TD"), "SPAN");
		if(objSpan == null || !objSpan.value)	return;
		var mask = Number(objSpan.value);
		var childs = this.findParentElement(obj, "TABLE").getElementsByTagName("INPUT");
		var cItem, cSpan, cValue;
		for(var i=0; i<childs.length; i++)
		{
			cItem = childs[i];
			if(cItem != obj)
			{
				cSpan = this.findChildElement(this.findParentElement(cItem, "TD"), "SPAN");
				cValue = Number(cSpan.value)
				if(obj.checked)
				{
					if((cValue & mask) == cValue)	cItem.checked = true;
				}
				else 
				{
					if((cValue & mask) == mask)		cItem.checked = false;
				}
			}
		}
		
		mask = cValue = null;
		objSpan = cItem = cSpan = null;
		childs = null;
	},
	checkBoxValue2: function(obj, boxTagName) 
	{
		if(obj == null || obj.tagName != "INPUT")	return;

		var mask = Number(obj.value);
		var childs = this.findParentElement(obj, boxTagName).getElementsByTagName("INPUT");
		var cItem, cValue;
		for(var i=0; i<childs.length; i++)
		{
			cItem = childs[i];
			if(cItem != obj)
			{
				cValue = Number(cItem.value)
				if(obj.checked)
				{
					if((cValue & mask) == cValue)	cItem.checked = true;
				}
				else 
				{
					if((cValue & mask) == mask)		cItem.checked = false;
				}
			}
		}
		
		mask = cValue = null;
		cItem = null;
		childs = null;
	},
	
	pwdStrengthValue: function(pwd)
    {
        var strengthValue = 0;
        var ComposedKind = 0;
        for(var i=0; i<this._pwdRegex.length; i++)
        {
            var chars = pwd.match(this._pwdRegex[i]);
            if(chars != null)
            {
                strengthValue += chars.length * this._pwdFactor[i];
                ComposedKind ++;
            }
        }
        strengthValue += this._pwdKindFactor[ComposedKind];
        ComposedKind = null;
        return strengthValue;
    },
    pwdStrengthLevel: function(pwd)
    {
        var value = this.pwdStrengthValue(pwd);
        for(var i=0; i<this._pwdLevelValue.length; i++)
        {
            if(value >= this._pwdLevelValue[i])	return this._pwdLevel[i];
        }
    },
    pwdSecurity: function(pwd)	{return (this.pwdStrengthValue(pwd) >= this._pwdLevelValue[1]);},
    
    namespace: function(ns) 
    {
		if(!ns || !ns.length)	return null;

		var levels = ns.split(".");
		var nsobj = EIIP;

		for(var i=(levels[0] == "EIIP") ? 1 : 0; i<levels.length; ++i) 
		{
			nsobj[levels[i]] = nsobj[levels[i]] || {};
			nsobj = nsobj[levels[i]];
		}

		return nsobj;
	},
	
	switchUI:function(obj,show){if(show) Element.show(obj); else Element.hide(obj);},
	switchUIByID:function(id,show){this.switchUI($(id),show);},
	
	setTabAct: function(obj,tag)
	{
		var wait;
		if(!obj._tag)	obj._tag = tag || "";
		if(obj.className=="cur"+obj._tag)	return;
		obj.onmouseout=function(){clearTimeout(wait);}
		if(!obj._tabfn) obj._tabfn=function(){EIIP._setTabAct(obj);}
		clearTimeout(wait);
		wait=setTimeout(obj._tabfn, 150);
	},
	_setTabAct: function(obj){
		this._setTabActLoop(obj, "DIV", "DIV", false, this._setTabActLoop(obj, "UL", "SPAN", true, 0));
	},
	_setTabActLoop:function(obj, ptag, tagname, ischild, pos)
	{
		var objs = this.findParentElement(obj, ptag);
		var the,count=0;
		for(var i=0; i<objs.children.length; i++)
		{
			if(ischild)
			{
				the=objs.children[i].children[0];
				if(the.tagName == tagname){
					count++;
					if(the==obj){
						the.className = "cur"+the._tag;
						pos=count;
					}
					else{the.className = "hdn"+the._tag;}
				}
			}
			else
			{
				with(objs.children[i])
				{
					if(tagName == tagname){
						count++;
						className = (count==pos) ? "cur" : "hdn";
					}
				}
			}
		}
		objs=the=null;
		return pos;
	},
	
	Dispose: function()
	{
		EIIP.URL.Dispose();
		
		this._windows = null;
		
		this._pwdLevel.length = 0;
		this._pwdLevel = null;
		this._pwdLevelValue.length = 0;
		this._pwdLevelValue = null;
		this._pwdFactor.length = 0;
		this._pwdFactor = null;
		this._pwdKindFactor.length = 0;
		this._pwdKindFactor = null;
		this._pwdRegex.length = 0;
		this._pwdRegex = null;
		
		EIIP._EditorContent = null;
		
		__ClearExpando(this);
	}
});

EIIP.namespace("URL");
Object.extend(EIIP.URL, {
	params: [],
	parsed: false,
	
	Parse: function(bForce)
	{
		if(this.parsed && !bForce)	return;
		var aParams = document.location.search.substr(1).split('&');
		for(var i=0; i<aParams.length; i++)
		{
			var aParam = aParams[i].split('=');
			this.params[aParam[0]] = aParam[1];
			aParam = null;
		}
		aParams = null;
		this.parsed = true;
	},
	Items: function(paramName)
	{
		if(!this.parsed)	this.Parse();
		return this.params[paramName];
	},
	GetPageName: function(url)
	{
		if(!url || url == '')	url = document.location.search;
		return url.replace(/.+[\\\/]([^\\]+)$/,'$1');
	},
	GetUrlParam: function(paramName, url, defaultV)
	{
		if(!url || url == '')	url = document.location.search;
		var oRegex = new RegExp('[\?&]' + paramName + '=([^&]+)', 'i');
		var oMatch = oRegex.exec(url);
		
		oRegex = null;
		
		if(oMatch && oMatch.length > 1)
			return oMatch[1];
		else
			return defaultV || '';
	},
	GetScriptPath: function(js)
	{
		js = js.toLowerCase();
		var script = document.getElementsByTagName("SCRIPT");
		for(var i=0; i<script.length; i++)
		{
			var s = script[i].src.toLowerCase();
			if(s.indexOf(js) != -1)	return s.replace(js, "");
		}
		return null;
	},
	
	Dispose: function()
	{
		for(var i=this.params.length-1; i>=0; i--)
		{
			this.params[i] = null;
		}
		this.params.length = 0;
		__ClearExpando(this.params);
		this.params = null;
	}
});

EIIP.XML = Class.create();
EIIP.XML.prototype = {
	initialize: function(oXmlHttp) 
	{
		if(oXmlHttp.responseXML.childNodes.length > 0)
		{
			this.DOMDocument = oXmlHttp.responseXML;
		}
		else
		{
			oXmlHttp.responseText.evalScripts();
		}
	},

	selectNodes: function(xpath)
	{
		if(!this.DOMDocument)	return null;
		
		if(document.all)
			return this.DOMDocument.selectNodes(xpath);
		else
		{
			var aNodeArray = new Array();
			var xPathResult = this.DOMDocument.evaluate(xpath, this.DOMDocument, 
					this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), 
					XPathResult.ORDERED_NODE_ITERATOR_TYPE, null);
					
			if(xPathResult) 
			{
				var oNode = xPathResult.iterateNext();
 				while(oNode)
 				{
 					aNodeArray[aNodeArray.length] = oNode;
 					oNode = xPathResult.iterateNext();
 				}
 				oNode = null;
			} 
			
			xPathResult = null;
			return aNodeArray;
		}
	},
	selectSingleNode: function(xpath) 
	{
		if(!this.DOMDocument)	return null;
		
		if(document.all)
			return this.DOMDocument.selectSingleNode(xpath);
		else	
		{
			var xPathResult = this.DOMDocument.evaluate(xpath, this.DOMDocument,
					this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), 9, null);

			if(xPathResult && xPathResult.singleNodeValue)
				return xPathResult.singleNodeValue;
			else	
				return null;
		}
	},
	
	Dispose: function()
	{
		this.DOMDocument = null;
	}
}

EIIP.GRIDCHK = Class.create();
EIIP.GRIDCHK.prototype = {
	initialize: function(objGrid, chkheadid, objHidden) 
	{
		if(objGrid == null)
		{
			alert("EIIP.GRIDCHK 未找到数据表格！");
			return;
		}
		var nodeList = objGrid.getElementsByTagName("INPUT");
		var nodes = $A(nodeList);
		
		this.hdnSelectedValues = objHidden;
		
		var checkHeadID = chkheadid || "chkAll";
		this.checkHeadID = checkHeadID;
		
		this.checkHead = nodes.detect( function(chk){
				return (chk.id == checkHeadID && chk.type == "checkbox" && chk.className == "InRow");
			});
		var checkHead = this.checkHead;
		
		this.checkList = nodes.findAll( function(chk){
				return (chk != checkHead && chk.type == "checkbox" && chk.className == "InRow");
			});
			
		this._Dispose = function()
		{
			nodeList = null;
			nodes = null;
			checkHeadID = null;
		}
	},
	headClick: function(objchk)
	{
		objchk.indeterminate = false;
		var fun = this._changeValues;
		var objhdn = this.hdnSelectedValues;
		this.checkList.each(function(chk){
			if(!chk.disabled)
			{
				chk.checked = objchk.checked;
				fun(chk, objhdn);
			}
		});
		
		fun = null;
		objhdn = null;
	},
	rowClick: function(objchk)
	{
		if(objchk.disabled)	return;
		
		if(this.checkHead)
		{
			this.checkHead.checked = 
				(objchk.checked) ? true : this.checkList.any(function(chk){return chk.checked;});

			if(this.checkHead.checked)
			{
				this.checkHead.indeterminate = this.checkList.any(function(chk){
					return (chk != objchk && objchk.checked != chk.checked);
				});
			}
			else
			{
				this.checkHead.indeterminate = false;
			}
		}
		
		this._changeValues(objchk, this.hdnSelectedValues);
	},
	backCheck: function()
	{
		if(!this.checkList || this.checkList.length == 0)	return;
		
		var fun = this._fromValues;
		var objhdn = this.hdnSelectedValues;
		
		this.checkList.each(function(chk){ fun(chk, objhdn); });
		
		fun = null;
		objhdn = null;
		
		if(this.checkHead)
		{
			this.checkHead.indeterminate = false;
			this.checkHead.checked = this.checkList.any(function(chk){return chk.checked;});

			if(this.checkHead.checked)
			{
				this.checkHead.indeterminate = this.checkList.any(function(chk){return !chk.checked;});
			}
		}
	},
	_changeValues: function(objchk, objhdn) 
	{ 
		if(!objhdn)	return;
		var temp = new String(objhdn.value);
		var ipos = -1;
		if(temp.length > 1)	 ipos = temp.indexOf("," + objchk.value + ",");
		
		if(objchk.checked)
		{
			if(ipos < 0)	objhdn.value += objchk.value + ","; 
		}
		else
		{
			if(ipos >= 0)
			{
				var ilen = objchk.value.length + 1;
				objhdn.value = temp.slice(0, ipos);
				if(temp.length > ipos + ilen)
				{
					objhdn.value += temp.slice(ipos + ilen);
				}
				ilen = null;
			}
		}
		
		temp = ipos = null;
	},
	_fromValues: function(objchk, objhdn) 
	{ 
		if(!objhdn)	return;
		var ptemp = new String((objhdn.pvalue || ""));
		var temp = new String(objhdn.value);
		var strValue = "," + objchk.value + ",";
		
		if(ptemp.length > 1 && (ptemp.indexOf(strValue) >= 0))
		{
			objchk.checked = true;
			objchk.disabled = true;
		}
		else if(temp.length > 1)
		{
			objchk.checked = (temp.indexOf(strValue) >= 0);
		}
		
		ptemp = temp = strValue = null;
	},
	
	Dispose: function()
	{
		this._Dispose();
		
		this.checkHead = null;
		this.checkList = null;
		this.hdnSelectedValues = null;
		this.checkHeadID = null;
		
		__ClearExpando(this);
	}
}

EIIP.POPWIN = function(id)
{
	this.tmrId = -1;
	this.tmrHide = -1;
	this.IEFilters = true;
	this.id = id || 'popBlue';
	
	this.startTime = 1000;
	this.hideAfter = 5000;
	this.autoShow = true;
	this.speed = 20;
	this._winStyle = 'menubar=no,resizable=no,status=no,toolbar=no,location=no,';
	this.winStyle = 'width=400,height=250,scrollbars=yes';
	this.showBy = null;
	this.dxTimer = -1;
	this.bChangeTexts = false;
	
	var instance = this;
	
	this.CreateInstance=function()
	{
		Event.observe(window, 'load', instance.espopup_winLoad);
		Event.observe(window, 'scroll', instance.espopup_winScroll);
	}
	
	this.espopup_winLoad = function() {
		instance.elCnt = $(instance.id + '_content');
		instance.elTit = $(instance.id + '_header');
		
		instance.elMsg = $(instance.id + 'aCnt');
		instance.elTitle = $(instance.id + 'titleEl');

		instance.el = $(instance.id);

		instance.oldLeft = instance.el.style.left;
		instance.popupBottom = parseInt(instance.el.style.bottom) || "";
	    
		instance.titHgt = parseInt(instance.elTit.style.height) || "";
		instance.popupHgt = parseInt(instance.el.style.height) || "";
		instance.actualHgt = 0;
		instance.cntDelta = instance.popupHgt - (parseInt(instance.elCnt.style.height) || "");

		if(instance.autoShow)
		{
			instance.resetTimer=true;
			instance.espopup_ShowPopup(null);
		}
	}

	this.espopup_winScroll = function()
	{
		if(instance.tmrHide != -1)
		{
			instance.el.style.display='none'; 
			instance.el.style.display='block';
		}
	}

	this.espopup_ShowPopup = function(show)
	{
		if(instance.dxTimer != -1)	instance.el.filters.blendTrans.stop();

		if((instance.tmrHide != -1) && ((show != null) && (show == instance.showBy)))
		{
			clearInterval(instance.tmrHide);
			instance.tmrHide = setInterval(instance.espopup_tmrHideTimer, instance.hideAfter);
			return;
		}
		
		if(instance.tmrId != -1) return;
		
		instance.showBy = show;

		instance.el.style.left = instance.oldLeft;
		instance.el.style.top = '';
		instance.el.style.filter = '';

		if(instance.tmrHide != -1) clearInterval(instance.tmrHide); 
		
		instance.tmrHide = -1;

		instance.elTit.style.display = 'none';
		instance.elCnt.style.display = 'none';

		if(navigator.userAgent.indexOf('Opera') != -1)
			instance.el.style.bottom = (document.body.scrollHeight*1-document.body.scrollTop*1
						-document.body.offsetHeight*1+1*instance.popupBottom)+'px';
	    
		if(instance.bChangeTexts)
		{
			instance.bChangeTexts = false;
			if(this.msgsound != null)
			{
				instance.elMsg.innerHTML =  instance.nMsg + this._getSound(this.msgsound);
			}
			else
			{
				instance.elMsg.innerHTML = instance.nMsg;
			}
			instance.elTitle.innerHTML = instance.nTitle + this._getSound(this.soundfile);
		}

		instance.actualHgt = 0; 
		instance.el.style.height = instance.actualHgt + 'px';
		instance.el.style.visibility = '';
		
		if(!instance.resetTimer) instance.el.style.display='';
		instance.tmrId = setInterval(instance.espopup_tmrTimer, (instance.resetTimer ? instance.startTime : 20));
	}
	
	this.IShowing = function()
	{
		return (instance.el.style.display != 'none' && instance.el.style.visibility != 'hidden');
	}
	this._getSound = function(file)
	{
		return "<EMBED src='" + file + "' hidden='true' width=0 height=0 AUTOSTART='TRUE' loop='false'></EMBED>";
	}

	this.espopup_tmrTimer = function()
	{
		if(instance.resetTimer)
		{
			instance.el.style.display='';
			clearInterval(instance.tmrId); 
			instance.resetTimer=false;
			instance.tmrId=setInterval(instance.espopup_tmrTimer, instance.speed);
		}
		
		instance.actualHgt+=5;
		
		if(instance.actualHgt >= instance.popupHgt)
		{
			instance.actualHgt=instance.popupHgt; 
			clearInterval(instance.tmrId); instance.tmrId=-1;
			instance.elCnt.style.display='';
			if(instance.hideAfter != -1) instance.tmrHide=setInterval(instance.espopup_tmrHideTimer, instance.hideAfter);
		}
		
		if(instance.titHgt<instance.actualHgt-6)	instance.elTit.style.display='';
		
		if((instance.actualHgt-instance.cntDelta)>0)
		{
			instance.elCnt.style.display='';
			instance.elCnt.style.height=(instance.actualHgt-instance.cntDelta)+'px';
		}
		instance.el.style.height=instance.actualHgt+'px';
	}

	this.espopup_tmrHideTimer = function()
	{
		clearInterval(instance.tmrHide); 
		instance.tmrHide = -1;
		if(instance.IEFilters)
		{
			instance.el.style.filter='blendTrans(duration=1)';
			instance.el.filters.blendTrans.apply();
			instance.el.style.visibility='hidden';
			instance.el.filters.blendTrans.play();
		    
			instance.dxTimer = setInterval(instance.espopup_dxTimer, 1000);
		}
		else instance.el.style.visibility='hidden';
	}

	this.espopup_dxTimer = function()
	{
		clearInterval(instance.dxTimer); 
		instance.dxTimer=-1;
	}

	this.espopup_Close = function()
	{
		if(instance.tmrId==-1)
		{
			instance.el.style.filter='';
			instance.el.style.display='none';
			if(instance.tmrHide!=-1) clearInterval(instance.tmrHide); 
			instance.tmrHide=-1;
			
			if(instance.ClosedCommand)	instance.ClosedCommand();
		}
	}
	
	this.espopup_ShowWindow = function(url)
	{
		if(instance.LinkCommand)
		{
			instance.LinkCommand();
		}
		else
		{
			if(instance.nWin != null)	instance.nWin.close();
			instance.nWin=window.open(url, instance.id + 'nWin', instance._winStyle + instance.winStyle);
		}
	}
	
	this.espopup_DragDrop = function(e)
	{
		instance.mousemoveBack=document.body.onmousemove;
		instance.mouseupBack=document.body.onmouseup;
		ox=(e.offsetX==null)?e.layerX:e.offsetX;
		oy=(e.offsetY==null)?e.layerY:e.offsetY;
		instance.ofsX=ox; 
		instance.ofsY=oy;

		document.body.onmousemove = instance.espopup_DragDropMove;
		document.body.onmouseup = instance.espopup_DragDropStop;
		if(instance.tmrHide!=-1) clearInterval(instance.tmrHide);
	}

	this.espopup_DragDropMove = function(e)
	{
		if(e == null)	e = event;
		
		instance.el.style.left = (e.clientX*1+document.body.scrollLeft-instance.ofsX)+'px';
		instance.el.style.top = (e.clientY*1+document.body.scrollTop-instance.ofsY)+'px';
		e.cancelBubble = true;
		
		if((e.button & 1)==0) instance.espopup_DragDropStop();
	}

	this.espopup_DragDropStop = function()
	{
		document.body.onmousemove=instance.mousemoveBack;
		document.body.onmouseup=instance.mouseupBack;
	}
	
	this.Dispose = function()
	{
		Event.stopObserving(window, 'load', instance.espopup_winLoad);
		Event.stopObserving(window, 'scroll', instance.espopup_winScroll);
		instance.elMsg = instance.elTitle = null;
		instance.elCnt = instance.elTit = null;
		instance.el = null;
		
		clearInterval(instance.dxTimer); 
		instance.dxTimer = -1;
		
		__ClearExpando(instance);
		instance = null;
		
		__ClearExpando(this);
	}
}

EIIP.ToolTab = Class.create();
EIIP.ToolTab.prototype = {
	initialize: function(name, doc) 
	{
		this.ID = name || "el_tab";
		this.tablist = new Array();
		this.vpath = EIIP.homeUrl;
		this.doc = doc || document;
	},
	
	ExcuteCmdName: function(cname)
	{
		for(var i=0; i<this.tablist.length; i++)
		{
			if(cname == this.tablist[i].cmdname)
			{
				var obj = $(this.tablist[i].ID);
				if(obj != null)
				{
					obj.click();
					obj.value = true;
				}
				obj = null;
				return true;
			}
		}
		
		return false;
	},
	
	Excute: function(objTab)
	{
		if(objTab == null)	return;
		var obj = $(objTab.ID);
		if(obj != null && !this.makeBoolean(obj.cooldisabled))
		{
			obj.click();
			obj.value = true;
		}
		obj = null;
	},
	
	makeBoolean: function(value)
	{
		if(value == true || value == false)	return value;
		if(value == null)	return false;
	        
		switch(value.toLowerCase())
		{
			case "true":
				return true;
			case "false":
				return false;
			default:
				return false;
		}
	},
	
	theTab: function(name, tip, icon, groupid, type, jsfun, checked, unenable, cmdname)
	{
		this.name = name;
		this.jsfun = jsfun;
		this.icon = icon;
		this.groupid = groupid;
		this.type = type;
		this.checked = checked;
		this.unenable = unenable;
		this.toString = toString;
		this.cmdname = cmdname;
		this.tip = tip;
		this.vpath = EIIP.homeUrl;
		
		function toString() 
		{
			var objCell;
			if(this.type == "tabHandle")
			{
				objCell = "<td width=6 height=26 align=center><img src='" + this.vpath + "images/m_hdl.gif' hspace=2 align=absbottom></td><td nowrap id=" + this.ID + ">";
				if(this.name != null && this.name != '')	objCell += "&nbsp;<font color=#696969>" + this.name + "</font>&nbsp;";
				objCell += "</td>";
			}
			else if(this.type == "tabSeparator")
			{
				objCell = "<td width=13 height=26 align=right background='" + this.vpath + "images/m_sep.gif'><img src='" + this.vpath + "images/m_hdl.gif' hspace=2 align=absbottom></td><td nowrap id=" + this.ID + ">";
				if(this.name != null && this.name != '')	objCell += "&nbsp;<font color=#696969>" + this.name + "</font>&nbsp;";
				objCell += "</td>";
			}
			else
			{
				objCell = "<td width=64><table class='TabObject' width=100% border=0 cellspacing=2 cellpadding=0><tr valign=middle><td height=24 nowrap class=btnTab";
				objCell += " id=" + this.ID + " onmouseover=\"this.className='btnTabOvr';\" onmouseout=\"this.className='btnTab';\" onmouseup=\"this.className='btnTabUn';\" onmousedown=\"this.className='btnTabDwn';\"";
				if(this.tip != null && this.tip != "")	objCell += " title=\"" + this.tip + "\"";
				if(this.jsfun != null && this.jsfun != "")	objCell += " onClick=\"" + this.jsfun + "\"";
				if(this.type != null && this.type != "")		objCell += " buttontype='" + this.type + "'";
				if(this.groupid != null && this.groupid != "")	objCell += " name='" + this.groupid + "'";
				if(this.checked != null)	objCell += " value='" + this.checked + "'";
				if(this.unenable != null)	objCell += " cooldisabled='" + this.unenable + "'";
				objCell += "><img src='" + this.vpath +  this.icon + "' hspace=2 align=absmiddle>" + this.name + "&nbsp; </td></tr></table></td>";
			}
			
			return objCell;
		}
	},

	addTabCell: function(name, tip, icon, groupid, type, jsfun, checked, unenable, cmdname)
	{
		var tab = new this.theTab(name, tip, icon, groupid, type, jsfun, checked, unenable, cmdname);
		this.tablist[this.tablist.length] = tab;
		tab.ID = this.ID + "_cell_" + (this.tablist.length - 1);
		return tab;
	},

	addTabRadio: function(name, tip, icon, groupid, jsfun, checked, unenable, cmdname)
	{
		return this.addTabCell(name, tip, icon, groupid, "radio", jsfun, checked, unenable, cmdname)
	},
	addTabButton: function(name, tip, icon, jsfun, unenable, cmdname)
	{
		return this.addTabCell(name, tip, icon, null, "", jsfun, null, unenable, cmdname)
	},

	addTabHandle: function(name)
	{
		var tab = new this.theTab(name, null, null, null, "tabHandle");
		this.tablist[this.tablist.length] = tab;
		tab.ID = this.ID + "_hdl_" + (this.tablist.length - 1);
		return tab;
	},
	addTabSeparator: function(name)
	{
		var tab = new this.theTab(name, null, null, null, "tabSeparator");
		this.tablist[this.tablist.length] = tab;
		tab.ID = this.ID + "_sep_" + (this.tablist.length - 1);
		return tab;
	},

	showTab: function(objPlace)
	{
		if(this.tablist.length == 0)	return;
		var outline = "<table border=0 cellpadding=0 cellspacing=0 class='TabBars'><tr>";
		for(var i=0; i<this.tablist.length; i++)
		{
			outline += this.tablist[i].toString();
		}
		outline += "<td width=6 background='" + this.vpath + "images/m_sep.gif'></td><td width=100%></td></tr></table>";
		
		if(objPlace == null)
		{
			this.doc.write(outline);
		}
		else
		{
			objPlace.innerHTML = outline;
		}
		
		outline = null;
	},
	
	Dispose: function()
	{
		this.ID = this.vpath = null;
		this.doc = null;
		
		for(var i=this.tablist.length-1; i>=0; i--)
		{
			this.tablist[i] = null;
		}
		this.tablist.length = 0;
		__ClearExpando(this.tablist);
		this.tablist = null;
	}
}

EIIP.ProgressBar = Class.create();
EIIP.ProgressBar.prototype = {
	initialize: function(objBar, objInfo) 
	{
		this.totalSize = 100;
		this.sizeCompleted = 0;
		this.progressBar = objBar;
		this.progressBarInfo = objInfo;
	},

	setSize: function(totalSize, size)
	{
		if(totalSize <= 0)	return;
		this.totalSize = totalSize;
		
		if(size < 0)
		{
			this.sizeCompleted = 0;
		}
		else if(size > this.totalSize)
		{
			this.sizeCompleted = this.totalSize;
		}
		else
		{
			this.sizeCompleted = size;
		}

		this.progressBar.style.width = this.getPercent();
		this.progressBarInfo.innerHTML = this.getProgressInfo();
	},
	getPercent: function()
	{
		if(this.sizeCompleted == 0)	return "0%";
		return Math.round(this.sizeCompleted / this.totalSize * 100) + "%";
	},
	getProgressInfo: function()
	{
		var sizeLeft = this.totalSize;
		if(this.sizeCompleted > 0)
		{
			sizeLeft -= this.sizeCompleted;
			if(sizeLeft < 1)	return "上传结束";
		}
		
		sizeLeft = Math.round(sizeLeft / 102.4) / 10;
		if(sizeLeft < 1025)	return "传输: 剩余 " + sizeLeft + " KB";
		
		sizeLeft = Math.round(sizeLeft / 102.4) / 10;
		return "传输: 剩余 " + sizeLeft + " MB";
	},
	
	runError: function(msg)
	{
		this.progressBarInfo.innerHTML = msg || "上传失败";
		this.progressBar.style.width = "0";
		this.sizeCompleted = 0;
	},
	runComplete: function(msg)
	{
		this.progressBarInfo.innerHTML = msg || "文件已经上传完成";
		this.progressBar.style.width = "100%";
		this.sizeCompleted = 0;
	},
	
	Dispose: function()
	{
		this.progressBar = null;
		this.progressBarInfo = null;
	}
}
}// End of EIIP

var STATE_OFF = 0;
var STATE_ON = 1;
var STATE_DISABLED = -1;
var ONLYICON = 0;
var ONLYTEXT = 1;
var ICONTEXT = 2;

EDWIN.__DisposObjects = [];
EDWIN.__LoadObjects = [];

function __Load()
{
	for(var i=0; i<EDWIN.__LoadObjects.length; i++)
	{
		if(EDWIN.__LoadObjects[i])	EDWIN.__LoadObjects[i]();
	}
}
function __AddLoadObject(obj)
{
	if(typeof(obj)=='function')	EDWIN.__LoadObjects[EDWIN.__LoadObjects.length] = obj;
}

function __Dispose()
{
	if(window._Edwindow)	window._Edwindow = null;
	if(document.childWin)	document.childWin = null;
	
	for(var i=EDWIN.__DisposObjects.length-1; i>=0; i--)
	{
		if(EDWIN.__DisposObjects[i] && EDWIN.__DisposObjects[i].Dispose)	EDWIN.__DisposObjects[i].Dispose();
		EDWIN.__DisposObjects[i] == null;
	}
	EDWIN.__DisposObjects.length = 0;
	
	for(var i=EDWIN.__LoadObjects.length-1; i>=0; i--)
	{
		EDWIN.__LoadObjects[i] == null;
	}
	EDWIN.__LoadObjects.length = 0;
	
	EIIP = null;
	EL.Dispose(); EL = null;
	
	if(EDWIN.Dispose)	EDWIN.Dispose();
	__ClearExpando(EDWIN);
	EDWIN = null;
	
	Event.stopObserving(window, 'load', __Load, false);
	Event.stopObserving(window, 'unload', __Dispose, false);
	CollectGarbage();
}
function __AddDisposObject(obj)
{
	if(obj && obj.Dispose)	EDWIN.__DisposObjects[EDWIN.__DisposObjects.length] = obj;
}
function __ClearExpando(theObject)
{
	if(!theObject)	return;
	
	if(theObject.constructor)
	{
		var obj = new theObject.constructor();
		for(var key in theObject)
		{
			if(obj[key] !== theObject[key])
			{
				obj[key] = null;
				theObject[key] = null; //delete theObject[key];
			}
		}
		obj = null;
    }
    else
    {
		for(var key in theObject)
		{
			theObject[key] = null; //delete theObject[key];
		}
    }
}

Event.observe(window, 'load', __Load, false);
Event.observe(window, 'unload', __Dispose, false);

var ELPanel = Class.create();
ELPanel.prototype = {
	initialize: function(cssfile, win) 
	{
		this.StyleSheet = cssfile;
		this.Window = win ? win : window;
	},
	
	Create: function()
	{
		this._Popup = this.Window.createPopup();
		this.Document = this._Popup.document;
		this.Document.oncontextmenu = function(){ return false;};
		
		if(this.StyleSheet)	this.Document.createStyleSheet(this.StyleSheet);
		this.PanelDiv = this.Document.body.appendChild(this.Document.createElement('DIV'));
		this.PanelDiv.className = 'EL_Panel';
		this.Created = true;
	},
	
	Show: function(x, y, oElement, w, h, auto)
	{
		if(!this.Created)	this.Create();
		this._Popup.show(x,y,0,0,oElement);
		
		var G = (!w ||(auto && w > this.PanelDiv.offsetWidth)) ? this.PanelDiv.offsetWidth : w;
		var I = (!h ||(auto && h > this.PanelDiv.offsetHeight))? this.PanelDiv.offsetHeight: h;
		
		this.PanelDiv.style.height = I;
		this._Popup.show(x, y, G, I, oElement);
	},
	
	Hide: function()
	{
		if(this._Popup)	this._Popup.hide();
	},
	
	Dispose: function()
	{
		this.StyleSheet = null;
		this.PanelDiv = null;
		this.Document.oncontextmenu = null;
		this.Document = null;
		this._Popup.hide();
		this._Popup = null;
		this.Window = null;
	}
}

var _SpecialCombo = Class.create();
_SpecialCombo.prototype = {
	initialize: function(caption) 
	{
		this.FieldWidth = 80;
		this.PanelWidth = 130;
		this.PanelMaxHeight = 350;
		this.Label = '&nbsp;';
		this.Tooltip = this.Caption = caption || "";
		this.Style = ICONTEXT;
		this.Enabled = true;
		this.HomeUrl = EIIP.homeUrl;
		this.Items = new Object();
		this._Panel = new ELPanel(EIIP.homeUrl + 'inc/css/control.css');
		this._Panel.Create();
		this._Panel.PanelDiv.className += ' SC_Panel';
		this._Panel.PanelDiv.innerHTML = '<table cellpadding="0" cellspacing="0" width="100%" style="TABLE-LAYOUT:fixed"><tr><td nowrap></td></tr></table>';
		this._ItemsHolderEl = this._Panel.PanelDiv.getElementsByTagName('TD')[0];
	},
	
	AddItem: function(id, text, label)
	{
		var objDiv = this._ItemsHolderEl.appendChild(this._Panel.Document.createElement('DIV'));
		objDiv.className = objDiv.originalClass = 'SC_Item';
		objDiv.innerHTML = text;
		objDiv.ItemID = id;
		objDiv.ItemLabel = label ? label : text;
		objDiv.title = objDiv.ItemLabel.stripTags();
		objDiv._specialcombo = this;
		objDiv.Selected = false;
		objDiv.onmouseover = function(){this.className += ' SC_ItemOver';};
		objDiv.onmouseout = function() {this.className = this.originalClass;};
		objDiv.onclick = function() 
					{
						this._specialcombo._Panel.Hide();
						this._specialcombo.SetLabel(this.ItemLabel);
						if(typeof(this._specialcombo.OnSelect) == 'function')
						{
							this._specialcombo.OnSelect(this);
						}
					};
					
		this.Items[id.toString().toLowerCase()] = objDiv;
		return objDiv;
	},
	
	GetItem: function(id)
	{
		return this.Items[id.toString().toLowerCase()];
	},
	SelectItem: function(id)
	{
		id = (id != null) ? id.toString().toLowerCase() : '';
		var item = this.Items[id];
		if(item)
		{
			item.className = item.originalClass = 'SC_ItemSelected';
			item.Selected = true;
			this.Instance.ValueInput.value = item.ItemID;
			
			item = null;
		}
		else
		{
			this.Instance.ValueInput.value = "";
		}
	},
	SetSelected: function(id)
	{
		id = (id != null) ? id.toString().toLowerCase() : '';
		var item = this.Items[id];
		
		if(item)
		{
			item.onclick();
			item = null;
			return true;
		}
		else 
			return false;
	},
	
	DeselectAll: function()
	{
		for(var i in this.Items)
		{
			with(this.Items[i])
			{
				className = originalClass = 'SC_Item';
				Selected = false;
			}
		}
	},
	
	SetLabelById: function(id)
	{
		id = (id != null) ? id.toString().toLowerCase() : '';
		var item = this.Items[id];
		this.SetLabel(item ? item.ItemLabel : '');
		item = null;
	},
	
	SetLabel: function(label)
	{
		this.Label = (label.length == 0) ? '&nbsp;' : label;
		if(this._LabelEl) this._LabelEl.innerHTML = this.Label;
	},
	
	SetEnabled: function(b)
	{
		this.Enabled = b;
		this._OuterTable.className = b ? '' : 'SC_FieldDisabled';
	},
	
	Create: function(objHolder)
	{
		this._OuterTable = objHolder.appendChild(document.createElement('TABLE'));
		this._OuterTable.cellPadding=0;
		this._OuterTable.cellSpacing=0;
		this._OuterTable.insertRow(-1);
		var hasAll = (this.Style == ICONTEXT);
		
		if(hasAll && this.Caption && this.Caption.length > 0)
		{
			var D = this._OuterTable.rows[0].insertCell(-1);
			D.unselectable = 'on';
			D.innerHTML = this.Caption;
			D.className = 'SC_FieldCaption';
			D = null;
		}
		
		var E = this._OuterTable.rows[0].insertCell(-1).appendChild(document.createElement('DIV'));

		if(hasAll)
		{
			E.className = 'SC_Field';
			E.style.width = this.FieldWidth + 'px';
			E.innerHTML = '<table title="' + this.Tooltip + '" width="100%" cellpadding=0 cellspacing=0 style="TABLE-LAYOUT:fixed;" unselectable="on"><tbody><tr><td class="SC_FieldLabel" unselectable="on"><label unselectable="on">&nbsp;</label></td><td class="SC_FieldButton" unselectable="on">&nbsp;</td></tr></tbody></table>';
			this._LabelEl = E.getElementsByTagName('label')[0];
			this._LabelEl.innerHTML = this.Label;
		}
		else
		{
			E.className = 'TB_Button_Off';
			E.innerHTML = '<table title="' + this.Tooltip + '" cellspacing="0" cellpadding="0" border="0" unselectable="on">'
				+'<tr><td class="TB_Text" unselectable="on">'+this.Caption
				+'</td><td class="TB_ButtonArrow" unselectable="on"><img src="'+ this.HomeUrl 
				+'images/arrow.gif" width="5" height="3"></td></tr></table>';
		}
		
		E.ELComboBox = this;
		
		E.onmouseover=function ()
			{
				if(!this.ELComboBox.Enabled)	return;
				this.className = (this.ELComboBox.Style == ICONTEXT)?'SC_Field SC_FieldOver':'TB_Button_On';
			};
		E.onmouseout=function(){this.className = (this.ELComboBox.Style == ICONTEXT)? 'SC_Field' : 'TB_Button_Off';};
		E.onclick=function (e)
			{
				if(this.ELComboBox.Enabled)
				{
					var oPanel = this.ELComboBox._Panel;
					if(typeof(this.ELComboBox.OnBeforeClick) == 'function') 
						this.ELComboBox.OnBeforeClick(this.ELComboBox);
					
					if(this.ELComboBox._ItemsHolderEl.offsetHeight > this.ELComboBox.PanelMaxHeight) 
					{
						oPanel.PanelDiv.style.height=this.ELComboBox.PanelMaxHeight+'px';
					}
					else 
					{
						oPanel.PanelDiv.style.height=this.ELComboBox._ItemsHolderEl.offsetHeight+'px';
					}
					
					oPanel.PanelDiv.style.width = this.ELComboBox.PanelWidth + 'px';
					oPanel.Show(0, this.offsetHeight, this, null, this.ELComboBox.PanelMaxHeight, true);
					
					oPanel = null;
				}
				return false;
			};
			
		this.Instance.ComboBoxDiv = E;

		E = null;
		hasAll = null;
	},
	
	Dispose: function()
	{
		for(var key in this.Items)
		{
			this.Items[key]._specialcombo = null;
			this.Items[key].onclick = null;
			this.Items[key] = null;
		}

		this.Items = null;
		this._ItemsHolderEl = null;

		if(this._LabelEl)	this._LabelEl = null;
		this.Instance.ComboBoxDiv.ELComboBox = null;
		this.Instance.ComboBoxDiv.onmouseover = null;
		this.Instance.ComboBoxDiv.onmouseout = null;
		this.Instance.ComboBoxDiv.onclick = null;
		this.Instance.ComboBoxDiv = null;
		if(this.Instance.ValueInput)	this.Instance.ValueInput = null;
		this.Instance = null;
		this._OuterTable = null;
		
		if(this.OnBeforeClick)	this.OnBeforeClick = null;
		if(this.OnSelect)	this.OnSelect = null;
		if(this.Command)	this.Command = null;
		this._Panel.Dispose();
		this._Panel = null;
	}
}

var SpecialCombo = Class.create();
SpecialCombo.prototype = {
	initialize: function() 
	{
	},

	CreateInstance: function(placeholder)
	{
		this._Combo = new _SpecialCombo(this.Label);
		this._Combo.FieldWidth = this.FieldWidth!=null ? this.FieldWidth : 100;
		this._Combo.PanelWidth = this.PanelWidth!=null ? this.PanelWidth : this._Combo.FieldWidth;
		this._Combo.PanelMaxHeight = this.PanelMaxHeight!=null ? this.PanelMaxHeight : 150;
		this._Combo.Tooltip = this.Tooltip || "";
		if(this.Style != null)	this._Combo.Style = this.Style;
		this._Combo.Instance = this;
		this.CreateItems();
		this._Combo.Create(placeholder);
		if(!this.Command)	this.Command = new ELDefaultCommand();
		this.Command.combo = this._Combo;
		this._Combo.Command = this.Command;
		this._Combo.OnBeforeClick=this.Command.RefreshVisibleItems;
		this._Combo.OnSelect = function(item){this.Command.Execute(item);this.Instance.RefreshState();};
		
		__AddDisposObject(this);
	},
	
	RefreshState: function()
	{
		var state;
		var cmdstate = this.Command.GetState();
		if(cmdstate === STATE_DISABLED)
		{
			state = STATE_DISABLED;
		}
		else
		{
			state = STATE_ON;
			if(this.RefreshActiveItems)
			{
				this.RefreshActiveItems(cmdstate);
			}
			else
			{
				this._Combo.DeselectAll();
				this._Combo.SelectItem(cmdstate);
				this._Combo.SetLabelById(cmdstate);
			}
		}
		
		if(state == this.State) return;
		if(state == STATE_DISABLED)
		{
			this._Combo.DeselectAll();
			this._Combo.SetLabel('');
		}
		
		this.State = state;
		this._Combo.SetEnabled(state != STATE_DISABLED);
		
		state = null;
		cmdstate = null;
	},
	
	Enable: function(){this.RefreshState();},
	Disable: function()
	{
		this.State = STATE_DISABLED;
		this._Combo.DeselectAll();
		this._Combo.SetLabel('');
		this._Combo.SetEnabled(false);
	},

	CreateItems: function()
	{
		if(!this.Data)	return;
		
		var data = this.Data;
		for(var i=0;i<data.length;i++)
		{
			if(data[i].length < 2) continue;
			
			if(data[i].length == 2)
			{
				this._Combo.AddItem(data[i][0],data[i][1],data[i][1]);
			}
			else
			{
				this._Combo.AddItem(data[i][0],data[i][1],data[i][2]);
			}
		}
		
		data = null;
	},
	RefreshActiveItems: function(id)
	{
		this._Combo.DeselectAll();
		this._Combo.SelectItem(id);
		this._Combo.SetLabelById(id);
	},
	
	Dispose: function()
	{
		this._Combo.Dispose();

		if(this._Combo.Instance)	this._Combo.Instance = null;
		if(this._Combo.Command)	this._Combo.Command = null;
		if(this._Combo.OnBeforeClick)	this._Combo.OnBeforeClick = null;
		if(this._Combo.OnSelect)	this._Combo.OnSelect = null;
		this._Combo = null;

		this.Command.combo = null;
		this.Command.Dispose();
		__ClearExpando(this.Command);
		this.Command = null;
		
		if(this.Data)	this.Data = null;
	}
}

var ELDefaultCommand=Class.create();
ELDefaultCommand.prototype={
	initialize:function(){this.StateFunction=this.StateFunctionParam=this.Item=null;},
	Execute:function(item){this.Item=item;},
	GetState:function(){return this.StateFunction?this.StateFunction(this.StateFunctionParam):this.Item.ItemID;},
	_RefreshVisibleItems:function(combo){
		var oid;
		for(var id in combo.Items){
			if(id=="1"){combo.Items[id].style.display=''; if(oid==null)	oid=id;}
			else combo.Items[id].style.display='none';
		}
		if(oid!=null) combo.SetSelected(oid);
	},
	Dispose:function(){
		this.StateFunction=null;
		this.StateFunctionParam=null;
		this.Item=null;
	}
}

EIIP._Panel=Class.create();
EIIP._Panel.prototype={
	initialize:function(){},
	_init:function(w,h){
		this.objText=$(this.ltbID);
		this.objText.onblur=this.hideDiv.bind(this);
		this.objText.onkeydown=this.keypressHandler.bind(this);
		this.objText.onselectstart=function(){return false;};
		this.objText.autocomplete="off";
		this.objPanel=null;
		this.objIFrame=null;
		this.panelID=this.ltbID+"_pnl";
		this.ifrmID=this.ltbID+"_ifr";
		this.width=120;
		this.height=h||100;
		this.pageSize=0;
		this.objHdn=$(this.ltbID+'_TB2');
		this.value=this.objHdn.value;
		this.valueLast="";
		this.created=false;
	},
	setValue:function(v){
		for(var i=0;i<this.Data.length;i++){
			if(this.Data[i][0]==v){
				this.valueLast=this.value;
				this.objHdn.value=this.value=v;
				this.objText.value=this.Data[i][1];
				return true;
			}
		}
		return false;
	},
	getValue:function(){return this.objHdn.value;},
	getText:function(){return this.objText.value;},
	keypressHandler:function(evt){
		var div=this.getPanel();
		evt=evt||window.event;
		var key=evt.keyCode;
		var KEYUP=38,KEYDOWN=40,KEYENTER=13,KEYTAB=9,KEYBK=8,KEYPGUP=33,KEYPGDN=34;
		if(div.style.visibility=="hidden"&&(key==KEYTAB||key==KEYENTER)) return key==KEYTAB;
		if(key==KEYBK) return false;
		if(key!=KEYUP&&key!=KEYDOWN&&key!=KEYENTER&&key!=KEYTAB&&key!=KEYPGUP&&key!=KEYPGDN) return true;
		if(!this.created) this.show();
		var idx=this.getCurrIdx(div);
		var curDiv=this.setCurrDiv(div,idx);
		if(this.pageSize==0) this.pageSize=parseInt(div.offsetHeight/curDiv.offsetHeight);
		switch(key){
			case KEYENTER:
			case KEYTAB:
				if(curDiv) this.selectItem(curDiv);
				evt.cancelBubble=true;
				return false;
			case KEYUP: curDiv=this.setCurrDiv(div,idx-1); break;
			case KEYDOWN:curDiv=this.setCurrDiv(div,idx+1);break;
			case KEYPGUP:curDiv=this.setCurrDiv(div,idx-this.pageSize);break;
			case KEYPGDN:curDiv=this.setCurrDiv(div,idx+this.pageSize);break;
		}
		this.showDiv(true);
		return true;
	},
	getPanel:function(){
		if(this.objPanel) return this.objPanel;
		this.objPanel=$(this.panelID);
		if(!this.objPanel){
			var n=document.createElement("div");
			n.setAttribute("id", this.panelID);
			document.body.appendChild(n);
			this.objPanel=$(this.panelID);
		}
		var obj=$(this.ltbID);
		var x=obj.offsetLeft;
		var y=obj.offsetTop+obj.offsetHeight+3;
		while(obj.offsetParent){
			obj=obj.offsetParent;
			x+=obj.offsetLeft;
			y+=obj.offsetTop;
		}
		this.objPanel.className="float";
		this.objPanel.style.width=this.width+"px";
		this.objPanel.style.left=x+"px";
		this.objPanel.style.top=y+"px";
		return this.objPanel;
	},
	setWidth:function(w){if(this.objPanel) this.objPanel.style.width=w+"px"; else this.width=w;},
	getCurrIdx:function(div){
		var ary=div.getElementsByTagName("div");
		if(ary){for(var i=0;i<ary.length;i++){if(ary[i].className=='active') return i;}}
		return -1;
	},
	setCurrDiv:function(div,idx){
		var divs=div.getElementsByTagName("div");
		if(!divs) return null;
		var thisDiv;
		if(idx==-1||idx>divs.length) idx=divs.length-1;
		else if(idx==divs.length||idx<-1) idx=0;
		for(var i=0;i<divs.length;i++){
			if(i==idx){thisDiv=divs[i]; this.setState(thisDiv,true,false);}
			else this.setState(divs[i],false,false);
		}
		return thisDiv;
	},
	selectItem:function(item){
		if(!item) item=this;
		if(item.className=="active"){
			this.objText.value=this.objText.title=item.val;
			this.valueLast=this.value;
			this.objHdn.value=this.value=item.key;
			var divs=this.getPanel().getElementsByTagName("div");
			for(var i=0;i<divs.length;i++) divs[i].originalClass='item';
			item.originalClass=item.className='cur';
			this.objText.focus();
			this.showDiv(false);
			if(typeof(this.OnSelect)=='function') this.OnSelect(item);
			return;
		}
	},
	setState:function(item,act,hold){
		if(!item) item=this;
		if(act==true){
			var a=item.offsetTop-item.parentNode.scrollTop;
			var b=item.parentNode.offsetHeight-item.offsetHeight;
			if(a<0) item.parentNode.scrollTop=item.offsetTop-2;
			else if(a>b) item.parentNode.scrollTop+=a-b+4;
			item.className='active';
			if(hold==true) item.originalClass='active';
		}else{
			if(hold==true) item.originalClass='item';
			item.className=item.originalClass;
		}
	},
	hideDiv:function(){this.showDiv(false);},
	showDiv:function(show){
		if(this.objPanel){this.objPanel.style.visibility=show?"visible":"hidden"; this.adjustiFrame();}
	},
	adjustiFrame:function(){
		if(!this.objIFrame){
			this.objIFrame=$(this.ifrmID);
			if(!this.objIFrame){
				var n=document.createElement("iframe");
				n.setAttribute("id",this.ifrmID);
				n.setAttribute("src","javascript:false;");
				n.setAttribute("scrolling","no");
				n.setAttribute("frameborder","0");
				document.body.appendChild(n);
				this.objIFrame=$(this.ifrmID);
			}
		}
		var div=this.objPanel;
		try{
			this.objIFrame.style.position="absolute";
			this.objIFrame.style.width=div.offsetWidth;
			this.objIFrame.style.height=div.offsetHeight;
			this.objIFrame.style.top=div.style.top;
			this.objIFrame.style.left=div.style.left;
			this.objIFrame.style.zIndex=div.style.zIndex - 1;
			this.objIFrame.style.visibility=div.style.visibility;
		}catch (e){}
	},
	show:function(reload){
		if(!this.created||reload){
			var div=this.getPanel();
			if(this.created) while(div.childNodes.length>0) div.removeChild(div.childNodes[0]);
			for(var i=0;i<this.Data.length;i++) this.AddItem(this.Data[i][0],this.Data[i][1]);
			if(this.height>20&&this.height<this.objPanel.offsetHeight) this.objPanel.style.height=this.height+"px";
			this.created=true;
		}
		var f=this.objPanel.style.visibility!="visible";
		if(f) this.refresh();
		this.showDiv(f);
		return f;
	},
	refresh:function(){
		if(!this.created||this.value==this.valueLast) return;
		var k=this.objHdn.value;
		var divs=this.getPanel().getElementsByTagName("div");
		for(var i=0;i<divs.length;i++){
			var d=divs[i];
			d.className=d.originalClass=(k==d.key)?'cur':'item';
		}
		this.valueLast=this.value=k;
	},
	generateItem:function(k,v){
		var div=this.getPanel();
		var d=div.appendChild(document.createElement("div"));
		this.setState(d,false,k==this.value);
		d.onmousedown=this.selectItem.bind(this,d);
		d.onmouseover=this.setState.bind(this,d,true,false);
		d.onmouseout=this.setState.bind(this,d,false,false);

		var s=d.appendChild(document.createElement("span"));
		s.innerHTML=v;
		s.title=d.val=v.stripTags();
		d.key=k;
		return d;
	},
	_Dispose:function(){this.objHdn=this.objText=this.objPanel=this.objIFrame=null;}
}

EIIP._ComboPanel=Class.create();
EIIP._ComboPanel.prototype=Object.extend(new EIIP._Panel(),{ 
	initialize:function(ltbID,data,defValue,caption,wf,wp,wh){
		this.FieldWidth=wf||80;
		this.PanelWidth=wp||130;
		this.PanelMaxHeight=wh||350;
		this.Label='';
		this.Tooltip=this.Caption=caption||"";
		this.Style=ICONTEXT;
		this.Enabled=true;
		this.Items=new Object();
		this.ltbID=ltbID;
		this.Data=data||[];
		this._init(this.PanelWidth,this.PanelMaxHeight);
		this.setValue(defValue);
	},
	Create:function(){
		var hasAll=(this.Style==ICONTEXT);
		if(hasAll&&this.Caption&&this.Caption.length>0){
			var b=$(this.ltbID+"_cap");
			b.innerHTML=this.Caption;
			b.style.display='';
		}else{$(this.ltbID+"_cap").style.display='none';}
		
		this._LabelEl=$(this.ltbID);//this._LabelEl.maxLength=0;
		this._LabelEl.style.width=this.FieldWidth-15+'px';
		
		var E=this._LabelEl.parentNode;
		if(this.Tooltip&&this.Tooltip.length>0) E.title=this.Tooltip;
		
		var t=this._LabelEl.value;
		if(hasAll){E.className='field'; t=(t.length==0)?this.Label.stripTags():'';}
		else{E.className='field2'; t=(t.length==0)?this.Caption.stripTags():'';}
		if(t.length>0) this._LabelEl.value=t;
		
		this._OuterDiv=E.parentNode;
		this.setWidth(this._OuterDiv.offsetWidth>this.PanelWidth?this._OuterDiv.offsetWidth:this.PanelWidth);
		
		E.ELComboBox=this;
		E.onmouseover=function(){
			if(!this.ELComboBox.Enabled) return;
			this.className=(this.ELComboBox.Style==ICONTEXT)?'field fieldOver':'field fBtnOn';};
		E.onmouseout=function(){this.className=(this.ELComboBox.Style==ICONTEXT)?'field':'field fBtnOff';};
		E.onclick=function(){
			if(this.ELComboBox.Enabled){
				if(typeof(this.ELComboBox.OnBeforeClick)=='function') this.ELComboBox.OnBeforeClick(this.ELComboBox);
				this.ELComboBox.show();
			}
			return false;
		};
		E=null;
	},
	AddItem:function(id,text){
		var div=this.generateItem(id,text);					
		this.Items[id.toString().toLowerCase()]=div;
		return div;
	},
	GetItem:function(id){return this.Items[id.toString().toLowerCase()];},
	SelectItem:function(id){
		id=(id!=null)?id.toString().toLowerCase():'';
		if(this.created){
			var item=this.Items[id];
			if(item){item.onmousedown(); item=null; return true;}
		}else{this.setValue(id);}
		return false;
	},
	SetSelected:function(id){return SelectItem(id);},
	SetLabel:function(label){this._LabelEl.value=this.Label=label;},
	SetEnabled:function(b){
		this.Enabled=b;
		if(b) Element.removeClassName(this._OuterDiv,'disabled');
		else Element.addClassName(this._OuterDiv,'disabled');
	},
	createItems:function(){
		var data=this.Data;
		for(var i=0;i<data.length;i++){
			if(data[i].length<2) continue;
			this.AddItem(data[i][0],data[i][1],data[i][(data[i].length==2)?1:2]);
		}
	},
	Dispose:function(){
		for(var key in this.Items){
			this.Items[key]._specialcombo=null;
			this.Items[key].onclick=null;
			this.Items[key]=null;
		}
		this.Items=null;

		if(this._LabelEl) {this._LabelEl.parentNode.ELComboBox=null;this._LabelEl=null;}
		this.Instance=null;
		this._OuterDiv=null;
		
		if(this.OnBeforeClick)	this.OnBeforeClick=null;
		if(this.OnSelect)	this.OnSelect=null;
		if(this.Command)	this.Command=null;
		this._Dispose();
	}
});

var SmartCombo=Class.create();
SmartCombo.prototype={
	initialize:function(){},
	CreateInstance:function(ltbID,defValue){
		this._Combo=new EIIP._ComboPanel(ltbID,this.Data,defValue,this.Label,
			this.FieldWidth,this.PanelWidth||this.FieldWidth,this.PanelMaxHeight);
		this._Combo.Tooltip=this.Tooltip||"";
		if(this.Style!=null) this._Combo.Style=this.Style;
		this._Combo.Instance=this;
		this._Combo.Create();
		this.ValueInput=this._Combo.objHdn;
		
		if(!this.Command) this.Command=new ELDefaultCommand();
		this.Command.combo=this._Combo;
		this._Combo.Command=this.Command;
		this._Combo.OnBeforeClick=this.Command.RefreshVisibleItems;
		this._Combo.OnSelect=function(item){this.Command.Execute(item);this.Instance.RefreshState();};
		
		__AddDisposObject(this);
	},
	RefreshState:function(){
		var state;
		var cmdstate=this.Command.GetState();
		if(cmdstate===STATE_DISABLED){
			state=STATE_DISABLED;
		}else{
			state=STATE_ON;
			if(this.RefreshActiveItems) this.RefreshActiveItems(cmdstate);
			else this._Combo.SelectItem(cmdstate);
		}
		
		if(state==this.State) return;
		if(state==STATE_DISABLED) this._Combo.SetLabel('');
		
		this.State=state;
		this._Combo.SetEnabled(state!=STATE_DISABLED);
		
		state=cmdstate=null;
	},
	Enable:function(){this.RefreshState();},
	Disable:function(){
		this.State=STATE_DISABLED;
		this._Combo.SetLabel('');
		this._Combo.SetEnabled(false);
	},
	RefreshActiveItems:function(id){this._Combo.SelectItem(id);},
	Reload:function(){
		this._Combo.Data=this.Data;
		this._Combo.show(true);
	},
	Dispose:function(){
		this._Combo.Dispose();

		if(this._Combo.Instance) this._Combo.Instance=null;
		if(this._Combo.Command)	this._Combo.Command=null;
		if(this._Combo.OnBeforeClick) this._Combo.OnBeforeClick=null;
		if(this._Combo.OnSelect) this._Combo.OnSelect=null;
		this._Combo=null;
		this.ValueInput=null;
		
		if(this.Command){
			this.Command.combo=null;
			this.Command.Dispose();
			__ClearExpando(this.Command);
			this.Command=null;
		}
		this.Data=null;
	}
}

EIIP.Searcher=Class.create();
EIIP.Searcher.prototype={
	initialize:function(txtid,hdDivID,w){
		this.objText=$(txtid);
		this.objText.onblur=this.hideDiv.bind(this);
		this.objText.onkeydown=this.keypressHandler.bind(this);
		this.objText.onfocus=function(){if(this.value.trim()==EDWIN.defaultWord){this.value='';Element.removeClassName(this,'c_gray');}};
		this.objText.onfocusout=function(){if(this.value.trim()==''){this.value=EDWIN.defaultWord;Element.addClassName(this,'c_gray');}};
		this.objText.autocomplete="off";
		this.defaultText=this.objText.defaultText||"";
		this.objDiv=null;
		this.objIFrame=null;
		this.divID=hdDivID||"elSearcherDiv";
		this.ifrmID="elSearcherIF";
		this.width=w||120;
		this.value="";
		this.valueLast="";
		this.cache=[];
	},
	resetCache:function(){this.cache.clear();},
	keypressHandler:function(evt){
		if(!this.timer) this.timer=setTimeout(this.mainLoop.bindAsEventListener(this), 100);
		var div=this.getDiv(this.divID);
		evt=evt||window.event;
		var key=evt.keyCode;//||evt.which||evt.charCode;
		var KEYUP=38,KEYDOWN=40,KEYENTER=13,KEYTAB=9;
		if(div.style.visibility=="hidden"){
			if(key==KEYENTER&&this.submitHandler){this.submitHandler();evt.cancelBubble=true;return false;}
			return true;
		}
		if(key!=KEYUP&&key!=KEYDOWN&&key!=KEYENTER&&key!=KEYTAB) return true;
		var idx=this.getCurrIdx(div);
		var curDiv=this.setCurrDiv(div,idx);
		switch(key){
			case KEYENTER:
			case KEYTAB:
				if(curDiv) this.selectItem(curDiv);
				evt.cancelBubble=true;
				return false;
			case KEYUP: curDiv=this.setCurrDiv(div,idx-1); break;
			case KEYDOWN:curDiv=this.setCurrDiv(div,idx+1);break;
		}
		this.showDiv(true);
		return true;
	},
	getDiv:function(divID){
		if(this.objDiv) return this.objDiv;
		this.objDiv=$(divID);
		if(!this.objDiv){
			var n=document.createElement("div");
			n.setAttribute("id", divID);
			document.body.appendChild(n);
			this.objDiv=$(divID);
		}
		var obj=this.objText;
		var x=obj.offsetLeft;
		var y=obj.offsetTop+obj.offsetHeight;
		while(obj.offsetParent){
			obj=obj.offsetParent;
			x+=obj.offsetLeft;
			y+=obj.offsetTop;
		}
		this.objDiv.className="float";
		this.objDiv.style.width=this.width+"px";
		this.objDiv.style.left=x+"px";
		this.objDiv.style.top=y+"px";
		return this.objDiv;
	},
	setWidth:function(w){w-=6; if(this.objDiv) this.objDiv.style.width=w+"px"; else this.width=w;},
	getCurrIdx:function(div){
		var ary=div.getElementsByTagName("div");
		if(ary){for(var i=0;i<ary.length;i++){if(ary[i].className=='active') return i;}}
		return -1;
	},
	setCurrDiv:function(div,idx){
		var divs=div.getElementsByTagName("div");
		if(!divs) return null;
		var thisDiv;
		if(idx<0) idx=divs.length;
		else if(idx>=divs.length) idx=0;
		for(var i=0;i<divs.length;i++){
			if(i==idx){
				thisDiv=divs[i];
				this.highlight(thisDiv);
			}
			else this.unhighlight(divs[i]);
		}
		return thisDiv;
	},
	selectItem:function(item){
		if(!item) item=this;
		if(item.className=="active"){
			this.objText.value=item.key;
			this.valueLast=this.value=item.key;
			this.mainLoop();
			this.objText.focus();
			this.showDiv(false);
			return;
		}
	},
	highlight:function(item){if(!item) item=this;item.className="active";},
	unhighlight:function(item){if(!item) item=this;item.className="";},
	hideDiv:function(){this.showDiv(false);},
	showDiv:function(show){
		if(this.objDiv){
			this.objDiv.style.visibility=show?"visible":"hidden";
			this.adjustiFrame();
		}
	},
	adjustiFrame:function(){
		if(!this.objIFrame){
			this.objIFrame=$(this.ifrmID);
			if(!this.objIFrame){
				var n=document.createElement("iframe");
				n.setAttribute("id",this.ifrmID);
				n.setAttribute("src","javascript:false;");
				n.setAttribute("scrolling","no");
				n.setAttribute("frameborder","0");
				document.body.appendChild(n);
				this.objIFrame=$(this.ifrmID);
			}
		}
		var div=this.objDiv;
		try{
			this.objIFrame.style.position="absolute";
			this.objIFrame.style.width=div.offsetWidth;
			this.objIFrame.style.height=div.offsetHeight;
			this.objIFrame.style.top=div.style.top;
			this.objIFrame.style.left=div.style.left;
			this.objIFrame.style.zIndex=div.style.zIndex - 1;
			this.objIFrame.style.visibility=div.style.visibility;
		}catch (e){}
	},
	mainLoop:function(){
		this.value=this.objText.value.trim();
		if(this.value==this.defaultText) this.value='';
		if(this.valueLast!=this.value){
			var re=this.cache[this.value];
			if(!re) this.cache[this.value]=re=this.AjaxGetItems(this.value);
			this.AjaxCallback(re.value||eval(re));
			this.valueLast=this.value;
		}
		setTimeout(this.mainLoop.bindAsEventListener(this), 100);
		return true;
	},
	AjaxGetItems:function(txt){return '';},
	AjaxCallback:function(aryResult){
		var div=this.objDiv;
		while(div.childNodes.length>0) div.removeChild(div.childNodes[0]);
		for(var i=0;i<aryResult.length;i++) {
			var d=document.createElement("div");
			d.style.width=div.style.width;
			this.unhighlight(d);
			d.onmousedown=this.selectItem.bind(this,d);
			d.onmouseover=this.highlight.bind(this,d);
			d.onmouseout=this.unhighlight.bind(this,d);

			var v=aryResult[i];
			var s=document.createElement("span");
			if(v.Key){s.innerHTML=v.Value; d.key=s.title=v.Key;}
			else{s.innerHTML=v; d.key=s.title=v.stripTags();}//typeof(v)=="string"
			d.appendChild(s);
			div.appendChild(d);
		}
		this.showDiv(aryResult.length>0);
	},
	Dispose:function(){
		this.resetCache();
		this.cache=this.objText=this.objDiv=this.objIFrame=null;
		if(this.timer){clearTimeout(this.timer);this.timer=null;}
	}
}

/////
var EL={
 alidationActive:false,_isValid:true,_ltbSubmit:false,_busyzoom:false,_upid:'',_patternZOOM:null,_patternHELP:null,
 _IEVer: 0,
 getIEVer:function(){
	if(EIIP.isIE&&this._IEVer==0) this._IEVer=navigator.appVersion.match(/MSIE (\d\.\d)/)[1] * 1;
	return this._IEVer;
 },
 zoomL:function(obj){
	if(!obj._fontSize){
		obj._fontSize=parseInt(obj.currentStyle.fontSize);
		if(isNaN(obj._fontSize)) obj._fontSize=12;
	}
	if(obj._fontSize<13) return;
	obj._fontSize-=2;
	obj.style.fontSize=obj._fontSize+'px';
	obj.style.lineHeight=(Math.round(obj._fontSize * 4/3))+'px';
 },
 zoomH:function(obj){
	if(!obj._fontSize){
		obj._fontSize=parseInt(obj.currentStyle.fontSize);
		if(isNaN(obj._fontSize)) obj._fontSize=12;
	}
	if(obj._fontSize>30) return;
	obj._fontSize+=2;
	obj.style.fontSize=obj._fontSize+'px';
	obj.style.lineHeight=(Math.round(obj._fontSize * 4/3))+'px';
 },
 zoom:function(isIN,tag,node){
	if(this._busyzoom) return;
	this._busyzoom=true;
	if(node==null) node=document;
	if(tag==null) tag='*';
	var els=node.getElementsByTagName(tag);
	if(els.length>0){
	 if(this._patternZOOM==null) this._patternZOOM=new RegExp("(^|\\s)ELZOOM(\\s|$)");
	 for(var i=0;i<els.length;i++){
		if(this._patternZOOM.test(els[i].className)){if(isIN) this.zoomH(els[i]); else this.zoomL(els[i]);}
	 }
	}
    els=node=null;
    this._busyzoom=false;
 },
 doHelp:function(show,tag,node){
	if(node==null) node=document;
	if(tag==null) tag='*';
	var els=node.getElementsByTagName(tag);
	if(els.length>0){
	 if(this._patternHELP==null) this._patternHELP=new RegExp("(^|\\s)ELHELP(\\s|$)");
	 for(var i=0;i<els.length;i++){
		if(this._patternHELP.test(els[i].className)){
			if(show) els[i].style.display=''; else els[i].style.display='none';
		}
	 }
	}
    els=node=null;
 },
 highlight:function(key,tagName,clsName,doc){
	if(!Object.isString(key)||(key=key.trim(),key.length==0)) return;
	var ary=$TC(tagName,clsName,doc);if(ary.length==0) return;
	if(key.indexOf(' ')!=-1) key=key.replace(/  +/ig,' ').replace(' ','|');
	var r=new RegExp("("+key+")","ig");
	JS.map(ary,function(o){o.innerHTML=o.innerHTML.replace(r,"<font color=red>$1</font>");});
	ary=r=null;
 },
 setIFrameSize:function(){
	var obj=self.parent.document.all[self.name];
	if(obj!=null) obj.style.pixelHeight=self.document.body.scrollHeight+5;
 },
 setTimeout:function(callback,timeout,param){
	var args=Array.prototype.slice.call(arguments,2);
	var _cb=function(){callback.apply(null,args);}
	window.setTimeout(_cb,timeout);
 },
	
	GetUploadID: function()
	{
		if(this._upid == '')	this._upid = "user_" + EIIP.current.userID + "_" + Math.floor(Math.random()*10000);
		return this._upid;
	},

	validatorOnSubmit: function(e) {return this.alidationActive ? this.validatorCommonOnSubmit(e) : true;},
	validatorCommonOnSubmit: function(e)
	{
		var result = !this._ltbSubmit;
		this._ltbSubmit = false;
		e = e || event;
		if(e)	e.returnValue = result;
		return result;
	},
	clientValidate: function() 
	{
		this._validatorUpdateIsValid();    
		this._ltbSubmit = !this._isValid;
		return this._isValid;
	},
	_validatorUpdateIsValid: function() 
	{
		if(typeof(EL_Validators) == "undefined")
		{
			this._isValid = true;
			return;
		}
		
		var obj;
		for(var i=0; i<EL_Validators.length; i++) 
		{
			obj = $(EL_Validators[i].id);
			if(!obj)	continue;

			if(obj.value != null)
			{
				obj.value = obj.value.trim();
				if(obj.value == "" || 
					(EL_Validators[i].minLen && (EL_Validators[i].minLen > obj.value.length)) || 
					(EL_Validators[i].maxLen && (EL_Validators[i].maxLen < obj.value.length)) )
				{
					if(EL_Validators[i].errormsg)	alert(EL_Validators[i].errormsg);
					this._isValid = false;
					
					if(EL_Validators[i].type != "hidden")
					{
						obj.focus();
					}
					
					obj = null;
					return;
				}
			}
		}
		obj = null;
		   
		this._isValid = true;
	},
	
	Preview: function(title, headzoom, obj)
	{
		var A = 680;
		var B = 500;
		var swidth = screen.width || 800;
		var sheight = screen.height || 600;
		var C = (swidth - A)/2;
		var T = (sheight - B - 100)/2;
		var D = window.open('', null, 'toolbar=yes,location=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width='+A+',height='+B+',top='+T+',left='+C);
		var E = '<html><head><title>' + title + '</title>';
		if(headzoom)	E += headzoom;
		E += '</head><body>' + obj.innerHTML + '</body></html>';
		
		D.document.write(E);
		D.document.close();
		D = null;
	},

	HookContextMenu: function()
	{
		try{window.document.oncontextmenu = window.top.onRightClick;}catch(e){}
	},

	Showtip: function(obj)
	{
		if(obj.clientWidth < obj.scrollWidth) obj.title = obj.innerText;
		else obj.title = '';
	},
	getListValue: function(objID, isRadio) 
	{
		var objSpan = $(objID);
		if(objSpan == null){ alert("未找到控件: " + objID); return;}
		
		var childs = objSpan.getElementsByTagName("INPUT");
		var re = 0;
		for(var i=0; i<childs.length; i++)
		{
			if(childs[i].checked)
			{
				if(isRadio == true)
				{
					re = childs[i].value;
					break;
				}
				else
				{
					re |= childs[i].value;
				}
			}
		}
		
		objSpan = childs = null;
		return re;
	},
	
	Person: function(pid, flagDo) {if(pid > 0) window.open("http://shop"+pid+EIIP.defaultDomain+"/");},
	User: function(uid)	{/*this.Person(uid, "user");*/},
	Role: function(rid)	{/*this.showDialog(EIIP.homeUrl + 'Manage/Role/Handle.aspx?rid=' + rid);*/},
	InfoCata: function(cid)	{/*this.showDialog(EIIP.homeUrl + 'Manage/App/InfoCataHandle.aspx?cid=' + cid);*/},
	
	SendMsg: function(rid){this.showDialog(EIIP.homeUrl + "Message/Send.aspx?do=usend&rid=" + rid);},
	SendMail: function(rid){this.showDialog(EIIP.homeUrl + "Mail/Send.aspx?do=usend&rid=" + rid, null, null,null, true);},

	BBS:function(tid){window.open(EIIP.homeUrl + "InfoWeb/BBSTopic.aspx?tid=" + tid);},
	Info:function(tid, cid)
	{
//		if(cid > 0)
//			this.InfoC(cid, "info", tid);
//		else
//			EIIP.openWin("Info/Item.aspx?tid=" + tid, "images/office/1030.gif", null,null, 810);
	},
	InfoL: function(tid){window.location.href = "http://info"+EIIP.defaultDomain+"/view/"+ tid;},
	InfoC: function(cid, flagDo, tid)
	{
//		var pg = "Info/Catalog.aspx?cid=" + cid;
//		var doAction = null;
//		
//		if(flagDo)
//		{
//			if(flagDo == "info")
//				doAction = EIIP.homeUrl + "Info/Item.aspx?tid=" + tid;
//			else
//				pg += "&do=" + flagDo;
//		}
//		
//		EIIP.openWin(pg, "images/office/0383.gif", null,null, null,null, "mainurl", doAction);
	},

	softKB: function(obj)	{this.showDialog(EIIP.homeUrl + 'Tools/SoftKB.htm', obj);},
	
	showDialog: function(pg, objPara, w, h, hascroll)
	{
		pg += (pg.indexOf("?") == -1)? "?" : "&";
		w = w || 500;
		h = h || 400;
		return window.showModalDialog(pg + 'rnd=' + Math.floor(Math.random()*1000), new Array(window, objPara),
			'dialogWidth:' + w + 'px;DialogHeight=' + h + 'px;status:no;scroll:' + 
			((hascroll == true)? "yes;" : "no;") );
	},
	openDialog: function(pg, objPara, w, h, funonclose, x, y)
	{
		if(!this._dialog)	this._dialog = new DIALOG();
		pg += (pg.indexOf("?") == -1)? "?" : "&";
		w = w || 500; h = h || 400;
		
		this._dialogInputValue = objPara;
		this._dialog.Open(pg, w, h, funonclose, x, y);
	},
	getDialogValue: function(){return this._dialogInputValue;},
	dialogFix: function()
	{
		var obj = $("elForm");
		if(!obj)	return;
		var borderWidth = window.screenLeft - parseInt(window.dialogLeft);
		var titleHeight = window.screenTop - parseInt(window.dialogTop);
		var sh = parseInt(window.dialogHeight) - parseInt(document.body.offsetHeight) - titleHeight;
		var h = parseInt(obj.offsetHeight) + titleHeight + sh;
		var w = parseInt(obj.offsetWidth) + borderWidth * 2;

		window.dialogHeight = h + "px";
		window.dialogWidth = w + "px";
		window.dialogTop = (screen.height) ? (screen.height - h)/2 : 0;
		window.dialogLeft = (screen.width) ? (screen.width - w)/2 : 0;
		
		obj = null;
	},
	dialog: function(pg, objPara, w, h, hascroll){return this.showDialog(EIIP.homeUrl + pg, objPara, w, h, hascroll);},
	
	markUser: function(id, name)
	{
		EIIP.clipCenter.user.id = id;
		EIIP.clipCenter.user.name = name;
	},
	markInfoCata: function(id, name)
	{
		if(id < 1)	{alert("标记失败: 信息栏目ID不合法！"); return;}
		EIIP.clipCenter.infoCata.id = id;
		EIIP.clipCenter.infoCata.name = name;
		alert("已成功标记信息栏目: " + name + "\n\n标记后，系统将锁定标记的栏目，您可以:\n√、将主题信息移至该栏目;\n√、在编辑器 [插入 EIIP 对象] 中选择 [信息栏目链接]，以制做栏目链接;\n等操作。");
	},
	markInfo: function(id, name)
	{
		EIIP.clipCenter.info.id = id;
		EIIP.clipCenter.info.name = name;
	},
	
	refrushPage: function(c)
	{
		if(c === true)
		{
			window.location.href = window.location.href;
		}
		else
		{
			var obj = $("OAPager1_input");
			if(typeof(__doPostBack) == "function" && obj)
			{
				__doPostBack("OAPager1", obj.value);
				obj = null;
			}
			else
			{
				obj = null;
				window.location.replace(window.location.href);
			}
		}
	},
	
	_createGridCheckObject: function()
	{
		if(EDWIN.GridCheckList == null)
		{
			var objGrid = $(EDWIN.dataList.id);
			if(objGrid == null){alert("未设置 dataList.id ！");return;}
			var objHdn = EDWIN.dataList.hdnObject || $((EDWIN.dataList.hdnid || "hdnSelectedValues"));
			EDWIN.GridCheckList = new EIIP.GRIDCHK(objGrid, EDWIN.dataList.chkid, objHdn);
			
			objGrid = null;
			objHdn = null;
		}
		
		return EDWIN.GridCheckList;
	},
	gridCheckHead: function(obj){ this._createGridCheckObject().headClick(obj); },
	gridCheckRow: function(obj)	{ this._createGridCheckObject().rowClick(obj);	},
	gridBackCheck: function()	{ this._createGridCheckObject().backCheck();	},
	
    ajaxError: function() 
    {
		alert("网络发生了连接性错误,请重试...");
		if(typeof(pg_ajaxError) == 'function')	pg_ajaxError();
	},
    ajaxComplete: function(originalRequest)
	{
		if(originalRequest.status == 200 || originalRequest.status == 304)
		{
			pg_ParseResult(originalRequest);
		}
		else
		{
			EIIP.POPWIN.gold.showMe("访问服务器: 错误", 
				'XML 访问错误: ' + originalRequest.statusText + ' (' + originalRequest.status + ')', document.title);
		}
	},
	
	beforeSubmit: function(objForm)
	{
		if(objForm && objForm.updateOAEditor)
		{
			for(var i=0; i<objForm.updateOAEditor.length; i++) objForm.updateOAEditor[i]();
		}
		
		return ((typeof(Page_ClientValidate) != 'function' || Page_ClientValidate()) && this.clientValidate());
	},
	
	winReturnSuccess: function(obj)
	{
		window.returnValue = new Array(0, obj);
		window.close();
	},
	
	closeMe: function()
	{
		if(EDWIN.CloseByEIIP == true)	return;
		event.returnValue= "您正在处理〖" + document.title + "〗！\n\n若您已经输入了资料，请确认该资料是否重要。离开后，本页输入的数据将会丢失！";
	},
	
	ShowOriginalImg: function(thumbSrc){window.open(thumbSrc.left(thumbSrc.length - 5) + ".gif");},
	GetThumbSrc: function(originalSrc, addHomeUrl){
		return (addHomeUrl ? EIIP.homeUrl : "") + originalSrc.left(originalSrc.length - 4) + "s.gif"
	},
	QSUI:function(){
		var re='';
		for(var i=0; i<arguments.length; i++){
			var id = arguments[i];
			re+="&"+((id.length>3)?id.substring(3):id);
			if(id.startsWith('ltb')){
				re+="ID="+$F(id+"_TB2");
			}else{
				re+="="+escape($F(id));
			}
		}
		return re;
	},
	QSValue:function(id,v){return "&"+id+"="+escape(v);},

	Dispose: function()
	{
		if(this._patternZOOM)	this._patternZOOM = null;
		if(this._patternHELP)	this._patternHELP = null;
		if(EDWIN.GridCheckList)	EDWIN.GridCheckList.Dispose();
		if(this._dialog)	{this._dialog.Dispose();this._dialog=null;}
	}
};

//////
function EL_imgload(obj)
{
	var w = screen.width - 250;
	if(obj.width > w)
	{
		obj.height = obj.height/obj.width * w;
		obj.width = w;
	}
	//obj.style.cursor='pointer';
	if(!obj.onclick)	obj.onclick = function() {window.open(this.src);}
	obj.title += '（您可以用鼠标滚轮缩放图片，点击图片可在新窗口打开）';
}
function EL_XHelper(){} //兼容保留

function EL_imgzoom(obj)
{
//	var zoom = parseInt(obj.style.zoom, 10) || 100;
//	zoom += event.wheelDelta / 12;
//	if(zoom > 0) obj.style.zoom = zoom + '%';
//	zoom = null;
    //	return false;
    return true;
}

function EL_SetCSS(obj, className) 
{
    obj.className = (className == true)? obj._class : className;
}
function EL_SetCSS2(obj) 
{
    obj.className = (obj._class2) ? obj._class2 : obj._class;
}

function EL_TMove(obj,e)
{   
  if(obj._isDown)   
  {   
    e.cancelBubble = true;
    if(obj.offsetWidth + (e.clientX - obj._oldX) >= 20)   //Min value 20px   
    {
        document._DivTag.style.left = document.body.scrollLeft + e.clientX
    }
  }
  else   
  {
    var el = e.srcElement;
    el.style.cursor = (e.offsetX >= el.offsetWidth - 4 && el.tagName == 'TH') ? "col-resize" : "default";
    el=null;
  }
}

function EL_TDown(obj,e)
{   
  var el = e.srcElement;
  if(e.offsetX >= el.offsetWidth - 4 && el.tagName == 'TH')   
  {
      if(document._DivTag == undefined)
      {
          document._DivTag = document.createElement("div");
          document.forms[0].insertAdjacentElement("afterBegin", document._DivTag);
          document._DivTag.style.cssText = "BORDER-LEFT:black 1px dashed;WIDTH:1px;CURSOR:col-resize;Z-INDEX:200;FONT-SIZE:10pt; WIDTH:90px;CURSOR:col-resize;COLOR:#aaaa;POSITION:absolute;HEIGHT:100%;TEXT-ALIGN:center;";
      }
      obj._isDown = true;
      obj._oldX = e.clientX + (obj.offsetWidth - e.offsetX);
      document._DivTag.style.display='';
      document._DivTag.style.top=document.body.scrollTop + e.y - e.offsetY - 2;
      document._DivTag.style.left=document.body.scrollLeft + e.clientX ;
      document._DivTag.style.height=800;
      el.setCapture();
  }
  el=null;
}

function EL_TUp(obj,e)
{    
  if(obj._isDown)   
  {   
      obj._isDown = false;
      obj.releaseCapture(); 
      obj.style.cursor = "default";
      document._DivTag.style.display='none';
      obj.style.width = obj.offsetWidth + (document._DivTag.offsetLeft - document.body.scrollLeft - obj._oldX);
  }
}

function ctl_txtKeydown(obj)
{
    if(obj.maxlength && obj.value.length>obj.maxlength-1 && event.keyCode!=8)
    {    
        obj.value = obj.value.substr(0,obj.maxlength);
        event.returnValue = false;  
    }
}



