//=================================================================
//=================================================================
//=================================================================
//=================================================================
//建立 T 命名空间
var T = new Object();
T.onLoginNeedReload=false;
//=================================================================
T.debugMode = true;
//=================================================================
if (!T.debugMode){ window.onerror=function(){return true} }
/**================================================================**/

/**================================================================**/
/**================================================================**/
/**================================================================**/
/**===============   T.OnDOMReady 开始，domloaded.js  =============**/

T.OnDOMLoaded = {
    onload : [],
    Loaded : function()
        {
            if (arguments.callee.done) return;
            arguments.callee.done = true;
            T.isIE?T.OnDOMLoaded.Run():window.setTimeout(T.OnDOMLoaded.Run,150);
        },
	Run : function()
	{
		for(var i=0;i<T.OnDOMLoaded.onload.length;i++)T.OnDOMLoaded.onload[i]();
	}
}

T.OnDOMLoaded.Clear=function()
{
    T.OnDOMLoaded.onload = [];
}

T.OnDOMLoaded.Load = function(fireThis)
	{
		T.OnDOMLoaded.onload.push(fireThis);
		if (document.addEventListener) 
			document.addEventListener("DOMContentLoaded", T.OnDOMLoaded.Loaded, null);
		/*正式准备去掉，不支持那两种浏览器
		if (/KHTML|WebKit/i.test(navigator.userAgent))
		{ 
			var _timer = setInterval(function()
			{
				if (/loaded|complete/.test(document.readyState))
				{
					clearInterval(_timer);
					delete _timer;
					T.OnDOMLoaded.loaded();
				}
			}, 10);
		}*/
		/*@cc_on @*/
		/*@if (@_win32)
		var proto = "javascript:void(0)";
		if (location.protocol == "https:") proto = "src=//0";
		document.write("<scr"+"ipt id=__ie_onload defer src=" + proto + "><\/scr"+"ipt>");
		var script = document.getElementById("__ie_onload");
		script.onreadystatechange = function() {
		    if (this.readyState == "complete") {
		        T.OnDOMLoaded.Loaded();
		    }
		};
		/*@end @*/
	   window.onload = T.OnDOMLoaded.Loaded;
	}
/**================   T.OnDOMReady         结束  ==================**/
/**================================================================**/
/**================================================================**/
/**================================================================**/
T.isIE = !!document.all;
T.$ = function(a){return typeof(a)=='string'?document.getElementById(a):a};
//=================================================================
//=================================================================
//=================================================================
//=================================================================
//对fireFox进行修正
if(window.Event){// 修正Event的DOM
   /*
                               IE5        MacIE5        Mozilla        Konqueror2.2        Opera5
   event                        yes        yes            yes            yes                    yes
   event.returnValue            yes        yes            no            no                    no
   event.cancelBubble            yes        yes            no            no                    no
   event.srcElement            yes        yes            no            no                    no
   event.fromElement            yes        yes            no            no                    no
   
   */
   Event.prototype.__defineSetter__("returnValue",function(b){// 
       if(!b)this.preventDefault();
       return b;
       });
   Event.prototype.__defineSetter__("cancelBubble",function(b){// 设置或者检索当前事件句柄的层次冒泡
       if(b)this.stopPropagation();
       return b;
       });
   Event.prototype.__defineGetter__("srcElement",function(){
       var node=this.target;
       while(node.nodeType!=1)node=node.parentNode;
       return node;
       });
   Event.prototype.__defineGetter__("fromElement",function(){// 返回鼠标移出的源节点
       var node;
       if(this.type=="mouseover")
           node=this.relatedTarget;
       else if(this.type=="mouseout")
           node=this.target;
       if(!node)return;
       while(node.nodeType!=1)node=node.parentNode;
       return node;
       });
   Event.prototype.__defineGetter__("toElement",function(){// 返回鼠标移入的源节点
       var node;
       if(this.type=="mouseout")
           node=this.relatedTarget;
       else if(this.type=="mouseover")
           node=this.target;
       if(!node)return;
       while(node.nodeType!=1)node=node.parentNode;
       return node;
       });
   Event.prototype.__defineGetter__("offsetX",function(){
       return this.layerX;
       });
   Event.prototype.__defineGetter__("offsetY",function(){
       return this.layerY;
       });
   }

if(window.Node){// 修正Node的DOM
   /*
                               IE5        MacIE5        Mozilla        Konqueror2.2        Opera5
   Node.contains                yes        yes            no            no                    yes
   Node.replaceNode            yes        no            no            no                    no
   Node.removeNode                yes        no            no            no                    no
   Node.children                yes        yes            no            no                    no
   Node.hasChildNodes            yes        yes            yes            yes                    no
   Node.childNodes                yes        yes            yes            yes                    no
   Node.swapNode                yes        no            no            no                    no
   Node.currentStyle            yes        yes            no            no                    no
   
   */

   Node.prototype.replaceNode=function(Node){// 替换指定节点
       this.parentNode.replaceChild(Node,this);
       }
   Node.prototype.removeNode=function(removeChildren){// 删除指定节点
       if(removeChildren)
           return this.parentNode.removeChild(this);
       else{
           var range=document.createRange();
           range.selectNodeContents(this);
           return this.parentNode.replaceChild(range.extractContents(),this);
           }
       }
   Node.prototype.swapNode=function(node){// 交换节点
       var nextSibling=this.nextSibling;
       var parentNode=this.parentNode;
       node.parentNode.replaceChild(this,node);
       parentNode.insertBefore(node,nextSibling);
       }
   }
if(window.HTMLElement){
   window.attachEvent=function(sType,fHandler){
       var shortTypeName=sType.replace(/on/,"");
	   fHandler._ieEmuEventHandler=function(e){
           window.event=e;
           return fHandler();
           }
       window.addEventListener(shortTypeName,fHandler._ieEmuEventHandler,false);
       }

   window.detachEvent=function(sType,fHandler){
       var shortTypeName=sType.replace(/on/,"");
       if(typeof(fHandler._ieEmuEventHandler)=="function")
           window.removeEventListener(shortTypeName,fHandler._ieEmuEventHandler,false);
       else
           window.removeEventListener(shortTypeName,fHandler,true);
       }


   HTMLElement.prototype.__defineGetter__("all",function(){
       var a=this.getElementsByTagName("*");
       var node=this;
       a.tags=function(sTagName){
           return node.getElementsByTagName(sTagName);
           }
       return a;
       });
   HTMLElement.prototype.__defineGetter__("parentElement",function(){
       if(this.parentNode==this.ownerDocument)return null;
       return this.parentNode;
       });
   HTMLElement.prototype.__defineGetter__("children",function(){
       var tmp=[];
       var j=0;
       var n;
       for(var i=0;i<this.childNodes.length;i++){
           n=this.childNodes[i];
           if(n.nodeType==1){
               tmp[j++]=n;
               if(n.name){
                   if(!tmp[n.name])
                       tmp[n.name]=[];
                   tmp[n.name][tmp[n.name].length]=n;
                   }
               if(n.id)
                   tmp[n.id]=n;
               }
           }
       return tmp;
       });
   HTMLElement.prototype.__defineGetter__("currentStyle", function(){
       return this.ownerDocument.defaultView.getComputedStyle(this,null);
       });
   HTMLElement.prototype.__defineSetter__("outerHTML",function(sHTML){
       var r=this.ownerDocument.createRange();
       r.setStartBefore(this);
       var df=r.createContextualFragment(sHTML);
       this.parentNode.replaceChild(df,this);
       return sHTML;
       });
   HTMLElement.prototype.__defineGetter__("outerHTML",function(){
       var attr;
       var attrs=this.attributes;
       var str="<"+this.tagName;
       for(var i=0;i<attrs.length;i++){
           attr=attrs[i];
           if(attr.specified)
               str+=" "+attr.name+'="'+attr.value+'"';
           }
       if(!this.canHaveChildren)
           return str+">";
       return str+">"+this.innerHTML+"</"+this.tagName+">";
       });
   HTMLElement.prototype.__defineGetter__("canHaveChildren",function(){
       switch(this.tagName.toLowerCase()){
           case "area":
           case "base":
           case "basefont":
           case "col":
           case "frame":
           case "hr":
           case "img":
           case "br":
           case "input":
           case "isindex":
           case "link":
           case "meta":
           case "param":
               return false;
           }
       return true;
       });

   HTMLElement.prototype.__defineSetter__("innerText",function(sText){
       var parsedText=document.createTextNode(sText);
       this.innerHTML=parsedText.textContent;
       return parsedText.textContent;
       });
   HTMLElement.prototype.__defineGetter__("innerText",function(){
       var r=this.ownerDocument.createRange();
       r.selectNodeContents(this);
       return r.toString();
       });
   HTMLElement.prototype.__defineSetter__("outerText",function(sText){
       var parsedText=document.createTextNode(sText);
       this.outerHTML=parsedText;
       return parsedText;
       });
   HTMLElement.prototype.__defineGetter__("outerText",function(){
       var r=this.ownerDocument.createRange();
       r.selectNodeContents(this);
       return r.toString();
       });
   HTMLElement.prototype.attachEvent=function(sType,fHandler){
       var shortTypeName=sType.replace(/on/,"");
       fHandler._ieEmuEventHandler=function(e){
           window.event=e;
           return fHandler();
           }
       this.addEventListener(shortTypeName,fHandler._ieEmuEventHandler,false);
       }
   HTMLElement.prototype.detachEvent=function(sType,fHandler){
       var shortTypeName=sType.replace(/on/,"");
       if(typeof(fHandler._ieEmuEventHandler)=="function")
           this.removeEventListener(shortTypeName,fHandler._ieEmuEventHandler,false);
       else
           this.removeEventListener(shortTypeName,fHandler,true);
       }
   HTMLElement.prototype.contains=function(Node){// 是否包含某节点
       do if(Node==this)return true;
       while(Node=Node.parentNode);
       return false;
       }
   HTMLElement.prototype.insertAdjacentElement=function(where,parsedNode){
       switch(where){
           case "beforeBegin":
               this.parentNode.insertBefore(parsedNode,this);
               break;
           case "afterBegin":
               this.insertBefore(parsedNode,this.firstChild);
               break;
           case "beforeEnd":
               this.appendChild(parsedNode);
               break;
           case "afterEnd":
               if(this.nextSibling)
                   this.parentNode.insertBefore(parsedNode,this.nextSibling);
               else
                   this.parentNode.appendChild(parsedNode);
               break;
           }
       }
   HTMLElement.prototype.insertAdjacentHTML=function(where,htmlStr){
       var r=this.ownerDocument.createRange();
       r.setStartBefore(this);
       var parsedHTML=r.createContextualFragment(htmlStr);
       this.insertAdjacentElement(where,parsedHTML);
       }
   HTMLElement.prototype.insertAdjacentText=function(where,txtStr){
       var parsedText=document.createTextNode(txtStr);
       this.insertAdjacentElement(where,parsedText);
       }
   HTMLElement.prototype.attachEvent=function(sType,fHandler){
       var shortTypeName=sType.replace(/on/,"");
       fHandler._ieEmuEventHandler=function(e){
           window.event=e;
           return fHandler();
           }
       this.addEventListener(shortTypeName,fHandler._ieEmuEventHandler,false);
       }
   HTMLElement.prototype.detachEvent=function(sType,fHandler){
       var shortTypeName=sType.replace(/on/,"");
       if(typeof(fHandler._ieEmuEventHandler)=="function")
           this.removeEventListener(shortTypeName,fHandler._ieEmuEventHandler,false);
       else
           this.removeEventListener(shortTypeName,fHandler,true);
       }
}
//结束对 FireFox 的修正 ==> if(window.HTMLElement){
//=================================================================
//=================================================================
//=================================================================
//=================================================================

Array.prototype.______Array = function(){return '______Array'}

var JSON = {
    org: 'http://www.JSON.org',
    copyright: '(c)2005 JSON.org',
    license: 'http://www.crockford.com/JSON/license.html',

    stringify: function (arg) {
        var c, i, l, s = '', v;

        switch (typeof arg) {
        case 'object':
            if (arg) {
			
                if (arg.______Array&&arg.______Array()== '______Array') {
                    for (i = 0; i < arg.length; ++i) {
                        v = this.stringify(arg[i]);
                        if (s) {
                            s += ',';
                        }
                        s += v;
                    }
                    return '[' + s + ']';
                } else if (typeof arg.toString != 'undefined') {
                    for (i in arg) {

                        v = arg[i];
                        if (typeof v != 'undefined' && typeof v != 'function') {
                            v = this.stringify(v);
                            if (s) {
                                s += ',';
                            }
                            s += this.stringify(i) + ':' + v;
                        }
                    }
                    return '{' + s + '}';
                }
            }
            return 'null';
        case 'number':
            return isFinite(arg) ? String(arg) : 'null';
        case 'string':
            l = arg.length;
            s = '"';
            for (i = 0; i < l; i += 1) {
                c = arg.charAt(i);
                if (c >= ' ') {
                    if (c == '\\' || c == '"') {
                        s += '\\';
                    }
                    s += c;
                } else {
                    switch (c) {
                        case '\b':
                            s += '\\b';
                            break;
                        case '\f':
                            s += '\\f';
                            break;
                        case '\n':
                            s += '\\n';
                            break;
                        case '\r':
                            s += '\\r';
                            break;
                        case '\t':
                            s += '\\t';
                            break;
                        default:
                            c = c.charCodeAt();
                            s += '\\u00' + Math.floor(c/16).toString(16)+(c%16).toString(16);
                    }
                }
            }
            return s + '"';
        case 'boolean':
            return String(arg);
        default:
            return 'null';
        }
    },
    parse: function (text) {
        var at = 0;
        var ch = ' ';

        function error(m) {
            throw {
                name: 'JSONError',
                message: m,
                at: at - 1,
                text: text
            };
        }

        function next() {
            ch = text.charAt(at);
            at += 1;
            return ch;
        }

        function white() {
            while (ch != '' && ch <= ' ') {
                next();
            }
        }

        function str() {
            var i, s = '', t, u;

            if (ch == '"') {
		outer:	while (next()) {
                    if (ch == '"') {
                        next();
                        return s;
                    } else if (ch == '\\') {
                        switch (next()) {
                        case 'b':
                            s += '\b';
                            break;
                        case 'f':
                            s += '\f';
                            break;
                        case 'n':
                            s += '\n';
                            break;
                        case 'r':
                            s += '\r';
                            break;
                        case 't':
                            s += '\t';
                            break;
                        case 'u':
                            u = 0;
                            for (i = 0; i < 4; i += 1) {
                                t = parseInt(next(), 16);
                                if (!isFinite(t)) {
                                    break outer;
                                }
                                u = u * 16 + t;
                            }
                            s += String.fromCharCode(u);
                            break;
                        default:
                            s += ch;
                        }
                    } else {
                        s += ch;
                    }
                }
            }
            error("Bad string");
        }

        function arr() {
            var a = [];

            if (ch == '[') {
                next();
                white();
                if (ch == ']') {
                    next();
                    return a;
                }
                while (ch) {
                    a.push(val());
                    white();
                    if (ch == ']') {
                        next();
                        return a;
                    } else if (ch != ',') {
                        break;
                    }
                    next();
                    white();
                }
            }
            error("Bad array");
        }

        function obj() {
            var k, o = {};

            if (ch == '{') {
                next();
                white();
                if (ch == '}') {
                    next();
                    return o;
                }
                while (ch) {
                    k = str();
                    white();
                    if (ch != ':') {
                        break;
                    }
                    next();
                    o[k] = val();
                    white();
                    if (ch == '}') {
                        next();
                        return o;
                    } else if (ch != ',') {
                        break;
                    }
                    next();
                    white();
                }
            }
            error("Bad object");
        }

        function num() {
            var n = '', v;
            if (ch == '-') {
                n = '-';
                next();
            }
            while (ch >= '0' && ch <= '9') {
                n += ch;
                next();
            }
            if (ch == '.') {
                n += '.';
                while (next() && ch >= '0' && ch <= '9') {
                    n += ch;
                }
            }
            if (ch == 'e' || ch == 'E') {
                n += 'e';
                next();
                if (ch == '-' || ch == '+') {
                    n += ch;
                    next();
                }
                while (ch >= '0' && ch <= '9') {
                    n += ch;
                    next();
                }
            }
            v = +n;
            if (!isFinite(v)) {
                error("Bad number");
            } else {
                return v;
            }
        }

        function word() {
            switch (ch) {
                case 't':
                    if (next() == 'r' && next() == 'u' && next() == 'e') {
                        next();
                        return true;
                    }
                    break;
                case 'f':
                    if (next() == 'a' && next() == 'l' && next() == 's' &&
                            next() == 'e') {
                        next();
                        return false;
                    }
                    break;
                case 'n':
                    if (next() == 'u' && next() == 'l' && next() == 'l') {
                        next();
                        return null;
                    }
                    break;
            }
            error("Syntax error");
        }

        function val() {
            white();
            switch (ch) {
                case '{':
                    return obj();
                case '[':
                    return arr();
                case '"':
                    return str();
                case '-':
                    return num();
                default:
                    return ch >= '0' && ch <= '9' ? num() : word();
            }
        }

        return val();
    }
};



//=================================================================
//=================================================================
//=================================================================
/** 清除数组中重复的元素 */
Array.prototype.Unique = function()
{
    var a = {}; for(var i=0; i<this.length; i++)
    {
        if(typeof a[this[i]] == "undefined")
        a[this[i]] = 1;
    }
    this.length = 0;
    for(var c in a) this[this.length] = c;
    return this;
}
/** 将字符串中的某些会打断传输的内容替换
原始内容    %    `　   @　  #　  $　  ^　    &　  =　   +　  [　  ]　  {　  }　  |　  /　  \　  <　  >　  ,　  ?　  :　  "　  ;　　
转换后内容  %25  %60　 %40　%23　%24　%5E　  %26　%3D　 %2B　%5B　%5D　%7B　%7D　%7C　%2F　%5C　%3C　%3E　%2C　%3F　%3A　%22　%3B
*/

String.prototype.URI = function()
{
    //return this.replace(/%/g,'%25').replace(/`/g,'%60').replace(/@/g,'%40').replace(/#/g,'%23').replace(/$/g,'%24').replace(/^/g,'%5E').replace(/&/g,'%26').replace(/=/g,'%3D').replace(/+/g,'%2B').replace(/[/g,'%5B').replace(/]/g,'%5D').replace(/{/g,'%7B').replace(/}/g,'%7D').replace(/|/g,'%7C').replace(/\//g,'%2F').replace(/\\/g,'%5C').replace(/</g,'%3C').replace(/>/g,'%3E').replace(/,/g,'%2C').replace(/?/g,'%3F').replace(/:/g,'%3A').replace(/\"/g,'%22').replace(/;/g,'%3B');
    //return this.replace(/\%/g,'%25').replace(/\&/g,'%26').replace(/\=/g,'%3D').replace(/\+/g,'%2B').replace(/\?/g,'%3F').replace(/ /g,'%20');
    return encodeURIComponent(this);
}
Number.prototype.URI = function(){ return this; }
/********************************************/
String.prototype.stripTags = function() {
    return this.replace(/<\/?[^>]+>/gi, '');
}
String.prototype.toURL = function()
{
    return this.replace(/\s|\%|\&|\"|\'|\\/ig,'');
}
String.prototype.length2 = function(sigle)//sigle为真表示一个汉字按2个算，否则则按三个算
{
	var _$num = this.length;
	//var a = new Date().getTime();
    var _$arr = this.match(/[^\x00-\x80]/ig);
    //alert(new Date().getTime()-a);
    //if (_$arr) alert(_$arr.length);
	if(_$arr!=null)_$num+= sigle?_$arr.length:_$arr.length*2;
	return _$num;
}
/** 去除前后的空格 */
String.prototype.trim = function()
{
   return this.replace(/(^\s+)|\s+$/g,"");
}
/** 去除前后的空格，包括全角 */
String.prototype.trim2 = function()
{
   return this.replace(/(^\s+)|\s+$|^　+|　+$/g,"");
}

String.prototype.right = function(n)
{
   return this.substr(this.length-n,this.length);
}

String.prototype.left = function(n)
{
   return this.substr(0,n);
}

String.prototype.left2 = function(n,m)
{
    var len = 0;
    var rs = ""; //截取的字符
    for(var i=0;len<n;i++)
    {
		if ((this.charCodeAt(i) >= 0) && (this.charCodeAt(i) <= 255))
		{
			len ++;
		}
		else
		{
			len +=(m==2?2:3);
		}
		if (len<=n) rs += this.substr(i,1);
		else break;
    }
	if (rs.length2()>n) rs = rs.substr(0,i-2);
    return rs;
}

String.prototype.widthTrim = function(n,m)
{
	if (n>=this.length+2) return this;
	return this.substr(0,n)+'...';
	//*****
    var len = 0;
    var rs = ""; //截取的字符
    for(var i=0;len<n;i++)
    {
		if ((this.charCodeAt(i) >= 0) && (this.charCodeAt(i) <= 255))
		{
			if (m==2) len +=0.5;
			else len ++;
		}
		else
		{
			len +=2;
		}
		if (len<=n) rs += this.substr(i,1);
		else break;
    }
	if (rs.length<this.length) rs +='...';
    return rs;
}

/** 一般应用于 conten_VAL.toHTML()，功能同 U.CVHtml */
String.prototype.toHTML = function(onerow)
{
    var temp = this.replace(/&/g,"&amp;").replace(/\"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/ /g,"&nbsp;").replace(/\n/g,onerow==2?'<br>':'').replace(/\s|\t/g,onerow==2?' ':'');
    return temp;
}
String.prototype.toText = function()
{
    var a = this.stripTags();
    var b = document.createElement("DIV");
    b.innerHTML = a;
    return b.innerText.trim2();
}
String.prototype.toValue = function()
{
    return this.replace(/&/g,"&#38;").replace(/\"/g,"&#34;").replace(/\'/g,'&#39;').replace(/</g,"&#60;").replace(/>/g,"&#62;").replace(/\t/g,"　").replace(/\n/g,'');
}
String.prototype.toTextareaValue = function()
{
    return this.replace(/&/g,"&#38;").replace(/\"/g,"&#34;").replace(/\'/g,'&#39;').replace(/</g,"&#60;").replace(/>/g,"&#62;").replace(/\t/g,"　");
}
String.prototype.toTitle = function()
{
    return this.replace(/&/g,'&#38;').replace(/\"/g,'&#34;').replace(/\'/g,'&#39;').replace(/</g,"&#60;").replace(/>/g,"&#62;").replace(/\n/ig,'&#10;');
}
String.prototype.toTitle2 = function()
{
    return this.replace(/\'/g,'&#39;').replace(/\"/g,'&#34;').replace(/&/g,'&#38;');
}
/**================================================================**/
/**================================================================**/
/**================================================================**/
/**===============    逻辑错误处理开始 开始，ERROR.js  =============**/

T._$baseUrl = "http://imgcache.qbar.qq.com/qbar/qbar2/";
T.ERROR = {};
T.ERROR.MSG = function(code,param,_$force)
{
    T.LoadJS(T._$baseUrl+"T.ERROR.js",
        function(){T.ERROR.MSG(code,param,_$force)})
}
T.ERROR.MSG2 = function(code,param,obj,style)
{
    T.LoadJS(T._$baseUrl+"T.ERROR.js",
        function(){T.ERROR.MSG2(code,param,obj,style)})
}
T.MSG = function(msg,style,obj)
{
    T.LoadJS(T._$baseUrl+"T.ERROR.js",
        function(){T.MSG(msg,style,obj)})
}
T.ERROR.WriteMSG = function(code,param,obj,style,callback)
{
	T.LoadJS(T._$baseUrl+"T.ERROR.js",
        function(){T.ERROR.WriteMSG(code,param,obj,style,callback)})
}
/**================================================================**/
/**================================================================**/
/**================================================================**/
/**===============    JS错误处理开始 开始，ERROR.js  =============**/
T.JSERROR = {};
T.JSERROR.MSG = function(code,param)
{
    T.LoadJS(T._$baseUrl+"T.JSERROR.js",
        function(){T.JSERROR.MSG(code,param)})
}

/**================================================================**/
/**================================================================**/
/**================================================================**/
/**================                        开始  ==================**/
//
T.ResetAllXMP = function()
{
	var a=document.getElementsByTagName('XMP');
	for (var i=0; i<a.length; i++)T.RenderDOM(a[i],-1);
}

//试图去渲染一个区域内的所有 XMP.TPL 
T.TryRenderDOM = function()
{
    
}
//--------------------------------------------------------------------
T.GetRand = function(_$onlyNum)
{
    var r = String(Math.random()).replace('0.','');
    if(_$onlyNum){return r}
    return "r"+r;
}
/* 将某个模版用数据渲染并放在模版后面
renderType:渲染模式 0:渲染后删除模版 1:渲染后保留原模版 2:累加渲染 -1:删除由某个模版的那个真实页面片
当_$data==-1的时候也是同样效果
*/
T.RenderDOM = function(_$tplDOM, _$data, _$renderType)
{
    if (typeof _$tplDOM == 'string')
	{
		_$tplDOM = T.$(_$tplDOM);
    }
    if (!_$tplDOM)
    {
		//if(T.debugMode)alert('T.RenderDOM时找不到节点');
        return;
    }
    //if (_$renderType==undefined || _$renderType==0)
    if (_$renderType==0)
    {
		//var a = T.TP.processDOMTemplate(_$tplDOM, _$data);
        _$tplDOM.outerHTML = T.TP.processDOMTemplate(_$tplDOM, _$data);
        return;
    }

    var _$C_prefix = "__TPL_RENDERFROM_prefix_";//作为IE常量

    var _$tplDOMID = _$tplDOM.getAttribute("id");
    
    if (!_$tplDOMID)
    {
        _$tplDOMID = "__RAND_ElEM_ID_" + T.GetRand(true);
       _$tplDOM.setAttribute("id", _$tplDOMID);
    }

    if (_$renderType!=2) //只要不是累加渲染，都要试图移除后面的那个被渲染生成的对象
    {
        try{
            if (_$tplDOM.nextSibling && _$tplDOM.nextSibling.getAttribute("ID")==_$C_prefix+_$tplDOMID)
            {
                if (T.isIE) // for IE
                {
                    _$tplDOM.nextSibling.removeNode(true);		
                }
                else // for firefox
                {
                    var _$nextElem = document.getElementById(_$tplDOMID).nextSibling;
                    document.getElementById(_$tplDOMID).parentNode.removeChild(_$nextElem);
                }
            }
        }catch(e){}finally{}
		try{
			if (_$renderType==-1||String(_$data)=="-1") return;
		}catch(e){}
    }
    
    var _$rendedHTML = T.TP.processDOMTemplate(_$tplDOMID, _$data);

	if (_$tplDOM.insertAdjacentHTML) // for IE
	{
		_$tplDOM.insertAdjacentHTML("afterEnd", "<span id='"+_$C_prefix+_$tplDOMID+"'>"+_$rendedHTML+"</span>");
	}
	else // for firefox
	{
		_$rendedHTML = new String(_$rendedHTML).trim();
		var _$fragment = _$tplDOM.ownerDocument.createElement('span');
        _$fragment.setAttribute("id", _$C_prefix+_$tplDOMID);
		_$fragment.innerHTML = _$rendedHTML;
		_$tplDOM.parentNode.insertBefore(_$fragment, _$tplDOM.nextSibling);        
	}
} //TJAX.RenderDOM = function(_$tplDOM, _$data, _$renderType)

/**================                        结束  ==================**/
/**================================================================**/
/**================================================================**/
/**================================================================**/


/**================================================================**/
/**================================================================**/
/**================================================================**/
/**==============   T.TP template.js 开始，修改版  ================**/
T.TP = {};

// TODO: Debugging mode vs stop-on-error mode - runtime flag.
// TODO: Handle || (or) characters and backslashes.
// TODO: Add more modifiers.

(function() {               // Using a closure to keep global namespace clean.
    if (T.TP == null)
        T.TP = new Object();
    if (T.TP.evalEx == null)
        T.TP.evalEx = function(src) { return eval(src); };

    var UNDEFINED;
    if (Array.prototype.pop == null)  // IE 5.x fix from Igor Poteryaev.
        Array.prototype.pop = function() {
            if (this.length === 0) {return UNDEFINED;}
            return this[--this.length];
        };
    if (Array.prototype.push == null) // IE 5.x fix from Igor Poteryaev.
        Array.prototype.push = function() {
            for (var i = 0; i < arguments.length; ++i) {this[this.length] = arguments[i];}
            return this.length;
        };

    T.TP.parseTemplate = function(tmplContent, optTmplName, optEtc) {
        if (optEtc == null)
            optEtc = T.TP.parseTemplate_etc;
        var funcSrc = parse(tmplContent, optTmplName, optEtc);
        var func = T.TP.evalEx(funcSrc, optTmplName, 1);
        if (func != null)
            return new optEtc.Template(optTmplName, tmplContent, funcSrc, func, optEtc);
        return null;
    }
    
    try {
        String.prototype.process = function(context, optFlags) {
            var template = T.TP.parseTemplate(this, null);
            if (template != null)
                return template.process(context, optFlags);
            return this;
        }
    } catch (e) {}finally{}
    
    T.TP.parseTemplate_etc = {};
    T.TP.parseTemplate_etc.statementTag = "forelse|for|if|elseif|else|var|macro";
    T.TP.parseTemplate_etc.statementDef = {
        "if"     : { delta:  1, prefix: "if (", suffix: ") {", paramMin: 1 },
        "else"   : { delta:  0, prefix: "} else {" },
        "elseif" : { delta:  0, prefix: "} else if (", suffix: ") {", paramDefault: "true" },
        "/if"    : { delta: -1, prefix: "}" },
        "for"    : { delta:  1, paramMin: 3,
                     prefixFunc : function(stmtParts, state, tmplName, etc) {
                        if (stmtParts[2] == "in") {
                            var iterVar = stmtParts[1];


                            if( stmtParts[4] == "to" ) {
                                var lbound = stmtParts[3];
                                var ubound = stmtParts[5];
                                
                                var step = 1;
                                if(stmtParts[6] == "by") {
                                    step = stmtParts[7];
                                }
                                
                                var ret = [ 
                                     "var ", iterVar, "_ct = 0;",                                     
                                     "var ", iterVar, "_index = -1;",                                     
                                     
                                     "var __LENGTH_STACK__;",                                     
                                     "if (typeof(__LENGTH_STACK__) == 'undefined' || !__LENGTH_STACK__.length) __LENGTH_STACK__ = new Array();",
                                     "__LENGTH_STACK__[__LENGTH_STACK__.length] = 0;", // Push a new for-loop onto the stack of loop lengths.
                                     
                                     "if( (", step, " > 0 && ", lbound, " < ", ubound, ") || (", step, " < 0 && ", lbound, ">", ubound, ") ) { ",
                                     "for (var ", iterVar, " = ", lbound, "; ",
                                                  iterVar, ( step < 0 ? ">" : "<" ), ubound, "; ",
                                                  iterVar, " += " , step, ") { ",
                                                  iterVar, "_ct++;", 
                                                  iterVar, "_index++;",
                                                  "__LENGTH_STACK__[__LENGTH_STACK__.length - 1]++;",
                                ].join("");
                                return ret;
                            }
                            else {
                                var listVar = "__LIST__" + iterVar;
                                
                                return [ "var ", listVar, " = ", stmtParts[3], ";",
                                     // Fix from Ross Shaull for hash looping, make sure that we have an array of loop lengths to treat like a stack.
                                     "var __LENGTH_STACK__;",
                                     "if (typeof(__LENGTH_STACK__) == 'undefined' || !__LENGTH_STACK__.length) __LENGTH_STACK__ = new Array();",
                                     "__LENGTH_STACK__[__LENGTH_STACK__.length] = 0;", // Push a new for-loop onto the stack of loop lengths.
                                     "if ((", listVar, ") != null) { ",
                                     "var ", iterVar, "_ct = 0;",       // iterVar_ct variable, added by B. Bittman
                                     "for (var ", iterVar, "_index in ", listVar, ") { ",
                                     iterVar, "_ct++;",
                                     "if (typeof(", listVar, "[", iterVar, "_index]) == 'function') {continue;}", // IE 5.x fix from Igor Poteryaev.
                                     "__LENGTH_STACK__[__LENGTH_STACK__.length - 1]++;",
                                     "var ", iterVar, " = ", listVar, "[", iterVar, "_index];" ].join("");
                            }
                        }
                        else {
                            if (T.debugMode)
                            {
                                throw new etc.ParseError(tmplName, state.line, "bad for loop statement: " + stmtParts.join(' '));
                            }
                        }
                     } },
        "forelse" : { delta:  0, prefix: "} } if (__LENGTH_STACK__[__LENGTH_STACK__.length - 1] == 0) { if (", suffix: ") {", paramDefault: "true" },
        "/for"    : { delta: -1, prefix: "} }; delete __LENGTH_STACK__[__LENGTH_STACK__.length - 1];" }, // Remove the just-finished for-loop from the stack of loop lengths.
        "var"     : { delta:  0, prefix: "var ", suffix: ";" },
        "macro"   : { delta:  1, 
                      prefixFunc : function(stmtParts, state, tmplName, etc) {
                          var macroName = stmtParts[1].split('(')[0];
                          return [ "var ", macroName, " = function", 
                                   stmtParts.slice(1).join(' ').substring(macroName.length),
                                   "{ var _OUT_arr = []; var _OUT = { write: function(m) { if (m) _OUT_arr.push(m); } }; " ].join('');
                     } }, 
        "/macro"  : { delta: -1, prefix: " return _OUT_arr.join(''); };" }
    }
    T.TP.parseTemplate_etc.modifierDef = {
        "eat"        : function(v)    { return ""; },
        "escape"     : function(s)    { return String(s).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"); },
        "capitalize" : function(s)    { return String(s).toUpperCase(); },
        "default"    : function(s, d) { return s != null ? s : d; }
    }
    T.TP.parseTemplate_etc.modifierDef.h = T.TP.parseTemplate_etc.modifierDef.escape;

    T.TP.parseTemplate_etc.Template = function(tmplName, tmplContent, funcSrc, func, etc) {
        this.process = function(context, flags) {
            if (context == null)
                context = {};
            if (context._MODIFIERS == null)
                context._MODIFIERS = {};
            if (context.defined == null)
                context.defined = function(str) { return (context[str] != undefined); };
            for (var k in etc.modifierDef) {
                if (context._MODIFIERS[k] == null)
                    context._MODIFIERS[k] = etc.modifierDef[k];
            }
            if (flags == null)
                flags = {};
            var resultArr = [];
            var resultOut = { write: function(m) { resultArr.push(m); } };
            try {
                func(resultOut, context, flags);
            } catch (e) {
                if (!T.debugMode) return;
                if (flags.throwExceptions == true)
                    throw e;
                var result = new String(resultArr.join("") + "[ERROR: " + e.toString() + (e.message ? '; ' + e.message : '') + "]");
                result["exception"] = e;
                return result;
            }finally{}
            return resultArr.join("");
        }
        this.name       = tmplName;
        this.source     = tmplContent; 
        this.sourceFunc = funcSrc;
        this.toString   = function() { return "T.TP.Template [" + tmplName + "]"; }
    }
    T.TP.parseTemplate_etc.ParseError = function(name, line, message) {
        this.name    = name;
        this.line    = line;
        this.message = message;
    }
    T.TP.parseTemplate_etc.ParseError.prototype.toString = function() { 
        return ("T.TP template ParseError in " + this.name + ": line " + this.line + ", " + this.message);
    }
    
    var parse = function(body, tmplName, etc) {
        body = cleanWhiteSpace(body);
        var funcText = [ "var T_TP_Template_TEMP = function(_OUT, _CONTEXT, _FLAGS) { with (_CONTEXT) {" ];
        var state    = { stack: [], line: 1 };                              // TODO: Fix line number counting.
        var endStmtPrev = -1;
        while (endStmtPrev + 1 < body.length) {
            var begStmt = endStmtPrev;
            // Scan until we find some statement markup.
            begStmt = body.indexOf("{", begStmt + 1);
            while (begStmt >= 0) {
                var endStmt = body.indexOf('}', begStmt + 1);
                var stmt = body.substring(begStmt, endStmt);
                var blockrx = stmt.match(/^\{(cdata|minify|eval)/); // From B. Bittman, minify/eval/cdata implementation.
                if (blockrx) {
                    var blockType = blockrx[1]; 
                    var blockMarkerBeg = begStmt + blockType.length + 1;
                    var blockMarkerEnd = body.indexOf('}', blockMarkerBeg);
                    if (blockMarkerEnd >= 0) {
                        var blockMarker;
                        if( blockMarkerEnd - blockMarkerBeg <= 0 ) {
                            blockMarker = "{/" + blockType + "}";
                        } else {
                            blockMarker = body.substring(blockMarkerBeg + 1, blockMarkerEnd);
                        }                        
                        
                        var blockEnd = body.indexOf(blockMarker, blockMarkerEnd + 1);
                        if (blockEnd >= 0) {                            
                            emitSectionText(body.substring(endStmtPrev + 1, begStmt), funcText);
                            
                            var blockText = body.substring(blockMarkerEnd + 1, blockEnd);
                            if (blockType == 'cdata') {
                                emitText(blockText, funcText);
                            } else if (blockType == 'minify') {
                                emitText(scrubWhiteSpace(blockText), funcText);
                            } else if (blockType == 'eval') {
                                if (blockText != null && blockText.length > 0) // From B. Bittman, eval should not execute until process().
                                    funcText.push('_OUT.write( (function() { ' + blockText + ' })() );');
                            }
                            begStmt = endStmtPrev = blockEnd + blockMarker.length - 1;
                        }
                    }                        
                } else if (body.charAt(begStmt - 1) != '$' &&               // Not an expression or backslashed,
                           body.charAt(begStmt - 1) != '\\') {              // so check if it is a statement tag.
                    var offset = (body.charAt(begStmt + 1) == '/' ? 2 : 1); // Close tags offset of 2 skips '/'.
                                                                            // 10 is larger than maximum statement tag length.
                    if (body.substring(begStmt + offset, begStmt + 10 + offset).search(T.TP.parseTemplate_etc.statementTag) == 0) 
                        break;                                              // Found a match.
                }
                begStmt = body.indexOf("{", begStmt + 1);
            }
            if (begStmt < 0)                              // In "a{for}c", begStmt will be 1.
                break;
            var endStmt = body.indexOf("}", begStmt + 1); // In "a{for}c", endStmt will be 5.
            if (endStmt < 0)
                break;
            emitSectionText(body.substring(endStmtPrev + 1, begStmt), funcText);
            emitStatement(body.substring(begStmt, endStmt + 1), state, funcText, tmplName, etc);
            endStmtPrev = endStmt;
        }
        emitSectionText(body.substring(endStmtPrev + 1), funcText);
        if (state.stack.length != 0)
            throw new etc.ParseError(tmplName, state.line, "unclosed, unmatched statement(s): " + state.stack.join(","));
        funcText.push("}}; T_TP_Template_TEMP");
        return funcText.join("");
    }
    
    var emitStatement = function(stmtStr, state, funcText, tmplName, etc) {
        var parts = stmtStr.slice(1, -1).split(' ');
        var stmt = etc.statementDef[parts[0]]; // Here, parts[0] == for/if/else/...
        if (stmt == null) {                    // Not a real statement.
            emitSectionText(stmtStr, funcText);
            return;
        }
        if (stmt.delta < 0) {
            if (state.stack.length <= 0)
                throw new etc.ParseError(tmplName, state.line, "close tag does not match any previous statement: " + stmtStr);
            state.stack.pop();
        } 
        if (stmt.delta > 0)
            state.stack.push(stmtStr);

        if (stmt.paramMin != null &&
            stmt.paramMin >= parts.length)
            throw new etc.ParseError(tmplName, state.line, "statement needs more parameters: " + stmtStr);
        if (stmt.prefixFunc != null)
            funcText.push(stmt.prefixFunc(parts, state, tmplName, etc));
        else 
            funcText.push(stmt.prefix);
        if (stmt.suffix != null) {
            if (parts.length <= 1) {
                if (stmt.paramDefault != null)
                    funcText.push(stmt.paramDefault);
            } else {
                for (var i = 1; i < parts.length; i++) {
                    if (i > 1)
                        funcText.push(' ');
                    funcText.push(parts[i]);
                }
            }
            funcText.push(stmt.suffix);
        }
    }

    var emitSectionText = function(text, funcText) {
        if (text.length <= 0)
            return;
        var nlPrefix = 0;               // Index to first non-newline in prefix.
        var nlSuffix = text.length - 1; // Index to first non-space/tab in suffix.
        while (nlPrefix < text.length && (text.charAt(nlPrefix) == '\n'))
            nlPrefix++;
        while (nlSuffix >= 0 && (text.charAt(nlSuffix) == ' ' || text.charAt(nlSuffix) == '\t'))
            nlSuffix--;
        if (nlSuffix < nlPrefix)
            nlSuffix = nlPrefix;
        if (nlPrefix > 0) {
            funcText.push('if (_FLAGS.keepWhitespace == true) _OUT.write("');
            var s = text.substring(0, nlPrefix).replace('\n', '\\n'); // A macro IE fix from BJessen.
            if (s.charAt(s.length - 1) == '\n')
            	s = s.substring(0, s.length - 1);
            funcText.push(s);
            funcText.push('");');
        }
        var lines = text.substring(nlPrefix, nlSuffix + 1).split('\n');
        for (var i = 0; i < lines.length; i++) {
            emitSectionTextLine(lines[i], funcText);
            if (i < lines.length - 1)
                funcText.push('_OUT.write("\\n");\n');
        }
        if (nlSuffix + 1 < text.length) {
            funcText.push('if (_FLAGS.keepWhitespace == true) _OUT.write("');
            var s = text.substring(nlSuffix + 1).replace('\n', '\\n');
            if (s.charAt(s.length - 1) == '\n')
            	s = s.substring(0, s.length - 1);
            funcText.push(s);
            funcText.push('");');
        }
    }
    
    var emitSectionTextLine = function(line, funcText) {
        var endMarkPrev = '}';
        var endExprPrev = -1;
        while (endExprPrev + endMarkPrev.length < line.length) {
            var begMark = "${", endMark = "}";
            var begExpr = line.indexOf(begMark, endExprPrev + endMarkPrev.length); // In "a${b}c", begExpr == 1
            if (begExpr < 0)
                break;
            if (line.charAt(begExpr + 2) == '%') {
                begMark = "${%";
                endMark = "%}";
            }
            var endExpr = line.indexOf(endMark, begExpr + begMark.length);         // In "a${b}c", endExpr == 4;
            if (endExpr < 0)
                break;
            emitText(line.substring(endExprPrev + endMarkPrev.length, begExpr), funcText);                
            // Example: exprs == 'firstName|default:"John Doe"|capitalize'.split('|')
            var exprArr = line.substring(begExpr + begMark.length, endExpr).replace(/\|\|/g, "#@@#").split('|');
            for (var k in exprArr) {
                if (exprArr[k].replace && k!="extend") // IE 5.x fix from Igor Poteryaev.
                    exprArr[k] = exprArr[k].replace(/#@@#/g, '||');
            }
            funcText.push('_OUT.write(');
            emitExpression(exprArr, exprArr.length - 1, funcText); 
            funcText.push(');');
            endExprPrev = endExpr;
            endMarkPrev = endMark;
        }
        emitText(line.substring(endExprPrev + endMarkPrev.length), funcText); 
    }
    
    var emitText = function(text, funcText) {
        if (text == null ||
            text.length <= 0)
            return;
        text = text.replace(/\\/g, '\\\\');
        text = text.replace(/\n/g, '\\n');
        text = text.replace(/\"/g,  '\\"');
        funcText.push('_OUT.write("');
        funcText.push(text);
        funcText.push('");');
    }
    
    var emitExpression = function(exprArr, index, funcText) {
        // Ex: foo|a:x|b:y1,y2|c:z1,z2 is emitted as c(b(a(foo,x),y1,y2),z1,z2)
        var expr = exprArr[index]; // Ex: exprArr == [firstName,capitalize,default:"John Doe"]

        if (index <= 0) {          // Ex: expr    == 'default:"John Doe"'
            funcText.push(expr);
            return;
        }
        var parts = expr.split(':');
        funcText.push('_MODIFIERS["');
        funcText.push(parts[0]); // The parts[0] is a modifier function name, like capitalize.
        funcText.push('"](');
        emitExpression(exprArr, index - 1, funcText);
        if (parts.length > 1) {
            funcText.push(',');
            funcText.push(parts[1]);
        }
        funcText.push(')');
    }

    var cleanWhiteSpace = function(result) {
        result = result.replace(/\t/g,   "    ");
        result = result.replace(/\r\n/g, "\n");

        //--add patch by BaggioWei at 2006-10-16, begin
        result = result.replace(/\n{1,}/g, "\n");
        //--add patch by BaggioWei at 2006-10-16, end

        result = result.replace(/\r/g,   "\n");
        result = result.replace(/^(\s*\S*(\s+\S+)*)\s*$/, '$1'); // Right trim by Igor Poteryaev.
        return result;
    }

    var scrubWhiteSpace = function(result) {
        result = result.replace(/^\s+/g,   "");
        result = result.replace(/\s+$/g,   "");
        result = result.replace(/\s+/g,   " ");
        result = result.replace(/^(\s*\S*(\s+\S+)*)\s*$/, '$1'); // Right trim by Igor Poteryaev.
        return result;
    }

    // The DOM helper functions depend on DOM/DHTML, so they only work in a browser.
    // However, these are not considered core to the engine.
    //
    T.TP.parseDOMTemplate = function(element, optDocument, optEtc) {
        if (optDocument == null)
            optDocument = document;
        if (typeof element == 'string')
        {
            element = optDocument.getElementById(element);
        }
        //var element = optDocument.getElementById(elementId);
        var content = element.value;     // Like textarea.value.
        if (content == null)
            content = element.innerHTML; // Like textarea.innerHTML.

        content = content.replace(/&lt;/g, "<").replace(/&gt;/g, ">");
        return T.TP.parseTemplate(content, element, optEtc);
    }

    T.TP.processDOMTemplate = function(element, context, optFlags, optDocument, optEtc) {
        return T.TP.parseDOMTemplate(element, optDocument, optEtc).process(context, optFlags);
    }
}) ();
/**==================   T.TP template.js 结束   ===================**/
/**================================================================**/
/**================================================================**/
/**================================================================**/

T.SetElemProgidAlpha = function(o, n)
{
if (!n) n=70;
o.style.filter="Alpha(opacity="+n+")";
o.style.MozOpacity=n/100;
}

T.LoadDeferImg = function(_$defer_time, _$element, _$defer_src)
{
	_$defer_src     = _$defer_src || "defer_src";
    _$element       = _$element || window.document.body;
	if (_$defer_time <0 || _$defer_time==undefined || _$defer_time== null || _$defer_time==='')
    {
        _$defer_time = 50;
    }
	window.setTimeout(function(){T._$LoadDeferImg(_$defer_time,_$element,_$defer_src)},_$defer_time);
}

T._$LoadDeferImg = function(_$defer_time,_$element, _$defer_src)
{
	var _$mainImg = {};
	var _$allImg = _$element.getElementsByTagName('IMG');
	for (var i=0; i<_$allImg.length; i++)
	{
		var _src = _$allImg[i].getAttribute(_$defer_src);
		if (!_src) continue;
        
		if (window.HTMLElement) //因为非 IE 不存在图片反复加载BUG，所以此处跳过
		{
			_$allImg[i].src = _src;
			continue;
		}

		//以下代码为 IE 的实现 
		var _$newimg = new Image();
        _$newimg.src = _src;
        if(_$newimg.fileSize>-1)
        {
            _$allImg[i].src = _$allImg[i].getAttribute(_$defer_src);
            continue;
        }
		
        if (_$mainImg[_src])
		{
			if (_$allImg[i].style.visibility != 'hidden')
			{
				_$allImg[i].style.visibility = 'hidden';
			}
			_$mainImg[_src].linkImg.push(_$allImg[i]);
		}
		else
		{
			_$mainImg[_src] = _$allImg[i];
			_$mainImg[_src].linkImg = [];
			
			_$allImg[i].onload = function()
            {
                var evtsrc = window.event.srcElement;
                var _src = evtsrc.getAttribute(_$defer_src);
                window.setTimeout(
                    function(){
                        for (var j=0; j<_$mainImg[_src].linkImg.length; j++)
                        {
                            _$mainImg[_src].linkImg[j].src = _src;
                            _$mainImg[_src].linkImg[j].style.visibility = 'inherit';
                        }
			        },_$defer_time);
            }
		}
	}//for (var i=0; i<allImg.length; i++) ==> END
    window.setTimeout(function(){
	    for (c in _$mainImg) { _$mainImg[c].src = c; }},_$defer_time/5);
}

/**===============================================================**/
/**===============================================================**/
/**===============================================================**/
/**===============================================================**/


T.lastHideFrame = "";
T.PostData = function(_$action,_$data,_$successEvent,_$failEvent,_$errorEvent,_$targetName)
{
    //var start = new Date();
    function toHTML2(str)
    {
        return str.replace(/&/g,"&#38;").replace(/\"/g,"&#34;").replace(/\'/g,'&#39;').replace(/</g,"&#60;").replace(/>/g,"&#62;");
    }
    var qbarid;
    try{
        if (!window.G) { G={qbarid:parent.G.qbarid} }
        else if (!G.qbarid) { G.qbarid=parent.G.qbarid }
    }catch(e){}
    
    //alert(document.domain);
    //document.domain = 'qq.com';

    _$targetName = _$targetName || 'hideFrame';
    if (T.lastHideFrame && document.getElementById(T.lastHideFrame))
    {
        document.getElementById(T.lastHideFrame).removeNode(true);
    }
    
    if (!T.isIE)
    {
        _$targetName = T.GetRand();
        T.lastHideFrame = _$targetName;
    }
    var _$form = document.createElement("FORM");
        _$form.action = _$action;
        _$form.method = "post";
        _$form.target = _$targetName;

    var _$innerHTML = "";
    if (_$data.constructor==Array)
    {
        for (var i=0;i<_$data.length;i++)
        {
			var _$pos = _$data[i].indexOf('=');
            if (_$pos>0)
            {
				var _$name = _$data[i].substr(0,_$pos);
				//var _$val = _$data[i].substr(_$pos+1).replace(/\'/g,'&#39;');
                var _$val = _$data[i].substr(_$pos+1);
				_$innerHTML += "<input type='hidden' name='"+_$name+"' value='"+toHTML2(_$val)+"'>";
			}
        }
    }
    else if (_$data.constructor==Object)
    {
        for (c in _$object)
        {
            //var _$val = String(_$object[c]).replace(/\'/g,'&#39;');
            var _$val = String(_$object[c]);
            _$innerHTML += "<input type='hidden' name='"+c+"' value='"+toHTML2(_$val)+"'>";
        }
    }
    else if (_$data.constructor==String)
    {
        var _$params = _$data.split("&");
        for (var i=0;i<_$params.length;i++)
        {
            var _$pos = _$params[i].indexOf('=');
            var _$name = _$params[i].substr(0,_$pos);
            //var _$val = decodeURIComponent(_$params[i].substr(_$pos+1).replace(/\'/g,'&#39;'));
            var _$val = decodeURIComponent(_$params[i].substr(_$pos+1));
            _$innerHTML += "<input type='hidden' name='"+_$name+"' value='"+toHTML2(_$val)+"'>";
        }
    }
    
    //_$innerHTML += "<input type='hidden' name='cafeid' value='"+RESULT.sys_param.cafeid+"'>"

    _$form.innerHTML = _$innerHTML;
    
    document.body.appendChild(_$form);
    T.CreateHideFrame(_$successEvent,_$failEvent,_$errorEvent,_$targetName);

    _$form.submit();
    //alert(new Date()-start+"xxx")
    try{
        if (event && event.srcElement)
        {
            if (LoadingWaitor) LoadingWaitor.swapNode(lastEvtElm);

            lastEvtElm = event.srcElement;
            if (LoadingWaitor) LoadingWaitor.removeNode(true);
            
            LoadingWaitor = document.createElement("IMG");
            LoadingWaitor.src = "http://imgcache.qbar.qq.com/qbar/qbar/images/Spinner.gif";
            LoadingWaitor.swapNode(lastEvtElm);
        }
    }catch(e){}
}

T.PostData2 = function(_$action,_$data,_$successEvent,_$failEvent,_$errorEvent,_$backParam)
{
	if(typeof _$failEvent=='object'){_$backParam=_$failEvent;_$failEvent=''}
	else if(typeof _$errorEvent=='object'){_$backParam=_$errorEvent;_$errorEvent=''}
	if(typeof _$backParam=='object'){
		if (T.isIE)_$backParam="'"+JSON.stringify(_$backParam).replace(/\"/g,'&#34;').replace(/\'/g,'&#39;')+"'";
	}

	var _$channel=0;
	if (typeof(_$action)!='string')
	{
		_$channel =  _$action[0];
		_$action = _$action[1];
		//if (_$channel>99999) {alert('通道号过大');return}
	}
	if (_$channel==0)_$channel=T.GetRand(true);
	
	//_$action = "http://imgcache.qbar.qq.com/TEST_POST.php";

    function toHTML2(str)
    {
        return str.replace(/&/g,"&#38;").replace(/\"/g,"&#34;").replace(/\'/g,'&#39;').replace(/</g,"&#60;").replace(/>/g,"&#62;");
    }
    var qbarid;
    try{
        if (!window.G) { G={qbarid:parent.G.qbarid} }
        else if (!G.qbarid) { G.qbarid=parent.G.qbarid }
    }catch(e){}

	var path=location.hostname;

    var _$form = document.createElement("FORM");
        _$form.action = _$action;
        _$form.method = "post";
        _$form.target = 'TDOM_IframeChannel_'+_$channel+'_'+path;

    var _$innerHTML = "";
    if (_$data.constructor==Array)
    {
        for (var i=0;i<_$data.length;i++)
        {
			var _$pos = _$data[i].indexOf('=');
            if (_$pos>0)
            {
				var _$name = _$data[i].substr(0,_$pos);
                var _$val = _$data[i].substr(_$pos+1);
				_$innerHTML += "<input type='hidden' name='"+_$name+"' value='"+toHTML2(_$val)+"'>";
			}
        }
    }
    else if (_$data.constructor==Object)
    {
        for (c in _$object)
        {
            var _$val = String(_$object[c]);
            _$innerHTML += "<input type='hidden' name='"+c+"' value='"+toHTML2(_$val)+"'>";
        }
    }
    else if (_$data.constructor==String)
    {
        var _$params = _$data.split("&");
        for (var i=0;i<_$params.length;i++)
        {
            var _$pos = _$params[i].indexOf('=');
            var _$name = _$params[i].substr(0,_$pos);
            var _$val = decodeURIComponent(_$params[i].substr(_$pos+1));
            _$innerHTML += "<input type='hidden' name='"+_$name+"' value='"+toHTML2(_$val)+"'>";
        }
    }

	//_$innerHTML += "<input type='hidden' name='cafeid' value='"+a+"'>";
	_$innerHTML += "<input type='hidden' name='Gjstag' value='2'>";
    _$form.innerHTML = _$innerHTML;
    
    document.body.appendChild(_$form);
    T.CreateHideFrame2(_$successEvent,_$failEvent,_$errorEvent,_$channel,_$backParam);

    _$form.submit();

    try{
        if (event && event.srcElement)
        {
            //if (LoadingWaitor) LoadingWaitor.swapNode(lastEvtElm);

            lastEvtElm = event.srcElement;
            //if (LoadingWaitor) LoadingWaitor.removeNode(true);
            
            LoadingWaitor = document.createElement("IMG");
            LoadingWaitor.src = "http://imgcache.qbar.qq.com/qbar/qbar/images/Spinner.gif";
            LoadingWaitor.swapNode(lastEvtElm);
        }
    }catch(e){}
}


var LoadingWaitor,lastEvtElm;


T.PostForm = function(_$form,_$successEvent,_$failEvent,_$errorEvent,_$targetName)
{
    //document.domain = 'qq.com';
    _$targetName = _$targetName || 'hideFrame';
    
    if (T.lastHideFrame && document.getElementById(T.lastHideFrame))
    {
        document.getElementById(T.lastHideFrame).removeNode(true);
    }
    
    if (!T.isIE)
    {
        _$targetName = T.GetRand();
        T.lastHideFrame = _$targetName;
    }

    T.CreateHideFrame(_$successEvent,_$failEvent,_$errorEvent,_$targetName);

    _$form.target = _$targetName;
    _$form.submit();
}

T.CreateHideFrame = function(_$successEvent,_$failEvent,_$errorEvent,_$frameName)
{
    for (var i=0;i<arguments.length-1;i++)
    {
        if (typeof(arguments[i])=='function'){arguments[i] = T.GetFunction(arguments[i]) }
        else if(arguments[i]=='' || arguments[i]==undefined || arguments[i]==null || typeof(arguments[i])=='string'){}
        else {alert("T.CreateHideFrame 入参不正确"); return }
    }
    if (!_$frameName)
    {
        alert("必须传递frame的名称");
        return;
    }
    var a = document.getElementById(_$frameName);
    if (!a)
    {
        a = document.createElement("iframe");
        document.body.appendChild(a);
    }
    
    var _$evtStr = [];
    _$evtStr.push(_$successEvent || "''");
    _$evtStr.push(_$failEvent || "''");
    _$evtStr.push(_$errorEvent || "''");
    var _$onload = "T.OnPostDataLoad('"+_$frameName+"',"+_$evtStr.join()+")";

    a.outerHTML='<iframe width=500 height=500 onload="'+_$onload+'" name='+_$frameName+' id='+_$frameName+' style="display:none"></iframe>';
}

T.CreateHideFrame2 = function(_$successEvent,_$failEvent,_$errorEvent,_$channel,_$backParam)
{
    if (_$channel.length<=5)//注意。开发人员指定的通道id值正整数必须不大于9999
    {
        var a = T.$('TDOM_IframeChannel_'+_$channel);
        if (a) {a.removeNode(true)};
    }
	
	var path=location.hostname;

	if (!T.isIE)
	{
		var a = document.createElement('IFRAME');
		//a.setAttribute('ID',_$frameName);
		//a.setAttribute('NAME','TDOM_IframeChannel_'+_$channel+'_'+window.location.hostname);

		a.setAttribute('NAME','TDOM_IframeChannel_'+_$channel+'_'+path);
	
		a.style.display='none';
		document.body.appendChild(a);
		a.onload = function(){T.OnPostData2Load(this,_$successEvent,_$failEvent,_$errorEvent,_$backParam)};
		//a.unonload = function(){a.onload=function(){}};
	}
	else
	{
		for (var i=0;i<arguments.length-1;i++)
		{
			if (typeof(arguments[i])=='function'){arguments[i] = T.GetFunction(arguments[i]) }
			else if(arguments[i]=='' || arguments[i]==undefined || arguments[i]==null || typeof(arguments[i])=='string'){}
			//else if(typeof(arguments[i])!='object'){alert("T.CreateHideFrame2 入参不正确"); return }
		}
		var _$es = [];
		_$es.push(_$successEvent || "''");
		_$es.push(_$failEvent || "''");
		_$es.push(_$errorEvent || "''");
		_$es.push(_$backParam || "''");
		var _$onload = "T.OnPostData2Load(this,"+_$es.join()+")";

		var h = '<iframe name="TDOM_IframeChannel_'+_$channel+'_'+path+'"';;
		if (_$channel) h += ' id="TDOM_IframeChannel_'+_$channel+'"';
		h += ' style="display:none" onload="'+_$onload+'"><\/iframe>';

		var a = document.createElement("iframe");
		document.body.appendChild(a);
		a.outerHTML = h;
	}
}

//传递
//T.AbortChannel([10,100])
T.AbortChannel = function(chans)
{
	if (arguments.length==0)
	{
		var iframes = document.body.getElementsByTagName('IFRAME');
		for (var i=iframes.length;i>0;i--)
		{		
			if (iframes[i-1].getAttribute("id").indexOf('TDOM_IframeChannel_')>-1)
			{
				T.RemoveIFrame(iframes[i-1]);
			}
		}
		return;
	}
	for (var i=chans.length;i>0;i--)
	{
		var iframe = T.$('TDOM_IframeChannel_'+chan[i-1]);
		T.RemoveIFrame(iframe);
	}
}

T.OnPostData2Load = function(iframeObj ,_$successEvent ,_$failEvent ,_$errorEvent ,_$backParam)
{
	_$backParam=JSON.parse(_$backParam||"{}");

    if (LoadingWaitor)
    {
		try{
			LoadingWaitor.swapNode(lastEvtElm);
			LoadingWaitor = "";
		}catch(e){}
    }
	window.setTimeout(function(){T.RemoveIFrame(iframeObj)},50);
	var RESULT;
	if (!T.isIE && iframeObj.src=='about:blank') return;

		try{ //当主页面设定了domument.domain时，子页面加载过程中没有完成时加载出错
			RESULT = iframeObj.contentWindow.name;
		}catch(e){return}
		
		if(!RESULT||RESULT==iframeObj.name) return;//一般发生在通道被释放时

		RESULT = RESULT.replace(/\r\n/g,'\\r\\n');

		eval("RESULT="+RESULT);

		T.UpdateLastTime();

        if(!RESULT){if(_$errorEvent)_$errorEvent();return}


    var r=Number(RESULT.sys_param.ret_code);
	if(r==0&&_$successEvent)_$successEvent(RESULT,_$backParam);
	else if(r!=0&&_$failEvent)_$failEvent(RESULT,_$backParam);
    else if(!T.PrepResult(RESULT,true)){ return }
    else alert("操作成功")
}


T.AfterFormSubmit = function(_$frameName)
{
    T.UpdateLastTime();
    T.RemoveHideFrame(_$frameName);
}

//此函数内部的引号(' ")方式不能轻易变更
//当_$url传递数组形式的时候，第一个参数表示通道号，应小于10000
//T.LoadData2([10,url][,...])
T.LoadData2=function(_$url,_$successEvent,_$failEvent,_$errorEvent,_$backParam)
{
	window.setTimeout(function(){T.TryHideLoader(1)},8000);
	if(typeof _$failEvent=='object'){_$backParam=_$failEvent;_$failEvent=''}
	else if(typeof _$errorEvent=='object'){_$backParam=_$errorEvent;_$errorEvent=''}
	if(typeof _$backParam=='object'){
		if (T.isIE)_$backParam="'"+JSON.stringify(_$backParam).replace(/\"/g,'&#34;').replace(/\'/g,'&#39;')+"'";
	}

	T.PrepShowLoader();
	var _$channel=0;
	if (typeof(_$url)!='string')
	{
		_$channel =  _$url[0];
		//if (_$channel>9999) {alert('通道号过大');return}
		_$url = _$url[1];
		var a = T.$('TDOM_IframeChannel_'+_$channel);

		if (a) {T.RemoveIFrame(a);T.TryHideLoader(true)};
	}
	if (_$channel==0) _$channel= T.GetRand(true);

	if (T.isIE)
	{
		for (var i=1;i<arguments.length;i++)
		{
			if (typeof(arguments[i])=='function'){arguments[i] = T.GetFunction(arguments[i]) }
			else if(_$backParam){}
			else if(arguments[i]=='' || arguments[i]==undefined || arguments[i]==null || typeof(arguments[i])=='string'){}
			else {alert("T.LoadData2 入参不正确"); return }
		}
		var _$es = [];

		_$es.push(_$successEvent || "''");
		_$es.push(_$failEvent || "''");
		_$es.push(_$errorEvent || "''");
		_$es.push(_$backParam || "''");
		var _$onload = "T.OnLoadData2Load(this,"+_$es.join()+")";
	}

	var lt = T.GetLastTime();

	if (lt) _$url += "&Glt="+lt;
	_$url = _$url.replace(/\&$/,'');
	_$url = _$url.replace(/\?\&/,'?');
	//****美丽的分割线

	T.lastTime=new Date();
	var sciptsrc = "javascript:document.write('<script>try{var a=parent.document.body}catch(e){document.domain=";
	
	sciptsrc += T.isIE?"\\&#39;qbar.qq.com\\&#39;":'"qbar.qq.com"'; //此处引号的方式不能轻易变更
	
	sciptsrc += "}finally{};";
	sciptsrc += T.debugMode?"":"window.onerror=function(e){return true}";
	sciptsrc += "<\/script><script src="+_$url+"><\/script>');document.close()";
	if (!T.isIE)
	{
		var a = document.createElement('IFRAME');
		if (_$channel) a.setAttribute('ID','TDOM_IframeChannel_'+_$channel);
		a.style.display='none';
		document.body.appendChild(a);
		a.onload = function(){T.OnLoadData2Load(this,_$successEvent ,_$failEvent ,_$errorEvent,_$backParam)};
		a.src = sciptsrc;
	}
	else
	{
		var a = document.createElement('iframe');
		document.body.appendChild(a);

		var h = '<iframe';
		if (_$channel) h += ' id="TDOM_IframeChannel_'+_$channel+'"';
		h +=' style="display:none" onerror="" onload="'+_$onload+'" src="'+sciptsrc+'"><\/iframe>';

		a.outerHTML = h;
		
	}
}
T.lastTime='';

T.PreCreateLoadChannel=function()
{
	var a = document.createElement('iframe');
		document.body.appendChild(a);
T.lastTime=new Date();
		var h = '<iframe id="TDOM_IframeChannel_1" src="blank.htm"><\/iframe>';
		
		a.outerHTML = h;
}



T.OnLoadData2Load=function(iframeObj,_$successEvent,_$failEvent,_$errorEvent,_$backParam)
{
	_$backParam=JSON.parse(_$backParam||"{}");
	

	T.TryHideLoader(true);

	var RESULT;
	if (!T.isIE && iframeObj.src=='about:blank') return;

	window.setTimeout(function(){T.RemoveIFrame(iframeObj)},50);

    try{
        RESULT = iframeObj.contentWindow.RESULT;
		if(!RESULT){if(_$errorEvent)_$errorEvent(_$backParam);return}
    }catch(e){
        if(_$errorEvent)_$errorEvent(_$backParam);return
	}finally{}

    var r=Number(RESULT.sys_param.ret_code);
	if(r==0&&_$successEvent)_$successEvent(RESULT,_$backParam);
	else if(r!=0&&_$failEvent)_$failEvent(RESULT,_$backParam);
	else T.PrepResult(RESULT,true);
}

T.OnPostDataLoad = function(_$frameName, _$successEvent, _$failEvent, _$errorEvent)
{
    if (LoadingWaitor)
    {
        LoadingWaitor.swapNode(lastEvtElm);
        LoadingWaitor = "";
    }
	window.setTimeout(function(){T.RemoveHideFrame(_$frameName)},50);
    var RESULT;
    try{
        RESULT=T.$(_$frameName).contentWindow.RESULT;

        T.UpdateLastTime();
        if (!RESULT){if(_$errorEvent){_$errorEvent()}else{T.ReportError("url:'"+_+"',retcode:null,remark:'找不到RESULT'")}return}

    }catch (e){
        var errmsg = "retcode:"+_$ret_code+",remark:'读取数据失败:T.rows.1217'";
        //T.ReportError(errmsg);
        if(_$errorEvent){_$errorEvent()}else{T.ERROR.MSG()} //"读取数据失败"
        T.AfterFormSubmit(); return
    }finally{}
    
    var _$ret_code = Number(RESULT.sys_param.ret_code);
    if (_$ret_code!=0)
    {
        //var errmsg = "postaction:'"+window[_$frameName].location+"',retcode:"+_$ret_code+",remark:'T.rows.1232出错'";
        //T.ReportError(errmsg);
    }
    if (_$ret_code!=0 && _$failEvent)
    {
        _$failEvent(RESULT);
        return;
    }
	else if(!T.PrepResult(RESULT,true)){ return }
    else if(_$successEvent)_$successEvent(RESULT);
    else alert("操作成功")
}

T.RemoveIFrame = function(obj)
{
	if (!obj) return;
	var st = obj.readyState;
	if (st=='interactive'||st=='loading') T.TryHideLoader(true);
	obj.src='about:blank';

	if (T.isIE)obj.removeNode(true)
	else window.setTimeout(function(){obj.removeNode(true)},200);
}

T.RemoveHideFrame = function(_$frameName)
{
    T.lastHideFrame = "";
	if (!T.isIE)window[_$frameName].location.replace('about:blank');
    try{document.getElementById(_$frameName).removeNode(true);}catch(e){}finally{}
}
//=================================================================
T.UpdateLastTime = function()
{

}
//-----------------------------------------------------------------
T.GetLastTime = function()
{
    var a = T.GetCookie("gLT");
    if (a) return a;
    else return T.UpdateLastTime();
}

//=================================================================
T.SetCookie = function(name, value)
{
var argv = arguments;
var argc = arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : "/";
var domain = (argc > 4) ? argv[4] : "qq.com";
var secure = (argc > 5) ? argv[5] : false;
try
{
document.cookie = name + "=" + escape (value) +
((expires == null) ? "": ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}
catch(e){alert("请启用 Cookie 功能");return "";}finally{}
}
//-----------------------------------------------------------------
T.GetCookie = function(name) 
{
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    while (i < clen) {
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg)
            return _$Private_getCookieVal(j);
        i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0) break; 
    }
    return null;

    function _$Private_getCookieVal(offset)
    {
        var endstr;
        try
        {
            endstr = document.cookie.indexOf (";", offset);
            if (endstr == -1) endstr = document.cookie.length;
            return unescape(document.cookie.substring(offset, endstr));
        }
        catch(e){ alert("请启用 Cookie 功能");return ""; }finally{}
    }
}

//-----------------------------------------------------------------
var RESULT = {};
//-----------------------------------------------------------------

//-----------------------------------------------------------------
T.GetFunctionName = function(_$function)
{
    var _$functionStr = String(_$function);
    
    _$function = _$functionStr.match(/(function\s)(\w+)(?=\s|\()/,'$1');
    
    if (_$function)
    {
        return String(_$function[2]);
    }
    else if (_$functionStr.indexOf("'")<0)
    {
        return _$functionStr;
    }
    else
    {
        alert("找不到函数，不能使用匿名函数");
        return "";
    }
}

T.GetFunction = function(_$function)
{
    var _$functionStr = String(_$function);
	_$functionStr = _$functionStr.replace(/\/\*(.+)*\*\//,' ');
    return _$functionStr.replace(/^function\s*\n*(\w+)\(/,'function(').replace(/\"/g,'&#34;').replace(/\'/g,'&#39;');
}

//-----------------------------------------------------------------
T.LoadData = function(_$url ,_$successEvent ,_$failEvent ,_$resultName)
{
	window.setTimeout(function(){T.TryHideLoader(1)},8000);
    if (!window.G){ G = {};}
    var lt = T.GetLastTime();
	if (!_$resultName)_$resultName='';

	var _$channel=0;
	if (typeof(_$url)!='string'&&_$url.constructor==Array)
	{
		_$channel =  _$url[0];
		//if (_$channel>9999) {alert('通道号过大');return}
		_$url = _$url[1];
		var a = T.$('TDOM_ScriptChannel_'+_$channel);

		//----if (a) {a.src='javascript:void(0)'};
		
	}
	if (_$channel==0) _$channel= T.GetRand(true);


	if (lt) lt = "Glt="+lt;
	else lt = '';

	T.LoadJS([_$channel,_$url],[_$successEvent, _$failEvent],lt,_$resultName);

}

//-----------------------------------------------------------------
T.LoadJS = function(_, _$callback, _$param, _$resultName)//callback在是数组的话表示是LoadData调用的多个回调
{
	T.PrepShowLoader();

    if (!window.G)
    {
        G = {};
    }
	
    var _$imgcacheBase = '/'; 
	var _$channel;
    
    var _$resultName = "";
	
    if (_.constructor==Array && _[1])
    {
        _$channel = _[0];
	    _ = _[1];
    }
    if (_.indexOf('http://')==-1) _ = _$imgcacheBase+_.replace(/^\//,'');

    if (_$param || _$resultName)
    {
	    if (_.indexOf("?")>-1) _ += "&";
	    else _ += "?";
        _ += _$param;
        if (_$resultName) _ += "&Gjsname="+_$resultName;
    }
	_ = _.replace('?&','?');

    var h = document.getElementsByTagName("head")[0];
    var s = document.createElement("script");
    s.language = "javascript";
    s.type = "text/javascript";
	if(_$channel)s.id = 'TDOM_ScriptChannel_'+_$channel;

	if(T._$srcScriptState[_]=='loading'){window.status='正在请求('+String(new Date().getTime()).right(5)+'): '+_;window.setTimeout(function(){window.status=''},3000);return}
    T._$srcScriptState[_] = 'loading';
	

    if (T.isIE)
    {
        s.src = "";
        h.appendChild(s);
        window.setTimeout(function(){s.src = _; TryCallBack()},0);
    }
    else
    {
        s.src = _;
        h.appendChild(s);
        TryCallBack();
    }
    
    function TryCallBack()
    {
        if (T.isIE)
        {
            s.onreadystatechange = function()
            {
                if (s.readyState=="loaded" || s.readyState=="complete") //for IE)
                {
                    _$OnInnerJSLoaded();
                }
            }
        }
        else
        {
            s.onload = function(){ _$OnInnerJSLoaded(); } //for FireFox
        }
        s.onerror = function(){
				T.TryHideLoader(true);

				var errmsg = "url:'"+_+"',retcode:null,remark:'T.LoadJS出错'";
				T.ReportError(errmsg);
				window.setTimeout(function(){
					T._$srcScriptState[_] = 'loaded';
				},2000);
				T.ERROR.MSG(14);				
				s.removeNode(true);
            }
    }

    function _$OnInnerJSLoaded()
    {
		//_ = _.replace(/\&Glt\=.*/,'');
		T.TryHideLoader(true);
		s.removeNode(true);
	
		window.setTimeout(function(){
        T._$srcScriptState[_] = 'loaded';
		},1500);
        if (typeof(_$callback)=='function') { _$callback = _$callback; }
        else if (typeof(_$callback)=='string' && typeof(eval(_$callback))=='function')
             { _$callback = eval(_$callback); }
        else if (typeof(_$callback)=='object')//表示是LoadData
        {
			window.setTimeout(function(){
            T._$srcScriptState[_] = null;
			},1510);
            for (var i=0;i<_$callback.length;i++)
            {
                if (_$callback[i]){
                    if (typeof(_$callback[i])=='string') { _$callback[i] = eval(_$callback[i]) }
                    else if (typeof(_$callback[i])=='function') { }
                    else { alert('参数类型错误') }
                }
                else{ _$callback[i] = "" }
            }
        }
        else { _$callback = function(){} }
        
        var _$callbackResult;
        if (_$resultName)
        {
            _$callbackResult = eval(_$resultName);
        }
        else
        {
            _$callbackResult = RESULT;
        }

        if (typeof(_$callback)=='object')//LoadJS
        {
            var _$successEvent=_$callback[0], _$failEvent=_$callback[1];
            try{
                var _$ret_code = Number(_$callbackResult.sys_param.ret_code);
            }catch(e){
                var errmsg = "url:'"+_+"',retcode:null,remark:'找不到ret_code'";
                T.ReportError(errmsg);
                return;}
            if (_$ret_code>0)
            {              
                if (Number(String(new Date().getTime()).substr(0,10))>Number(T.GetLastTime())+5)
                {
                    T.UpdateLastTime();
                }
            }
            
            
            if (_$ret_code!=0 && _$failEvent)
            {
                _$failEvent(_$callbackResult);
                return;
            }
            if (!T.PrepResult(_$callbackResult,true)){ return }
            else {
                if (_$successEvent){
                    _$successEvent(_$callbackResult)
                }else{alert("缺少回调函数")}
            }
        }
        else
        {
            _$callback(_$callbackResult);
        }
    }
}
//*****************************************************************

var loaderCounter=0 ,showLoaderTimer;
T.PrepShowLoader = function(n)
{
	loaderCounter++;
	if (!n || n<1000) n= 1000;
	window.clearTimeout(showLoaderTimer);
	showLoaderTimer = window.setTimeout(T.ShowLoader ,n);
}

T.ShowLoader = function()
{
    var a = T.$('DOM_waitState');
    if (a)
	{
		a.style.display='';
		a.style.top = document.body.scrollTop+"px";
	}
	else
    {
        var nd = document.createElement("DIV");
        document.body.appendChild(nd);
        //_$style = "position:absolute;top:0px;right:0px;border:1px solid black;padding:3 15;background-color:#FFFFCC;color:black;width:200px;z-index:1000";
		_$style = "position:absolute;top:0px;right:0px;z-index:1000";
        //nd.outerHTML = '<DIV id="DOM_waitState" style="'+_$style+'"><img src=\'http://imgcache.qbar.qq.com/qbar/qbar2/images/waiter.gif\' width=16 height=16 style=\'margin:0 3px -3px 0\'>传输中。。。</DIV>';
		nd.outerHTML = '<DIV id="DOM_waitState" style="'+_$style+'"><img src=\'http://imgcache.qbar.qq.com/qbar/qbar2/images/waiter.gif\' width=16 height=16></DIV>';
    }
	window.attachEvent('onscroll',function(){
		var a = T.$('DOM_waitState');
		if (a && a.style.display=='') a.style.top = document.body.scrollTop+"px";
	});
}
T.TryHideLoader = function(reduce)
{
	if(reduce)loaderCounter--;
	if(loaderCounter>0)return;
	if(loaderCounter<0)loaderCounter=0;
	window.clearTimeout(showLoaderTimer);
	var a = T.$('DOM_waitState');
    if (a) a.style.display='none';
}
//-----------------------------------------------------------------
T._$srcScriptState = {}; //{'1.js':'loading','http://ww.qq.com/a.js':'loaded'}
//-----------------------------------------------------------------
T.SrcScriptState = function(_)
{
    if (T.isIE)
	{
		var scs = document.scripts;
		for (var i=0; i<scs.length; i++)
		{
            if (scs[i].src==_)
			{
			if (scs[i].readyState=='loaded' || scs[i].readyState=='complete') { return 'loaded'; }
			else if (scs[i].readyState=='loading') { return 'loading'; }
			}
		}
	}
    else
    {
        if (T._$srcScriptState[_]) { return T._$srcScriptState[_]; }
    }
    return null; //return undefuned
}
//-----------------------------------------------------------------
T.LoadCSS = function(_,_$timeout)
{
    _$timeout = _$timeout || 50;
    var h = document.getElementsByTagName("head")[0];
    var c = document.createElement("link");
    c.rel = "stylesheet";
    c.type = "text/css";
    c.href = "";
    h.appendChild(c);
	c.href = _;
    //window.setTimeout(function(){ c.href = _;}, _$timeout );
}


//-----------------------------------------------------------------
T.OnSuccessEvent_Default = function()
{
    
}
//-----------------------------------------------------------------
T.OnErrorEvent_Default = function(_$jsData)
{
    if (!_$jsData) {T.ERROR.MSG(0); return;}
    var _$returnCode = Number(_$jsData.sys_param.ret_code);
    if (T.ERROR.msg[_$returnCode]) T.ERROR.MSG(_$returnCode,_$jsData.sys_param.ret_msg);
    else T.ERROR.MSG(0);
}
//-----------------------------------------------------------------
T.PrepResult = function(_$jsData,_$force)
{
    try{
        if (_$force==true && !_$jsData){ alert("找不到数据");return false; }
    	else { _$jsData = _$jsData || eval("RESULT"); }
        var _$ret_code = Number(_$jsData.sys_param.ret_code);

        switch (_$ret_code)
        {
            case 0:
                return true;
            case 4011:
                    T.fireLogin_BackOnCancel = 0;
                    //top.T.CreateLoginFrameWin();
					T.SetCookie("superseed", "", new Date(new Date().getTime()-99999),'/','qbar.qq.com');
					T.SetCookie("qbarkey", "", new Date(new Date().getTime()-99999),'/','qbar.qq.com');
					T.SetCookie("uin", "", new Date(new Date().getTime()-99999),'/','qq.com');
					T.SetCookie("skey", "", new Date(new Date().getTime()-99999),'/','qq.com');
					T.SetCookie("zzpaneluin", "", new Date(new Date().getTime()-99999),'/','qq.com');
					T.SetCookie("zzpanelkey", "", new Date(new Date().getTime()-99999),'/','qq.com');
					top.location.replace("/");
                break;
            default:
                T.ERROR.MSG(_$ret_code,'',_$force);
                break;
        }
        return false;
    }catch (e){
        T.JSERROR.MSG(0,"T.PrepResult");
        return false;
    }finally{}
    return true;
}

/*
T.CreateTopMaskDIV = function(_$cancelBack)
{
T.LoadJS("http://imgcache.qbar.qq.com/b03js/fireLogin.js",function(){T.CreateTopMaskDIV(_$cancelBack)});
}
T.CreateTopFrame = function(_$cancelBack)
{
T.LoadJS("http://imgcache.qbar.qq.com/b03js/fireLogin.js",function(){T.CreateTopFrame(_$cancelBack)});
}*/
//----------------------------------------------------------------
//一般的，由于本窗口domain为qq.com，因此不能访问和设置父窗口，此时可以使用代理窗口
//原理为在本窗口创建一个iframe，然后由其去调用其父窗口的父窗口的函数

//----------------------------------------------------------------
T.WriteJS = function(src)
{
document.write("<script onerror=\"alert('加载JS失败')\" src='"+src+"'><\/script>");
}
T.WriteData = function(src)
{
    var a = T.GetDomainName();
    if (src.indexOf("?")<0) src +="?";
    else src += "&";

    //	if (T.GetLastTime()) src+="Glt="+T.GetLastTime();
    //	src = src.replace(/\?$/,'');

	var a=T.GetQbarBasic();
	if(a.length>0)qbarid=a[0];
	else qbarid=top.STATIC_RESULT.cafe_info.id;
	src+="cafeid="+qbarid+"&Glt="+T.GetLastTime();
    T.WriteJS(src);
}
//************************************************************************
var Event = {};
T.Event = function(evt)
{
    Event={};
    evt=(evt)?evt:((window.event)?window.event:"");
    var elem;
    if(evt)elem=(evt.target)?evt.target:evt.srcElement;
    if(elem)Event.target=elem;
    Event.x=evt.x||evt.clientX;
    Event.y=evt.y||evt.clientY;
	Event.keyCode = evt.keyCode;
	Event.shiftKey = evt.shiftKey;
	Event.shiftLeft = evt.shiftLeft;
	Event.altKey = evt.altKey;
	Event.altLeft = evt.altLeft;
	Event.ctrlKey = evt.ctrlKey;
	Event.ctrlLeft = evt.ctrlLeft;
	return Event;
}

var _$autoWinTimer;
T.AutoWinHeight = function(_$time,objIframe,needed)
{
	if (window.name=='Dname_mainFrame2')return;
	top.document.documentElement.style.height='500px';
	top.document.body.style.height='500px';
	if(objIframe && objIframe.readyState=="complete")
	{
		frameElement.style.height=objIframe.contentWindow.document.body.scrollHeight+'px'
	}

    if (window==window.top) return;
    if (_$autoWinTimer) window.clearTimeout(_$autoWinTimer);
    if (!_$time) window.setTimeout(_$innerAutoHeight,50);
    else if (needed) window.setTimeout(_$innerAutoHeight,_$time+50);
    else _$autoWinTimer = window.setTimeout(_$innerAutoHeight,_$time+50);

    function _$innerAutoHeight()
    {
        var _$winidname = window.name;
		var _$height;
		
		//IE和xmhtl标准模式下的方法，
		//标准独立页面IE也可以用 document.documentElement 代替 document.body
		//但对于嵌在iframe内的body，这个方法不能获得body高度
		if (T.isIE) _$height = document.body.scrollHeight+15;
		else _$height = document.documentElement.offsetHeight+15;

		if (_$height<500) _$height=500;

		try{
			var _$width = document.body.scrollWidth;
			var _$mainFrame = parent.document.getElementById(_$winidname);
			_$mainFrame.style.height = _$height+"px"; 
			top.document.body.style.height='500px';
		}catch (e){}
    }
}
//*********************************************************************


//************************ JQ.JS **********************************/
if(typeof window.jQuery=="undefined"){window.undefined=window.undefined;var jQuery=function(B,C){if(window==this)return new jQuery(B,C);B=B||document;if(jQuery.isFunction(B))return new jQuery(document)[jQuery.fn.ready?"ready":"load"](B);if(typeof B=="string"){var A=/^[^<]*(<(.|\s)+>)[^>]*$/.exec(B);if(A)B=jQuery.clean([A[1]]);else return new jQuery(C).find(B)}return this.setArray(B.constructor==Array&&B||(B.jquery||B.length&&B!=window&&!B.nodeType&&B[0]!=undefined&&B[0].nodeType)&&jQuery.makeArray(B)||[B])};if(typeof $!="undefined")jQuery._$=$;var $=jQuery;jQuery.fn=jQuery.prototype={jquery:"1.1.2",size:function(){return this.length},length:0,get:function(A){return A==undefined?jQuery.makeArray(this):this[A]},pushStack:function(A){var B=jQuery(A);B.prevObject=this;return B},setArray:function(A){this.length=0;[].push.apply(this,A);return this},each:function(B,A){return jQuery.each(this,B,A)},index:function(A){var B=-1;this.each(function(C){if(this==A)B=C});return B},attr:function(A,B,D){var C=A;if(A.constructor==String)if(B==undefined)return this.length&&jQuery[D||"attr"](this[0],A)||undefined;else{C={};C[A]=B}return this.each(function(A){for(var B in C)jQuery.attr(D?this.style:this,B,jQuery.prop(this,C[B],D,A,B))})},css:function(A,B){return this.attr(A,B,"curCSS")},text:function(B){if(typeof B=="string")return this.empty().append(document.createTextNode(B));var A="";jQuery.each(B||this,function(){jQuery.each(this.childNodes,function(){if(this.nodeType!=8)A+=this.nodeType!=1?this.nodeValue:jQuery.fn.text([this])})});return A},wrap:function(){var A=jQuery.clean(arguments);return this.each(function(){var B=A[0].cloneNode(true);this.parentNode.insertBefore(B,this);while(B.firstChild)B=B.firstChild;B.appendChild(this)})},append:function(){return this.domManip(arguments,true,1,function(A){this.appendChild(A)})},prepend:function(){return this.domManip(arguments,true,-1,function(A){this.insertBefore(A,this.firstChild)})},before:function(){return this.domManip(arguments,false,1,function(A){this.parentNode.insertBefore(A,this)})},after:function(){return this.domManip(arguments,false,-1,function(A){this.parentNode.insertBefore(A,this.nextSibling)})},end:function(){return this.prevObject||jQuery([])},find:function(A){return this.pushStack(jQuery.map(this,function(B){return jQuery.find(A,B)}),A)},clone:function(A){return this.pushStack(jQuery.map(this,function(B){var B=B.cloneNode(A!=undefined?A:true);B.$events=null;return B}))},filter:function(A){return this.pushStack(jQuery.isFunction(A)&&jQuery.grep(this,function(C,B){return A.apply(C,[B])})||jQuery.multiFilter(A,this))},not:function(A){return this.pushStack(A.constructor==String&&jQuery.multiFilter(A,this,true)||jQuery.grep(this,function(B){return(A.constructor==Array||A.jquery)?jQuery.inArray(B,A)<0:B!=A}))},add:function(A){return this.pushStack(jQuery.merge(this.get(),A.constructor==String?jQuery(A).get():A.length!=undefined&&(!A.nodeName||A.nodeName=="FORM")?A:[A]))},is:function(A){return A?jQuery.filter(A,this).r.length>0:false},val:function(A){return A==undefined?(this.length?this[0].value:null):this.attr("value",A)},html:function(A){return A==undefined?(this.length?this[0].innerHTML:null):this.empty().append(A)},domManip:function(C,A,E,F){var D=this.length>1,B=jQuery.clean(C);if(E<0)B.reverse();return this.each(function(){var C=this;if(A&&jQuery.nodeName(this,"table")&&jQuery.nodeName(B[0],"tr"))C=this.getElementsByTagName("tbody")[0]||this.appendChild(document.createElement("tbody"));jQuery.each(B,function(){F.apply(C,[D?this.cloneNode(true):this])})})}};jQuery.extend=jQuery.fn.extend=function(){var D=arguments[0],B=1;if(arguments.length==1){D=this;B=0}var C;while(C=arguments[B++])for(var A in C)D[A]=C[A];return D};jQuery.extend({noConflict:function(){if(jQuery._$)$=jQuery._$;return jQuery},isFunction:function(A){return!!A&&typeof A!="string"&&!A.nodeName&&typeof A[0]=="undefined"&&/function/i.test(A+"")},isXMLDoc:function(A){return A.tagName&&A.ownerDocument&&!A.ownerDocument.body},nodeName:function(A,B){return A.nodeName&&A.nodeName.toUpperCase()==B.toUpperCase()},each:function(B,E,C){if(B.length==undefined){for(var A in B)E.apply(B[A],C||[A,B[A]])}else for(var A=0,D=B.length;A<D;A++)if(E.apply(B[A],C||[A,B[A]])===false)break;return B},prop:function(C,B,D,A,F){if(jQuery.isFunction(B))B=B.call(C,[A]);var E=/z-?index|font-?weight|opacity|zoom|line-?height/i;return B&&B.constructor==Number&&D=="curCSS"&&!E.test(F)?B+"px":B},className:{add:function(A,B){jQuery.each(B.split(/\s+/),function(B,C){if(!jQuery.className.has(A.className,C))A.className+=(A.className?" ":"")+C})},remove:function(A,B){A.className=B?jQuery.grep(A.className.split(/\s+/),function(A){return!jQuery.className.has(B,A)}).join(" "):""},has:function(B,A){B=B.className||B;A=A.replace(/([\.\\\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g,"\\$1");return B&&new RegExp("(^|\\s)"+A+"(\\s|$)").test(B)}},swap:function(D,A,C){for(var B in A){D.style["old"+B]=D.style[B];D.style[B]=A[B]}C.apply(D,[]);for(B in A)D.style[B]=D.style["old"+B]},css:function(F,C){if(C=="height"||C=="width"){var B={},D,E,A=["Top","Bottom","Right","Left"];jQuery.each(A,function(){B["padding"+this]=0;B["border"+this+"Width"]=0});jQuery.swap(F,B,function(){if(jQuery.css(F,"display")!="none"){D=F.offsetHeight;E=F.offsetWidth}else{F=jQuery(F.cloneNode(true)).find(":radio").removeAttr("checked").end().css({visibility:"hidden",position:"absolute",display:"block",right:"0",left:"0"}).appendTo(F.parentNode)[0];var A=jQuery.css(F.parentNode,"position");if(A==""||A=="static")F.parentNode.style.position="relative";D=F.clientHeight;E=F.clientWidth;if(A==""||A=="static")F.parentNode.style.position="static";F.parentNode.removeChild(F)}});return C=="height"?D:E}return jQuery.curCSS(F,C)},curCSS:function(A,C,E){var D;if(C=="opacity"&&jQuery.browser.msie)return jQuery.attr(A.style,"opacity");if(C=="float"||C=="cssFloat")C=jQuery.browser.msie?"styleFloat":"cssFloat";if(!E&&A.style[C])D=A.style[C];else if(document.defaultView&&document.defaultView.getComputedStyle){if(C=="cssFloat"||C=="styleFloat")C="float";C=C.replace(/([A-Z])/g,"-$1").toLowerCase();var B=document.defaultView.getComputedStyle(A,null);if(B)D=B.getPropertyValue(C);else if(C=="display")D="none";else jQuery.swap(A,{display:"block"},function(){var A=document.defaultView.getComputedStyle(this,"");D=A&&A.getPropertyValue(C)||""})}else if(A.currentStyle){var F=C.replace(/\-(\w)/g,function(A,B){return B.toUpperCase()});D=A.currentStyle[C]||A.currentStyle[F]}return D},clean:function(B){var A=[];jQuery.each(B,function(C,B){if(!B)return;if(B.constructor==Number)B=B.toString();if(typeof B=="string"){var I=jQuery.trim(B),E=document.createElement("div"),D=[],H=!I.indexOf("<opt")&&[1,"<select>","</select>"]||(!I.indexOf("<thead")||!I.indexOf("<tbody")||!I.indexOf("<tfoot"))&&[1,"<table>","</table>"]||!I.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!I.indexOf("<td")||!I.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||[0,"",""];E.innerHTML=H[1]+I+H[2];while(H[0]--)E=E.firstChild;if(jQuery.browser.msie){if(!I.indexOf("<table")&&I.indexOf("<tbody")<0)D=E.firstChild&&E.firstChild.childNodes;else if(H[1]=="<table>"&&I.indexOf("<tbody")<0)D=E.childNodes;for(var F=D.length-1;F>=0;--F)if(jQuery.nodeName(D[F],"tbody")&&!D[F].childNodes.length)D[F].parentNode.removeChild(D[F])}B=[];for(var C=0,G=E.childNodes.length;C<G;C++)B.push(E.childNodes[C])}if(B.length===0&&!jQuery.nodeName(B,"form"))return;if(B[0]==undefined||jQuery.nodeName(B,"form"))A.push(B);else A=jQuery.merge(A,B)});return A},attr:function(B,D,A){var C=jQuery.isXMLDoc(B)?{}:{"for":"htmlFor","class":"className","float":jQuery.browser.msie?"styleFloat":"cssFloat",cssFloat:jQuery.browser.msie?"styleFloat":"cssFloat",innerHTML:"innerHTML",className:"className",value:"value",disabled:"disabled",checked:"checked",readonly:"readOnly",selected:"selected"};if(D=="opacity"&&jQuery.browser.msie&&A!=undefined){B.zoom=1;return B.filter=B.filter.replace(/alpha\([^\)]*\)/gi,"")+(A==1?"":"alpha(opacity="+A*100+")")}else if(D=="opacity"&&jQuery.browser.msie)return B.filter?parseFloat(B.filter.match(/alpha\(opacity=(.*)\)/)[1])/100:1;if(D=="opacity"&&jQuery.browser.mozilla&&A==1)A=0.9999;if(C[D]){if(A!=undefined)B[C[D]]=A;return B[C[D]]}else if(A==undefined&&jQuery.browser.msie&&jQuery.nodeName(B,"form")&&(D=="action"||D=="method"))return B.getAttributeNode(D).nodeValue;else if(B.tagName){if(A!=undefined)B.setAttribute(D,A);if(jQuery.browser.msie&&/href|src/.test(D)&&!jQuery.isXMLDoc(B))return B.getAttribute(D,2);return B.getAttribute(D)}else{D=D.replace(/-([a-z])/ig,function(A,B){return B.toUpperCase()});if(A!=undefined)B[D]=A;return B[D]}},trim:function(A){return A.replace(/^\s+|\s+$/g,"")},makeArray:function(D){var C=[];if(D.constructor!=Array){for(var A=0,B=D.length;A<B;A++)C.push(D[A])}else C=D.slice(0);return C},inArray:function(D,C){for(var A=0,B=C.length;A<B;A++)if(C[A]==D)return A;return-1},merge:function(D,E){var C=[].slice.call(D,0);for(var A=0,B=E.length;A<B;A++)if(jQuery.inArray(E[A],C)==-1)D.push(E[A]);return D},grep:function(E,F,B){if(typeof F=="string")F=new Function("a","i","return "+F);var D=[];for(var A=0,C=E.length;A<C;A++)if(!B&&F(E[A],A)||B&&!F(E[A],A))D.push(E[A]);return D},map:function(F,I){if(typeof I=="string")I=new Function("a","return "+I);var E=[],C=[];for(var B=0,D=F.length;B<D;B++){var A=I(F[B],B);if(A!==null&&A!=undefined){if(A.constructor!=Array)A=[A];E=E.concat(A)}}C=E.length?[E[0]]:[];A:for(var B=1,G=E.length;B<G;B++){for(var H=0;H<B;H++)if(E[B]==C[H])continue A;C.push(E[B])}return C}});new function(){var A=navigator.userAgent.toLowerCase();jQuery.browser={safari:/webkit/.test(A),opera:/opera/.test(A),msie:/msie/.test(A)&&!/opera/.test(A),mozilla:/mozilla/.test(A)&&!/(compatible|webkit)/.test(A)};jQuery.boxModel=!jQuery.browser.msie||document.compatMode=="CSS1Compat"};jQuery.each({parent:"a.parentNode",parents:"jQuery.parents(a)",next:"jQuery.nth(a,2,'nextSibling')",prev:"jQuery.nth(a,2,'previousSibling')",siblings:"jQuery.sibling(a.parentNode.firstChild,a)",children:"jQuery.sibling(a.firstChild)"},function(A,B){jQuery.fn[A]=function(A){var C=jQuery.map(this,B);if(A&&typeof A=="string")C=jQuery.multiFilter(A,C);return this.pushStack(C)}});jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after"},function(A,B){jQuery.fn[A]=function(){var A=arguments;return this.each(function(){for(var D=0,C=A.length;D<C;D++)jQuery(A[D])[B](this)})}});jQuery.each({removeAttr:function(A){jQuery.attr(this,A,"");this.removeAttribute(A)},addClass:function(A){jQuery.className.add(this,A)},removeClass:function(A){jQuery.className.remove(this,A)},toggleClass:function(A){jQuery.className[jQuery.className.has(this,A)?"remove":"add"](this,A)},remove:function(A){if(!A||jQuery.filter(A,[this]).r.length)this.parentNode.removeChild(this)},empty:function(){while(this.firstChild)this.removeChild(this.firstChild)}},function(A,B){jQuery.fn[A]=function(){return this.each(B,arguments)}});jQuery.each(["eq","lt","gt","contains"],function(A,B){jQuery.fn[B]=function(A,C){return this.filter(":"+B+"("+A+")",C)}});jQuery.each(["height","width"],function(A,B){jQuery.fn[B]=function(A){return A==undefined?(this.length?jQuery.css(this[0],B):null):this.css(B,A.constructor==String?A:A+"px")}});jQuery.extend({expr:{"":"m[2]=='*'||jQuery.nodeName(a,m[2])","#":"a.getAttribute('id')==m[2]",":":{lt:"i<m[3]-0",gt:"i>m[3]-0",nth:"m[3]-0==i",eq:"m[3]-0==i",first:"i==0",last:"i==r.length-1",even:"i%2==0",odd:"i%2","nth-child":"jQuery.nth(a.parentNode.firstChild,m[3],'nextSibling',a)==a","first-child":"jQuery.nth(a.parentNode.firstChild,1,'nextSibling')==a","last-child":"jQuery.nth(a.parentNode.lastChild,1,'previousSibling')==a","only-child":"jQuery.sibling(a.parentNode.firstChild).length==1",parent:"a.firstChild",empty:"!a.firstChild",contains:"jQuery.fn.text.apply([a]).indexOf(m[3])>=0",visible:"a.type!=\"hidden\"&&jQuery.css(a,\"display\")!=\"none\"&&jQuery.css(a,\"visibility\")!=\"hidden\"",hidden:"a.type==\"hidden\"||jQuery.css(a,\"display\")==\"none\"||jQuery.css(a,\"visibility\")==\"hidden\"",enabled:"!a.disabled",disabled:"a.disabled",checked:"a.checked",selected:"a.selected||jQuery.attr(a,'selected')",text:"a.type=='text'",radio:"a.type=='radio'",checkbox:"a.type=='checkbox'",file:"a.type=='file'",password:"a.type=='password'",submit:"a.type=='submit'",image:"a.type=='image'",reset:"a.type=='reset'",button:"a.type==\"button\"||jQuery.nodeName(a,\"button\")",input:"/input|select|textarea|button/i.test(a.nodeName)"},".":"jQuery.className.has(a,m[2])","@":{"=":"z==m[4]","!=":"z!=m[4]","^=":"z&&!z.indexOf(m[4])","$=":"z&&z.substr(z.length - m[4].length,m[4].length)==m[4]","*=":"z&&z.indexOf(m[4])>=0","":"z",_resort:function(A){return["",A[1],A[3],A[2],A[5]]},_prefix:"z=a[m[3]];if(!z||/href|src/.test(m[3]))z=jQuery.attr(a,m[3]);"},"[":"jQuery.find(m[2],a).length"},parse:[/^\[ *(@)([a-z0-9_-]*) *([!*$^=]*) *('?"?)(.*?)\4 *\]/i,/^(\[)\s*(.*?(\[.*?\])?[^[]*?)\s*\]/,/^(:)([a-z0-9_-]*)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/i,/^([:.#]*)([a-z0-9_*-]*)/i],token:[/^(\/?\.\.)/,"a.parentNode",/^(>|\/)/,"jQuery.sibling(a.firstChild)",/^(\+)/,"jQuery.nth(a,2,'nextSibling')",/^(~)/,function(A){var B=jQuery.sibling(A.parentNode.firstChild);return B.slice(jQuery.inArray(A,B)+1)}],multiFilter:function(B,E,F){var A,D=[];while(B&&B!=A){A=B;var C=jQuery.filter(B,E,F);B=C.t.replace(/^\s*,\s*/,"");D=F?E=C.r:jQuery.merge(D,C.r)}return D},find:function(t,context){if(typeof t!="string")return[t];if(context&&!context.nodeType)context=null;context=context||document;if(!t.indexOf("//")){context=context.documentElement;t=t.substr(2,t.length)}else if(!t.indexOf("/")){context=context.documentElement;t=t.substr(1,t.length);if(t.indexOf("/")>=1)t=t.substr(t.indexOf("/"),t.length)}var ret=[context],done=[],last=null;while(t&&last!=t){var r=[];last=t;t=jQuery.trim(t).replace(/^\/\//i,"");var foundToken=false,re=/^[\/>]\s*([a-z0-9*-]+)/i,m=re.exec(t);if(m){jQuery.each(ret,function(){for(var A=this.firstChild;A;A=A.nextSibling)if(A.nodeType==1&&(jQuery.nodeName(A,m[1])||m[1]=="*"))r.push(A)});ret=r;t=t.replace(re,"");if(t.indexOf(" ")==0)continue;foundToken=true}else for(var i=0;i<jQuery.token.length;i+=2){re=jQuery.token[i],m=re.exec(t);if(m){r=ret=jQuery.map(ret,jQuery.isFunction(jQuery.token[i+1])?jQuery.token[i+1]:function(a){return eval(jQuery.token[i+1])});t=jQuery.trim(t.replace(re,""));foundToken=true;break}}if(t&&!foundToken)if(!t.indexOf(",")){if(ret[0]==context)ret.shift();jQuery.merge(done,ret);r=ret=[context];t=" "+t.substr(1,t.length)}else{var re2=/^([a-z0-9_-]+)(#)([a-z0-9\\*_-]*)/i,m=re2.exec(t);if(m)m=[0,m[2],m[3],m[1]];else{re2=/^([#.]?)([a-z0-9\\*_-]*)/i;m=re2.exec(t)}if(m[1]=="#"&&ret[ret.length-1].getElementById){var oid=ret[ret.length-1].getElementById(m[2]);if(jQuery.browser.msie&&oid&&oid.id!=m[2])oid=jQuery("[@id=\""+m[2]+"\"]",ret[ret.length-1])[0];ret=r=oid&&(!m[3]||jQuery.nodeName(oid,m[3]))?[oid]:[]}else{if(m[1]==".")var rec=new RegExp("(^|\\s)"+m[2]+"(\\s|$)");jQuery.each(ret,function(){var A=m[1]!=""||m[0]==""?"*":m[2];if(jQuery.nodeName(this,"object")&&A=="*")A="param";jQuery.merge(r,m[1]!=""&&ret.length!=1?jQuery.getAll(this,[],m[1],m[2],rec):this.getElementsByTagName(A))});if(m[1]=="."&&ret.length==1)r=jQuery.grep(r,function(A){return rec.test(A.className)});if(m[1]=="#"&&ret.length==1){var tmp=r;r=[];jQuery.each(tmp,function(){if(this.getAttribute("id")==m[2]){r=[this];return false}})}ret=r}t=t.replace(re2,"")}if(t){var val=jQuery.filter(t,r);ret=r=val.r;t=jQuery.trim(val.t)}}if(ret&&ret[0]==context)ret.shift();jQuery.merge(done,ret);return done},filter:function(t,r,not){while(t&&/^[a-z[({<*:.#]/i.test(t)){var p=jQuery.parse,m;jQuery.each(p,function(A,B){m=B.exec(t);if(m){t=t.substring(m[0].length);if(jQuery.expr[m[1]]._resort)m=jQuery.expr[m[1]]._resort(m);return false}});if(m[1]==":"&&m[2]=="not")r=jQuery.filter(m[3],r,true).r;else if(m[1]=="."){var re=new RegExp("(^|\\s)"+m[2]+"(\\s|$)");r=jQuery.grep(r,function(A){return re.test(A.className||"")},not)}else{var f=jQuery.expr[m[1]];if(typeof f!="string")f=jQuery.expr[m[1]][m[2]];eval("f = function(a,i){"+(jQuery.expr[m[1]]._prefix||"")+"return "+f+"}");r=jQuery.grep(r,f,not)}}return{r:r,t:t}},getAll:function(A,C,E,F,D){for(var G=A.firstChild;G;G=G.nextSibling)if(G.nodeType==1){var B=true;if(E==".")B=G.className&&D.test(G.className);else if(E=="#")B=G.getAttribute("id")==F;if(B)C.push(G);if(E=="#"&&C.length)break;if(G.firstChild)jQuery.getAll(G,C,E,F,D)}return C},parents:function(A){var B=[],C=A.parentNode;while(C&&C!=document){B.push(C);C=C.parentNode}return B},nth:function(D,C,E,B){C=C||1;var A=0;for(;D;D=D[E]){if(D.nodeType==1)A++;if(A==C||C=="even"&&A%2==0&&A>1&&D==B||C=="odd"&&A%2==1&&D==B)return D}},sibling:function(C,A){var B=[];for(;C;C=C.nextSibling)if(C.nodeType==1&&(!A||C!=A))B.push(C);return B}});jQuery.event={add:function(A,D,C,E){if(jQuery.browser.msie&&A.setInterval!=undefined)A=window;if(E)C.data=E;if(!C.guid)C.guid=this.guid++;if(!A.$events)A.$events={};var B=A.$events[D];if(!B){B=A.$events[D]={};if(A["on"+D])B[0]=A["on"+D]}B[C.guid]=C;A["on"+D]=this.handle;if(!this.global[D])this.global[D]=[];this.global[D].push(A)},guid:1,global:{},remove:function(A,E,D){if(A.$events){var B,F,C;if(E&&E.type){D=E.handler;E=E.type}if(E&&A.$events[E]){if(D)delete A.$events[E][D.guid];else for(B in A.$events[E])delete A.$events[E][B]}else for(F in A.$events)this.remove(A,F);for(C in A.$events[E])if(C){C=true;break}if(!C)A["on"+E]=null}},trigger:function(D,E,A){E=jQuery.makeArray(E||[]);if(!A)jQuery.each(this.global[D]||[],function(){jQuery.event.trigger(D,E,this)});else{var C=A["on"+D],B,F=jQuery.isFunction(A[D]);if(C){E.unshift(this.fix({type:D,target:A}));if((B=C.apply(A,E))!==false)this.triggered=true}if(F&&B!==false)A[D]();this.triggered=false}},handle:function(D){if(typeof jQuery=="undefined"||jQuery.event.triggered)return;D=jQuery.event.fix(D||window.event||{});var E,A=this.$events[D.type],B=[].slice.call(arguments,1);B.unshift(D);for(var C in A){B[0].handler=A[C];B[0].data=A[C].data;if(A[C].apply(this,B)===false){D.preventDefault();D.stopPropagation();E=false}}if(jQuery.browser.msie)D.target=D.preventDefault=D.stopPropagation=D.handler=D.data=null;return E},fix:function(B){if(!B.target&&B.srcElement)B.target=B.srcElement;if(B.pageX==undefined&&B.clientX!=undefined){var D=document.documentElement,C=document.body;B.pageX=B.clientX+(D.scrollLeft||C.scrollLeft);B.pageY=B.clientY+(D.scrollTop||C.scrollTop)}if(jQuery.browser.safari&&B.target.nodeType==3){var A=B;B=jQuery.extend({},A);B.target=A.target.parentNode;B.preventDefault=function(){return A.preventDefault()};B.stopPropagation=function(){return A.stopPropagation()}}if(!B.preventDefault)B.preventDefault=function(){this.returnValue=false};if(!B.stopPropagation)B.stopPropagation=function(){this.cancelBubble=true};return B}};jQuery.fn.extend({bind:function(A,B,C){return this.each(function(){jQuery.event.add(this,A,C||B,B)})},one:function(A,B,C){return this.each(function(){jQuery.event.add(this,A,function(A){jQuery(this).unbind(A);return(C||B).apply(this,arguments)},B)})},unbind:function(A,B){return this.each(function(){jQuery.event.remove(this,A,B)})},trigger:function(A,B){return this.each(function(){jQuery.event.trigger(A,B,this)})},toggle:function(){var A=arguments;return this.click(function(B){this.lastToggle=this.lastToggle==0?1:0;B.preventDefault();return A[this.lastToggle].apply(this,[B])||false})},hover:function(B,C){function A(D){var A=(D.type=="mouseover"?D.fromElement:D.toElement)||D.relatedTarget;while(A&&A!=this){try{A=A.parentNode}catch(D){A=this}}if(A==this)return false;return(D.type=="mouseover"?B:C).apply(this,[D])}return this.mouseover(A).mouseout(A)},ready:function(A){if(jQuery.isReady)A.apply(document,[jQuery]);else jQuery.readyList.push(function(){return A.apply(this,[jQuery])});return this}});jQuery.extend({isReady:false,readyList:[],ready:function(){if(!jQuery.isReady){jQuery.isReady=true;if(jQuery.readyList){jQuery.each(jQuery.readyList,function(){this.apply(document)});jQuery.readyList=null}if(jQuery.browser.mozilla||jQuery.browser.opera)document.removeEventListener("DOMContentLoaded",jQuery.ready,false)}}});new function(){jQuery.each(("blur,focus,load,resize,scroll,unload,click,dblclick,"+"mousedown,mouseup,mousemove,mouseover,mouseout,change,select,"+"submit,keydown,keypress,keyup,error").split(","),function(B,A){jQuery.fn[A]=function(B){return B?this.bind(A,B):this.trigger(A)}});if(jQuery.browser.mozilla||jQuery.browser.opera)document.addEventListener("DOMContentLoaded",jQuery.ready,false);else if(jQuery.browser.msie){document.write("<scr"+"ipt id=__ie_init defer=true "+"src=javascript:void(0)></script>");var A=document.getElementById("__ie_init");if(A)A.onreadystatechange=function(){if(this.readyState!="complete")return;this.parentNode.removeChild(this);jQuery.ready()};A=null}else if(jQuery.browser.safari)jQuery.safariTimer=setInterval(function(){if(document.readyState=="loaded"||document.readyState=="complete"){clearInterval(jQuery.safariTimer);jQuery.safariTimer=null;jQuery.ready()}},10);jQuery.event.add(window,"load",jQuery.ready)};if(jQuery.browser.msie)jQuery(window).one("unload",function(){var D=jQuery.event.global;for(var B in D){var C=D[B],A=C.length;if(A&&B!="unload")do jQuery.event.remove(C[A-1],B);while(--A)}});jQuery.fn.extend({loadIfModified:function(C,B,A){this.load(C,B,A,1)},load:function(F,D,A,E){if(jQuery.isFunction(F))return this.bind("load",F);A=A||function(){};var C="GET";if(D)if(jQuery.isFunction(D)){A=D;D=null}else{D=jQuery.param(D);C="POST"}var B=this;jQuery.ajax({url:F,type:C,data:D,ifModified:E,complete:function(D,C){if(C=="success"||!E&&C=="notmodified")B.attr("innerHTML",D.responseText).evalScripts().each(A,[D.responseText,C,D]);else A.apply(B,[D.responseText,C,D])}});return this},serialize:function(){return jQuery.param(this)},evalScripts:function(){return this.find("script").each(function(){if(this.src)jQuery.getScript(this.src);else jQuery.globalEval(this.text||this.textContent||this.innerHTML||"")}).end()}});if(!window.XMLHttpRequest)XMLHttpRequest=function(){return new ActiveXObject("Microsoft.XMLHTTP")};jQuery.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(B,A){jQuery.fn[A]=function(B){return this.bind(A,B)}});jQuery.extend({get:function(E,D,A,B,C){if(jQuery.isFunction(D)){A=D;D=null}return jQuery.ajax({url:E,data:D,success:A,dataType:B,ifModified:C})},getIfModified:function(D,C,A,B){return jQuery.get(D,C,A,B,1)},getScript:function(B,A){return jQuery.get(B,null,A,"script")},getJSON:function(C,B,A){return jQuery.get(C,B,A,"json")},post:function(D,C,A,B){if(jQuery.isFunction(C)){A=C;C={}}return jQuery.ajax({type:"POST",url:D,data:C,success:A,dataType:B})},ajaxTimeout:function(A){jQuery.ajaxSettings.timeout=A},ajaxSetup:function(A){jQuery.extend(jQuery.ajaxSettings,A)},ajaxSettings:{global:true,type:"GET",timeout:0,contentType:"application/x-www-form-urlencoded",processData:true,async:true,data:null},lastModified:{},ajax:function(E){E=jQuery.extend({},jQuery.ajaxSettings,E);if(E.data){if(E.processData&&typeof E.data!="string")E.data=jQuery.param(E.data);if(E.type.toLowerCase()=="get"){E.url+=((E.url.indexOf("?")>-1)?"&":"?")+E.data;E.data=null}}if(E.global&&!jQuery.active++)jQuery.event.trigger("ajaxStart");var A=false,D=new XMLHttpRequest();D.open(E.type,E.url,E.async);if(E.data)D.setRequestHeader("Content-Type",E.contentType);if(E.ifModified)D.setRequestHeader("If-Modified-Since",jQuery.lastModified[E.url]||"Thu, 01 Jan 1970 00:00:00 GMT");D.setRequestHeader("X-Requested-With","XMLHttpRequest");if(D.overrideMimeType)D.setRequestHeader("Connection","close");if(E.beforeSend)E.beforeSend(D);if(E.global)jQuery.event.trigger("ajaxSend",[D,E]);var B=function(G){if(D&&(D.readyState==4||G=="timeout")){A=true;if(C){clearInterval(C);C=null}var H;try{H=jQuery.httpSuccess(D)&&G!="timeout"?E.ifModified&&jQuery.httpNotModified(D,E.url)?"notmodified":"success":"error";if(H!="error"){var B;try{B=D.getResponseHeader("Last-Modified")}catch(I){}if(E.ifModified&&B)jQuery.lastModified[E.url]=B;var F=jQuery.httpData(D,E.dataType);if(E.success)E.success(F,H);if(E.global)jQuery.event.trigger("ajaxSuccess",[D,E])}else jQuery.handleError(E,D,H)}catch(I){H="error";jQuery.handleError(E,D,H,I)}if(E.global)jQuery.event.trigger("ajaxComplete",[D,E]);if(E.global&&!--jQuery.active)jQuery.event.trigger("ajaxStop");if(E.complete)E.complete(D,H);if(E.async)D=null}},C=setInterval(B,13);if(E.timeout>0)setTimeout(function(){if(D){D.abort();if(!A)B("timeout")}},E.timeout);try{D.send(E.data)}catch(F){jQuery.handleError(E,D,null,F)}if(!E.async)B();return D},handleError:function(C,B,A,D){if(C.error)C.error(B,A,D);if(C.global)jQuery.event.trigger("ajaxError",[B,C,D])},active:0,httpSuccess:function(A){try{return!A.status&&location.protocol=="file:"||(A.status>=200&&A.status<300)||A.status==304||jQuery.browser.safari&&A.status==undefined}catch(B){}return false},httpNotModified:function(C,B){try{var A=C.getResponseHeader("Last-Modified");return C.status==304||A==jQuery.lastModified[B]||jQuery.browser.safari&&C.status==undefined}catch(D){}return false},httpData:function(r,type){var ct=r.getResponseHeader("content-type"),data=!type&&ct&&ct.indexOf("xml")>=0;data=type=="xml"||data?r.responseXML:r.responseText;if(type=="script")jQuery.globalEval(data);if(type=="json")eval("data = "+data);if(type=="html")jQuery("<div>").html(data).evalScripts();return data},param:function(A){var C=[];if(A.constructor==Array||A.jquery)jQuery.each(A,function(){C.push(encodeURIComponent(this.name)+"="+encodeURIComponent(this.value))});else for(var B in A)if(A[B]&&A[B].constructor==Array)jQuery.each(A[B],function(){C.push(encodeURIComponent(B)+"="+encodeURIComponent(this))});else C.push(encodeURIComponent(B)+"="+encodeURIComponent(A[B]));return C.join("&")},globalEval:function(A){if(window.execScript)window.execScript(A);else if(jQuery.browser.safari)window.setTimeout(A,0);else eval.call(window,A)}});jQuery.fn.extend({show:function(A,B){var C=this.filter(":hidden");A?C.animate({height:"show",width:"show",opacity:"show"},A,B):C.each(function(){this.style.display=this.oldblock?this.oldblock:"";if(jQuery.css(this,"display")=="none")this.style.display="block"});return this},hide:function(A,B){var C=this.filter(":visible");A?C.animate({height:"hide",width:"hide",opacity:"hide"},A,B):C.each(function(){this.oldblock=this.oldblock||jQuery.css(this,"display");if(this.oldblock=="none")this.oldblock="block";this.style.display="none"});return this},_toggle:jQuery.fn.toggle,toggle:function(C,A){var B=arguments;return jQuery.isFunction(C)&&jQuery.isFunction(A)?this._toggle(C,A):this.each(function(){jQuery(this)[jQuery(this).is(":hidden")?"show":"hide"].apply(jQuery(this),B)})},slideDown:function(A,B){return this.animate({height:"show"},A,B)},slideUp:function(A,B){return this.animate({height:"hide"},A,B)},slideToggle:function(A,B){return this.each(function(){var C=jQuery(this).is(":hidden")?"show":"hide";jQuery(this).animate({height:C},A,B)})},fadeIn:function(A,B){return this.animate({opacity:"show"},A,B)},fadeOut:function(A,B){return this.animate({opacity:"hide"},A,B)},fadeTo:function(B,A,C){return this.animate({opacity:A},B,C)},animate:function(C,A,D,B){return this.queue(function(){this.curAnim=jQuery.extend({},C);var F=jQuery.speed(A,D,B);for(var E in C){var G=new jQuery.fx(this,F,E);if(C[E].constructor==Number)G.custom(G.cur(),C[E]);else G[C[E]](C)}})},queue:function(A,B){if(!B){B=A;A="fx"}return this.each(function(){if(!this.queue)this.queue={};if(!this.queue[A])this.queue[A]=[];this.queue[A].push(B);if(this.queue[A].length==1)B.apply(this)})}});jQuery.extend({speed:function(A,C,D){var B=A&&A.constructor==Object?A:{complete:D||!D&&C||jQuery.isFunction(A)&&A,duration:A,easing:D&&C||C&&C.constructor!=Function&&C};B.duration=(B.duration&&B.duration.constructor==Number?B.duration:{slow:600,fast:200}[B.duration])||400;B.old=B.complete;B.complete=function(){jQuery.dequeue(this,"fx");if(jQuery.isFunction(B.old))B.old.apply(this)};return B},easing:{},queue:{},dequeue:function(A,B){B=B||"fx";if(A.queue&&A.queue[B]){A.queue[B].shift();var C=A.queue[B][0];if(C)C.apply(A)}},fx:function(C,F,D){var A=this,E=C.style,B=jQuery.css(C,"display");E.overflow="hidden";A.a=function(){if(F.step)F.step.apply(C,[A.now]);if(D=="opacity")jQuery.attr(E,"opacity",A.now);else if(parseInt(A.now))E[D]=parseInt(A.now)+"px";E.display="block"};A.max=function(){return parseFloat(jQuery.css(C,D))};A.cur=function(){var B=parseFloat(jQuery.curCSS(C,D));return B&&B>-10000?B:A.max()};A.custom=function(C,B){A.startTime=(new Date()).getTime();A.now=C;A.a();A.timer=setInterval(function(){A.step(C,B)},13)};A.show=function(){if(!C.orig)C.orig={};C.orig[D]=this.cur();F.show=true;A.custom(0,C.orig[D]);if(D!="opacity")E[D]="1px"};A.hide=function(){if(!C.orig)C.orig={};C.orig[D]=this.cur();F.hide=true;A.custom(C.orig[D],0)};A.toggle=function(){if(!C.orig)C.orig={};C.orig[D]=this.cur();if(B=="none"){F.show=true;if(D!="opacity")E[D]="1px";A.custom(0,C.orig[D])}else{F.hide=true;A.custom(C.orig[D],0)}};A.step=function(H,I){var K=(new Date()).getTime();if(K>F.duration+A.startTime){clearInterval(A.timer);A.timer=null;A.now=I;A.a();if(C.curAnim)C.curAnim[D]=true;var J=true;for(var G in C.curAnim)if(C.curAnim[G]!==true)J=false;if(J){E.overflow="";E.display=B;if(jQuery.css(C,"display")=="none")E.display="block";if(F.hide)E.display="none";if(F.hide||F.show)for(var L in C.curAnim)if(L=="opacity")jQuery.attr(E,L,C.orig[L]);else E[L]=""}if(J&&jQuery.isFunction(F.complete))F.complete.apply(C)}else{var M=K-this.startTime,L=M/F.duration;A.now=F.easing&&jQuery.easing[F.easing]?jQuery.easing[F.easing](L,M,H,(I-H),F.duration):((-Math.cos(L*Math.PI)/2)+0.5)*(I-H)+H;A.a()}}}})}

