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()
		}
	);
	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,attrs=this.attributes,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+">"
	});
}
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 temp=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 temp;
	},
	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,'')},
	toTextareaValue:function(){return this.replace(/&/g,"&#38;").replace(/\"/g,"&#34;").replace(/\'/g,'&#39;').replace(/</g,"&#60;").replace(/>/g,"&#62;").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
	},
	trim:function(){return this.replace(/(^\s+)|\s+$/g,"")},
	trim2:function(){return this.replace(/(^\s+)|\s+$|^　+|　+$/g,"")},
	toTitle:function(){
		return this.replace(/&/g,'&#38;').replace(/\"/g,'&#34;').replace(/\'/g,'&#39;').replace(/</g,"&#60;").replace(/>/g,"&#62;").replace(/\n/ig,'&#10;')
	},
	widthTrim:function(n,m){
		if (n>=this.length+2) return this;
		return this.substr(0,n)+'...';
		var len = 0,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
	},
	left2:function(n,m){
		var len=0,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
	}
});
Extend(Array.prototype,{
	remove:function(obj){
		if (isNaN(obj) || obj<0 || obj>this.length-1) return null;
		var j=obj, r=this[j];
		if (obj>this.length/2){				
			for (;j<this.length-1;j++) this[j]=this[j+1];
			this.pop();
		}else{
			for (;j>0;j--) this[j]=this[j-1];
			this.shift();
		}
		return r
	},
	insert:function(obj,pos){
		var temp=[],len=this.length;
		if (pos>=len) this.push(obj);
		else if (pos<0) this.unshift(obj);
		else{	
			for (var i=0; i<len; i++){
				if (i!=pos){
					temp.unshift(this.shift());
					continue;
				}
				this.unshift(obj);
				while (temp.length) this.unshift(temp.shift());
				break;
			}
		}
		return this
	},
	swap:function(a,b){
		var t=this[a];
		this[a]=this[b];
		this[b]=t;
		return this
	}
});
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(a){
    var d=GetDocumentElement(a);
    return {
        'width':d.clientWidth||window.innerWidth,
        'height':d.clientHeight||window.innerHeight
    }
}
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(flg){
	var b=GetBrowserWindowSize(this),
	doc=GetDocumentElement(this),
	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;
	if (flg) t=doc.scrollTop+30;
	SetStyle(this,{"position":"absolute","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=top.$("message");
	if (!d){
		d=top.document.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:8px">'+m+' <a href="javascript:void(0)" class="links1" onclick="top.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:8px">'+m+'<a href="javascript:void(0)" class="links1" onclick="top.messageHide2();return false;">关闭</a></div>';
		ShowObj.call(d,"block")
	}
	if (gMessageHideTimer) clearTimeout(gMessageHideTimer);
	SetToCenter.call(d,true);
	gMessageHideTimer=window.setTimeout(messageHide,2000);
	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="cur"')
			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="cur"')
				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="cur"')
				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="cur"')
				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(){
    var r=String(Math.random()).replace('0.','');
    return r
}
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){
	var st=top.STATIC_RESULT.cafe_info.svc_type;
	if (st>20&&st<31){
		T.LoadJS("http://imgcache.qbar.qq.com/b04js/campus/campuserror.js",function(){T.ERROR.MSG(code,param,_$force)})
	}else{
		T.LoadJS("http://imgcache.qbar.qq.com/b04js/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
}
function Render(dom,_$data,_$renderType){
    if (IsString(dom)){
		dom=$(dom);
    }
    if (!dom){
        return;
    }
    //if (_$renderType==undefined || _$renderType==0)
    if (_$renderType==0){
		//var a = T.TP.processDOMTemplate(dom, _$data);
        dom.outerHTML=T.TP.processDOMTemplate(dom,_$data);
        return;
    }
    var _$C_prefix="__TPL_RENDERFROM_prefix_";//作为IE常量
    var _$tplDOMID=dom.getAttribute("id");
    if (!_$tplDOMID){
		_$tplDOMID = "__RAND_ElEM_ID_" + GetRand(true);
		dom.setAttribute("id", _$tplDOMID);
    }
    if (_$renderType!=2){ //只要不是累加渲染，都要试图移除后面的那个被渲染生成的对象
        try{
            if (dom.nextSibling&&dom.nextSibling.getAttribute("ID")==_$C_prefix+_$tplDOMID){
                if (gIsIE){ // for IE                
                    dom.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 (dom.insertAdjacentHTML){ // for IE
		dom.insertAdjacentHTML("afterEnd", "<span id='"+_$C_prefix+_$tplDOMID+"'>"+_$rendedHTML+"</span>");
	} else {
	 // for firefox
		_$rendedHTML = new String(_$rendedHTML).trim();
		var _$fragment = dom.ownerDocument.createElement('span');
        _$fragment.setAttribute("id", _$C_prefix+_$tplDOMID);
		_$fragment.innerHTML = _$rendedHTML;
		dom.parentNode.insertBefore(_$fragment, dom.nextSibling);        
	}
}
/**================  结束  ==================**/

/**==============   T.TP template.js 开始  ================**/
T.TP={};
(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.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 qbarid;
    try{
        if (!window.G) { G={qbarid:parent.G.qbarid} }
        else if (!G.qbarid) { G.qbarid=parent.G.qbarid }
    }catch(e){}

	var path=BASE.replace('http://','').replace(/\/$/,'');
    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)+"'>";
        }
    }
	var a = GetQbarBasic();
    if (a.length>0)	a=a[0];
	else a=GetQBarPath();
	if(a.indexOf('qbar.qq.com')>-1)a=a.replace(/qbar\.qq\.com|\.|\//g,'')
	_$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){
            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=T.$('TDOM_IframeChannel_'+_$channel);
        if (a) {a.removeNode(true)};
    }
	
	var path=BASE.replace('http://','').replace(/\/$/,'');
	if (!gIsIE){
		var a = document.createElement('IFRAME');
		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)};
	}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()+")";
		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;
	}
}
var LoadingWaitor;
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 (!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 if(!T.PrepResult(RESULT,true)){ return }
    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';
	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()+")"
	}
	if(!/(\?|&)cafeid\=/.test(_$url)){
		if(_$url.indexOf("?")>-1)_$url+="&cafeid=";
		else _$url+="?cafeid=";
		var a=GetQbarBasic();
		if(a.length>0) _$url+=a[0];
		else _$url+=top.RESULT1.cafe_info.id;
		_$url+="&";
	}
	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+=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(_$call
)}
		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)}
    }
}
T.UpdateLastTime=function(){
	var a=String(new Date().getTime()).substr(0,10);
	SetCookie('gLT', a, new Date(new Date().getTime()+1000*60*30), '/','qq.com');
	return a
}
T.GetLastTime=function(){
    var a = GetCookie("gLT");
    if (a) return a;
    else return T.UpdateLastTime();
}
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=window.BASE+"login/mnglogin.html"+(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)
		}
	)
}

//************************************************************************************************
function GetQBarPath(_$spath){
	_$spath = _$spath || window.location.href.replace(/\?.*/g,'');
	if(window.BASE)return window.BASE.replace('http://','');
	var a=_$spath.replace('http://','').split('/')
	if(a.length==1)_$spath=a[0]
	else if(a.length>1){
		_$spath=a[0]
		if(a[0].indexOf('qbar.qq.com')<1)_$spath+='/'+a[1]
	}	
	return _$spath+'/';
}
function GetQbarBasic(_$domain){
	return [GetQBarPath().replace(/http:\/\/|\/$/g,''),'s9']
    if (!_$domain){
        _$domain=GetQBarPath().replace(/\/$/,'');
        var m1=_$domain.match(/^http\:\/\/(\w*)\.qbar\.qq\.com/i);
        if (m1)	{_$domain = m1[1] }
        else{
            var m2=_$domain.match(/^http\:\/\/qbar\.qq\.com\/(\w*)/i);
            if (m2) {_$domain = m2[1]}
        }
    }
	return[_$domain,'s9'];
}
var gAutoHeightTimer;
function AutoHeight(_$time,needed){
	if(window==top)return;
	frameElement.style.height=document.documentElement.scrollHeight+'px';
	if(gAutoHeightTimer)window.clearTimeout(gAutoHeightTimer);
	if(_$time>0)window.setTimeout(innerAH,_$time);
	else if(needed)window.setTimeout(innerAH,_$time+50);
	else gAutoHeightTimer=window.setTimeout(innerAH,_$time+50);
	function innerAH(){
		var _$winidname=window.name;
		var _$height;

		if(gIsIE)_$height=docuht=document.body.scrollHeight+15;
		else _$height=document.documentElement.offsetHeight+15;
		if(_$height<600)_$height=600;
		try{
			var _$width=document.body.scrollWidth;
			var _$mainFrame=parent.document.getElementById(_$winidname);
			_$mainFrame.style.height=_$height+"px";
		}catch(e){}
	}
}
function IFP(rs,ui){
	var tmp=ui.split(",");
	for (var i=0; i<tmp.length; i++){if (GetPer(rs,parseInt(tmp[i]))) return true}
	return false
}
function GetPer(rs,ui){
    if((ui>rs.length*4)||(ui<1)) return false
    var uiIdx=parseInt((ui-1)/4);
    var uiOffset=(ui-1)-uiIdx*4;
    var chArbiter=0x8>>uiOffset;
	var chPermission=Number("0x"+rs.charAt(uiIdx));
	if (isNaN(chPermission)) return false
	if ((chArbiter&chPermission)==0) return false
    return true
}

var BASE=null;
if(window!=parent&&parent.window.BASE) BASE=parent.BASE;
else if(window==top&&window.RESULT1&&window.RESULT1.BASE) BASE=RESULT1.BASE;
else if(!window.BASE) BASE='http://'+GetQBarPath().toLowerCase();

//************************************************************************************************

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();