var gIsIE=!!document.all;
if(window.HTMLElement){
	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()
		}
	)
}
if(window.Event){
	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
		}
	)
}
function Extend(d,s){
	for (var p in s) d[p]=s[p]
	return d
}
Extend(String.prototype,{
	toHTML:function(f){
		var t=this.replace(/&/g,"&amp;").replace(/\"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/ /g,"&nbsp;").replace(/\n/g,f==2?'<br>':'').replace(/\s|\t/g,f==2?' ':'');
		return t
	},
	toValue:function(){return this.replace(/\t/g,"　").replace(/\n/g,'')},
	toTextareaValue:function(){return this.replace(/\t/g,"　")},
	URI:function(){return encodeURIComponent(this)},
	length2:function(f){
		var a=this.length,b=this.match(/[^\x00-\x80]/ig);
		if(b!=null)a+=f?b.length:b.length*2
		return a
	},
	trim2:function(){return this.replace(/(^\s+)|\s+$|^　+|　+$/g,"")}
});
function $(){
    if (arguments.length==0) return null
    var es=[],e;
    for (var i=0,len=arguments.length;i<len;i++){
        e=arguments[i];
        if (IsString(e)) e=document.getElementById(e)
        if (arguments.length==1) return e
        es.push(e)
    }
    return es
}
function IsString(s){return typeof s=='string'}
function IsFunction(f){return typeof f=='function'}
function IsNumber(f){return typeof f=='number'}
function AddEvent(node,type,listener){
    if (!(node=$(node))) return false
    if (node.addEventListener){
        node.addEventListener(type,listener,false);
        return true
    }else if(node.attachEvent){
        node['e'+type+listener]=listener;
        node[type+listener]=function(){node['e'+type+listener](window.event)}
        node.attachEvent('on'+type,node[type+listener]);
        return true
    }
    return false
}
function RemoveEvent(node,type,listener){
    if(!(node=$(node))) return false
    if (node.removeEventListener){
        node.removeEventListener(type,listener,false);
        return true
    }else if (node.detachEvent){
        node.detachEvent('on'+type,node[type+listener]);
        node[type+listener]=null;
        return true
    }
    return false
}
function StopPropagation(e){
    e=window.event||e;
    if(e.stopPropagation) e.stopPropagation()
    else e.cancelBubble=true
}
function PreventDefault(e){
    e=window.event||e;
    if(e.preventDefault) e.preventDefault()
    else e.returnValue=false
}
function GetBrowserWindowSize(){
    var d=GetDocumentElement();
    return {
        'width':window.innerWidth||d.clientWidth,
        'height':window.innerHeight||d.clientHeight
    }
}
function CreateElement(t){return document.createElement(t)}
function AddLoadEvent(loadEvent,fimg){
    if(fimg) {return AddEvent(window,'load',loadEvent)}
    var init=function(){
        if (arguments.callee.done) return;
        arguments.callee.done=true;
        loadEvent.apply(document,arguments)
    }
    if (document.addEventListener) {document.addEventListener("DOMContentLoaded",init,false)}
    if (/WebKit/i.test(navigator.userAgent)){
        var _timer=setInterval(function(){
            if (/loaded|complete/.test(document.readyState)){
                clearInterval(_timer);
                init()
            }
        },10)
    }
    /*@cc_on @*/
    /*@if (@_win32)
    document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
    var script=document.getElementById("__ie_onload");
    script.onreadystatechange=function(){
        if (this.readyState=="complete") {init()}
    }
    /*@end @*/
    return true
}
function GetTarget(e){
    e=window.event||e;
    var target=e.srcElement||e.target;
    if(target.nodeType==3) target=node.parentNode
    return target
}
function UnCamelize(s,t){
    t=t||'-';
    return s.replace(/([a-z])([A-Z])/g,function(strMatch,p1,p2){return p1+t+p2.toLowerCase()})
}
function Camelize(s){
    return s.replace(/-(\w)/g,function(strMatch, p1){return p1.toUpperCase()})
}
function SetStyle(element, styles){
    if(!(element=$(element))) return false
    for (var property in styles){
        if(!styles.hasOwnProperty(property)) continue
        if(element.style.setProperty){
            element.style.setProperty(UnCamelize(property),styles[property],null)
        }else{
            element.style[Camelize(property)]=styles[property]
        }
    }
    return true
}
function GetStyle(element,property){
    if(!(element=$(element))||!property) return false
    var value=element.style[Camelize(property)];
    if (!value){
        var dc=GetOwnerDocument(element);
        if (dc.defaultView && dc.defaultView.getComputedStyle){
            var css=dc.defaultView.getComputedStyle(element,null);
            value=css?css.getPropertyValue(property):null
        }else if (element.currentStyle){
            value=element.currentStyle[Camelize(property)]
        }
    }
    return value=='auto'?'':value
}
function GetOffset(a){
	if(GetStyle(a,"display")!="none"){
        return {
            'width':a.offsetWidth,
            'height':a.offsetHeight
        }
	}
	var b=a.style,c=b.visibility,d=b.position;
	b.visibility="hidden";
	b.position="absolute";
	b.display="";
	var f=a.offsetWidth,e=a.offsetHeight;
	b.display="none";
	b.position=d;
	b.visibility=c;
	return {
        "width":f,
        "height":e
    }
}
function SetOpacity(a,b){
	var c=a.style;
    if("filter"in c){c.filter="alpha(opacity="+b*100+")"}
    else if("MozOpacity"in c){c.MozOpacity=b}
	else if("opacity"in c){c.opacity=b}
	else if("KhtmlOpacity"in c){c.KhtmlOpacity=b}
}
Doc=function(a){this.p=a||this.document||document}
Doc.prototype.T=function(){return this.p}
Doc.prototype.U=function(a){
	if(typeof a=="string")return this.p.getElementById(a)
	else{return a}
}
Doc.prototype.createElement=function(a){return this.p.createElement(a)}
Doc.prototype.createTextNode=function(a){return this.p.createTextNode(a)}
Doc.prototype.appendChild=AppendChild;
Doc.prototype.removeNode=RemoveNode;
function AppendChild(a,b){
    b=b||GetOwnerDocument(a).body;
    b.appendChild(a)
}
function RemoveNode(a){if(a.parentNode) a.parentNode.removeChild(a)}
var gDoc;
function DocObj(){
	if(!gDoc) gDoc=new Doc
	return gDoc
}
function GetOwnerDocument(a){return a.nodeType==9?a:a.ownerDocument||a[document]}
function GetDocumentElement(a){
    var b;
    if (a){b=(a.nodeType==9)?a:GetOwnerDocument(a)}
    else {b=DocObj().T()}
	if(gIsIE&&b.compatMode!="CSS1Compat") return b.body
	return b.documentElement
}
function ShowObj(r){SetStyle(this,{"display":r})}
function IsShow(){return GetStyle(this,"display")=="none"?false:true}
function GetMask(){
	var d=$("mask");
	if (d){
		SetStyle(d,{"display":""});
		SetSelectHide(true);
		return true;
	}
	d=DocObj().createElement("DIV");
    d.id="mask";
	var b=GetDocumentElement();
	SetStyle(d,{"width":(b.scrollWidth>b.clientWidth?b.scrollWidth:b.clientWidth)+"px","height":(b.scrollHeight>b.clientHeight?b.scrollHeight:b.clientHeight)+"px","background-color":"#000","position":"absolute","top":"0","left":"0","z-index":5});
	SetOpacity(d,0.1);
    AppendChild(d);
	SetSelectHide(true);
	d.onselectstart=function(){return false}
	return true
}
function SetSelectHide(f,t){
	t=t?t:document;
	f=f?"hidden":"visible";
	var s=t.getElementsByTagName("SELECT");
	for (var i=0,len=s.length;i<len;i++) SetStyle(s[i],{"visibility":f})
}
function SetToCenter(e){
	var b=GetBrowserWindowSize(),
	doc=GetDocumentElement(),
	off=GetOffset(this),
	w=parseInt(GetStyle(this,"width"))||off.width,
	h=parseInt(GetStyle(this,"height"))||off.height,
	t=(b.height-h)/2+doc.scrollTop-80,
	l=(b.width-w)/2+doc.scrollLeft;
	SetStyle(this,{"top":t+"px","left":l+"px","width":w+"px"})
}
function CreateModelDialog(name,url,width,height,title,srcobj){
	if (!name||!url||!IsString(name)||!IsString(url)){alert("参数错误，创建ModelDialog失败");return false}
	var d=$("MD-"+name);
	if (!d){
		d=DocObj().createElement("DIV");
		d.id="MD-"+name;
		d.className="pwin";
		width=(IsNumber(width)?width:null)||400,height=(IsNumber(height)?(height>40?height:null):null)||400;
		SetStyle(d,{"width":width+"px","height":height+"px","position":"absolute","z-index":10,"overflow":"hidden"});
		d.innerHTML='<h4 id="MD-'+name+'-title">'+(title||"Q吧")+'</h4><a id="MD-'+name+'-close" class="cancel" href="javascript:void(0)" title="关闭">×</a><div class="winCon"><iframe id="MD-'+name+'-frame" name="MD-'+name+'-frame" src="'+url+'" width="100%" height="'+(height-40)+'" frameborder="0" scrolling="no"></iframe></div>';
		AppendChild(d);
		Drag.init($("MD-"+name+"-title"),d);
		AddEvent($("MD-"+name+"-close"),"click",function(e){Close(e,d)})
	}else{
		width=width||400,height=(height>40?height:null)||400;
		SetStyle(d,{"display":"","width":width+"px","height":height+"px"});
		$("MD-"+name+"-title").innerHTML=(title||"Q吧");
		$("MD-"+name+"-frame").src="about:blank";	
		window.setTimeout(function(){$("MD-"+name+"-frame").src=url},100)
	}
	SetToCenter.call(d);
	GetMask()
}
function Close(e,o){
	o.style.display="none";
	StopPropagation(e);
	PreventDefault(e);
	o.getElementsByTagName("IFRAME")[0].src="about:blank";
	SetSelectHide(false);
	var mask=$("mask");
	if (IsShow.call(mask)){SetStyle(mask,{"display":"none"})}
}
var gTipsHideTimer=null;
function MyTips(e,a){
	var o=GetTarget(e),m=o.innerText||o.textContent||"";
	if (a&&IsString(a)) m=a
	var d=$(o.getAttribute("_tips")),c=GetPositionOnPage(o);
	if (!d){
		d=DocObj().createElement("DIV");
		d.id=o.id+"_tips";
		SetStyle(d,{"border":"1px solid blue","position":"absolute","top":(c.y+20)+"px","left":c.x+"px","z-index":6});
		d.innerHTML=m;
		o.setAttribute("_tips",d.id);
		AppendChild(d);
		AddEvent(d,"mouseover",function(e){if(gTipsHideTimer) clearTimeout(gTipsHideTimer)});
		AddEvent(d,"mouseout",function(e){
			var o=this;
			if(gTipsHideTimer) clearTimeout(gTipsHideTimer);
			gTipsHideTimer=setTimeout(function(){SetStyle(o,{"display":"none"})},600)
		})
	}
	else {SetStyle(d,{"display":"block"})}
	StopPropagation(e)
}
function Point(a,b){
	this.x=Number(a);
	this.y=Number(b)
}
function GetPositionOnPage(a){
	var b=GetOwnerDocument(a),c=new Point(0,0),d=GetDocumentElement(b),f=null,e;
	if(a==d){return c}
	if(a.getBoundingClientRect){
		e=a.getBoundingClientRect();
		c.x=e.left+d.scrollLeft;
		c.y=e.top+d.scrollTop
	}
	else{
		c.x=a.offsetLeft;
		c.y=a.offsetTop;
		f=a.offsetParent;
		if(f!=a){
			while(f){
				c.x+=f.offsetLeft;
				c.y+=f.offsetTop;
				f=f.offsetParent
			}
		}
	}
	return c
}
var gMessageHideTimer=null;
function MyMessage(m){
	if (!m||!IsString(m)) return;
	var d=$("message");
	if (!d){
		d=DocObj().createElement("DIV");
		d.id="message";
		SetStyle(d,{"width":"300px","text-align":"center","z-index":30,"overflow":"hidden"});
		d.className="alertWrap";
		d.innerHTML='<div class="floatAlert" style="padding:12px">'+m+' <a href="javascript:void(0)" class="links1" onclick="messageHide2();return false">关闭</a></div>';
		AppendChild(d);
		AddEvent(d,"mouseover",function(e){if (gMessageHideTimer) clearTimeout(gMessageHideTimer)});
		AddEvent(d,"mouseout",function(e){gMessageHideTimer=window.setTimeout(messageHide,500)})
	}else{
		d.innerHTML='<div class="floatAlert" style="padding:12px">'+m+'<a href="javascript:void(0)" class="links1" onclick="messageHide2();return false;">关闭</a></div>';
		ShowObj.call(d,"block")
	}	
	if (gMessageHideTimer) clearTimeout(gMessageHideTimer);
	SetToCenter.call(d);
	gMessageHideTimer=window.setTimeout(messageHide,1500);
	function messageHide(){if (IsShow.call(d)) ShowObj.call(d,"none")}
}
function messageHide2(){if (IsShow.call($("message"))) ShowObj.call($("message"),"none")}
function Minimize(d){
	function run(){
		var w=parseInt(GetStyle(d,"width")),h=parseInt(GetStyle(d,"height"));
		if (!IsShow.call(d)||w<8||h<10){
			var s=w,q=GetBrowserWindowSize().width;
			function td(){
				if (s>=800){
					ShowObj.call(d,"none")
				}else{
					s+=100;
					SetStyle(d,{"left":(q-s)/2+"px"});
					SetStyle(d,{"width":s+"px"});
					window.setTimeout(td,10)
				}
			}
			window.setTimeout(td,10)
		}
		else{
			var l=parseInt(GetStyle(d,"left")),t=parseInt(GetStyle(d,"top"));
			SetStyle(d,{"left":(l+10)+"px","top":(t+10)+"px"});
			SetStyle(d,{"width":(w-20)+"px","height":(h-20)+"px"});
			window.setTimeout(run,15)
		}
	}
	window.setTimeout(run,15)
}
function Maximize(o,a,b,fun){
	function run(){
		var w=parseInt(GetStyle(o,"width")),h=parseInt(GetStyle(o,"height")),f=w/h;
		if (!IsShow.call(o)||w>a||h>b){
			SetStyle(o,{"width":a+"px","height":b+"px"});
			if (fun) fun()
		}else{
			var l=parseInt(GetStyle(o,"left")),t=parseInt(GetStyle(o,"top"));
			SetStyle(o,{"left":(l-5*f)+"px","top":(t-5)+"px"});
			SetStyle(o,{"width":(w+10*f)+"px","height":(h+10)+"px"});
			window.setTimeout(run,15)
		}
	}
	window.setTimeout(run,15)
}
function GetPager(a,b,c){
	a=parseInt(a);
	b=parseInt(b);
	c=parseInt(c);
	function getHref(a){
		var rt=location.href.replace(/\?page=\d+/,'?page='+a).replace(/&page=\d+/,'&page='+a);
		if (rt==location.href){
			return location.href+((location.search=='')?'?':'&')+'page='+a
		}
		return rt
	}
	var perpage=c?c:10,pageno=a,items=b,total=Math.ceil(items/perpage),i=1;
	total=total?total:1;
	var str=[(pageno==1)?'<span class="Fgray" style="margin:0 5px">上一页</span>':'<a href="'+getHref(pageno-1)+'" class="pagePre">上一页</a>'];
	if (total<16){
		for (i=1;i<=total;i++){
			str.push('<a href="'+getHref(i)+'"');
			if (i==pageno) str.push(' class="current l2t"')
			str.push('>'+i+'</a>')
		}
	}
	else if (total>15){
		if (pageno<6){
			for (i=1;i<=(pageno+2);i++){
				str.push('<a href="'+getHref(i)+'"');
				if (i==pageno) str.push(' class="current l2t"')
				str.push('>'+i+'</a>')
			}
			str.push('...');
			str.push('<a href="'+getHref(total-1)+'">'+(total-1)+'</a>');
			str.push('<a href="'+getHref(total)+'">'+total+'</a>')
		}else if (pageno>=6&&pageno<=(total-5)){
			str.push('<a href="'+getHref(1)+'">1</a>');
			str.push('<a href="'+getHref(2)+'">2</a>');
			str.push('...');
			for (i=(pageno-2);i<=(pageno+2);i++){
				str.push('<a href="'+getHref(i)+'"');
				if (i==pageno) str.push(' class="current l2t"')
				str.push('>'+i+'</a>')
			}
			str.push('...');
			str.push('<a href="'+getHref(total-1)+'">'+(total-1)+'</a>');
			str.push('<a href="'+getHref(total)+'">'+total+'</a>')
		}else if (pageno>(total-5)){
			str.push('<a href="'+getHref(1)+'">1</a>');
			str.push('<a href="'+getHref(2)+'">2</a>');
			str.push('...');
			for (i=(pageno-2);i<=total;i++){
				str.push('<a href="'+getHref(i)+'"');
				if (i==pageno) str.push(' class="current l2t"')
				str.push('>'+i+'</a>')
			}
		}
	}
	str.push((pageno==total)?'<span class="Fgray" style="margin:0 5px">下一页</span>':'<a href="'+getHref(pageno+1)+'" class="pageNext">下一页</a>');
	return str.join("")
}
var Drag={
obj:null,
init:function(o,oRoot,minX,maxX,minY,maxY,bSwapHorzRef,bSwapVertRef,fXMapper,fYMapper,onstart,ondrag,onend){
	o.onmousedown=Drag.start;
	o.hmode=bSwapHorzRef?false:true;
	o.vmode=bSwapVertRef?false:true;
	o.root=oRoot&&oRoot!=null?oRoot:o;
	if (o.hmode&&isNaN(parseInt(GetStyle(o.root,"left")))) SetStyle(o.root,{"left":"0px"})
	if (o.vmode&&isNaN(parseInt(GetStyle(o.root,"top")))) SetStyle(o.root,{"top":"0px"})
	if (!o.hmode&&isNaN(parseInt(GetStyle(o.root,"right")))) SetStyle(o.root,{"right":"0px"})
	if (!o.vmode&&isNaN(parseInt(GetStyle(o.root,"bottom")))) SetStyle(o.root,{"bottom":"0px"})
	o.minX=typeof minX!='undefined'?minX:null;
	o.minY=typeof minY!='undefined'?minY:null;
	o.maxX=typeof maxX!='undefined'?maxX:null;
	o.maxY=typeof maxY!='undefined'?maxY:null;
	o.xMapper=fXMapper?fXMapper:null;
	o.yMapper=fYMapper?fYMapper:null;
	o.root.onStart=new Function();
	o.root.onDrag=new Function();
	o.root.onEnd=new Function();
	if (onstart) o.root.onStart=onstart
	if (ondrag) o.root.onDrag=ondrag
	if (onend) o.root.onEnd=onend
},
start:function(e){
	var o=Drag.obj=this;
	e=window.event||e;
	var y=parseInt(GetStyle(o.root,(o.vmode?"top":"bottom")));
	var x=parseInt(GetStyle(o.root,(o.hmode?"left":"right")));
	o.root.onStart(x, y);
	o.lastMouseX=e.clientX;
	o.lastMouseY=e.clientY;
	if (o.hmode){
		if (o.minX!=null) o.minMouseX=e.clientX-x+o.minX;
		if (o.maxX!=null) o.maxMouseX=o.minMouseX+o.maxX-o.minX
	}else{
		if (o.minX!=null) o.maxMouseX=-o.minX+e.clientX+x;
		if (o.maxX!=null) o.minMouseX=-o.maxX+e.clientX+x
	}
	if (o.vmode){
		if (o.minY!=null) o.minMouseY=e.clientY-y+o.minY;
		if (o.maxY!=null) o.maxMouseY=o.minMouseY+o.maxY-o.minY
	}else{
		if (o.minY!=null) o.maxMouseY=-o.minY+e.clientY+y;
		if (o.maxY!=null) o.minMouseY=-o.maxY+e.clientY+y
	}
	if (gIsIE){
		document.attachEvent("onmousemove",Drag.drag);
		document.attachEvent("onmouseup",Drag.end)
	}else{
		document.addEventListener("mousemove",Drag.drag,false);
		document.addEventListener("mouseup",Drag.end,false)
	}
	return false
},
drag:function(e){
	e=window.event||e;
	var o=Drag.obj,ey=e.clientY,ex=e.clientX,nx,ny;
	var y=parseInt(GetStyle(o.root,(o.vmode?"top":"bottom")));
	var x=parseInt(GetStyle(o.root,(o.hmode?"left":"right")));
	if (o.minX!=null) ex=o.hmode?Math.max(ex, o.minMouseX):Math.min(ex, o.maxMouseX)
	if (o.maxX!=null) ex=o.hmode?Math.min(ex, o.maxMouseX):Math.max(ex, o.minMouseX)
	if (o.minY!=null) ey=o.vmode?Math.max(ey, o.minMouseY):Math.min(ey, o.maxMouseY)
	if (o.maxY!=null) ey=o.vmode?Math.min(ey, o.maxMouseY):Math.max(ey, o.minMouseY)
	nx=x+((ex-o.lastMouseX)*(o.hmode?1:-1));
	ny=y+((ey-o.lastMouseY)*(o.vmode?1:-1));
	if (o.xMapper) nx=o.xMapper(y)
	else if (o.yMapper) ny=o.yMapper(x)
	o.root.style[o.hmode?"left":"right"]=nx+"px";
	o.root.style[o.vmode?"top":"bottom"]=ny+"px";
	o.lastMouseX=ex;
	o.lastMouseY=ey;
	o.root.onDrag(nx, ny);
	return false
},
end:function(){
	if (gIsIE){
		document.detachEvent("onmousemove",Drag.drag);
		document.detachEvent("onmouseup",Drag.end)
	}else{
		document.removeEventListener("mousemove",Drag.drag,false);
		document.removeEventListener("mouseup",Drag.end,false)
	}
	Drag.obj=null
}};
function GetRand(){
    return String(Math.random()).replace('0.','')
}
function GetFunction(_$function){
    var _$functionStr=String(_$function);
	_$functionStr=_$functionStr.replace(/\/\*(.+)*\*\//,' ');
    return _$functionStr.replace(/^function\s*\n*(\w+)\(/,'function(').replace(/\"/g,'&#34;').replace(/\'/g,'&#39;');
}
var T={};
T.ERROR={};
T.ERROR.MSG=function(code,param,_$force){
    T.LoadJS("http://user.qbar.qq.com/js/error.js",function(){T.ERROR.MSG(code,param,_$force)})
}
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:
                top.GetLoginDialog();
                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.PostData2=function(_$action,_$data,_$successEvent,_$failEvent,_$errorEvent,_$backParam){
	if(typeof _$failEvent=='object'){_$backParam=_$failEvent;_$failEvent=''}
	else if(typeof _$errorEvent=='object'){_$backParam=_$errorEvent;_$errorEvent=''}
	var _$channel=0;
	if (typeof(_$action)!='string'){
		_$channel= _$action[0];
		_$action=_$action[1]
	}
	if (_$channel==0)_$channel=GetRand(true);
    function toHTML2(str){
        return str.replace(/&/g,"&#38;").replace(/\"/g,"&#34;").replace(/\'/g,'&#39;').replace(/</g,"&#60;").replace(/>/g,"&#62;")
    }
    var _$form=CreateElement("FORM");
	_$form.action=_$action;
	_$form.method="post";
	_$form.target='TDOM_IframeChannel_'+_$channel;
    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),_$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('='),_$name=_$params[i].substr(0,_$pos),
            _$val=decodeURIComponent(_$params[i].substr(_$pos+1));
            _$innerHTML+="<input type='hidden' name='"+_$name+"' value='"+toHTML2(_$val)+"'>";
        }
    }
	_$innerHTML+="<input type='hidden' name='Gjstag' value='2'>";
    _$form.innerHTML=_$innerHTML;
    AppendChild(_$form);
    T.CreateHideFrame2(_$successEvent,_$failEvent,_$errorEvent,_$channel,_$backParam);
    _$form.submit();
    try{/*
        if (event&&event.srcElement)
            lastEvtElm=event.srcElement;          
            LoadingWaitor=document.createElement("IMG");
            LoadingWaitor.src="http://imgcache.qbar.qq.com/qbar/qbar/images/Spinner.gif";
            LoadingWaitor.swapNode(lastEvtElm)
        }*/
    }catch(e){}
}
T.CreateHideFrame2=function(_$successEvent,_$failEvent,_$errorEvent,_$channel,_$backParam){
    if (_$channel.length<=5){
        var a=$('TDOM_IframeChannel_'+_$channel);
        if (a) RemoveNode(a)
    }
	if (!gIsIE){
		var a=CreateElement('IFRAME');
		a.setAttribute('NAME','TDOM_IframeChannel_'+_$channel);	
		a.style.display='none';
		AppendChild(a);
		a.onload=function(){T.OnPostData2Load(this,_$successEvent,_$failEvent,_$errorEvent,_$backParam)}
	}else{
		for (var i=0;i<arguments.length-1;i++){
			if (typeof(arguments[i])=='function'){arguments[i]=GetFunction(arguments[i])}
			else if(arguments[i]==''||arguments[i]==undefined||arguments[i]==null||typeof(arguments[i])=='string'){}
		}
		var _$es=[];
		_$es.push(_$successEvent||"''");
		_$es.push(_$failEvent||"''");
		_$es.push(_$errorEvent||"''");
		_$es.push(_$backParam|| "''");
		var _$onload="T.OnPostData2Load(this,"+_$es.join()+")",h='<iframe name="TDOM_IframeChannel_'+_$channel+'"';
		if (_$channel) h+=' id="TDOM_IframeChannel_'+_$channel+'"'
		h+=' style="display:none" onload="'+_$onload+'"><\/iframe>';
		var a=CreateElement("iframe");
		AppendChild(a);
		a.outerHTML=h
	}
}
T.OnPostData2Load=function(iframeObj,_$successEvent,_$failEvent,_$errorEvent,_$backParam){
	//window.setTimeout(function(){T.RemoveIFrame(iframeObj)},50);
	var RESULT;
	if (!gIsIE&&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 T.PrepResult(RESULT,true)
}
T.RemoveIFrame=function(obj){
	if (!obj) return;
	var st=obj.readyState;
	if (st=='interactive'||st=='loading') T.TryHideLoader(true)
	obj.src='about:blank';
	RemoveNode(obj)
}
T.TryHideLoader=function(reduce){
	if(reduce)loaderCounter--
	if(loaderCounter>0)return
	if(loaderCounter<0)loaderCounter=0
	window.clearTimeout(showLoaderTimer);
	var a=$('DOM_waitState');
    if (a) a.style.display='none'
}
T.ShowLoader=function(){
    var a=$('DOM_waitState');
    if (a){
		a.style.display='';
		a.style.top=document.body.scrollTop+"px"
	}else{
        var nd =CreateElement("DIV");
        AppendChild(nd);
		_$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></DIV>'
    }
}
var loaderCounter=0,showLoaderTimer,RESULT={};
T.lastTime=0,T.debugMode=true;
T.PrepShowLoader=function(n){
	loaderCounter++;
	if (!n||n<1000) n=1000
	window.clearTimeout(showLoaderTimer);
	showLoaderTimer=window.setTimeout(T.ShowLoader,n)
}
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=''}
	T.PrepShowLoader();
	var _$channel=0;
	if (typeof(_$url)!='string'){
		_$channel=_$url[0];
		_$url=_$url[1];
		var a=$('TDOM_IframeChannel_'+_$channel);
		if (a) {T.RemoveIFrame(a);T.TryHideLoader(true)}
	}
	if (_$channel==0) _$channel=GetRand()
	if (gIsIE){
		for (var i=1;i<arguments.length;i++){
			if (typeof(arguments[i])=='function'){arguments[i]=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()+")"
	}
	T.lastTime=new Date();
	var sciptsrc="javascript:document.write('<script>try{var a=parent.document.body}catch(e){document.domain=";
	sciptsrc+=gIsIE?"\\&#39;qq.com\\&#39;":'"qq.com"'; //此处引号的方式不能轻易变更
	sciptsrc+="}finally{};";
	sciptsrc+=T.debugMode?"":"window.onerror=function(e){return true}";
	sciptsrc+="<\/script><script src="+_$url+"><\/script>');document.close()";
	if (!gIsIE){
		var a=CreateElement('IFRAME');
		if (_$channel) a.setAttribute('ID','TDOM_IframeChannel_'+_$channel)
		a.style.display='none';
		AppendChild(a);
		a.onload=function(){T.OnLoadData2Load(this,_$successEvent ,_$failEvent ,_$errorEvent,_$backParam)};
		a.src=sciptsrc
	}else{
		var a=CreateElement('iframe'),h='<iframe';;
		AppendChild(a);
		if (_$channel) h+=' id="TDOM_IframeChannel_'+_$channel+'"'
		h+=' style="display:none" onerror="" onload="'+_$onload+'" src="'+sciptsrc+'"><\/iframe>';
		a.outerHTML=h
	}
}
T.OnLoadData2Load=function(iframeObj,_$successEvent,_$failEvent,_$errorEvent,_$backParam){
	T.TryHideLoader(true);
	var RESULT;
	if (!gIsIE && 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._$srcScriptState={};
T.LoadJS = function(_,_$callback,_$param,_$resultName){
	T.PrepShowLoader();
    var _$channel,_$resultName="";
    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],s=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 (gIsIE){
        s.src="";
        h.appendChild(s);
        window.setTimeout(function(){s.src=_; TryCallBack()},0)
    }else{
        s.src=_;
        h.appendChild(s);
        TryCallBack()
    }
    function TryCallBack(){
        if (gIsIE){
            s.onreadystatechange=function(){
                if (s.readyState=="loaded"||s.readyState=="complete") _$OnInnerJSLoaded();
            }
        }else{s.onload=function(){_$OnInnerJSLoaded()}}
        s.onerror=function(){
			T.TryHideLoader(true);
			var errmsg="url:'"+_+"',retcode:null,remark:'T.LoadJS出错'";
			window.setTimeout(function(){T._$srcScriptState[_]='loaded'},2000);
			T.ERROR.MSG(14);				
			RemoveNode(s)
		}
    }
    function _$OnInnerJSLoaded(){
		T.TryHideLoader(true);
		RemoveNode(s);
		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=(_$resultName)?eval(_$resultName):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'";
                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)}
    }
}
function SetCookie(name, value){
	var argv=arguments,argc=arguments.length,
	expires=(argc>2)?argv[2]:null,
	path=(argc>3)?argv[3]:"/",
	domain=(argc>4)?argv[4]:"qbar.qq.com",
	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{}
}
function GetCookie(name){
    var arg=name+"=",alen=arg.length,clen=document.cookie.length,i=0,j;
    while (i<clen){
        j=i+alen;
        if (document.cookie.substring(i,j)==arg) return cv(j)
        i=document.cookie.indexOf(" ", i)+1;
        if (i==0) break
    }
    return null
    function cv(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{}
    }
}
function GetUin(){
	var uin=GetCookie('luin');
	if(uin)uin=ru(uin)
	else{
		uin=GetCookie('zzpaneluin');
		if(uin)uin=ru(uin)
		else{
			uin=GetCookie('uin');
			uin=ru(uin)||0
		}
	}
	if(!uin>10000)uin=0
	return uin
	function ru(uin){
		uin=String(uin);
		if(uin.length>15)uin=uin.substr(0,10)
		return uin.replace(/^(\D|0)+/ig,'').replace(/(\D.*)/gi,'')
	}
}
function Search(){
	var kw=$("keyword");
	if (kw.value!=""&&kw.value!=kw.defaultValue){
		var schopt=document.getElementsByName("topSearch"),str="",r;
		if (schopt[0].checked){
			r=kw.value.match(/[^\d]/g);
			if (r||parseInt(kw.value)<10001||kw.value.length>11){
				MyMessage("请正确输入QQ号！");
				kw.select();
				return false
			}
			location.href="http://user.qbar.qq.com/"+kw.value.URI()+"/"
		}else{
			str="http://web.qbar.qq.com/search/?cont="+kw.value.URI();
			if (gIsIE){
				var a=CreateElement("A");
				a.href=str;
				a.target='_blank';
				AppendChild(a);
				a.click();
				RemoveNode(a)
			}else{
				window.open(str)
			}
		}
	}
	else{
		MyMessage("请输入要搜索的内容！")
		kw.select()
	}
}
function SOnmouseover(o){
	if (o.value=='请输入QQ号'||o.value=='请输入搜索关键字') o.value=''
	o.focus()
}
function SOnmouseout(o){
	if (o.value==''){
		o.value=(document.getElementsByName("topSearch")[0].checked)?"请输入QQ号":"请输入搜索关键字";
		o.blur()
	}
}
function CSearchType(f){
	var o=$("keyword");
	if (o.value==""||o.value=="请输入QQ号"||o.value=="请输入搜索关键字"){
		o.value=f?"请输入搜索关键字":"请输入QQ号"
	}
}
var gSystime=0;
function GetTime(time,fullFlag){
	var rt,flg=false;
	if (!fullFlag){
		flg=true;
		var diff=gSystime-time;
		if (diff<1) diff=1
		if (diff<60) return [flg,diff+'秒前']
		if (diff<630) return [flg,parseInt(diff/60)+'分钟前'] //小于 11分钟的显示
		//else if (diff<780) return [flg,'10分钟前'] // 11 - 13
		else if (diff<1080) return [flg,'15分钟前']  // 13 - 18
		//else if (diff<1560) return [flg,'20分钟前']  // 18 - 26
		else if (diff<3000) return [flg,'半小时前']  // 40 - 50
		else if (diff<5400) return [flg,'1小时前']  // 50 - 90
		else if (diff<86400) return [flg,parseInt(diff/3600)+'小时前']
	}
	var time0=gSystime-gSystime%86400-28800,time1=time0-86400,time2=time1-86400;
    var date=new Date(time*1000),y=date.getFullYear(),m=date.getMonth()+1,d=date.getDate(),h=date.getHours(),mi=date.getMinutes();
	m=(m<10?'0':'')+m;
	d=(d<10?'0':'')+d;
	h=(h<10?'0':'')+h;
	mi=(mi<10?'0':'')+mi;
	rt=''+h+':'+mi;
	if (time>time0) {rt='今天 '+rt;flg=true}
	//else if(time>time1) {rt='昨天 '+rt;flg=true}
	//else if(time>time2) {rt='前天 '+rt;flg=true}
	else {rt=y+"."+m+"."+d+' '+h+':'+mi;flg=false}
	if (fullFlag){rt= y+"-"+m+"-"+d;flg=false}
	return [flg,rt]
}
function GetLoginDialog(href){
	var name="login",d=$("MD-"+name);
	if (!d){
		d=DocObj().createElement("DIV");
		d.id="MD-"+name;
		SetStyle(d,{"width":470+"px","position":"absolute","z-index":15,"overflow":"hidden"});
		d.innerHTML='<iframe id="MD-'+name+'-frame" name="MD-'+name+'-frame" width="470" height="364" frameborder="0" scrolling="no"></iframe>';
		AppendChild(d);
		$("MD-"+name+"-frame").src="http://user.qbar.qq.com/login/"+(href!=undefined?"?ref="+href:"")
	}
	else{SetStyle(d,{"display":""})}
	SetToCenter.call(d);
	SetStyle(d,{"top":parseInt(GetStyle(d,"top"))+80+"px"});
	GetMask()
}
function Loginout(){
	T.LoadData2('http://mng.qbar.qq.com/cgi-bin/cafecgi_mng_logout.cgi?'+GetRand(),function(){
		var t=window.location;
		window.setTimeout(function(){window.location.replace(t)},1000)
	})
}
var pingPGVTimer='';
function PingPGV(t){
	window.clearTimeout(pingPGVTimer);
	if (!t) t=1000;
	if(typeof(pgvMain)=='function') pingPGVTimer=window.setTimeout(p,t)
	else{
		window.clearTimeout(pingPGVTimer);
		pingPGVTimer=window.setTimeout(function(){T.LoadJS('http://pingjs.qq.com/ping.js',p)},t)
	}
	function p(){
		window.clearTimeout(pingPGVTimer);
		pvRepeatCount = 1;
		try{
			pvCurDomain="user.qbar.qq.com";
			pvCurUrl="/";
			if(typeof(pgvMain)=='function')pingPGVTimer=window.setTimeout(pgvMain,400)
		}catch(e){}
	}
}
PingPGV();