function Browser(){}
Browser.list = (function(){
	var m = (navigator.userAgent.toLowerCase()).match(/(msie|firefox|chrome|opera|version).*?([\d.]+)/);
	return [m[1].replace(/version/, "'safari"),m[2]];
})();
Browser.isIE=window.ActiveXObject ? true : false;
Browser.isIE6 = Browser.isIE&&Browser.list[1] == '6.0';
Browser.isIE7 = Browser.isIE&&window.XMLHttpRequest&&!document.querySelector;
Browser.isIE8 = Browser.isIE&&document.querySelector;
Browser.isMozilla=Browser.isIE?false:(typeof document.implementation!='undefined')&&(typeof document.implementation.createDocument!='undefined')&&(typeof HTMLDocument!='undefined');
Browser.isFirefox=Browser.isIE?false:(navigator.userAgent.toLowerCase().indexOf("firefox")!=-1);
Browser.isSafari=Browser.isIE?false:(navigator.userAgent.toLowerCase().indexOf("safari")!=-1);
Browser.isOpera=Browser.isIE?false:(navigator.userAgent.toLowerCase().indexOf("opera")!=-1);

function Sys(){}
Sys.loadCleanMode = false;
Sys.uniqID = '';
Sys.__oready = function(){};
Sys.oReady = function(fun){Sys.__oready = Sys.__oready.inject(fun);};
Sys.ready = function()
{
	Sys._ready();
	Sys.__ready();
	if ( Browser.isIE && Browser.isIE8 ) Sys._init();
};
Sys._ready = function(_tagObj)
{
	_tagObj = _tagObj || document;
	Sys._readyTipOrRange(_tagObj.getElementsByTagName('input'));
	Sys._readyTipOrRange(_tagObj.getElementsByTagName('textarea'));
	_tagObj = null;
};
//Security Authentication
Sys._readyTipOrRange = function(_objs)
{
	var i = 0;
	for( i;i<_objs.length;i++)
	{
		if ( _objs[i].getAttribute('initReady') ) continue;
		if ( _objs[i].getAttribute('tip') ) Menu.tip($(_objs[i]));
		if ( _objs[i].getAttribute('range') ) Opt.range(_objs[i]);
		if ( _objs[i].getAttribute('security') ) Opt.secure(_objs[i]);
		_objs[i].setAttribute('initReady',1);
	}
	_objs = null;i = null;
};
Sys.__ready = function()
{
	if ( Browser.isFirefox || Browser.isOpera ) document.addEventListener("DOMContentLoaded", Sys.__init, false);
	else if ( /loaded|complete/.test(document.readyState) )Sys.__init();
	else Sys.delayExecute(Sys.__ready,10);
};
Sys._init = function()
{
	Panel.init();
	Load.init();
	Mutual.init();
	WF.createShade();
	WF.creDiv('__popup__'+Sys.uniqID,document.body,[['position','absolute'],['visibility','hidden'],['left',0],['top',0],['zIndex',2000]]);
	WF.creDiv('overDiv',document.body,[['position','absolute'],['visibility','hidden'],['zIndex',1000]]);
	try{Sys.__oready();}catch(e){alert('Sys.oReady:'+e.message);};
};
Sys.__init = function()
{
	if ( !Browser.isIE || !Browser.isIE8 ) Sys._init();
	if ( typeof appendOnLoad == 'function' ){try{appendOnLoad();}catch (e){}}
	if ( !Sys.loadCleanMode )
	{
		WF.setImgTag();
		//WF.initShopView();
		WF.initSVSView();
	}
};
Sys.uniq = function(uniq,level)
{
	level = parseInt(level);
	level = isNaN(level) ? 1 : level;
	uniq = parseInt(uniq);
	uniq = isNaN(uniq) ? 1000 : uniq;
	return parseInt(Math.random()*uniq) +( document.uniqueID ? document.uniqueID : ( level > 0 ? '_'+Sys.uniq(uniq,~-level) : ''));
};
Sys.delayExecute = function(_fun,_delay,_paras)
{
	_delay = parseInt(_delay);
	_delay = isNaN(_delay) ? 500 : _delay;
	if ( typeof _fun == 'function' ) setTimeout(function(){_fun(_paras);},_delay);
};
Sys.setLoadHit = function(_sID,_sColor)
{
	$(_sID).set('<div class="add_loading" '+(_sColor ? 'style="background-color:'+_sColor+'"' : '')+' id="order_flow_loading"><img src="'+Url.getHead()+'/shared/images/loading.gif" />正在提取數據...</div>');
};
Sys.setText = function(_mID,_sTxt,_fCallBack)
{
	var _obj = null;
	_obj = typeof _mID == 'string' ? $(_mID) : _mID;
	if ( _obj )
	{
		if ( !WF.issetOpacity(_obj) ) WF.setOpacity(_obj,100);
		Sys.delayExecute(function()
		{
			EF.fade(_obj,function()
			{
				WF.setInnerHTML(_obj,_sTxt);
				EF.fade(_obj,_fCallBack,null,10,null,2);
			},null,10,null,2);
		},10);
	}
};
Sys.setTag = function(_obj)
{
	if ( !_obj || (typeof _obj.elementExists == 'function' && !_obj.elementExists()) ) return;
	var parentObj = _obj.parentElement ? _obj.parentElement : _obj.parentNode;
	if ( _obj.getAttribute('ftag') && parentObj )
	{
	    var _ftag = _obj.getAttribute('ftag');
	    var _fdelimiter = _obj.getAttribute('fdelimiter');
	    if ( typeof _fdelimiter != 'string' ) _fdelimiter = '$$';
		_ftag = _ftag.split(_fdelimiter);
		var i = 0;
		var tmp = '';
		while(_ftag[i])
		{
			if ( _ftag[i].length ) tmp = tmp + Sys.doSetTag(_obj,_ftag[i]);
			i = -(~i);
		}
		WF.insertHTML(_obj,'afterEnd',tmp);
		i = 0;
		while(parentObj.childNodes[i])
		{
			_ftag = parentObj.childNodes[i].nodeName.toLowerCase();
			if ( (_ftag == 'div' || _ftag == 'img' ) && (tmp = parentObj.childNodes[i].getAttribute('position')) )
			{
				switch(tmp)
				{
					case '1': // 浮層上右
						tmp = parentObj.childNodes[i];
						if ( tmp.nodeName == 'IMG' )
						{
							if ( parseInt(tmp.offsetWidth) == 0 ) tmp.setAttribute('needadjust',true);
							tmp.style.marginLeft = 0 - tmp.offsetWidth+'px';
							tmp.style.marginTop =  '0px';
						}
						else if ( Browser.isIE && !Browser.isIE8 )
						{
							tmp.style.marginLeft = 0 - tmp.offsetWidth;
							tmp.style.marginTop = 0;
						}
						else
						{
							tmp.style.marginTop = (0 - _obj.offsetHeight + _obj.offsetTop - 3)+'px';
							if ( parseInt(_obj.offsetLeft) > 3 )
							tmp.style.marginLeft = (_obj.offsetLeft+2 + tmp.offsetWidth -3)+'px';
							else
							tmp.style.marginLeft = (_obj.offsetLeft+2 + tmp.offsetWidth )+'px';
						}
						break;
					case '2': // 浮層下左
						tmp = parentObj.childNodes[i];
						if ( tmp.nodeName == 'IMG' )
						{
							if ( parseInt(tmp.offsetHeight) == 0 ) tmp.setAttribute('needadjust',true);
							tmp.style.marginLeft =0 - (_obj.offsetWidth || _obj.width)+'px';
							tmp.style.marginTop = ((_obj.offsetHeight||_obj.height)-tmp.offsetHeight) + _obj.offsetTop - 3+'px';
						}
						else if ( Browser.isIE && !Browser.isIE8 )
						{
							tmp.style.marginLeft = 0 - _obj.offsetWidth;
							tmp.style.marginTop = _obj.offsetHeight-tmp.offsetHeight;
						}
						else
						{
							tmp.style.marginTop = 0-tmp.offsetHeight + _obj.offsetTop - 3+'px';
							if ( parseInt(_obj.offsetLeft) > 3 )
							tmp.style.marginLeft = (_obj.offsetLeft-2-3)+'px';
							else
							tmp.style.marginLeft = (_obj.offsetLeft-2)+'px';
						}
						break;
					case '3': // 浮層下右
						tmp = parentObj.childNodes[i];
						if ( tmp.nodeName == 'IMG' )
						{
							if ( parseInt(tmp.offsetWidth) == 0 ) tmp.setAttribute('needadjust',true);
							tmp.style.marginTop = (_obj.offsetHeight||_obj.height) -tmp.offsetHeight + 'px';
							tmp.style.marginLeft =0- tmp.offsetWidth+'px';
						}
						else if ( Browser.isIE && !Browser.isIE8 )
						{
							tmp.style.marginTop = _obj.offsetHeight - tmp.offsetHeight  -1;
							tmp.style.marginLeft = 0-tmp.offsetWidth;
						}
						else
						{
							tmp.style.marginTop = ( 0 - tmp.offsetHeight )  + 'px';
							if ( parseInt(_obj.offsetLeft) > 3 )
							tmp.style.marginLeft = ( _obj.offsetLeft+_obj.offsetWidth - tmp.offsetWidth - 3 )+ 'px';
							else
							tmp.style.marginLeft = ( _obj.offsetLeft+_obj.offsetWidth - tmp.offsetWidth )+ 'px';
						}
						break;
					default: // 浮層上左
						tmp = parentObj.childNodes[i];
						if ( tmp.nodeName == 'IMG' )
						{
							tmp.style.marginTop = 0+'px';
							tmp.style.marginLeft =  0 - (_obj.offsetWidth || _obj.width) +'px';
						}
						else if ( Browser.isIE && !Browser.isIE8 )
						{
							tmp.style.marginTop = 0;
							tmp.style.marginLeft = 0 - _obj.offsetWidth;
						}
						else
						{
							tmp.style.marginTop = ( 0 - _obj.offsetHeight )  + 'px';
							if ( parseInt(_obj.offsetLeft) > 3 )tmp.style.marginLeft = ( _obj.offsetLeft - 3 )+ 'px';
							else if ( parseInt(_obj.offsetLeft) != 3 )tmp.style.marginLeft = _obj.offsetLeft+ 'px';
						}
						break;
				}
			}
			i = -(~i);
		}
		i = null; tmp = null; _fdelimiter = null; _ftag = null;
	}
	parentObj = null;
};
Sys.doSetTag = function(_obj,_ftag)
{
    _ftag = _ftag.split("|");
    _ftag[1] = _ftag[1] || 0;
    _ftag[2] = _ftag[0].toLowerCase();
    _ftag[4] = (_ftag[2].indexOf(".gif") > -1 || _ftag[2].indexOf(".jpg") > -1 || _ftag[2].indexOf(".png") > 0 ) ? 'img_path' : ( (/([-\d]+)px([ ]+)/ig).test(_ftag[2]) ? 'coordinate' : 'string');
    _obj.removeAttribute('ftag');
	switch(_ftag[4])
	{
		case 'img_path':
			return '<img position="'+_ftag[1]+'" '+(Browser.isIE ? '' : 'onload="Sys.adjustTagNotIE(this);"')+' src="'+Url.img+_ftag[0]+'" style="position:absolute;border:0px;"/>';
			break;
		case 'coordinate':
			var tmp = _ftag[0].match(/([-\d]+)px/ig);
			return '<div position="'+_ftag[1]+'" style="position:absolute;"><div class="ico_bg" style="padding-left:'+tmp[2]+';padding-bottom:'+tmp[3]+';background-position:'+tmp[0]+' '+tmp[1]+';+width:'+tmp[2]+';_height:'+tmp[3]+';+padding-left:0px;overflow:hidden;">&nbsp;</div></div>';
			break;
		case 'string':
			return '<div position="'+_ftag[1]+'" style="position:absolute;">'+_ftag[0]+'</div>';
			break;
	}
};
Sys.adjustTagNotIE = function(_obj)
{
	var tmp = _obj.getAttribute('position');
	if ( tmp )
	{
		switch(tmp)
		{
			case '1': // 浮層上右
				tmp = _obj.getAttribute('needadjust');
				if ( tmp )
				{
					tmp = parseInt(_obj.style.marginLeft);
					_obj.style.marginLeft = tmp - _obj.offsetWidth + 'px';
				}
				break;
			case '2': // 浮層下左
				tmp = _obj.getAttribute('needadjust');
				if ( tmp )
				{
					tmp = parseInt(_obj.style.marginTop);
					_obj.style.marginTop = tmp - _obj.offsetHeight + 'px';
				}
				break;
			case '3': // 浮層下右
				tmp = _obj.getAttribute('needadjust');
				if ( tmp )
				{
					tmp = parseInt(_obj.style.marginLeft);
					_obj.style.marginLeft = tmp - _obj.offsetWidth + 'px';
					tmp = parseInt(_obj.style.marginTop);
					_obj.style.marginTop = tmp - _obj.offsetHeight + 'px';
				}
				break;
		}
	}
};
Sys.imgClip = function(_imgObj,_aPosition,_aClip)
{
	if ( _imgObj && _imgObj.nodeName == 'IMG' && $type(_aPosition) == 'array' && _aPosition.length == 2 && $type(_aClip) == 'array' && _aClip.length == 4 )
	{
		_imgObj.style.position = 'absolute';
		_imgObj.style.top = _aPosition[0] + 'px';
		_imgObj.style.left = _aPosition[1] + 'px';
		_imgObj.style.clip = 'rect('+(_aClip.join("px ")+"px")+')';
	}
};
Sys.limitChar = function(obj)
{
	obj = obj || this;
	obj = typeof obj == 'string' ? $(obj) : obj;
	obj = $type(obj) == 'element' ? obj : ( $type(this) == 'element' ? this : ( obj.srcElement ? obj.srcElement : obj ) );
	var limitObj = $(obj.id+'_Stat');
	var specialChar = obj.getAttribute('specialChar');
	var limitLen = obj.getAttribute('limitCharLen') || 0;
	if ( typeof specialChar == 'string' && specialChar != '0' && specialChar.length ) 
	{
		try
		{
			eval("specialChar=/"+specialChar+"/ig;");
			if ( specialChar.test(obj.value) ) obj.value=obj.value.replace(specialChar,'');
		}catch (e){}
	}
	var len = String(obj.value).len(obj.getAttribute('eachCnLen'));
	if( limitLen  > 0 )
	{
		if ( len > limitLen )
		{
			obj.value = String(obj.value).cut(obj.getAttribute('limitCharLen'),obj.getAttribute('eachCnLen'));
			if ( (specialChar = obj.getAttribute('cutCharCallBack')) && typeof specialChar == 'function' ) specialChar(obj.value);
			len = limitLen;
		}
		if( limitObj.elementExists() )
		{
			limitLen = obj.getAttribute('lenway') ? len :  limitLen - len;
			try{limitObj.innerHTML = limitLen;}catch(e){limitObj.innerText = limitLen;}
			
		}
	}
	limitObj = null;specialChar = null;len = null;limitLen = null;
};
function Evt(){}
Evt.bind = function(oTarget,sType,fHandler)
{
};
// 追加內容到窗體事件函數中
Evt.addWin = function(_fName,_sWin)
{
	_sWin = _sWin || 'load';
	if ( _sWin.indexOf("on") == -1 ) _sWin = "on"+_sWin;
	if ( typeof window[_sWin] != 'function') window[_sWin] = _fName;
	else
	{
		var old =window[_sWin];
		window[_sWin] = window[_sWin].inject(_fName);
	}
};
/* 增加對象事件*/
Evt.add = function(oTarget, sType, fHandler, bRemove) 
{
	if (!oTarget) return;
	if (oTarget.addEventListener)
		bRemove ? oTarget.removeEventListener(sType, fHandler, false) : oTarget.addEventListener(sType, fHandler, false);
	else if (oTarget.attachEvent)
		bRemove ? oTarget.detachEvent("on" + sType, fHandler) : oTarget.attachEvent("on" + sType, fHandler);
	else
		oTarget["on" +sType] = bRemove ? null : fHandler;
};
/* 移除對象事件*/
Evt.remove = function(oTarget, sType, fHandler) 
{
	if (!oTarget) return;
	if (oTarget.removeEventListener)oTarget.removeEventListener(sType, fHandler, false);
	else if (oTarget.detachEvent)oTarget.detachEvent("on" + sType, fHandler);
	else oTarget["on" + sType] = null;
};
function WF(){}
WF._sShadeID = '_shadelayer_';
WF._shadeFreeze = false;
WF._showShadeIndex = 0;
WF.getBW = function(_win){_win = _win || window;return _win.document.body.offsetWidth;};
WF.getBH = function(_win){_win = _win || window;return _win.document.body.offsetHeight;};
WF.getBCH = function(_win){_win = _win || window;return _win.document.documentElement.clientHeight;};
WF.getBCW = function(_win){_win = _win || window;return _win.document.documentElement.clientWidth;};
WF.getBL = function(_win)
{
	_win = _win || window;
	if (typeof(_win.pageXOffset) != 'undefined') return _win.pageXOffset; 
    else if (typeof(_win.document.compatMode)!= 'undefined' && _win.document.compatMode != 'BackCompat') return _win.document.documentElement.scrollLeft;
    else if(typeof(document.body)!= 'undefined') return _win.document.body.scrollLeft;
};
WF.getBT = function(_win)
{
	_win = _win || window;
	if (typeof(_win.pageYOffset) != 'undefined') return _win.pageYOffset; 
    else if (typeof(_win.document.compatMode)!= 'undefined' && _win.document.compatMode != 'BackCompat') return _win.document.documentElement.scrollTop;
    else if(typeof(document.body)!= 'undefined') return _win.document.body.scrollTop;
};
WF.getST = function(_win){_win = _win || window;return _win.screenTop;};
WF.getSL = function(_win){_win = _win || window;return _win.screenLeft;};
WF.getObjOrientation = function(obj)
{
	obj = $type(obj) == 'string' ? $(obj) : obj;
	return WF.getElementCoordinate(obj);
};
WF.getWrapperST = function()
{
	try
	{
		var tmp,i = 0;
		for ( i;i<document.body.children.length; i++ )
		{
			tmp = document.body.children.item(i);
			if ( tmp.className == 'wrapper' )
			{
				return tmp.scrollTop;
			}
		}
		return 0;
	}
	catch (e){'WF.getWrapperST:'+e.message}
	finally{tmp = null;i = null;}
};
// 填充內容并執行script腳本
WF.setInnerHTML = function(el, htmlCode,bReady)
{
	htmlCode = htmlCode || '';
	el = $type(el) == 'string' ? $(el) : el;
	if ( Browser.isIE )
	{
		if ( (['SPAN','P']).exists(el.nodeName) )
		{
			htmlCode = htmlCode.replace(/<script([^>]*)>/gi,'<script$1 defer>');
			el.innerHTML = htmlCode;
		}
		else
		{
			htmlCode = '<div style="display:none">for IE</div>' + htmlCode;   
			htmlCode = htmlCode.replace(/<script([^>]*)>/gi,'<script$1 defer>');
			el.innerHTML = htmlCode;
			el.removeChild(el.firstChild);
		}
		el = null;
	}
	else if ( Browser.isFirefox )
	{
		var el_next = el.nextSibling; 
		var el_parent = el.parentNode;
		el_parent.removeChild(el);
		el.innerHTML = htmlCode;
		if (el_next) el_parent.insertBefore(el, el_next);else el_parent.appendChild(el);
		el_next = null;
		el_parent = null;
	}
	else
	{
		el.innerHTML = htmlCode;
		String(htmlCode).evalScripts();
	}
	if ( bReady ) Sys._ready(el);
};
/*在制定位置插入html代碼*/
WF.insertHTML = function(el, where, html)
{
	if (!el) return;
	html = html || '';
	if (el.insertAdjacentHTML)
	{
		el.insertAdjacentHTML(where, html);
	}
	else
	{
		var range = el.ownerDocument.createRange();
		var isBefore = where.indexOf("before") == 0;
		var isBegin = where.indexOf("Begin") != -1;
		if (isBefore == isBegin)
		{
			range[isBefore ? "setStartBefore" : "setStartAfter"](el);
			el.parentNode.insertBefore(range.createContextualFragment(html), isBegin ? el : el.nextSibling);
		}
		else
		{
			var obj = el[isBefore ? "lastChild" : "firstChild"];
			if (obj)
			{
				range[isBefore ? "setStartAfter" : "setStartBefore"](obj);
				el[isBefore ? "appendChild" : "insertBefore"](range.createContextualFragment(html), obj);
			}
			else el.innerHTML = html;
		}
	}
};
/**
 * 創建動態DIV
 */
WF.creDiv = function(_mID,_oApp,_aStyle,_sText,_apacity)
{
	try
	{
		var _oDiv = document.createElement('DIV');
		switch($type(_mID))
		{
			case 'array':
				var i = 0;
				while(_mID[i])
				{
					_oDiv.setAttribute(_mID[i][0],_mID[i][1]);
					i = -(~i);
				}
				i = null;
				break;
			case 'string':
				_oDiv.setAttribute("id",_mID);
				break;
		}
		switch($type(_aStyle))
		{
			case 'array':
				if (_aStyle.length)
				{
					var i = 0;
					while(_aStyle[i])
					{
						try
						{
							_oDiv.style[_aStyle[i][0]] = (_aStyle[i][0] == 'zIndex'|| isNaN(_aStyle[i][1])) ? _aStyle[i][1] : _aStyle[i][1] + 'px';
						}
						catch(e){alert(_aStyle[i][0])}
						i = -(~i);
					}
				}
				break;
			case 'string':
				_oDiv.className = _aStyle;
				break;
		}
		if ( typeof _sText != 'undefined' && typeof _sText != 'object' && _sText.length > 0) _oDiv.innerHTML = _sText;
		if ( _oApp ) _oApp.appendChild(_oDiv);
		_apacity = parseInt(_apacity);
		if ( !isNaN(_apacity) ) WF.setOpacity(_oDiv,_apacity);
		return _oDiv;
	}catch (e){alert('WF.creDiv:'+e.message);}finally{_oDiv = null;_mID = null;_oApp = null;_aStyle = null;_sText == null;_apacity = null;}
};
/**
 * 創建遮罩層
 */
WF.createShade = function()
{
	WF.creDiv(WF._sShadeID,document.body,[
		['visibility','hidden'],
		['position','absolute'],
		['top',0],['left',0],
		['width',WF.getBW()+15],
		['height',WF.getBH()-5],
		['backgroundColor','#000000'],
		['zIndex',10]
	],'&nbsp;',0);
};
// 依據透明度顯示遮罩層
WF.showShade = function()
{
	if ( !WF._showShadeIndex )
	{
		document.body.parentNode.style.overflow="hidden";
		if ( Browser.isIE6 ) WF.freezeOptionElement();
	}
	WF.shadeSHOperation(60,false);
	WF._showShadeIndex = -(~WF._showShadeIndex);
};
WF.shadeClickEvent  = function(){WF.captionTwinkling();};
// 標題閃閃效果
WF.captionTwinkling = function(_obj,_time,_color)
{
	_obj = _obj || $('__captionBar__');
	_time = _time || 0;
	_color = _color || 0;
	if ( _obj && _time < 7 )
	{
		_color = _color^1;
		_obj.style.backgroundColor = _color ? '#F0F8FE' :'#FFEEEE' ;
		_time = -(~_time);
		setTimeout(function(){WF.captionTwinkling(_obj,_time,_color);},50);
	}
};
WF.hideShade = function()
{
	WF._showShadeIndex = ~(-WF._showShadeIndex);
	if ( WF._showShadeIndex <= 0 )
	{
		if ( Browser.isIE6 ) WF.thawOptionElement();
		WF.shadeSHOperation(0,true);
		WF._showShadeIndex = 0;
	}
};
// 凍結select元素
WF.freezeOptionElement = function(){WF.shadeOptionElement(true);WF._shadeFreeze = true;};
// 給已凍結的select元素解凍
WF.thawOptionElement = function(){if ( WF._shadeFreeze ){WF.shadeOptionElement();WF._shadeFreeze = false;}};
WF.shadeOptionElement = function(_freeze,_frame)
{
	var _obj = null;
	var i = 0;
	if ( (_obj = $T('SELECT')) && _obj.length > 0  )
	{
		while(_obj[i])
		{
			if ( _freeze && !_obj[i].disabled ){_obj[i].style.visibility = 'hidden';_obj[i].disablement = true;}
			else if ( !_freeze && _obj[i].disablement ){_obj[i].style.visibility = 'visible';_obj[i].disablement = false;}
			i = - (~i);
		}
	}
	_obj = null; i = null;
};
WF.shadeSHOperation = function(_apacity,_hidden)
{
	var _obj = null;
	if ( (_obj = $(WF._sShadeID)) && _obj.elementExists() )
	{
		_obj.style.width = (WF.getBW() + WF.getBL())+'px';
		_obj.style.height = WF.getBH()+'px';
		if ( _apacity > 0 )
		{
			WF.setOpacity(_obj,_obj.getAttribute('minOpacity') ? _obj.getAttribute('minOpacity') : 0);
			_obj.setAttribute('maxOpacity',_apacity);
			_obj.removeAttribute('minOpacity');
		}
		else
		{
			WF.setOpacity(_obj,_obj.getAttribute('maxOpacity') ? _obj.getAttribute('maxOpacity') : 0);
			_obj.setAttribute('minOpacity',_apacity);
			_obj.removeAttribute('maxOpacity');
		}
		_obj.style.visibility = 'visible';
		EF.fade(_obj,function()
		{
			_obj.style.visibility = _hidden ? 'hidden' : 'visible';
			if ( !_hidden  )Evt.add(_obj,'click',WF.shadeClickEvent);else Evt.remove(_obj,'click',WF.shadeClickEvent);
			_obj = null;
		});
	}
};
WF.adjustContainerSize = function(id)
{
	var _obj = typeof id == 'string' ? $(id) : id;
	var _scroll = [WF.getBW()-10 , WF.getBCH()-55];
	_obj.style.overflow = 'hidden';
	_obj.style.width = 'auto';
	_obj.style.height = 'auto';
	var _tmp = _obj.offsetHeight;
	if ( _tmp >= _scroll[1] )
	{
		_obj.style.height = _scroll[1]+'px';
		_obj.style.overflow = 'auto';
	}
	_tmp = _obj.offsetWidth;
	if ( _tmp >= _scroll[0] )
	{
		_obj.style.overflow = 'auto';
		_obj.style.width = _scroll[0]+'px';
	}
	else _obj.style.width = _tmp +'px';
	_obj = null;_tmp = null;_scroll = null;

};
/**
 * 調整框架的方位
 *
 * @var string          _bearing     // 方位簡碼
 * @var string|object   _who         // 要調整的對象或是元素ID
 * @var number          _errNum      // 誤差
 */
WF.adjustOrientation = function(_bearing,_who,_errNum)
{
	if ( typeof _bearing != 'string'  ) return;
	_errNum = $splat(_errNum || 0);
	_errNum[0] = parseInt(_errNum[0]);_errNum[0] = isNaN(_errNum[0]) ? 0 : _errNum[0];
	_errNum[1] = parseInt(_errNum[1]);_errNum[1] = isNaN(_errNum[1]) ? 0 : _errNum[1];
	_who = typeof _who == 'string' ? $(_who) : _who;
	var noChange = false;
	if ( _who )with(_who.style)
	{
		if ( visibility == 'visible' || display == 'block' || display == '' ) noChange = true;else{ visibility = 'hidden';display = 'block';}
		switch(_bearing)
		{
			case "LT":left = _errNum[0] + 'px';top = (WF.getBT() - _errNum[1])+'px';break;
			case "LM":
				left = _errNum[0]+'px';top = (parseInt(WF.getBH())/2-_who.offsetHeight/2-_errNum[1]+WF.getBT())+'px'; break;
			case "LB":
				left = _errNum[0]+'px';top = (parseInt(WF.getBH())-_who.offsetHeight-_errNum[1]+WF.getBT())+'px';break;
			case "RT":
				left = (parseInt(WF.getBW()) - _who.offsetWidth-_errNum[0])+'px';
				top = (WF.getBT()-_errNum[1])+'px';break;
			case "RM":
				left = (parseInt(WF.getBW()) - _who.offsetWidth-_errNum[0])+'px';
				top = (parseInt(WF.getBCH())/2-_who.offsetHeight/2-_errNum[1]+ WF.getBT())+'px';break;
			case "RB":
				left =(parseInt(WF.getBW()) - _who.offsetWidth-_errNum[0] - ( !Browser.isIE8 && Browser.isIE ? -5 : 0)) + 'px';
				top = (parseInt(WF.getBCH()) - _who.offsetHeight+ WF.getBT() - _errNum[1])+'px';break;
			case "MT":
				left = _errNum[0]+'px';
				top = (parseInt(WF.getBCH())/2-_who.offsetHeight/2+ WF.getBT() - _errNum[1])+'px';break;
			case "MM":
				left = (parseInt(WF.getBW())/2-_who.offsetWidth/2-_errNum[0]) + 'px';
				top = ((parseInt(WF.getBCH())-_who.offsetHeight)/2-_errNum[1] + WF.getBT()) + 'px';
				break;
			case "MB":
				left =(parseInt(WF.getBW())/2-_who.offsetWidth/2-_errNum[0])+'px';
				top = (parseInt(WF.getBCH()) - _who.offsetHeight-_errNum[1] + WF.getBT()) + 'px';break;
		}
		_errNum = parseInt(left);
		//if ( (_errNum = (_errNum - WF.getSL()*2 + WF.getBL())) > 0 ) left = _errNum + 'px';
		_errNum = parseInt(top);
		if ( _errNum < 0 ) top = WF.getBT()+'px';
		//top = (parseInt(window.screen.availHeight)/2 - (parseInt(_who.offsetHeight) )+WF.getBT()) + 'px';
		if ( !noChange ) display = 'none';
		return [left,top];
	}
	return null;
};
WF.setElementXY = function(_ele,_xy,_errXY,_setAll)
{
	if ( !_ele ) return;
	_ele = $type(_ele) == 'string'  ? $(_ele) : _ele;
	if ( _ele.style && $type(_xy) == 'array' )
	{
		_errXY = $type(_errXY) == 'array' ? _errXY : ( _xy.length == 4 ? [_xy[2],_xy[3]] : [0,0] );
		_xy[0] = parseInt(_xy[0]);
		_xy[1] = parseInt(_xy[1]);
		_ele.style.left = (_xy[0] + _errXY[0])+'px';
		_ele.style.top = (_xy[1] + _errXY[1])+'px';
		if ( _setAll )
		{
			_xy[2] = parseInt(_xy[2]);
			_xy[3] = parseInt(_xy[3]);
			_ele.style.width = _xy[2]+'px';
			_ele.style.height = _xy[3]+'px';
		}
	}
};
WF.getElementIntactXY = function(obj,endTag){return WF.getElementCoordinate(obj,endTag,true);};
WF.getElementXY = function(obj,endTag,noWrapper){return WF.getElementCoordinate(obj,endTag,noWrapper);};
WF.getElementCoordinate = function(elmObj,endTag,noWrapper)
{
	if ( !elmObj || !elmObj.style ) return [0,0,0,0];
	endTag = endTag || 'BODY';
	var leftpos = 0;
	var toppos = 0;
	var obj = elmObj;
	if ( elmObj.style )
	{
		leftpos = parseInt(elmObj.style.left);
		leftpos = isNaN(leftpos) ? 0 : leftpos;
		toppos = parseInt(elmObj.style.top);
		toppos = isNaN(toppos) ? 0 : toppos;
	}
	if ( !leftpos && !toppos )
	{
		while ( elmObj && elmObj.tagName != endTag)
		{
			if ( elmObj )
			{
			    leftpos += elmObj.offsetLeft;
			    toppos += elmObj.offsetTop;
			}
			elmObj = elmObj.offsetParent;
			if ( !noWrapper && elmObj && elmObj.tagName == 'BODY' )
			{
				toppos -= WF.getWrapperST();
			}
		}
		if ( !noWrapper && endTag == 'BODY' && Browser.isIE && !Browser.isIE8 )
		{
			toppos -= WF.getWrapperST();
		}
	}
	return [leftpos,toppos,obj.offsetWidth || obj.scrollWidth,obj.offsetHeight || obj.scrollHeight];
};
WF.setOpacity = function(_obj,_apacity)
{
	try
	{
		if ( !_obj )return;
		_apacity = parseInt(_apacity);
		_apacity = isNaN(_apacity) ? 0 : _apacity;
		if ( Browser.isFirefox ) _obj.style.MozOpacity = _apacity / 100; 
		else if ( Browser.isMozilla ) _obj.style.opacity = (_apacity >= 100 ? 99.999 : _apacity) / 100;
		else if ( typeof _obj.filters == 'object' && typeof _obj.filters.alpha == 'object' ) _obj.filters.alpha.opacity = _apacity; 
		else if ( typeof _obj.style == 'object' )_obj.style.filter="alpha(opacity="+_apacity+")";
	}
	catch (e){}finally{_obj = null;_apacity = null;}
};
WF.issetOpacity = function(_obj)
{
	try
	{
		var isset = false;
		if ( Browser.isFirefox )isset = _obj.style.MozOpacity;
		else if ( Browser.isMozilla )isset = _obj.style.opacity;
		else isset = _obj.filters && _obj.filters.alpha ? _obj.filters.alpha.opacity : 0;
		isset = parseInt(isset);
		isset = isNaN(isset);
		return isset;
	}catch(e){alert('WF.issetOpacity:'+e.message);}finally{isset = null;_obj = null;}
};
WF.getOpacity = function(_obj)
{
	try
	{
		var opacity = 0
		if ( Browser.isFirefox )
		{
			opacity = parseFloat(_obj.style.MozOpacity);
			opacity = opacity * 100;
		}
		else if ( Browser.isMozilla )
		{
			opacity = _obj.style.opacity;
			opacity = parseFloat(opacity);
			opacity = isNaN(opacity) ? 0 : opacity;
			if ( opacity >0 && opacity < 1 ) opacity = opacity * 100;
			opacity = opacity > 99.9 ? 100 : opacity;
		}
		else opacity = _obj.filters && _obj.filters.alpha ? _obj.filters.alpha.opacity : 0;
		opacity = parseInt(opacity);
		return isNaN(opacity) ? 0 : opacity;
	}
	catch(e){alert('WF.getOpacity:'+e.message);}finally{opacity = null;_obj = null;}
};
WF.setImgTag = function(doc)
{
	var _obj = $T('img',doc);
	var _pstr = '';
	if ( _obj.length )
	{
		var tmp,i = 0;
		while(_obj[i])
		{
			if ( (_pstr = _obj[i].getAttribute('ftag')) && _obj[i].parentNode )
			{
				if ( Browser.isIE || Browser.isFirefox || Browser.isOpera )
					Sys.setTag(_obj[i]);
				else
				{
					tmp =  _obj[i].parentElement ? _obj[i].parentElement : _obj[i].parentNode;
				    if ( _pstr.indexOf(">") > -1 )
				    {
				        _obj[i].removeAttribute('ftag');
					    tmp.innerHTML = tmp.innerHTML.replace('>','onload="Sys.setTag(this);">');
					    _obj[i].setAttribute('ftag',_pstr);
					}
					else 
					    tmp.innerHTML = tmp.innerHTML.replace('>','onload="Sys.setTag(this);">');
				}
			}
			i = -(~i);
		}
		tmp = null;i = null;
	}
	_pstr = null;_obj = null;
};
WF.removeMyself = function(_oObj)
{
	if ( !_oObj ) return;
	WF.removeAllChild(_oObj);
	if ( _oObj.parentNode )
	{
		WF.remove(_oObj,_oObj.parentNode);
	}
	else if ( _oObj.parentElement() )WF.remove(_oObj,_oObj.parentElement());
};
/* 移除動態*/
WF.remove = function(_oObj,_oApp)
{
	_oApp = _oApp || document.body;
	_oObj = typeof _oObj == 'string' ? $(_oObj) : _oObj;
	if ( _oObj && _oApp ) _oApp.removeChild(_oObj);
};
/* 移除對象內的全部元素*/
WF.removeAllChild = function(_oObj,_oApp)
{
	_oObj = typeof _oObj == 'string' ? $(_oObj,_oApp) : _oObj;
	while(_oObj.hasChildNodes()) _oObj.removeChild(_oObj.firstChild);
};
WF.initSVSView = function()
{
	var tmp = WF.creDiv('__serviceview__'+Sys.uniqID,document.body,[
		['position','absolute'],
		['width',100],
		['height',120],
		['overflow','hidden'],
		['zIndex',101],
		['backgroundColor','#FFFFFF'],
		['border','1px solid #FF0000']
	],'<div class="qv" style="cursor:'+(Browser.isIE || Browser.isOpera ? 'hand' : 'pointer')+'"><div>Iwee幫助</div><div><img src="'+Url.getImg('quest_max_close.gif')+'" /></div></div><div><input type="button" onclick="window.location.href=\'/service/proposal_post/\'" value="線上提案"/></div><div><input type="button" onclick="window.location.href=\'/service/feedback/\'" value="我要留言"/></div><div><input type="button" value="客服佈告欄" onclick="window.location.href=\'/service/announce/\'"/></div>');
	tmp.setAttribute('direction','down');
	tmp.setAttribute('maxLimit',tmp.offsetHeight - 24);
	WF.adjustOrientation('RB',tmp,[18,0-parseInt(tmp.getAttribute('maxLimit'))]);
	Sys.imgClip(((tmp.children.item(0)).children.item(1)).children.item(0),[0,80],[6,12,16,2]);
	Sys._ready(tmp);
	Evt.add(tmp.children.item(0),'click',function()
	{
		var mainFrame = $('__serviceview__'+Sys.uniqID);
		var tmp = mainFrame.getAttribute('direction');
		mainFrame.setAttribute('direction',tmp == 'up' ? 'down' : 'up');
		EF.slide(mainFrame,function()
		{
			if ( tmp == 'up' ) Sys.imgClip(((mainFrame.children.item(0)).children.item(1)).children.item(0),[0,80],[6,12,16,2]);
			else Sys.imgClip(((mainFrame.children.item(0)).children.item(1)).children.item(0),[-22,80],[28,12,38,2]);
			mainFrame = null;tmp = null;
		},null,50,3,4);
	});
	Evt.addWin(function()
	{
		var tmp = $('__serviceview__'+Sys.uniqID);
		WF.adjustOrientation('RB',tmp,[18,0-parseInt(tmp.getAttribute('maxLimit'))]);
		tmp = null;
	},'resize');
};
WF.initShopView = function()
{
	var tmp = WF.creDiv('__shopping_cart__'+Sys.uniqID,document.body,[
		['position','absolute'],
		['width',40],
		['height',410],
		['top',100],
		/*['border','1px solid #FF0000'],*/
		['left',WF.getBCW() - 32],
		['overflow','hidden'],
		['zIndex',9]
	],'<div><div style="text-align:right;position:absolute;z-Index:8;"><a href="javascript:;" onclick="WF.doShopView(this);">瀏<br/>覽<br/>過<br/>的<br/>商<br/>品</a></div><div style="border:1px solid #FF0000;background-color:#FFECEC;margin-left:150px;z-Index:7;position:absolute;height:300px;width:150px;"  direction="left">正在載入瀏覽過的商品...</div></div>');
	var subObj = tmp.children.item(0);
	subObj = subObj.children.item(0);
	tmp.style.left = (WF.getBCW() - subObj.offsetWidth -20 ) + 'px';
	Evt.addWin(function()
	{
		var tmpObj = $('__shopping_cart__'+Sys.uniqID);
		var _diffW = ((tmpObj.children.item(0)).children.item(1)).getAttribute('maxLimit');_diffW = parseInt(_diffW);_diffW = isNaN(_diffW) ? 32 : _diffW+32;
		tmpObj.style.left = (WF.getBCW() - _diffW) + 'px';
		tmpObj = null;_diffW = null;
	},'resize');
};
WF.doShopView = function(_self)
{
	var _Obj = _self.parentNode ? _self.parentNode : _self.parentElement;
	_Obj = _Obj.parentNode ? _Obj.parentNode : _Obj.parentElement;
	var _BtnObj = _Obj.children.item(0);
	_Obj = _Obj.children.item(1);
	_BtnObj.style.marginLeft = (138 + _BtnObj.offsetWidth) + 'px';
	if ( !_Obj.getAttribute('maxLimit') ) _Obj.setAttribute('maxLimit',150);
	with($('__shopping_cart__'+Sys.uniqID).style)
	{
		width = (150 + _BtnObj.offsetWidth) + 'px';
		left = (WF.getBCW() - 168 - _BtnObj.offsetWidth) + 'px';
	}
	if ( _Obj.getAttribute('direction') == 'right' ) _Obj.setAttribute('maxLimit',150 + _BtnObj.offsetWidth);
	EF.slide(_Obj,function()
	{
		if ( _Obj.getAttribute('direction') == 'right' )
		{
			with($('__shopping_cart__'+Sys.uniqID).style)
			{
				width = _BtnObj.offsetWidth + 'px';
				left = (WF.getBCW() -_BtnObj.offsetWidth - 18) + 'px';
			}
			_BtnObj.style.marginLeft = '0px';
		}
		_Obj.setAttribute('direction',_Obj.getAttribute('direction') == 'left' ? 'right' : 'left');
		if ( !_Obj.getAttribute('loaded') )
		{
			_Obj.setAttribute('loaded',1);
			Req.makeRequest(Url.product('viewcache'),function(_ajax)
			{
				_Obj.innerHTML = '<div style="width:150px;height:300px;position:absolute;overflow:auto;overflow-y:scroll;overflow-x:hidden;word-break:break-all;word-wrap:break-word;z-Index:5;">'+_ajax.responseText+'</div>';
			});
		}
	});
};
WF.ajaxContainer = function(_id)
{
	var obj = $(_id);
	if ( obj.elementExists() )
	{
		var ulObj = null;
		var liObj = function(_1)
		{
			try
			{
				if ( !_1 ) return;
				if ( _1.nodeName == 'UL' )ulObj = _1;else liObj(_1.children.item(0));
			}catch (e){alert(''+e.message);}finally{}
		};
		liObj(obj.children.item(0));
		if ( ulObj )
		{
			var frg = Url.fragment();
			var selectedIdx = -1;
			for ( var i = 0;i<ulObj.children.length ; i++)
			{
				liObj = ulObj.children.item(i);
				Evt.add(liObj,'click',function()
				{
					var tmp = null;
					if ( this.className.indexOf("selected") == -1 )
					{
						for ( var i = 0;i<ulObj.children.length ;i++ )
						{
							tmp = ulObj.children.item(i);
							tmp.className = tmp.className.replace('selected',''); 
						}
						this.className = this.className + ' selected';
						Load.tab(this.getAttribute('data'),obj);
					}
					tmp = null;
				}.bind(liObj));
				if ( (frg && liObj.getAttribute('fragment') == frg) || liObj.className.indexOf("selected") > -1 )
				{
					liObj.className = liObj.className.replace('selected',''); 
					selectedIdx = i;
				}
			}
			if ( selectedIdx > -1 )
			{
				liObj = ulObj.children.item(selectedIdx);
				liObj.className = liObj.className + ' selected';
				Load.tab(liObj.getAttribute('data'),obj);
			}
		}
	}
};
function Url(){}
Url.head = "";
Url.img = "";
Url.getHead = function(_nofull)
{
	_nofull = _nofull || false;
	var _h = document.URL.match(/(\/~[\w]*)/ig);
	_h = Url.takeTailBacklash(window.location.protocol + "//" + window.location.hostname+ (_nofull || !_h ? '' : _h));
	if ( _h == 'outlook://' ) _h = 'http://www.iwee.com.tw/';
	return _h;
};
Url.tab = function(_paras,_id){return Url.getHead()+'ajax/tab.html?invoke='+_paras + (_id ? "&id="+_id : '');};
Url.order = function(_invoke,_id){_invoke = _invoke || 'getPrdFromCart';return Url.ajax('order',_invoke,_id);};
Url.member = function(_invoke,_id){_invoke = _invoke || 'sign';return Url.ajax('member',_invoke,_id);};
Url.product = function(_invoke,_id){_invoke = _invoke || 'searching';return Url.ajax('product',_invoke,_id);};
Url.ajax = function(_doc,_invoke,_id)
{
	var _serach = window.location.search || '';
	if ( _serach && _serach.length ) _serach = _serach.replace(/\?/ig,'&');
	_invoke = $splat(_invoke);
	return Url.getHead()+'ajax/'+_doc+'.html?invoke='+_invoke[0]+_serach+(_id ? '&id='+_id : '') + (_invoke[1] ? '&handle='+_invoke[1] : '');
};
Url.setImage = function(){Url.img = "/shared/images/";};
Url.getImg = function(_1,_2){return Url.head + Url.img + (_2 ? _2 + '/' : '') + _1;};
Url.takeTailBacklash = function(_string,_backlash)
{
	_backlash = _backlash || '/' ;
	return (/(\/|\\)$/).test(_string) ? _string : _string + _backlash;
};
Url.stripBTEBacklash = function(_string){return Url.stripTailBacklash(Url.stripHeadBacklash(_string));};
Url.stripHeadBacklash = function(_string)
{ 
	return ( _string.charAt(0) == '/' || _string.charAt(0) == '\\' ) ? _string.substring(1,_string.length) : _string;
};
Url.stripTailBacklash = function(_string)
{
	return ( _string.charAt(_string.length-1) == '/' || _string.charAt(_string.length-1) == '\\' ) ? _string.substring(0,_string.length-1) : _string;
};
Url.init = function(){Url.head = Url.getHead();Url.setImage();};
Url.get = function(_w){ _w = _w ? Url.stripHeadBacklash(window.location.pathname) : window.location.href;_w = _w.replace(/\#([\w\d_]+)/ig,'');_w = _w.indexOf('outlook:') > -1 ? '/rss/' : _w;return _w;};
Url.set = function(_url)
{
	if ( typeof _url != 'string' ) return;
	_url = _url.indexOf("http") > -1 || _url.indexOf("rss") > -1 ? _url : Url.head+_url;
	if ( Browser.isIE )window.location.reload(_url);else window.location.href = _url;
};
Url.reload = function(){Url.set(Url.get());};
Url.fragment = function()
{
		var _url = document.URL;
		if ( !_url || !_url.length ) _url = window.location.href;
		_url = _url.match(/\#([\w\d_]+)$/ig);
		if ( _url ) _url = String(_url[0]).replace("#",'');
		return _url;
};
Url.format = function(_url){return _url ? _url + (_url.indexOf("?") > -1 ? "&" : "?") : '';};
function Panel(){}
Panel._sID = '_panel_';
Panel._sContentID = '_panel_content_';
Panel._sCalculagraph = '_panel_time_';
Panel._sCalContainer = '_panel_time_container_';
Panel._sCaption = '_panel_caption_';
Panel._sCaptionText='提示信息';
Panel._sContentColor='#000000';
Panel._aReturnParas = [];
Panel._nRtnPIndex = 0;
Panel._nTime = 10;
Panel._bOpened = false;
Panel._fCloseToCallFun = null;
Panel._oTimeOutObj = null;
Panel.getHTML = function()
{
	return "<table width=100% cellpadding=0 cellspacing=0 border=0><tr><td width=11><div class=\"ico_bg ico_panel_ctl\">&nbsp;</div></td><td valign=top style=\"cursor:move;\" onMouseDown=\"MM_dragLayer('"+Panel._sID+"',event);\"><table width=100% height=31 cellpadding=0 cellspacing=0 border=0><tr align=left id=\"__captionBar__\" style=\"background-color:#F0F8FE;\"><td style=\"border-top:1px solid #BDD3E5;\"><div style=\"float:right\"><a href=\"javascript:void(0);\" onClick=\"Panel.close();\">關閉</a></div><div class=\"price_blue\" id=\""+Panel._sCaption+"\">"+Panel._sCaptionText+"</div></td></tr></table></td><td width=11><div class=\"ico_bg ico_panel_ctr\">&nbsp;</div></td><tr><td width=11 background='"+Url.head + Url.img+"tw/box_bg02.gif'></td><td height=100 align=center bgcolor=\"#FFFFFF\" style=\"color:#BFBFBF\"><div id=\""+Panel._sContentID+"\" style=\"color:#000000;font-size:16px;\"></div><div id=\""+Panel._sCalContainer+"\"><span id=\""+Panel._sCalculagraph+"\">"+Panel._nTime+"</span>秒後自動關閉</div></td><td width=11 background='"+Url.head + Url.img+"tw/box_bg03.gif'></td></tr><tr><td width=11 height=10><div class=\"ico_bg ico_panel_cbl\">&nbsp;</div></td><td style=\"background-repeat:repeat-x;height:10px;font-size:1px;\" width=100% height=10 background='"+Url.head + Url.img+"tw/box_bg04.gif'></td><td width=11 height=10><div class=\"ico_bg ico_panel_cbr\">&nbsp;</div></td></tr></table>";
};
Panel.close = function()
{
	$(Panel._sID).style.visibility = 'hidden';
	$(Panel._sCaption).set(Panel._sCaptionText);
	$(Panel._sContentID).set('');
	$(Panel._sCalContainer).hide();
	Panel.setColor();
	WF.hideShade();
	if ( Panel._oTimeOutObj ) 
	{
		clearTimeout(Panel._oTimeOutObj);
		Panel._oTimeOutObj = null;
	}
	if ( typeof Panel._fCloseToCallFun == 'function') Panel._fCloseToCallFun.apply(this,Panel._aReturnParas);
	Panel._fCloseToCallFun = null;
	Panel._bOpened = false;
	Panel._nRtnPIndex = 0;
	Panel._aReturnParas = [];
};
Panel.calculagraphStart = function(_nTimeOut)
{
	$(Panel._sCalContainer).disp();
	_nTimeOut = parseInt(_nTimeOut);
	if ( isNaN(_nTimeOut) ) Panel.calculagraph();
	else if ( _nTimeOut > 0 ) Panel.calculagraph(_nTimeOut);
	else $(Panel._sCalContainer).hide();
};
Panel.setRtnParas = function()
{
	var i = 0;
	var diff = 0;
	while(arguments[i])
	{
		Panel._aReturnParas[i+Panel._nRtnPIndex+diff] = arguments[i];
		i = -(~i);
	}
};
Panel.setCaption = function(_sCaption){$(Panel._sCaption).set(_sCaption);};
Panel.setColor = function(_sColor)
{
	var _obj = null;
	if ( (_obj = $(Panel._sContentID)) && _obj.elementExists() ) _obj.style.color = _sColor || '#000000';
	_obj = null;
};
/**
 * 
 * @var string _sType 0:html,1:ajax
 */
Panel.prompt = function(_sParas,_fCallBack,_sTitle,_sType)
{
	if ( typeof _sParas == 'undefined' || typeof _fCallBack != 'function') return;
	_sType = _sType || 0;
	var _obj = null;
	if ( !Panel._bOpened && (_obj = $(Panel._sID)) && _obj.elementExists() )
	{
		WF.showShade();
		Panel._bOpened = true;
		switch(_sType)
		{
			case 0:
			case '0':
				WF.setInnerHTML(Panel._sContentID,_sParas);
				WF.adjustContainerSize(Panel._sContentID);
				WF.adjustOrientation('MM',$(Panel._sID));
				Sys._ready($(Panel._sContentID));
				break;
			case 1:
			case '1':
				$(Panel._sContentID).set('正在加載，請稍後...');
				Req.makeRequest(_sParas,function(_ajax)
				{
					WF.setInnerHTML(Panel._sContentID,_ajax.responseText);
					WF.adjustContainerSize(Panel._sContentID);
					WF.adjustOrientation('MM',$(Panel._sID));
					Sys._ready($(Panel._sContentID));
				});
				break;
		}
		if ( arguments.length > 4 )
		{
			var i = 4;
			while(arguments[i])
			{
				Panel._aReturnParas[Panel._nRtnPIndex] = arguments[i];
				Panel._nRtnPIndex = -(~Panel._nRtnPIndex);
				i = -(~i);
			}
		}
		if ( typeof _fCallBack == 'function' ) Panel._fCloseToCallFun = _fCallBack;
		_obj.style.visibility = 'visible';
		WF.adjustOrientation('MM',_obj);
		Panel.setCaption((_sTitle || '輸入信息'));
		$(Panel._sCalContainer).style.display = 'none';
		_obj = null;
	}
};
Panel.open = function(_sContent,_fCallBack,_nTimeOut)
{
	var _obj = null;
	if ( (_obj = $(Panel._sID)) && _obj.elementExists() )
	{
		if ( !Panel._bOpened )
		{
			WF.showShade();
			Panel._bOpened = true;
			_obj.style.visibility = 'visible';
		}
		if ( typeof _fCallBack == 'function' ) Panel._fCloseToCallFun = _fCallBack;
		Panel.calculagraphStart(_nTimeOut);
		WF.setInnerHTML(Panel._sContentID,_sContent);
		WF.adjustContainerSize(Panel._sContentID);
		WF.adjustOrientation('MM',_obj);
		_obj = null;
	}
};
Panel.init = function()
{
	WF.creDiv(Panel._sID,document.body,[
		['visibility','hidden'],
		['position','absolute'],
		['width',( Browser.isIE ? 300 : '300px' )],
		['left',0],
		['top',0],
		['zIndex',50]
	],Panel.getHTML());
};
Panel.calculagraph = function(_nTimer)
{
	_nTimer = parseInt(_nTimer);
	_nTimer = isNaN(_nTimer) ? Panel._nTime :_nTimer;
	if ( _nTimer > 0  && Panel._bOpened )
	{
		$(Panel._sCalculagraph).set(_nTimer);
		Panel._oTimeOutObj = setTimeout(function(){Panel.calculagraph(~(-_nTimer))},1000);
	}
	else if ( Panel._bOpened ) Panel.close();
};
function Mutual(){}
Mutual._sID = '_mutual_panel_';
Mutual._sTitleID = '_mutual_title_';
Mutual._sContentID = '_mutual_content_';
Mutual._bOpened = false;
Mutual._aXY = [];
Mutual._closeToCallFun = null;
Mutual._closeToCallParas = [];
Mutual._sAlias = '';
Mutual._clientY = 0;
Mutual.getHTML = function()
{
	return '<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td align="center"><div class="arrow_up" id="_mutual_pointer_up_">◆</div></td></tr></table></div><div style="border:1px solid #3581CB;background-color:#3581CB;"><div><div id="_mutual_img_" style="float:right;"><a href="#this" onclick="Mutual.close();" class="ico_bg ico_close_win">&nbsp;</span></a></div><div id="'+Mutual._sTitleID+'" style="color:#ffffff;"></div><div></div></div><div style="background-color:#ffffff;overflow:auto;" id="'+Mutual._sContentID+'">test</div></div><div><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td align="center"><div class="arrow_down_parent"><div class="arrow_down" id="_mutual_pointer_down_">◆</div></div></td></tr></table>';
};
Mutual.init = function()
{
	WF.creDiv(Mutual._sID,document.body,[
		['visibility','hidden'],
		['position','absolute'],
		['width',( Browser.isIE ? 300 : '300px' )],
		['left',0],
		['top',0],
		['zIndex',49]
	],Mutual.getHTML());
};
Mutual.getUrl = function(_sInvoke,_sDoc)
{
	_sDoc = _sDoc || 'mutual';
	return Url.ajax(_sDoc,_sInvoke);
};
Mutual.setW = function(_aWidth)
{
	_aWidth = parseInt(_aWidth);
	if ( !isNaN(_aWidth) ) $(Mutual._sID).style.width = _aWidth + 'px';
};
Mutual.setCallBack = function(_fun,_paras)
{
	if ( typeof _fun == 'function' )
	{
		Mutual._closeToCallFun = _fun;
		if ( _paras ) Mutual._closeToCallParas = $splat(_paras);
	}
};
Mutual.setData = function(_aText,_aValue)
{
	if ( Mutual._sAlias.length > 0 )
	{
		var i = 0;
		var tmp = null;
		$(Mutual._sAlias+'_text').value = _aText.join(",");
		while( (tmp = $(Mutual._sAlias+'_value_'+i)) && tmp.elementExists() )
		{
			if ( _aValue[i] == null || _aValue[i] == undefined )_aValue[i] = '';
			if ( tmp.nodeName =='INPUT' ) tmp.value = _aValue[i];
			else tmp.innerHTML = _aValue[i];
			i = -(~i);
		}
	}
};
Mutual.prompt = function(_sID,_sPrompt,_sTitle)
{
	var _obj = null;
	if ( !Mutual._bOpened && (_obj = $(Mutual._sID)) && _obj.elementExists() )
	{
		WF.showShade();
		Mutual._bOpened = true;
		_sTitle = _sTitle || '相關提示';
		$(Mutual._sContentID).set(_sPrompt);
		$(Mutual._sTitleID).set(_sTitle);
		Mutual.adjustXY(_sID);
	}
};
Mutual.open = function(_sAlias,_sTitle,_sInvoke,_sDoc)
{
	var _obj = null;
	if ( !Mutual._bOpened && (_obj = $(Mutual._sID)) && _obj.elementExists() )
	{
		WF.showShade();
		Mutual._sAlias = _sAlias;
		_sTitle = _sTitle || '';
		Mutual._bOpened = true;
		$(Mutual._sContentID).set('正在加載內容，請稍候...');
		$(Mutual._sTitleID).set(_sTitle);
		Req.makeRequest(Mutual.getUrl(_sInvoke,_sDoc),function(_ajax)
		{
			$(Mutual._sID).style.visibility = 'hidden';
			WF.setInnerHTML(Mutual._sContentID,_ajax.responseText);
			Sys.delayExecute(Mutual.adjustXY,10);
		});
		Mutual.adjustXY();
		_obj = null;
	}
};
Mutual.arrowHead = function(_up)
{
	if ( _up )
	{
		$('_mutual_pointer_up_').style.display = 'none';
		$('_mutual_pointer_down_').style.display = 'block';
	}
	else
	{
		$('_mutual_pointer_down_').style.display = 'none';
		$('_mutual_pointer_up_').style.display = 'block';
	}
};
Mutual.adjustXY = function(_sID)
{
	var _tmp,_obj = null;
	_sID = _sID || Mutual._sAlias+'_text';
	if ( (_obj = $(Mutual._sID)) && (_tmp = $(_sID)) )
	{
		_obj.style.height = null;
		if ( !Mutual._aXY || !Mutual._aXY.length ) Mutual._aXY = WF.getObjOrientation(_tmp);
		var _diff = 0;
		var _bt = WF.getBT();
		_obj.style.left =(Mutual._aXY[0] + _tmp.offsetWidth / 2 - _obj.offsetWidth / 2) + 'px';
		var _half = WF.getBCH() / 2+ _bt;
		try
		{
			if ( typeof event == 'object' )
				Mutual._clientY = Browser.isIE ? event.clientY : event.offsetY;
		}
		catch (e){}
		if ( Mutual._aXY[1] >=  _half ) // 上半部分
		{
			_diff = Mutual._aXY[1] - _obj.offsetHeight;
			_half = Mutual._aXY[1] - _bt;
			Mutual.arrowHead(1);
			if ( _diff < 0 )
			{
				_obj.style.top = _bt + 'px';
				if ( (_diff = $(Mutual._sContentID)) )
				{
					_tmp = Mutual._aXY[1]-23-parseInt(_obj.style.top);
					if ( _tmp > 0 )_diff.style.height =  _tmp+'px';
				}
			}
			else if ( _obj.offsetHeight > _half )
			{
				_obj.style.top = _bt+1+'px';
				$(Mutual._sContentID).style.height = (_half-Mutual._aXY[3]-2)+'px';
			}
			else _obj.style.top = _diff+1 + 'px';
		}
		else  // 下半部分
		{
			Mutual.arrowHead();
			_obj.style.top = Mutual._aXY[1] + _tmp.offsetHeight + 'px';
			_diff =WF.getBCH() - parseInt(_obj.style.top) + _bt-24;
			if ( _obj.offsetHeight > _diff &&  ( (_tmp = $(Mutual._sContentID)) && _tmp.elementExists()) ) _tmp.style.height =  _diff+'px';
		}
		_obj.style.visibility = 'visible';
		_obj = null;_half_level = null;_diff = null;_bt = null;_tmp = null;
	}
};
Mutual.close = function()
{
	WF.hideShade();
	$(Mutual._sID).style.visibility = 'hidden';
	var _cObj = null;
	if ( (_cObj = $(Mutual._sContentID)) && _cObj.elementExists() )
	{
		$(_cObj).set('');
		_cObj.style.height = null;
	}
	Mutual._aXY = null;
	Mutual._bOpened = false;
	if ( typeof Mutual._closeToCallFun == 'function' )
	{
		Mutual._closeToCallFun.apply(this,Mutual._closeToCallParas);
		Mutual._closeToCallFun = null;
	}
};
function Load(){}
Load._sID = "window_loading";
Load.init = function()
{
	WF.creDiv(Load._sID,document.body,'box_loading','<img src="'+Url.getHead()+'shared/images/window_loading.gif" /><p>請稍後...</p>');
};
Load.show = function(_title)
{
	var _obj = null;
	if ( (_obj = $(Load._sID)) && _obj.elementExists() )
	{
		with(_obj.style)
		{
			top=WF.getBT()+3+'px';
			left=(window.screen.width-158)+'px';
			display = 'block';
			$(_obj.childNodes[2]).set(_title || '請稍後...');
		}
		_obj = null;
	}
};
Load.hide = function()
{
	var _obj = null;
	if ( (_obj = $(Load._sID)) && _obj.elementExists() ) _obj.style.display = 'none';
	_obj = null;
};
Load._tabShowOrHide = function(parentObj,id,tag,i)
{
	try
	{
		tag = tag || 'DIV';
		i = i || 1;
		for ( i;i<parentObj.children.length ;i++ )
		{
			_obj = parentObj.children.item(i);
			if ( _obj.getAttribute('subloop') )
			{
				var tmp = _obj.getAttribute('subloop');
				tmp = tmp.split("|");
				Load._tabShowOrHide(_obj.children.item(0),id,tmp[0],tmp[1]);
			}
			else
			{
				if ( _obj.nodeName != tag ) continue;
				_obj.style.display = _obj.id == id[2] && $type(id) == 'array' || i == id ? 'block' : 'none';
			}
		}
	}catch (e){alert('Load._tabShowOrHide:'+e.message);}finally{tag = null;parentObj = null;id = null; i = null;}
};
Load.tab = function(id,parentObj)
{
	if ( parentObj )
	{
		if ( id )
		{
			id = id.split("|");
			id[2] = id[0]+'_'+id[2];
			var _obj,obj = $(id[2]);
			Load._tabShowOrHide(parentObj,id);
			id[1] = id[1].split(",");
			if ( !obj.elementExists() ) 
			{
				obj = WF.creDiv(id[2],parentObj,[['display','block'],['border','1px solid #D8D8D8'],['margin',0],['padding',0]],'正在加載....');
				obj.setAttribute('getData',1);
			}
			if ( obj.getAttribute('getData') )
			{
				switch(String(id[3] || '').toLowerCase())
				{
					case 'direct':
						Url.set(Url.head+ id[1][0] + '?id='+id[0]+(id[1][1] ? '&method='+id[1][1] : ''));
						break;
					case 'get':
						Url.set(Url.get(true) + '?id='+id[0]+'&method='+id[1][0]);
						break;
					case 'ajax':
					default:
						Req.makeRequest(id[1].length == 1 ? Url.tab(id[1][0],id[0]) : Url.ajax(id[1][0],id[1][1],id[0]),function(_1)
						{
							obj.innerHTML = _1.responseText;
							obj = null;
						});
				}
				obj.removeAttribute('getData');
			}			
		}
		else
		{
			var _obj,obj = null;
			_obj = parentObj.children.item(0);
			for ( var i = 0;i<_obj.children.length ;i++ )
			{
				obj = _obj.children.item(i);
				if ( (obj.className).indexOf("selected") > -1 )
				{
					obj = i+1;
					break;
				}
			}
			Load._tabShowOrHide(parentObj,obj);
		}
		_obj = null;id = null;parentObj = null;
	}
};
function Req(){}
Req._postParas = [];					// 提交參數
Req.append = function(_name,_value)
{
	_value = encodeURIComponent(_value);
	if ( Req._postParas.length && _name.indexOf('[') == -1 )
	{
		var find = false;
		for ( var i = 0;i<Req._postParas.length ;i++ )
		{
			find = Req._postParas[i][0] == _name;
			if ( find )
			{
				Req._postParas[i][1] = _value;
				break;
			}
		}
		if ( !find ) Req._postParas.push([_name,_value]);
	}
	else Req._postParas.push([_name,_value]);
}
// 添加ajax提交參數
Req.addPostParas = function(_name,_value)
{
	if ( $type(_value) == 'array')
	{
		if ( $type(_name) == 'array' )
		{
			for ( var i = 0;i<_value.length ; i++ ) Req.append(_name[i],_value[i]);
		}
		else
		{
			for ( var i = 0;i<_value.length ; i++ ) Req.append(_name+'['+i+']',_value[i]);
		}
	}
	else Req.append(_name,_value);
};
// 獲取ajax提交時的參數，如果有參數則提交方式為post否則為get
Req.getPostParas = function(_clean)
{
	var i = 0;
	var str = "";
	while(Req._postParas[i])
	{
		str += (str!= ""?"&": "")+Req._postParas[i][0]+"="+Req._postParas[i][1];
		if (_clean)Req._postParas[i] = null;
		i = -(~i);
	}
	i = null;
	if (_clean)Req.clearPostParas();
	return str;
};
// 清除ajax提交的參數集
Req.clearPostParas = function(_1)
{
	if ( _1 )
	{
		var newParas = [];
		Req._postParas.each(function(_11)
		{
			if ( _11[0] != _1 ) newParas.push(_11);
		});
		Req._postParas = newParas;
	}
	else Req._postParas = [];
};
// 產生ajax對象
Req.getRequest=function()
{
	return $trys(
	function() {return new ActiveXObject('MSXML2.XMLHttp.6.0')},
	function() {return new ActiveXObject('MSXML2.XMLHttp.3.0')},
	function() {return new XMLHttpRequest()},
	function() {return new ActiveXObject('MSXML2.XMLHttp.5.0')},
	function() {return new ActiveXObject('MSXML2.XMLHttp.4.0')},
	function() {return new ActiveXObject('Msxml2.XMLHTTP')},
	function() {return new ActiveXObject('MSXML.XMLHttp')},
	function() {return new ActiveXObject('Microsoft.XMLHTTP')}
	) || null;
};
// ajax發生錯誤時調用函數
Req.errorCallBack = function(_req,_fun)
{
	$alert('errCB:'+_req.status+'\n'+_req.responseText);
	if ( typeof _fun[1] == 'function' ) _fun[1](_req,_fun[2]);
};
// ajax成功完成後調用的函數
Req.succeedCallBack = function(_req,_fun)
{
	if ( typeof _fun[0] == 'function' )
	{
		if ( $type(_fun[2]) == 'element' )_fun[0].apply(_fun[2],[_req,_fun[2]]); else _fun[0](_req,_fun[2]);
	}
};
Req.make = function(){(Req.makeRequest).apply(this,arguments);}
// 執行以ajax方式的請求
Req.makeRequest = function(_url,_fun,_paras)
{
		if(_url == '' || !_url ){ $alert(_url);return;}
		var xmlHttp = null;
		_fun = $splat(_fun);
		if( (xmlHttp =  Req.getRequest()) )
		{
			_fun[2] = _fun[2] || _paras;
			var readyCallBack = function()
			{
				if(xmlHttp && xmlHttp.readyState==4 )
				{
					if( xmlHttp.status==200 && typeof _fun[0] == 'function' )
						Req.succeedCallBack(xmlHttp,_fun);
					else
						Req.errorCallBack(xmlHttp,_fun);
				}
			};
			var _postPars = Req.getPostParas(true);
			if ( _postPars != "" )
			{
				xmlHttp.open("POST", _url, true);
				xmlHttp.onreadystatechange = readyCallBack;
				xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8");
				xmlHttp.send(_postPars);
			}
			else
			{
				xmlHttp.open("GET",_url,true);
				xmlHttp.onreadystatechange = readyCallBack;
				xmlHttp.setRequestHeader("Content-Type","multipart/form-data");
				xmlHttp.send(null);
			}
			_postPars = null;readyCallBack = null;
		}
};
function Msg(){}
Msg.alert = function(msg)
{
	msg = msg.replace('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />','');
	alert(msg);
};
Msg.infoEventHandle = function(_obj,_text_container,evtType)
{
	var mode = _text_container.getAttribute('direction');
	var closed = function(evt)
	{
		var tmp_container = $('__info_'+mode+'container__'+_obj.getAttribute('info_uniq_id'));
		if ( !tmp_container || !tmp_container.elementExists() ) return;
		var tmp_text = tmp_container.children.item(0);
		switch(mode)
		{
			case 'up':tmp_text.setAttribute('direction','down');break;
			case 'down':tmp_text.setAttribute('direction','up');break;
			case 'left':tmp_text.setAttribute('direction','right');break;
			default:tmp_text.setAttribute('direction','left');
		}
		EF.slide(tmp_text,function()
		{
			var _title = tmp_text.children.length ? tmp_text.children.item(0).innerHTML : tmp_text.innerHTML;
			var _callBack = tmp_text.getAttribute('removeCallBack');
			if ( _callBack ) tmp_text.removeAttribute('removeCallBack');
			WF.removeMyself(tmp_container);tmp_container = null;
			_obj.removeAttribute('is_'+mode+'_Busy');
			if ( _callBack == 1 ) Msg.__buildElement(_obj,mode,_title);
			tmp_text = null;_title = null;mode = null;_callBack = null;
		},null,10,3,5);
		if ( !Browser.isIE8)
		{
			_text_container.removeAttribute('maxOpacity');
			_text_container.setAttribute('minOpacity',0);
			EF.fade(_text_container,function(){_text_container = null;},20,null,5);
		}
		if ( typeof evt != 'boolean' && evt ) Evt.remove(_obj,'click',closed);
	};
	var global_closing = function(evt)
	{
		evt = evt ? evt : window.event;
		if ( evt && !$O(evt.target ? evt.target : evt.srcElement,['__info_'+mode+'container__'+_obj.getAttribute('info_uniq_id'),_obj]) )
		{
			closed();
			Evt.remove(document.body,(evtType ? ( evtType == '2' ? 'mouseover' : 'blur' ):'click'),global_closing);
			global_closing = null;
		}
	};
	var blur_closing = function(){closed();Evt.remove(_obj,'blur',blur_closing);blur_closing = null;};
	if ( _text_container.getAttribute('removeCallBack') ) global_closing();
	else
	{
		EF.slide(_text_container,function()
		{
			_obj.removeAttribute('is_'+mode+'_Busy');
			if ( evtType )
			{
				if ( evtType == '2' ) Evt.add(document.body,'mouseover',global_closing);else Evt.add(_obj,'blur',blur_closing);
			}
			else Evt.add(document.body,'click',global_closing);
		},null,10,3,5);
		if ( !Browser.isIE8 )
		{
			WF.setOpacity(_text_container,0);
			_text_container.setAttribute('maxOpacity',100);
			EF.fade(_text_container);
		}
	}
};
Msg.doUp = function(_obj,_title){Msg.__buildElement(_obj,'up',_title);};
Msg.doDown = function(_obj,_title){Msg.__buildElement(_obj,'down',_title);};
Msg.doLeft = function(_obj,_title){Msg.__buildElement(_obj,'left',_title);};
Msg.doRight = function(_obj,_title){Msg.__buildElement(_obj,'right',_title);};
Msg.show = function(_obj)
{
	_obj = $(_obj);
	if ( !_obj.elementExists() ) return;
	if ( _obj.getAttribute('info_up') )Msg.__buildElement(_obj,'up');
	if ( _obj.getAttribute('info_down') )Msg.__buildElement(_obj,'down');
	if ( _obj.getAttribute('info_left') )Msg.__buildElement(_obj,'left');
	if ( _obj.getAttribute('info_right') )Msg.__buildElement(_obj,'right');
};
Msg.closeAll = function(_obj,_type,tmpUniqID,cb)
{
	var _container,_text_container = null;
	_container = $('__info_'+_type+'container__'+tmpUniqID);
	_text_container = $('__info_'+_type+'textcontainer__'+tmpUniqID);
	if ( _text_container.elementExists() )
	{
		if (cb) _text_container.setAttribute('removeCallBack',1);
		try
		{
			if (cb)
				Msg.infoEventHandle(_obj,_text_container);
			else
			{
				switch(_type)
				{
					case 'up':_text_container.setAttribute('direction','down');break;
					case 'down':_text_container.setAttribute('direction','up');break;
					case 'left':_text_container.setAttribute('direction','right');break;
					default:_text_container.setAttribute('direction','left');
				}
				Msg.infoEventHandle(_obj,_text_container);
			}
			return true;
		}catch (e){alert('Msg.__buildElement.1'+e.message);}finally{}
	}
	return false;
};
Msg.__buildElement = function(_obj,_type,_title)
{
	try
	{
		var _xy,_text_container,_container,_titleObj;
		var tmpUniqID  = _obj.getAttribute('info_uniq_id');
		if ( _obj.getAttribute('is_'+_type+'_Busy') ) return; else _obj.setAttribute('is_'+_type+'_Busy',1);
		if ( tmpUniqID )
		{
			_titleObj = ['up','down','left','right'];
			_titleObj = _titleObj.without(_type);
			_titleObj.each(function(_1,_2)
			{
				Msg.closeAll(_obj,_1,tmpUniqID)
			});
			if ( Msg.closeAll(_obj,_type,tmpUniqID,true) ) _container = true;
			if ( _container ) return;
		}
		tmpUniqID = Sys.uniq();
		_container = ['#FF0000','#FFE8E8'];
		_xy = WF.getElementIntactXY(_obj);
		_type = _type || 'up';
		_titleObj = $(_title);
		if ( _titleObj.elementExists() )
		{
			_title = _titleObj.innerHTML;
			if ( (_text_container = _titleObj.getAttribute('info_color'))  ) _container  = Msg.__getStyle(_text_container);
			_title = '<div style="'+(_text_container ? 'padding:2px;border:1px solid '+_container[0]+';background-color:'+_container[1]+';' : '')+'width:auto;">'+_title+'</div>';
		}
		else
		{
			_title = _obj.getAttribute('info_'+_type) || _obj.getAttribute('tip') || _title || 'no content'; 
			if ( (_text_container = _obj.getAttribute('info_'+_type+'_config'))  ) _container  = Msg.__getStyle(_text_container);
			_title = '<div style="'+(_text_container ? 'padding:2px;border:1px solid '+_container[0]+';background-color:'+_container[1]+';' : '')+'width:auto;">'+_title+'</div>';
		}
		_obj.setAttribute('info_uniq_id',tmpUniqID);
		_container = WF.creDiv('__info_'+_type+'container__'+tmpUniqID,(_obj.getAttribute('appBody') ? document.body:document.body.children.item(0)),[
			['width','auto'],['height',_xy[3]],['overflow','hidden'],['whiteSpace','nowrap'],['top',0],['left',0],['position','absolute'],['zIndex',2999]
		]);
		_text_container = WF.creDiv('__info_'+_type+'textcontainer__'+tmpUniqID,_container,[
			['width','auto'],['height','auto'],['overflow','hidden'],['wordBreak','break-all'],['wordWrap','break-word'],['zIndex',3000]
		],_title);
		/*if ( _text_container.children.length && _text_container.offsetWidth < _text_container.children.item(0).offsetWidth )
		{
			_xy[2] = _text_container.children.item(0).offsetWidth;
			_container.style.width = _text_container.style.width = _xy[2]+'px';
		}*/
		_container.style.width = parseInt(_text_container.offsetWidth) + 'px';
		if ( _text_container.getAttribute('direction') ) return;
		_text_container.setAttribute('direction',_type);
		if ( _type == 'up' || _type == 'down') _text_container.setAttribute('maxLimit',_text_container.offsetHeight);
		else 
		{
			_text_container.setAttribute('maxLimit',_text_container.offsetWidth);
			(_text_container.children.item(0)).style.height = '16px';
			(_text_container.children.item(0)).style.whiteSpace = 'nowrap';
		}
		switch(_type)
		{
			case 'up':
				with(_container.style)
				{
					left = _xy[0] + 'px';
					top = (_xy[1] - _text_container.offsetHeight) + 'px';
					height = _text_container.offsetHeight + 'px';
				}
				with(_text_container.style){marginTop = _text_container.offsetHeight + 'px';}
				break;
			case 'down':
				with(_container.style)
				{
					left = _xy[0] + 'px';
					top = (_xy[1] + _xy[3]+( Browser.isFirefox ? _xy[3]-10 : 0)) + 'px';
					height = _text_container.offsetHeight + 'px';
				}
				with(_text_container.style){marginTop = (0-_text_container.offsetHeight) + 'px';}
				break;
			case 'left':
				with(_container.style)
				{
					left = (_xy[0] - _text_container.offsetWidth) + 'px';
					top = _xy[1] + 'px';
					height = _text_container.offsetHeight + 'px';
				}
				with(_text_container.style){marginLeft =  _text_container.offsetWidth + 'px';}
				break;
			case 'right':
				with(_container.style)
				{
					left = (_xy[0] + _text_container.offsetWidth) + 'px';
					top = _xy[1] + 'px';
					height = _text_container.offsetHeight + 'px';
				}
				with(_text_container.style){marginRight = (_text_container.offsetWidth) + 'px';}
				break;
		}
		_type = _obj.getAttribute('blur');
		_type = typeof _type == 'string' ? _type : _obj.getAttribute('info_evttype');
		Msg.infoEventHandle(_obj,_text_container,_type);
	}
	catch (e){alert('Msg.__buildElement:'+e.message);}finally{_container = null;tmpUniqID = null;_xy = null;_type = null;_title = null;_titleObj = null;}
};
Msg.__getStyle = function(config)
{
	try
	{
		config = config.split("|");
		switch(config[0])
		{
			case 'error':
			case 'red':
			case '0':
				return ['#FF0000','#FFE8E8',''];
				break;
			case 'normal':
			case 'blue':
			case '1':
				return ['#0080FF','#E1F0FF',''];
				break;
			case 'warn':
			case 'yellow':
			case '2':
				return ['#FFD98C','#FFF5DB',''];
				break;
			default:
				return [config[0] || '#FF0000',config[1] || '#FFE8E8',config[2] || ''];
		}
	}catch (e){alert('Msg.__getStyle:'+e.message)}finally{config = null;}
};
function Menu(){}
Menu.popContent = [];
Menu.__popItemClkEvent = function(idx)
{
	var containerObj = $('__popup__'+Sys.uniqID);
	switch(typeof Menu.popContent[idx])
	{
		case 'string':
			window.location.href = Menu.popContent[idx];
			containerObj.hide();
			break;
		case 'function':
			Menu.popContent[idx]();
			containerObj.hide();
			break;
	}
};
Menu.pop = function(_obj,_cType)
{
	_obj = $(_obj);
	if ( !_obj.elementExists() ) return;
	var layer = _obj.getAttribute('pop');
	var color = {
		'classic':['#808080','#CCCCCC','#CFD6E8','#737b92','#000000']
	};
	_cType = _cType || 'classic';
	if ( typeof color[_cType] == 'object' )
	{
		color = color[_cType];
	}
	else color = color['classic'];
	var listObj,parentObj = _obj.parentElement ? _obj.parentElement : _obj.parentNode;
	for ( var i = 0;i<parentObj.children.length ; i++)
	{
		listObj = parentObj.children.item(i);
		if ( listObj === _obj )
		{
			i = -~i;
			listObj = i <parentObj.children.length ? parentObj.children.item(i) : null;
			break;
		}
		else listObj = null;
	}
	if ( listObj )
	{
		var containerObj = $('__popup__'+Sys.uniqID);
		Menu.popContent = [];
		var popupW = 150;
		var popupH = 0;
		if ( !containerObj.elementExists() ) return;
		var tempObj,html = '<table style="border:1px solid '+color[0]+';font-size:12px;" id="evtPopup" bgcolor="'+color[1]+'" width="'+popupW+'" cellpadding="0" cellspacing="1" oncontextmenu="self.event.returnValue=false">';
		if ( listObj.children.length )
		{
			for ( var i = 0; i<listObj.children.length; i++ )
			{
				tempObj = listObj.children.item(i);
				html+='<tr><td style="cursor:hand;cursor:pointer;color:'+color[4]+';border:1px solid '+color[1]+'" onmouseover="this.style.background=\''+color[2]+'\';this.style.border=\'1px solid '+color[3]+'\';" onmouseout="this.style.background=\''+color[1]+'\';this.style.border=\'1px solid '+color[1]+'\';"';
				html +=' onclick="Menu.__popItemClkEvent('+i+');">'+tempObj.innerHTML+'</td></tr>';
				Menu.popContent[i] = tempObj.href;
			}
		}
		html = html + '</table>';
		containerObj.innerHTML = html;
		var _xy = WF.getElementXY(_obj);
		var _setXY = [0,0,0];
		_setXY[1] = _xy[1] = _xy[1] - 2;
		_setXY[0] = _xy[0] - popupW;
		if ( (_setXY[1] + popupH) > WF.getBH() )
		{
			_setXY[1] = WF.getBH() - popupH;
			_setXY[2] = _xy[1] - _setXY[1];
		}
		if ( _setXY[1] < 0 )
		{
			popupH = popupH + _xy[1];
			_setXY[1] = 0;
		}
		if ( (_xy[4] = (_setXY[0] < 0)) )
		{
			_setXY[0] = _setXY[0] + popupW +_xy[2];
			if ( parseInt(_setXY[0] + popupW) > WF.getBW() ) _setXY[0] = WF.getBW() - popupW - 2;
			_xy[3] = 0 - popupW+40;
			if ( Browser.isOpera || Browser.isIE ) _xy[3] = 0;
		}
		else _xy[3] = popupW - 1;
		containerObj.disp(); 
		var _creDiv = WF.creDiv('_popcaption_',null,[
			['position','absolute'],
			['marginLeft',_xy[3]],
			['fontWeight','bold'],
			['width',_xy[2]+4],
			['noWrap','true'],
			['padding','2px'],
			['cursor',Browser.isIE || Browser.isOpera ? 'hand' : 'pointer'],
			['borderBottom','1px solid '+color[0]],
			['borderTop','1px solid '+color[0]],
			[_xy[3] < 0 ? 'borderLeft' : 'borderRight','1px solid '+color[0]],
			['backgroundColor',color[1]],
			['color',color[4]],
			['zIndex',2001]
		],_obj.innerHTML);
		WF.insertHTML(containerObj,'afterBegin',_creDiv.outerHTML);
		containerObj.oncontextmenu = function(){return false;};
		_creDiv = containerObj.children.item(0);
		if ( _obj.onclick )
		{
			_creDiv.onclick = _obj.onclick;
			_creDiv.style.cursor = Browser.isIE || Browser.isOpera ? 'hand' : 'pointer';
		}
		else if ( _obj.href )
		{
			_creDiv.onclick = function(){window.location.href = _obj.href;}
			_creDiv.style.cursor = Browser.isIE || Browser.isOpera ? 'hand' : 'pointer';
		}
		if ( _xy[4] )
		{
			_creDiv.style.borderRight = "0px";
			_creDiv.style.borderLeft = "1pt solid #808080";
			_creDiv.style.left = 1 - parseInt(_creDiv.offsetWidth);
		}
		with(containerObj.style)
		{
			left = _setXY[0]+'px';
			top = _setXY[1] + 'px';
		}
		containerObj.setAttribute('maxLeft',_setXY[0]+containerObj.offsetWidth);
		containerObj.setAttribute('maxTop',_setXY[1]+containerObj.offsetHeight);
		var domousemove = function(evt)
		{
			evt = typeof evt == 'boolean' ? evt : ( evt ? evt : event );
			if ( evt && !$O(evt.target ? evt.target : evt.srcElement,['__popup__'+Sys.uniqID,_obj]) )
			{
				containerObj.hide();
				Evt.remove(document.body,'mousemove',domousemove);
			}
		};
		Evt.add(document.body,'mousemove',domousemove);
	}
};
Menu._guideCallBack = [];
Menu.guideSetCB = function(obj,fun,paras)
{
	var _found = false;
	Menu._guideCallBack.each(function(_val)
	{
			if ( !_found ) _found = _val[0] === obj;
	});
	if ( !_found ) Menu._guideCallBack.push([obj,fun,paras]);
	_found = null;
};
Menu.guideCall = function(obj)
{
	var _callBack = [];
	var _cb = null;
	Menu._guideCallBack.each(function(_val)
	{
			if ( _val[0] === obj ) _cb = _val; else _callBack.push(_val);
	});
	Menu._guideCallBack = _callBack;
	if ( _cb )
	{
		_cb[2] = $splat(_cb[2]);
		_cb[2].unshift(obj);
		_cb[1].apply(this,_cb[2]);
	}
	_callBack = null;_cb = null;
};
Menu.guide = function(_obj,_find,_cb)
{
	if ( $type(_find) != 'array' ) return;
	var _per = 10;
	var _total = 1;
	var _page = 1;
	var _container = null;
	var _currIdx = -1;
	var _currTxt = _obj.value.length ? _obj.value : 0;
	var _currVal = '';
	var searchEngine = [];
	var findEngine = [];
	var valEngine = [];
	var tmp = null;
	_find.each(function(_val,_key)
	{
		_find[_key] = _val.replace(/(.*)\((.*)\)\[(.*)\]/ig,"$1");
		tmp = _val.replace(/(.*)\((.*)\)\[(.*)\]/ig,"$2");
		findEngine[_key] = tmp;
		tmp = tmp.split("|");
		tmp.push(_find[_key]);
		searchEngine[_key] = tmp;
		tmp = _val.replace(/(.*)\((.*)\)\[(.*)\]/ig,"$3");
		valEngine[_key] = tmp;
	});
	var doCallBack = function()
	{
		switch($type(_cb))
		{
			case 'function':
				_cb.apply(this,[_currTxt,_currVal]);
				break;
			case 'element':
			case 'string':
				_cb = $(_cb);
				_cb.value = _obj.value.length > 0 ? _currVal : '';
				break;
			case 'array':
				break;
		}
	};
	var doKeyboardUD = function()
	{
		if ( _total > 1 &&  (window.event.keyCode == 38 || window.event.keyCode == 40) )
		{
			var tmp,tmpObj = _container.children.item(1);
			if ( _currIdx > -1 && (tmp = tmpObj.children.item(_currIdx)))
			{
				tmp.style.backgroundColor = '#FFFFFF';
				tmp.setAttribute('onmouseover','this.style.borderBottom=\'1px solid #7F9DB9\';this.style.backgroundColor=\'#E7F1FB\';');
				tmp.setAttribute('onmouseout','this.style.border=\'1px solid #FFFFFF\';this.style.backgroundColor=\'#FFFFFF\';');
			}
			_currIdx = _currIdx + (window.event.keyCode == 38 ? -1 : (window.event.keyCode == 40 ? 1 : 0));
			_currIdx = _currIdx >= _per ? 0 : ( _currIdx < 0 ? (_per > _total ? (_total -1): _per-1) : _currIdx);
			_currIdx = _currIdx >= _total ? 0 : _currIdx;
			if ( (tmp = tmpObj.children.item(_currIdx)) )
			{
				tmp.style.backgroundColor = '#C8E3FC';
				tmp.setAttribute('onmouseover','this.style.borderTop=\'1px solid #7F9DB9\';this.style.borderBottom=\'1px solid #7F9DB9\';this.style.backgroundColor=\'#E7F1FB\';');
				tmp.setAttribute('onmouseout','this.style.border=\'1px solid #FFFFFF\';this.style.backgroundColor=\'#C8E3FC\';');
				tmp = tmp.children.item(1);
				_currTxt = tmp.innerHTML;
				_currVal = tmp.getAttribute('value');
			}
			tmpObj = null;tmp = null;
		}
		else if ( _total > 10 && (window.event.keyCode == 37 || window.event.keyCode == 39) )
		{
			var tmp = Math.ceil(_total / _per);
			_page = _page + (window.event.keyCode == 37 ? -1 : (window.event.keyCode == 39 ? 1 : 0));
			_page = _page > tmp ? tmp : ( _page < 1 ? 1 : _page);
			doGuidePage(_page);
			tmp = null;
		}
		else if ( _total > 0 && window.event.keyCode ==	13 )
		{
			var tmpObj = _container.children.item(1);
			var tmp,i = 0;
			for ( i;i<tmpObj.children.length ;i++ )
			{
				if ( _currIdx == i )
				{
					tmp = tmpObj.children.item(i);
					_currTxt = tmp.children.item(1).innerHTML;
					_currVal = tmp.children.item(0).getAttribute('value');
					_obj.value = _currTxt;
					_obj.blur();
					closed();
					break;
				}
			}
			tmpObj = null;i = null;tmp = null;
		}
	};
	var doGuideChanged = function()
	{
		if ( _obj.getAttribute('old_guide_kw') == _obj.value || _obj.value == _obj.getAttribute('tip') ) return;
		var tmp = _container.children.item(0);
		var _tmpObj = [[],[],[]];
		var re = eval('/(^'+(_obj.value.replace(/\//ig,"\//"))+')+/ig');
		var find = [];
		_page = 1;
		searchEngine.each(function(_val,_key)
		{
			find = _val.select(function(_v,_k)
			{
				if ( re.test(_v) ) return true;
			});
			if ( find.length )
			{
				_tmpObj[0].push(_find[_key]);
				_tmpObj[1].push(_val[0]);
				_tmpObj[2].push(valEngine[_key]);
			}
		});
		if ( _tmpObj.length )
		{
			_currTxt = 0;
			var _html = _getHtml(_tmpObj[0],_tmpObj[1],_tmpObj[2]);
			var _pageObj = _container.children.item(1);
			_pageObj.innerHTML = _html[0];
			_pageObj = _container.children.item(2);
			_pageObj.innerHTML = _html[1];
			setGuideItem();
		}
		find = tmp.children.item(0);
		find.innerHTML =  _obj.value.length > 0  && _tmpObj.length > 0  ? _obj.value+',' : (_obj.value.length > 0 ? '對不起，' : '');
		find = tmp.children.item(1);
		find.innerHTML =  _obj.value.length > 0  && _tmpObj.length > 0  ?  '請選擇' : ( _obj.value.length > 0 ? '找不到：'+_obj.value : '請選擇');
		_obj.setAttribute('old_guide_kw',_obj.value);
		tmp = null;_tmpObj = null;re = null;find = null;
	};
	var doGuidePage = function(_p)
	{
		_obj.removeAttribute('guide_loaded');
		_p = parseInt(_p);
		_page = isNaN(_p) ? parseInt(this.innerText ? this.innerText : this.innerHTML) : _p;
		_currTxt = (_page - 1) * _per;
		var _html = _getHtml();
		var _pageObj = _container.children.item(1);
		_pageObj.innerHTML = _html[0];
		_pageObj = _container.children.item(2);
		_pageObj.innerHTML = _html[1];
		setGuideItem();
		Sys.delayExecute(function()
		{
			_obj.setAttribute('guide_loaded',1);
		});
		_html = null;_pageObj = null;
	};
	var setGuidePage = function()
	{
		var _pageObj = _container.children.item(2);
		var tmp,i = 0;
		for ( i;i<_pageObj.children.length ;i++ )
		{
			tmp = _pageObj.children.item(i);
			if ( parseInt(tmp.innerText) != _page ) tmp.onclick = doGuidePage;
		}
		tmp = null;i = null;_pageObj = null;
	};
	var setGuideItem = function()
	{
		var tmpObj = _container.children.item(1);
		var tmp,i = 0;
		for ( i;i<tmpObj.children.length ;i++ )
		{
			tmp = tmpObj.children.item(i);
			tmp.onclick = function()
			{
				if ( this.children.length )
				{
					_currTxt = this.children.item(1).innerHTML;
					_currVal = this.children.item(0).getAttribute('value');
					_obj.value = _currTxt;
				}
				closed();
			};
		}
		tmpObj = null;i = null;tmp = null;
		setGuidePage();
	};
	var _getHtml = function(_paras,_findEngine,_valEngine)
	{
		try
		{
			var i  = (_page - 1) * _per;
			var j = _page * _per;
			var html = ['',''];
			_paras = _paras || _find;
			_findEngine = _findEngine || findEngine;
			_valEngine = _valEngine || valEngine;
			_total = _paras.length;
			while(i<j)
			{
				if ( i < _total )
				{
					if ( _currTxt == i || _currTxt == _findEngine[i] || _currTxt == _paras[i] )
					{
						html[0] = html[0] + '<div style="padding:4px 2px;height:18px;cursor:'+(Browser.isIE || Browser.isOpera ? 'hand' : 'pointer')+';border:1px solid #FFFFFF;color:#0055AA;background-color:#C8E3FC;" onmouseover="this.style.borderTop=\'1px solid #7F9DB9\';this.style.borderBottom=\'1px solid #7F9DB9\';this.style.backgroundColor=\'#E7F1FB\';" onmouseout="this.style.border=\'1px solid #FFFFFF\';this.style.backgroundColor=\'#C8E3FC\';"><div style="float:right;" value="'+_valEngine[i]+'">'+(_obj.getAttribute('noalp') ? '' : _findEngine[i])+'</div><div>'+_paras[i]+'</div></div>';
						_currTxt = _paras[i];_currIdx = i;_currVal = _valEngine[i];
					}
					else html[0] = html[0] + '<div style="padding:4px 2px;height:18px;cursor:'+(Browser.isIE || Browser.isOpera ? 'hand' : 'pointer')+';color:#0055AA;border:1px solid #FFFFFF" onmouseover="this.style.borderTop=\'1px solid #7F9DB9\';this.style.borderBottom=\'1px solid #7F9DB9\';this.style.backgroundColor=\'#E7F1FB\';" onmouseout="this.style.border=\'1px solid #FFFFFF\';this.style.backgroundColor=\'#FFFFFF\';"><div style="float:right;" value="'+_valEngine[i]+'">'+(_obj.getAttribute('noalp') ? '' : _findEngine[i])+'</div><div>'+_paras[i]+'</div></div>';
				}
				else html[0] = html[0] + '<div style="padding:4px 2px;height:18px;border:1px solid #FFFFFF;">&nbsp;</div>';
				i = -~i;
			}
			j = Math.ceil(_total / _per);
			i = 1;
			for ( i;i <= j ;i++ )
			{
				if ( _page == i ) html[1] = html[1] + '<font color="#000000;">'+i+'</font>&nbsp;';
				else  html[1] = html[1] + '<a href="javascript:;" style="font-size:16px;text-decoration:underline;padding-left:2px;padding-right:2px;color:#3A55B9;">'+i+'</a>&nbsp;';
			}
			return html;
		}
		catch (e){alert('_getHtml:'+e.message);}finally{i = null;j = null;html = null;_paras = null;_findEngine = null;_valEngine = null;}
	};
	var init = function()
	{
		var _xy = WF.getElementIntactXY(_obj);
		var html = _getHtml();
		_container = WF.creDiv('__guide_'+Sys.uniqID,document.body.children.item(0),[
			['position','absolute'],
			['width',200],
			['height','auto'],
			['left',_xy[0]],
			['top',_xy[1]+_xy[3]],
			['backgroundColor','#FFFFFF'],
			['border','1px solid #7F9DB9']
		],'<div style="border-bottom:1px dashed #AAAAAA;color:#666666;padding-left:9px;padding-top:8px;padding-bottom:4px;word-break:break-all;word-wrap:break-word;"><span>'+(_obj.value.length && _obj.value != _obj.getAttribute('tip') ? _obj.value+'，' : '')+'</span><span>請選擇</span></div><div>'+html[0]+'</div><div style="text-align:center;">'+html[1]+'</div>');
		setGuideItem();
		if ( _obj.value.length )
		{
			_obj.removeAttribute('old_guide_kw');
			doGuideChanged(); 
		}
		else _obj.setAttribute('old_guide_kw',_obj.value);
		_xy = null;i = null;html = null;
	};
	var closed = function()
	{
		_obj.value = _obj.value.length > 0 ? _currTxt : _obj.value;
		doCallBack();
		Evt.remove(document.body,'click',click_closing);
		Evt.remove(document,'keydown',doKeyboardUD);
		if ( Browser.isIE ) Evt.remove(_obj,'propertychange',doGuideChanged);
		else Evt.remove(_obj,'input',doGuideChanged);
		_obj.removeAttribute('guide_loaded');
		WF.removeMyself(_container);
		Menu.guideCall(_obj);
		_container = null;init = null;_getHtml = null;click_closing = null;_per = null;_total = null;_page = null;_currTxt = null;doGuideChanged = null;searchEngine = null;closed = null;findEngine = null;_currIdx = null;doGuidePage = null;ValEngine = null;doCallBack = null;
	};
	var click_closing = function(evt)
	{
		evt = evt ? evt : event;
		if ( _obj.getAttribute('guide_loaded') && evt && !$O(evt.target ? evt.target : evt.srcElement,['__guide_'+Sys.uniqID,_obj]) ) closed();
	};
	if ( !_obj.getAttribute('guide_loaded') )
	{
		_obj.setAttribute('guide_loaded',1);
		init();
		Evt.add(document.body,'click',click_closing);
		Evt.add(document,'keydown',doKeyboardUD);
		if ( Browser.isIE ) Evt.add(_obj,'propertychange',doGuideChanged); else Evt.add(_obj,'input',doGuideChanged);
	}
};
Menu.tip = function(_obj)
{
	if ( _obj.type != 'text' && _obj.type != 'password' &&  _obj.nodeName != 'TEXTAREA' ) return;
	if ( _obj.type == 'password')
	{
		if ( !_obj.id ) _obj.id = Sys.uniq();
		WF.insertHTML(_obj,'afterEnd','<input type="text" id="'+_obj.id+'_relate" style="width:'+(Browser.isIE ? _obj.offsetWidth-6 : _obj.offsetWidth-2)+'px;" tip="'+_obj.getAttribute('tip')+'" tipRelate="'+_obj.id+'"/>');
		_obj.hide();
		_obj.removeAttribute('tip');
		_obj.value = '';
	}
	if ( _obj.value.length && _obj.value != _obj.getAttribute('tip') ) _obj.style.color="#000000";
	else
	{
		_obj.value = _obj.getAttribute('tip');
		_obj.style.color = '#B7B7B7';
	}
	Evt.add(_obj,'focus',function()
	{
		var evt= window.event;
		var obj = $(evt.srcElement ? evt.srcElement : evt.target);
		if ( obj.getAttribute('tipRelate') )
		{
			obj.hide();
			obj = $(obj.getAttribute('tipRelate'));
			obj.disp();
			obj.focus();
			obj.value = '';
			obj.style.color="#000000";
		}
		else
		{
			if ( obj.value == obj.getAttribute('tip') )
			{
				obj.value = '';
				obj.style.color="#000000";
			}
			if ( obj.getAttribute('guide_loaded') )
			{
				Menu.guideSetCB(obj,function(_1)
				{
					if ( !_1.value.length )
					{
						_1.value = _1.getAttribute('tip');
						_1.style.color="#B7B7B7";
					}
				});
			}
		}
		obj = null;evt = null;
	});
	Evt.add(_obj,'blur',function()
	{
		var evt= window.event;
		var obj = evt.srcElement ? evt.srcElement : evt.target;
		var guide_loaded = obj.getAttribute('guide_loaded');
		Sys.delayExecute(function()
		{
			if ( obj.type == 'password' && !obj.value.length)
			{
				$(obj.id+'_relate').disp();
				obj.hide();
			}
			else if ( obj.getAttribute('guide_loaded') || !guide_loaded )
			{
				if ( !obj.value.length )
				{
					obj.value = obj.getAttribute('tip');
					obj.style.color="#B7B7B7";
				}
			}
			guide_loaded = null;obj = null;evt = null;
		},200);
	});
};
function EF(){}
// 伸縮效果
EF.flex = function(_obj,_fCallBack,_aParas,_nSpeed,_nStep,_nFurlStep)
{
	_nStep = _nStep || 5;
	_nSpeed = _nSpeed || 25;
	_nFurlStep = _nFurlStep || 0;
	_obj = typeof _obj == 'string' ? $(_obj) : _obj;
	if ( _obj && !_obj.getAttribute('isBusy') )
	{
		_obj.setAttribute('isBusy', 1);
		var _fix = [];
		_obj.style.overflow = "hidden";
		_obj.setAttribute('minMeasure', _obj.getAttribute('minMeasure') || 1);

		if ( _obj.getAttribute('flexFix') )
		{
			_fix = [parseInt(_obj.style.left),parseInt(_obj.style.width),-1];
			if ( isNaN(_fix[1]) ) _fix[1] = _obj.offsetWidth;
		}
		else
		{
			_fix = [parseInt(_obj.style.top),parseInt(_obj.style.height),-1];
			if ( isNaN(_fix[1]) ) _fix[1] = _obj.offsetHeight;
		}
		if ( !_obj.getAttribute('maxMeasure') ) _obj.setAttribute('maxMeasure', _fix[1] > 1 ? _fix[1] : 110);
		if ( !_obj.getAttribute('flex') ) _nStep = _fix[1] > 1 ? -_nStep : _nStep;
		else _nStep = _obj.getAttribute('flex') == 'elongate' ? _nStep : -_nStep;
		if ( !isNaN(_fix[0]) ) _fix[2] = _nStep > 0 ? _fix[0] - _obj.getAttribute('maxMeasure') + _obj.getAttribute('minMeasure') : _fix[0] + _obj.getAttribute('maxMeasure') - _obj.getAttribute('minMeasure');
		if ( _nFurlStep > 0 ) _nFurlStep = _nStep > 0 ?  _nFurlStep : -_nFurlStep;
		var process = function()
		{
			_nStep = _nStep + _nFurlStep;
			_fix[1] = _fix[1] + _nStep;
			if ( !isNaN(_fix[0]) )
			{
				_fix[0] = _fix[0] - _nStep;
				if (_obj.getAttribute('flexFix') ) _obj.style.left = _fix[0]+'px';
				else _obj.style.top = _fix[0];
			}
			if ( _nStep > 0 && _fix[1] > _obj.getAttribute('maxMeasure') )
			{
				if (_obj.getAttribute('flexFix') )
				{
					if ( !isNaN(_fix[0]) ) _obj.style.left = _fix[2];
					_obj.style.width = _obj.getAttribute('maxMeasure')+'px';
				}
				else _obj.style.height = _obj.getAttribute('maxMeasure')+'px';
				if ( typeof _fCallBack == 'function' ) _fCallBack.apply(this,$splat(_aParas||[]));
				_fix = null;
				window.clearInterval(tt);
				_obj.removeAttribute('isBusy');
			}
			else if ( _nStep < 0 && _fix[1] <= _obj.getAttribute('minMeasure') )
			{
				if ( _obj.getAttribute('minMeasure') <= 1 ) _obj.style.visibility = "hidden";
				if (_obj.getAttribute('flexFix') )
				{
					if ( !isNaN(_fix[0]) ) _obj.style.left = _fix[2];
					_obj.style.width = _obj.getAttribute('minMeasure')+'px';
				}
				else _obj.style.height = _obj.getAttribute('minMeasure')+'px';
				if ( typeof _fCallBack == 'function' ) _fCallBack.apply(this,$splat(_aParas||[]));
				_fix = null;
				window.clearInterval(tt);
				_obj.removeAttribute('isBusy');
			}
			else if (_obj.getAttribute('flexFix') ) _obj.style.width = _fix[1]+'px';
			else _obj.style.height = _fix[1]+'px';
			if ( _nStep > 0 ) _obj.style.visibility = "visible";
		};
		var tt = window.setInterval(process,_nSpeed);
	}
};
// 虛擬框放縮效果
EF.bulk = function(_star,_end,_callBack,_nSpeed,_nStep,_bTimeCtl)
{
	var tmp = null;
	_nStep = _nStep || 10;
	_nSpeed = _nSpeed || 2;
	_bTimeCtl = _bTimeCtl || false;
	if ( _bTimeCtl ) _nStep =  Math.ceil(_nStep / _nSpeed);
	if ( $type(_star) != 'array' )
	{
		tmp = typeof _star == 'string' ? $(_star) : _star;
		_star = WF.getElementXY(tmp);
	}
	
	if ( $type(_end) != 'array' )
	{
		tmp = typeof _end == 'string' ? $(_end) : _end;
		_end = WF.getElementXY(tmp);
	}
	if ( _star.join('') == '0000' || _end.join('') === '0000' )
	{
		if (typeof _callBack == 'function') Sys.delayExecute(_callBack,100);
		return;
	}
	var _step = [Math.ceil((_end[0]-_star[0]) /_nStep),Math.ceil((_end[1]-_star[1]) /_nStep),Math.ceil((_end[2]-_star[2]) /_nStep),Math.ceil((_end[3]-_star[3]) /_nStep)];
	var _sDiv = WF.creDiv('__effect_bulk__'+Sys.uniq(),document.body,[['position','absolute'],['zIndex',504],['border','1px solid #FF84C8'],['backgroundColor','#FFF4FA']],'&nbsp;');
	WF.setElementXY(_sDiv,_star,[0,0],true);
	WF.setOpacity(_sDiv,70);
	var i = 0;
	var process = function()
	{
		with(_sDiv.style)
		{
			left = _star[0]+'px';
			top = _star[1]+'px';
			width = _star[2]+'px';
			height = _star[3]+'px';
		}
		_star[0] = _star[0] + _step[0];
		_star[1] = _star[1] + _step[1];
		_star[2] = _star[2] + _step[2];
		_star[3] = _star[3] + _step[3];

		if ( _step[0] < 0 )
			_star[0] = _star[0] <= _end[0] ? _end[0] : _star[0];
		else
			_star[0] = _star[0] >= _end[0] ? _end[0] : _star[0];
		
		if ( _step[1] < 0 )
			_star[1] = _star[1] <= _end[1] ? _end[1] : _star[1];
		else
			_star[1] = _star[1] >= _end[1] ? _end[1] : _star[1];
		if ( _step[2] < 0 )
			_star[2] = _star[2] <= _end[2] ? _end[2] : _star[2];
		else
			_star[2] = _star[2] >= _end[2] ? _end[2] : _star[2];
		if ( _step[3] < 0 )
			_star[3] = _star[3] <= _end[3] ? _end[3] : _star[3];
		else
			_star[3] = _star[3] >= _end[3] ? _end[3] : _star[3];
		if ( _star[0] == _end[0] && _star[1] == _end[1] && _star[2] == _end[2] && _star[3] == _end[3] )
		{
			if (typeof _callBack == 'function')
			{
				Sys.delayExecute(function()
				{
					document.body.removeChild(_sDiv);
					_callBack();
					_sDiv = null;
				},100);
			}
			window.clearInterval(tt);
			_step = null;tt= null;tmp = null;
		}
		i = -(~i);
	};
	var tt = window.setInterval(process,_nSpeed);
};
// 淡入淡出
EF.fade = function(_obj,_fCallBack,_aParas,_nSpeed,_nStep,_nFurlStep)
{
	_nSpeed = _nSpeed || _obj.getAttribute('speed') || 2;
	_nStep = _nStep || _obj.getAttribute('step') || (Browser.isIE ? 12 : 11);
	_nFurlStep = _nFurlStep || _obj.getAttribute('fstep') || 2;
	_obj = typeof _obj == 'string' ? $(_obj) : _obj;
	if ( _obj )
	{
		var _apacity = WF.getOpacity(_obj);
		var minOpc = _obj.getAttribute('minOpacity') || 0;
		var maxOpc = _obj.getAttribute('maxOpacity') || 100;
		_nStep = _apacity > 0 || minOpc > 0 ? -_nStep : _nStep;
		_nFurlStep = _apacity > 0 || _obj.getAttribute('minOpacity') > 0 ? - _nFurlStep : _nFurlStep;
		var callBack = function(_opc)
		{
			WF.setOpacity(_obj,_opc);
			if ( typeof _fCallBack == 'function' )
			{
				_fCallBack.bind(_obj);
				_fCallBack.apply(_obj,$splat(_aParas || []));
			}
			window.clearInterval(tt);
			maxOpc = null;minOpc = null;tt = null;process = null;callBack = null;_obj = null;_nSpeed = null;_nStep = null;_nFurlStep = null;
		};
		var process = function()
		{
			_nStep = _nStep + _nFurlStep;
			_apacity = _apacity + _nStep;
			if ( _nStep > 0 && _apacity > maxOpc) callBack(maxOpc);
			else if ( _nStep < 0 && _apacity < minOpc ) callBack(minOpc);
			else WF.setOpacity(_obj,_apacity);
		};
		var tt = window.setInterval(process,_nSpeed);
	}
};
// 滑動
EF.slide = function(_obj,_fCallBack,_aParas,_nSpeed,_nStep,_nFurlStep)
{
	_nStep = _nStep || _obj.step || 5;
	_nSpeed = _nSpeed || _obj.speed || 10;
	_nFurlStep = _nFurlStep || _obj.fstep || 0;
	var direction = _obj.getAttribute('direction');
	var stepVal = direction == 'up' || direction == 'down' ? parseInt(_obj.style.marginTop) : parseInt(_obj.style.marginLeft);
	var startSlideDirection = direction;
	if ( _obj.getAttribute('startSlideDirection') )startSlideDirection = _obj.getAttribute('startSlideDirection');else _obj.setAttribute('startSlideDirection',direction);
	stepVal = startSlideDirection == 'right' ? parseInt(_obj.style.marginRight) : stepVal;
	stepVal = isNaN(stepVal) ? 0 : stepVal;
	var maxLimit = parseInt(_obj.getAttribute('maxLimit'));
	var stepRecord = 0;
	var process = function()
	{
		_nStep = _nStep + _nFurlStep;
		stepRecord = stepRecord + _nStep;
		if ( stepRecord >= maxLimit )
		{
			stepRecord = maxLimit;
			complete();
		}
		switch(direction)
		{
			case 'up':
				_obj.style.marginTop = (stepVal - stepRecord)+'px';
				break;
			case 'down':
				_obj.style.marginTop = (stepVal + stepRecord)+'px';
				break;
			case 'left':
				if ( startSlideDirection == direction )_obj.style.marginLeft = (stepVal - stepRecord)+'px';else _obj.style.marginRight = (stepVal + stepRecord)+'px';
				break;
			case 'right':
				if ( startSlideDirection == direction ) _obj.style.marginRight = (stepVal - stepRecord)+'px';else _obj.style.marginLeft = (stepVal + stepRecord)+'px';
				break;
		}
	};
	var complete = function()
	{
		window.clearInterval(tt);
		if ( typeof _fCallBack == 'function' ) _fCallBack.apply(this,$splat(_aParas||[]));
		tt = null;maxLimit = null;
	};
	var tt = window.setInterval(process,_nSpeed);
};
EF.scrollUp = function(_obj,_fCallBack,_aParas,_nSpeed,_nStep,_nFurlStep)
{
	_nSpeed = _nSpeed || 50;
	_nStep = _nStep || 2;
	_obj = typeof _obj == 'string' ? $(_obj) : _obj;
	if ( _obj && _obj.children.length > 1 && !_obj.getAttribute('pause') )
	{
		var _firstChild = _obj.children.item(0);
		var tmp = parseInt(_firstChild.getAttribute('removeZS'));
		_firstChild.setAttribute('removeZS',isNaN(tmp) ? -1 : tmp);tmp = null;
		var c = 0;
		var l = 0;
		var tt,t = null;
		var d = parseInt(_obj.style.height);
		d = isNaN(d) ? _obj.offsetHeight : d;
		_firstChild.setAttribute('busy',1);
		if ( _obj.getAttribute('c') )
		{
			c = _obj.getAttribute('c');
			_obj.removeAttribute('c');
		}
		var process = function()
		{
			if ( _obj.getAttribute('pause') )
			{
				_obj.setAttribute('c',c);
				return;
			}
			if(d<=c)
			{
				window.clearInterval(tt);
				t=_firstChild.cloneNode(true);
				_obj.removeChild(_firstChild);
				if ( t.getAttribute('removeZS') != 0 )
				{
					t.setAttribute('busy',0);
					_obj.appendChild(t);
					t.style.marginTop='0px';
				}
				_firstChild.style.marginTop='0px';
				t = null;tt = null;c = null; l = null; d = null;
				if ( typeof _fCallBack == 'function' ) _fCallBack.apply(this,$splat(_aParas||[]));
			}
			else
			{
				c = c + _nStep;
				l=(c>=d?c-d:0);
				_firstChild.style.marginTop=(-c+l)+'px';
			}
		};
		if (  _obj.children.length ) tt = window.setInterval(process,_nSpeed);
	}
};
function Opt(){}
Opt.secure = function(_obj)
{
	if ( !_obj ||! _obj.getAttribute('security') ) return;
	var _find = _obj.getAttribute('security').match(/\{([^\{\}]+)\}/ig);
	if ( !_obj.id ) _obj.setAttribute('id','_auto_limiter_'+Sys.uniq());
	if ( _find && _find.length )
	{
		var tmp;i = 0;
		var speChar = '^';
		for ( i;i<_find.length;i++ )
		{
			tmp = _find[i].match(/([^\{\}]+):([^\{\}]*)/i);
			if ( tmp && tmp.length == 3 )
			{
				switch(String(tmp[1]).toLowerCase())
				{
					case 'limit':
						tmp[2] = tmp[2].split("-");
						tmp[2] = tmp[2].length > 1 ? tmp[2][1] : tmp[2][0];
						tmp[2] = parseInt(tmp[2]);tmp[2] = isNaN(tmp[2]) || tmp[2] <= 0 ? 0 : tmp[2];
						if ( tmp[2] > 0 )
						{
							_obj.setAttribute('limitCharLen',tmp[2]);
							if ( !$(_obj.id+'_Stat').elementExists() )
								WF.insertHTML(_obj,'afterEnd','<span>（限<font color="#FF0000">'+tmp[2]+'</font> ，剩<font color="#FF0000" id="'+_obj.id+'_Stat">'+(_obj.value ? tmp[2] - String(_obj.value.trim(_obj.getAttribute('tip'))).len() : tmp[2])+'</font>）</span>');
						}
						break;
					case 'type':
						tmp[2] = String(tmp[2]).toLowerCase();
						switch(tmp[2])
						{
							case 'email':
								speChar = speChar + '\\w\\d_@\\._';
								break;
							case 'phone':
								speChar = speChar + '\\d-\\.\\(\\)';
								break;
							case 'money':
								speChar = speChar + '\\d\\.';
								break;
							case 'eng':
								speChar= speChar + '\\w \\.,\'';
								break;
							case 'num':
								speChar= speChar + '\\d';
								break;
							case 'sign':
								speChar= speChar + '\\+-\\*';
								break;
						}
						break;
					case 'ext':
						speChar = speChar + tmp[2];
						break;
					case 'operator':
						speChar = tmp[2] + substr(1);
						break;
				}
			}
		}
		if ( speChar.length && speChar != '^' ) _obj.setAttribute('specialChar','['+speChar+']');
		Evt.add(_obj,'keyup',Sys.limitChar.bind(_obj));
	}
};
Opt.range = function(_obj)
{
	var _parent = _obj.parentElement ? _obj.parentElement : _obj.parentNode;
	var getSpan = function(_html)
	{
		try
		{
			var _span = document.createElement('span');
			with(_span.style)
			{
				padding = '0px 3px';
				border = '1px solid #DBDBDB';
				cursor = Browser.isIE || Browser.isOpera ? 'hand' : 'pointer';
				width = '8px';
			}
			_span.innerHTML = _html || '-';
			_span.onmouseover = function(){this.style.border='1px solid #FF0000';};
			_span.onmouseout = function(){this.style.border='1px solid #DBDBDB';};
			_span.onclick = function()
			{
				var range,tmp,_obj = this.parentElement ? this.parentElement : this.parentNode;
				_obj = _obj.children.item(1);
				range = _obj.getAttribute('range') || '0-0';
				range = range.split('-');
				range[0] = parseInt(range[0]);range[0] =  isNaN(range[0]) || range[0] < 0 ? 0 : range[0];
				range[1] = parseInt(range[1]);range[1] =  isNaN(range[1]) || range[1] < 0 ? 0 : range[1];
				tmp = parseInt(_obj.value);
				tmp = isNaN(tmp) || tmp < 0 ? 0 : tmp;
				if ( this.innerHTML == '+' )tmp = -~tmp;else tmp = ~-tmp;
				tmp = tmp >= 0 ? tmp : 1;
				if ( tmp > range[1] && range[1] > 0 )
				{
					_obj.setAttribute('info_up','<div style="border:1px solid #FF0000;width:120px;">已經超出最大值「'+range[1]+'」</div>');
					Msg.doUp(_obj);
				}
				else if ( tmp < range[0] && range[0] > 0)
				{
					_obj.setAttribute('info_up','<div style="border:1px solid #FF0000;width:120px;">已經超出最小值「'+range[0]+'」</div>');
					Msg.doUp(_obj);
				}
				else
				{
					_obj.value = tmp;
					if ( _obj.onchange ) _obj.onchange();
				}
				_obj = null;tmp = null;range = null;
			};
			return _span;
		}
		catch (e){}finally{_span = null;_html = null;}
	};
	_parent.insertBefore(getSpan('-'),_obj);
	_parent.appendChild(getSpan('+'));
	_parent = null;_obj = null;
};
function CK(){}
CK.set = function(name,value)
{
  var Days = 30; //此 cookie 将被保存 30 天
  var exp  = new Date();    //new Date("December 31, 9998");
  exp.setTime(exp.getTime() + Days*24*60*60*1000);
  document.cookie = name + "="+ escape(value) +";expires="+ exp.toGMTString();
};
CK.get = function(name)
{
  var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
  if(arr != null) return unescape(arr[2]); return null;
};
CK.del = function(name)
{
  var exp = new Date();
  exp.setTime(exp.getTime() - 1);
  var cval=CK.get(name);
  if(cval!=null) document.cookie=name +"="+cval+";expires="+exp.toGMTString();
};

(function()
{
	Sys.uniqID = Sys.uniq();
	Url.init();
})();