if(typeof(HTMLElement)!="undefined" && !window.opera)
{
	HTMLElement.prototype.__defineGetter__("outerHTML",function()
	{
		var a=this.attributes, str="<"+this.tagName.toLowerCase(), i=0;for(;i<a.length;i++)
		if(a[i].specified)
		str+=" "+a[i].name+'="'+a[i].value+'"';
		if(!this.canHaveChildren)
		return str+">";
		return str+">"+this.innerHTML+"</"+this.tagName+">";
	});
	HTMLElement.prototype.__defineSetter__("outerHTML",function(s)
	{
		var r = this.ownerDocument.createRange();
		r.setStartBefore(this);
		var df = r.createContextualFragment(s);
		this.parentNode.replaceChild(df, this);
		return s;
	});
	HTMLElement.prototype.__defineGetter__("canHaveChildren",function()
	{
		return !/^(area|base|basefont|col|frame|hr|img|br|input|isindex|link|meta|param)$/.test(this.tagName.toLowerCase());
	});
}
function $extend(destination, source) {if ( typeof destination == 'object' && destination != null ){for (var property in source) destination[property] = source[property];}return destination;};

String.prototype.extractScripts = function()
{
	var matchAll = new RegExp('(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)', 'img');
	var matchOne = new RegExp('(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)', 'im');
	return (this.match(matchAll) || []).map(function(scriptTag) 
	{
		return (scriptTag.match(matchOne) || ['', ''])[1];
	});
};
String.prototype.evalScripts = function()
{
	return this.extractScripts().map(function(script) { return window.eval(script);});
};
Array.prototype.each = function(iterator)
{
	var index = 0;
	try 
	{
		this._each(function(value)
		{
			try {iterator(value, index++);} catch (e) { throw e;}
		});
	}
	catch (e){throw e;}
	return this;
};
Array.prototype._each = function(iterator)
{
	for (var i = 0, length = this.length; i < length; i++)iterator(this[i]);
};
Array.prototype.map = function(iterator)
{
	var results = [];
	this.each(function(value, index) 
	{
		results.push((iterator || Core.$K)(value, index));
	});
	return results;
};

function Browser(){}
Browser.isIE=window.ActiveXObject ? true : false;
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.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)
{
	WF.setText(_sID,'<div class="add_loading" '+(_sColor ? 'style="background-color:'+_sColor+'"' : '')+' id="order_flow_loading"><img src="'+getUrlHead()+'/shared/images/tw/loading.gif" />正在提取數據...</div>');
};
Sys.setTag = function(_obj)
{
	if ( _obj && _obj.getAttribute('ftag') && _obj.parentNode )
	{
	    var _ftag = _obj.getAttribute('ftag');
	    var _fdelimiter = _obj.getAttribute('fdelimiter');
	    if ( typeof _fdelimiter == 'string' )
	    {
	        _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(_obj.parentNode.childNodes[i])
	        {
				_ftag = _obj.parentNode.childNodes[i].nodeName.toLowerCase();
	            if ( (_ftag == 'div' || _ftag == 'img' ) && (tmp = _obj.parentNode.childNodes[i].getAttribute('position')) )
	            {
	                switch(tmp)
	                {
	                    case '1': // 浮層上右
							tmp = _obj.parentNode.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 = _obj.parentNode.childNodes[i];
	                        if ( tmp.nodeName == 'IMG' )
	                        {
								if ( parseInt(tmp.offsetHeight) == 0 ) tmp.setAttribute('needadjust',true);
								tmp.style.marginLeft =0 - _obj.offsetWidth+'px';
								tmp.style.marginTop = (_obj.offsetHeight-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 = _obj.parentNode.childNodes[i];
	                        if ( tmp.nodeName == 'IMG' )
	                        {
								if ( parseInt(tmp.offsetWidth) == 0 ) tmp.setAttribute('needadjust',true);
								tmp.style.marginTop = _obj.offsetHeight -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 = _obj.parentNode.childNodes[i];
	                        if ( tmp.nodeName == 'IMG' )
	                        {
								tmp.style.marginTop = 0+'px';
								tmp.style.marginLeft =  0 - _obj.offsetWidth +'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
								tmp.style.marginLeft = _obj.offsetLeft+ 'px';
							}
	                        break;
	                }
	            }
	            i = -(~i);
	        }
	        i = null; tmp = null;
	    }
	    else Sys.doSetTag(_obj,_ftag);
		_fdelimiter = null; _ftag = null;
	}
};
Sys.doSetTag = function(_obj,_ftag)
{
    var coordinate = WF.getElementCoordinate(_obj);
    _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 );
    _obj.removeAttribute('ftag');
    if ( _ftag[4] )
        return '<img position="'+_ftag[1]+'" '+(Browser.isIE ? '' : 'onload="Sys.adjustTagNotIE(this);"')+' src="'+Url.img+_ftag[0]+'" style="position:absolute;border:0px;"/>';
    else
        return '<div position="'+_ftag[1]+'" style="position:absolute;">'+_ftag[0]+'</div>';
};
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;
		}
	}
};
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;};
// 填充內容但不執行script腳本
WF.setText = function(_id,_content,_title)
{
	if ( !_id ) return;
	switch($type(_content))
	{
		case 'undefined':
			_content = '';
			break;
		case 'object':
			_content = typeof _content.value == 'undefined' ? _content.innerHTML : _content.value;
			break;
	}
	_id = $type(_id) == 'element' ? _id : $(_id);
	if ( _id )
	{
		_content = '<div style="display:none">for IE</div>' + _content;   
		_id.innerHTML = _content;
		_id.removeChild(_id.firstChild);
		if ( _title ) _id.title = _id.innerText;
	}
};
/*依據id來拿html中開始和結束的標記*/
WF.getText = function(_id,_win,_stripHTML)
{
	if ( !_id ) return '';
	_id = Core.$type(_id) == 'element' ? _id : Core.$(_id,_win);
	if ( !_id ) return '';
	if ( _id.nodeName == 'INPUT' || _id.nodeName == 'TEXTAREA' ) return _id.value;
	else  return _stripHTML ? ( Browser.isIE ? _id.innerText : _id.textContent) : _id.innerHTML;
};
WF.getObjOrientation = function(obj)
{
	obj = $type(obj) == 'string' ? $(obj) : obj;
	var objLeft = 0;
	var objTop = 0;
	if ( obj )
	{
		objLeft = obj.offsetLeft;
		objTop = obj.offsetTop;
		var objParent = obj.offsetParent;
		while (objParent && objParent.tagName.toUpperCase () != "BODY") 
		{
			objLeft += objParent.offsetLeft;
			objTop += objParent.offsetTop;
			objParent = objParent.offsetParent;	
		}
	}
	return [objLeft,objTop,obj.offsetWidth,obj.offsetHeight];
};
// 填充內容并執行script腳本
WF.setInnerHTML = function(el, htmlCode)
{
	htmlCode = htmlCode || '';
	el = $type(el) == 'string' ? $(el) : el;
	if ( Browser.isIE )
	{
		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();
	}
};
/*在制定位置插入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(_sId,_oApp,_aStyle,_sText)
{
	var _sDiv = document.createElement('DIV');
	if ( _sId ) _sDiv.setAttribute("id",_sId);
	switch($type(_aStyle))
	{
		case 'array':
			if (_aStyle.length)
			{
				var i = 0;
				while(_aStyle[i])
				{
					try
					{
						_sDiv.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':
			_sDiv.className = _aStyle;
			break;
	}
	if ( _sText && _sText.length > 0) _sDiv.innerHTML = _sText;
	if ( _oApp ) _oApp.appendChild(_sDiv);
	//alert(_sDiv.outerHTML);
	return _sDiv;
};
/**
 * 創建遮罩層
 */
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)-5],
		['backgroundColor','#000000']
	]);
};
// 依據透明度顯示遮罩層
WF.showShade = function()
{
	if ( !WF._showShadeIndex )
	{
		document.body.parentNode.style.overflow="hidden";
		WF.freezeOptionElement();
	}
	WF.shadeSHOperation(30,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 )
	{
		document.body.parentNode.style.overflow="auto";
		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.style.width = WF.getBW()+'px';
		_obj.style.height = WF.getBH()+'px';
		if ( Browser.isFirefox  ) _obj.style.MozOpacity = _apacity/100; 
		else if ( Browser.isMozilla ) _obj.style.opacity = _apacity/100;
		else if ( !_obj.style.filter ) _obj.style.filter="alpha(opacity="+_apacity+")";
		if ( Browser.isIE && _obj.filters.alpha ) _obj.filters.alpha.opacity = _apacity; 
		_obj.style.visibility = _hidden ? 'hidden' : 'visible';
		if ( !_hidden  )
		{
			if ( Browser.isMozilla ) _obj.addEventListener("click",WF.shadeClickEvent,true); else _obj.attachEvent("onclick",WF.shadeClickEvent);
		}
		else if (_obj.attachEvent)
		{
			if ( Browser.isMozilla ) _obj.removeEventListener("click",WF.shadeClickEvent,false); else _obj.detachEvent("onclick");
		}
		_obj = null;
	}
};
WF.adjustContainerSize = function(id)
{
	var _obj = typeof id == 'string' ? $(id) : id;
	var _scroll = [WF.getBW()-10 , WF.getBCH()-55];
	var _tmp = _obj.offsetHeight;
	_obj.style.overflow = 'hidden';
	if ( _tmp > _scroll[1] )
	{
		_obj.style.overflow = 'auto';
		_obj.style.height = _scroll[1];
	}
	else _obj.style.height = 'auto';
	_tmp = _obj.offsetWidth;
	if ( _tmp > _scroll[0] )
	{
		_obj.style.overflow = 'auto';
		_obj.style.width = _scroll[1];
	}
	else _obj.style.width = 'auto';
	_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 = _errNum || 0;
	_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 = '0px';top = WF.getBT()+'px';break;
			case "LM":
				left = '0px';top = (parseInt(WF.getBH())/2-_who.offsetHeight/2-_errNum+WF.getBT())+'px'; break;
			case "LB":
				left = '0px';top = (parseInt(WF.getBH())-_who.offsetHeight-_errNum+WF.getBT())+'px';break;
			case "RT":
				left = (parseInt(WF.getBW()) - _who.offsetWidth-_errNum)+'px';
				top = WF.getBT()+'px';break;
			case "RM":
				left = (parseInt(WF.getBW()) - _who.offsetWidth-_errNum)+'px';
				top = (parseInt(WF.getBCH())/2-_who.offsetHeight/2-_errNum+ WF.getBT())+'px';break;
			case "RB":
				left =(parseInt(WF.getBW()) - _who.offsetWidth-_errNum) + 'px';
				top = (parseInt(WF.getBCH()) - _who.offsetHeight-5+ WF.getBT())+'px';break;
			case "MT":
				left = '0px';
				top = (parseInt(WF.getBCH())/2-_who.offsetHeight/2+ WF.getBT())+'px';break;
			case "MM":
				left = (parseInt(WF.getBW())/2-_who.offsetWidth/2-_errNum) + 'px';
				top = ((parseInt(WF.getBCH())-_who.offsetHeight)/2-_errNum + WF.getBT()) + 'px';
				break;
			case "MB":
				left =(parseInt(WF.getBW())/2-_who.offsetWidth/2-_errNum)+'px';
				top = (parseInt(WF.getBCH()) - _who.offsetHeight-_errNum + WF.getBT()) + 'px';break;
		}
		_errNum = parseInt(left);
		if ( (_errNum = (_errNum - WF.getSL()*2 + WF.getBL())) > 0 ) left = _errNum + 'px';
		//top = (parseInt(window.screen.availHeight)/2 - (parseInt(_who.offsetHeight) )+WF.getBT()) + 'px';
		if ( !noChange ) display = 'none';
		return [left,top];
	}
	return null;
};
WF.getElementCoordinate = function(elmObj,endTag)
{
	endTag = endTag || 'BODY';
	var leftpos = 0;
	var toppos = 0;
	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 )
	{
		do 
		{
			elmObj = elmObj.offsetParent;
			if ( elmObj )
			{
			    leftpos += elmObj.offsetLeft;
			    toppos += elmObj.offsetTop;
			}
		}while ( elmObj && elmObj.tagName != endTag);
	}
	return [leftpos,toppos];
};
WF.setImgTag = function()
{
	var _obj = document.getElementsByTagName('img');
	var _pstr = '';
	var _ostr = '';
	if ( _obj.length )
	{
		var 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
				{
				    if ( _pstr.indexOf(">") > -1 )
				    {
				        _obj[i].removeAttribute('ftag');
					    _obj[i].parentNode.innerHTML = _obj[i].parentNode.innerHTML.replace('>','onload="Sys.setTag(this);">');
					    _obj[i].setAttribute('ftag',_pstr);
					}
					else 
					    _obj[i].parentNode.innerHTML = _obj[i].parentNode.innerHTML.replace('>','onload="Sys.setTag(this);">');
				}
			}
			i = -(~i);
		}
	}
	_pstr = null;_obj = null;_ostr = null;
};
WF.removeMyself = function(_oObj)
{
	if ( !_oObj ) return;
	WF.removeAllChild(_oObj);
	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.removeSpecifyChild = function(_oObj,_sTag,_oApp)
{
	_oObj = typeof _oObj == 'string' ? $(_oObj,_oApp) : _oObj;
};
function Url(){}
Url.head = "";
Url.img = "";
Url.getHead = function(_nofull)
{
	_nofull = _nofull || false;
	var _h = document.URL.match(/(\/~[\w]*)/ig);
	return Url.takeTailBacklash(window.location.protocol + "//" + window.location.hostname+ '///');
};
Url.setImage = function()
{
	Url.img = "/shared/images/";
};
Url.takeTailBacklash = function(_string,_backlash)
{
	_backlash = _backlash || '/' ;
	return (/(\/|\\)$/).test(_string) ? _string : _string + _backlash;
};
Url.init = function()
{
	Url.head = Url.getHead();
	Url.setImage();
};
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><img src='"+Url.img+"tw/corner01.gif' width='11' height='31'></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><img src='"+Url.img+"tw/corner02.gif' width='11' height='31'></td><tr><td width=11 background='"+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;width:100%;text-align:center;\"></div><div id=\""+Panel._sCalContainer+"\" style=\"width:100%;text-align:center;\"><span id=\""+Panel._sCalculagraph+"\">"+Panel._nTime+"</span>秒後自動關閉</div></td><td width=11 background='"+Url.img+"tw/box_bg03.gif'>&nbsp;</td></tr><tr><td width=11><img src='"+Url.img+"tw/corner03.gif' width='11'></td><td width=100% background='"+Url.img+"tw/box_bg04.gif'></td><td width=11><img src='"+Url.img+"tw/corner04.gif' width='11'></td></tr></table>";
};
Panel.close = function()
{
	$(Panel._sID).style.visibility = 'hidden';
	WF.setText(Panel._sCaption,Panel._sCaptionText);
	WF.setText(Panel._sContentID,'');
	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._bOpened = false;
	Panel._nRtnPIndex = 0;
	Panel._aReturnParas = [];
};
Panel.calculagraphStart = function(_nTimeOut)
{
	$(Panel._sCalContainer).style.display = 'block';
	_nTimeOut = parseInt(_nTimeOut);
	if ( isNaN(_nTimeOut) ) Panel.calculagraph();
	else if ( _nTimeOut > 0 ) Panel.calculagraph(_nTimeOut);
	else $(Panel._sCalContainer).style.display = 'none';
};
Panel.setRtnParas = function()
{
	var i = 0;
	var j = 0;
	var diff = 0;
	while(arguments[i])
	{
		Panel._aReturnParas[i+Panel._nRtnPIndex+diff] = arguments[i];
		i = -(~i);
	}
};
Panel.setCaption = function(_sCaption){WF.setText(Panel._sCaption,_sCaption);};
Panel.setColor = function(_sColor)
{
	var _obj = null;
	if ( (_obj = $(Panel._sContentID)) ) _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)) )
	{
		WF.showShade();
		Panel._bOpened = true;
		switch(_sType)
		{
			case 0:
			case '0':
				WF.setText(Panel._sContentID,_sParas);
				break;
			case 1:
			case '1':
				WF.setText(Panel._sContentID,'正在加載，請稍後...');
				Req.makeRequest(_sParas,function(_ajax)
				{
					WF.setInnerHTML(Panel._sContentID,_ajax.responseText);
					WF.adjustContainerSize(Panel._sContentID);
					WF.adjustOrientation('MM',$(Panel._sID));
				});
				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)) )
	{
		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 )
	{
		WF.setText(Panel._sCalculagraph,_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 '<div><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td align="center"><img id="_mutual_pointer_up_" src="/shared/images/onpointer_up.gif"/></td></tr></table></div><div style="border:1px solid #3581CB;background-color:#3581CB;"><div><div id="_mutual_img_" onclick="Mutual.close();" style="float:right;"><img src="/shared/images/win_close.gif"/></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"><img id="_mutual_pointer_down_" src="/shared/images/onpointer_down.gif"/></td></tr></table></div>';
};
Mutual.init = function()
{
	WF.creDiv(Mutual._sID,document.body,[
		['visibility','hidden'],
		['position','absolute'],
		['width',( Browser.isIE ? 300 : '300px' )],
		['left',0],
		['top',0],
		['backgroundColor','#B9DCFF']
		['zIndex',100]
	],Mutual.getHTML());
};
Mutual.getUrl = function(_sInvoke,_sDoc)
{
	_sDoc = _sDoc || 'mutual';
	return getAjaxUrl(_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)) )
		{
			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)) )
	{
		WF.showShade();
		Mutual._bOpened = true;
		_sTitle = _sTitle || '相關提示';
		WF.setText(Mutual._sContentID,_sPrompt);
		WF.setText(Mutual._sTitleID,_sTitle);
		Mutual.adjustXY(_sID);
	}
};
Mutual.open = function(_sAlias,_sTitle,_sInvoke,_sDoc)
{
	var _obj = null;
	if ( !Mutual._bOpened && (_obj = $(Mutual._sID)) )
	{
		WF.showShade();
		Mutual._sAlias = _sAlias;
		_sTitle = _sTitle || '';
		Mutual._bOpened = true;
		WF.setText(Mutual._sContentID,'正在加載內容，請稍候...');
		WF.setText(Mutual._sTitleID,_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 _obj = null;
	var _tmp = 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.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)) )
	{
		WF.setText(_cObj,'');
		_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="'+getUrlHead()+'shared/images/tw/window_loading.gif" /><p>請稍後...</p>');
};
Load.show = function(_title)
{
	var _obj = null;
	if ( (_obj = $(Load._sID)) )
	{
		with(_obj.style)
		{
			top=WF.getBT()+3+'px';
			left=(window.screen.width-158)+'px';
			display = 'block';
			WF.setText(_obj.childNodes[2],_title || '請稍後...');
		}
		_obj = null;
	}
};
Load.hide = function()
{
	var _obj = null;
	if ( (_obj = $(Load._sID)) )
	{
		_obj.style.display = 'none';
		_obj = null;
	}
};
function Req(){}
Req._postParas = [];					// 提交參數
// 添加ajax提交參數
Req.addPostParas = function(_name,_value)
{
	if ( $type(_value) == 'array')
	{
		var i = 0;
		while(_value[i])
		{
			Req._postParas.push([_name+'['+i+']',encodeURIComponent(_value[i])]);
			i = -(~i);
		}
		i = null;
	}
	else Req._postParas.push([_name,encodeURIComponent(_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()
{
	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)
{
	$try(function()
	{
		if ( arguments[0][1] && typeof arguments[0][1][0] == 'function' ) arguments[0][1][0](arguments[0][0],arguments[0][1][2]);
	},arguments,'Req.succeedCallBack');
};
// 執行以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 FW(){}
FW.obj = null;
FW._sID = '__Frame_Work__';
FW._sContentID = '__Frame_Work_Content__';
FW.getHTML = function()
{
	return '<table><tr><td><div id="__Frame_Work_Close__"><a href="javascript:;" onclick="FW.close()"><font color="#FFFFFF"></font></a></div><div id="'+FW._sContentID+'"></div></td></tr></table>';
};
FW.init = function()
{
	FW.obj = WF.creDiv(FW._sID,document.body,[
		['visibility','visible'],
		['position','absolute'],
		['width',( Browser.isIE ? 300 : '300px' )],
		['left',0],
		['top',0],
		['zIndex',50]
	],FW.getHTML());
};
FW.open = function(_url)
{
	FW.init();
	WF.showShade();
	Req.makeRequest(_url,function(_ajax)
	{
		WF.setInnerHTML(FW._sContentID,_ajax.responseText);
		WF.adjustContainerSize(FW._sContentID);
		WF.adjustOrientation('MM',$(FW._sID));
	});
};
FW.close = function()
{
	WF.hideShade();
	WF.removeMyself(FW.obj);
};
function CK(){}
CK.setCookie = 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.getCookie = function(name)
{
  var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
  if(arr != null) return unescape(arr[2]); return null;
};
CK.delCookie = function(name)
{
  var exp = new Date();
  exp.setTime(exp.getTime() - 1);
  var cval=getCookie(name);
  if(cval!=null) document.cookie=name +"="+cval+";expires="+exp.toGMTString();
};
