bizqqwpa.define("wpa.selectpanel","lang.browser,util.style,util.classname,util.events,util.offset,util.css,util.proxy,lang.extend",function(require){var style=require("style"),classname=require("classname"),events=require("events"),offset=require("offset"),browser=require("browser"),css=require("css"),proxy=require("proxy"),extend=require("extend");var node_type_element=1;var doc=document;var findbyid=function(parent,id){var append=function(host,tail){for(var i=0,len=tail.length;i!==len;host.push(tail[i++])){}return host},children=append([],parent.childnodes),len=children.length,pos=0,curnode,ret=null;while(len>pos){curnode=children[pos++];if(curnode.nodetype!==node_type_element){continue}if(curnode.getattribute("id")===id){ret=curnode;break}append(children,curnode.childnodes);len=children.length}return ret};var settings={container:doc.getelementsbytagname("body")[0],template:['
"].join(""),csstext:[".wpa3-select-panel { z-index:2147483647; width:463px; height:292px; margin:0; padding:0; border:1px solid #d4d4d4; background-color:#fff; border-radius:5px; box-shadow:0 0 15px #d4d4d4;}",'.wpa3-select-panel * { position:static; z-index:auto; top:auto; left:auto; right:auto; bottom:auto; width:auto; height:auto; max-height:auto; max-width:auto; min-height:0; min-width:0; margin:0; padding:0; border:0; clear:none; clip:auto; background:transparent; color:#333; cursor:auto; direction:ltr; filter:; float:none; font:normal normal normal 12px "helvetica neue", arial, sans-serif; line-height:16px; letter-spacing:normal; list-style:none; marks:none; overflow:visible; page:auto; quotes:none; -o-set-link-source:none; size:auto; text-align:left; text-decoration:none; text-indent:0; text-overflow:clip; text-shadow:none; text-transform:none; vertical-align:baseline; visibility:visible; white-space:normal; word-spacing:normal; word-wrap:normal; -webkit-box-shadow:none; -moz-box-shadow:none; -ms-box-shadow:none; -o-box-shadow:none; box-shadow:none; -webkit-border-radius:0; -moz-border-radius:0; -ms-border-radius:0; -o-border-radius:0; border-radius:0; -webkit-opacity:1; -moz-opacity:1; -ms-opacity:1; -o-opacity:1; opacity:1; -webkit-outline:0; -moz-outline:0; -ms-outline:0; -o-outline:0; outline:0; -webkit-text-size-adjust:none; font-family:microsoft yahei,simsun;}',".wpa3-select-panel a { cursor:auto;}",".wpa3-select-panel .wpa3-select-panel-top { height:25px;}",".wpa3-select-panel .wpa3-select-panel-close { float:right; display:block; width:47px; height:25px; background:url(http://combo.b.qq.com/crm/wpa/release/3.3/wpa/views/selectpanel-sprites.png) no-repeat;}",".wpa3-select-panel .wpa3-select-panel-close:hover { background-position:0 -25px;}",".wpa3-select-panel .wpa3-select-panel-main { padding:23px 20px 45px;}",'.wpa3-select-panel .wpa3-select-panel-guide { margin-bottom:42px; font-family:"microsoft yahei"; font-size:16px;}',".wpa3-select-panel .wpa3-select-panel-selects { width:246px; height:111px; margin:0 auto;}",".wpa3-select-panel .wpa3-select-panel-chat { float:right; display:block; width:88px; height:111px; background:url(http://combo.b.qq.com/crm/wpa/release/3.3/wpa/views/selectpanel-sprites.png) no-repeat 0 -80px;}",".wpa3-select-panel .wpa3-select-panel-chat:hover { background-position:-88px -80px;}",".wpa3-select-panel .wpa3-select-panel-aio-chat { float:left;}",".wpa3-select-panel .wpa3-select-panel-qq { display:block; width:76px; height:76px; margin:6px; background:url(http://combo.b.qq.com/crm/wpa/release/3.3/wpa/views/selectpanel-sprites.png) no-repeat -50px 0;}",".wpa3-select-panel .wpa3-select-panel-qq-anony { background-position:-130px 0;}",".wpa3-select-panel .wpa3-select-panel-label { display:block; padding-top:10px; color:#00a2e6; text-align:center;}",".wpa3-select-panel .wpa3-select-panel-bottom { padding:0 20px; text-align:right;}",".wpa3-select-panel .wpa3-select-panel-install { color:#8e8e8e;}"].join(""),modal:true};style.add("_wpa_select_panel_style",settings.csstext);var selectpanel=function(opts){this.opts=extend({},opts,settings);this.render()};selectpanel.prototype={render:function(){var panel=this,opts=this.opts,body=this.container=opts.container;var frag=doc.createelement("div"),frame;frag.innerhtml=opts.template;this.$el=frame=frag.firstchild;events.addevent(findbyid(frame,"wpa3-select-panel-close"),"click",function(){panel.remove();opts.onclose&&opts.onclose()});events.addevent(findbyid(frame,"wpa3-select-panel-aio-chat"),"click",function(){panel.remove();opts.onaiochat&&opts.onaiochat()});events.addevent(findbyid(frame,"wpa3-select-panel-anony-chat"),"click",function(){panel.remove();opts.onanonychat&&opts.onanonychat()});(function(){try{body.appendchild(frame)}catch(e){settimeout(arguments.callee,1);return}if(opts.modal){panel.rendermodal()}panel.setcenter()})()},show:function(){this.css("display","block");this.modal&&css(this.modal,"display","block");return this},hide:function(){this.css("display","none");this.modal&&css(this.modal,"display","none");return this},remove:function(){this.$el.parentnode.removechild(this.$el);this.modal&&this.modal.parentnode.removechild(this.modal);return this},css:function(){var args=[this.$el].concat(array.prototype.slice.call(arguments));return css.apply(this,args)},setcenter:function(){this.css({position:"absolute",top:"50%",left:"50%"});var styles={position:"fixed",marginleft:"-"+this.outerwidth()/2+"px",margintop:"-"+this.outerheight()/2+"px"};var isquirk=doc.compatmode==="backcompat";if(browser.msie&&parseint(browser.version,10)<7||isquirk){styles.position="absolute";styles.margintop=0;var top=styles.top=(offset.getclientheight()-this.outerheight())/2;setinterval(proxy(this.$el,function(){this.style.top=offset.getscrolltop()+top+"px"}),128)}this.css(styles)},rendermodal:function(){var container=this.container,width=css(container,"width"),height=css(container,"height"),overflow=css(container,"overflow");var modallayer=doc.createelement("div"),styles={position:"fixed",top:0,left:0,zindex:2147483647,width:offset.getclientwidth()+"px",height:offset.getclientheight()+"px",backgroundcolor:"white",opacity:.1,filter:"alpha(opacity=10)"};var isquirk=doc.compatmode==="backcompat";if(browser.msie&&parseint(browser.version,10)<7||isquirk){styles.position="absolute";setinterval(proxy(modallayer,function(){this.style.top=offset.getscrolltop()+"px"}),128)}css(modallayer,styles);container.insertbefore(modallayer,this.$el);this.modal=modallayer;events.addevent(window,"resize",proxy(modallayer,function(){css(this,{width:offset.getclientwidth()+"px",height:offset.getclientheight()+"px"})}))},outerwidth:function(){return this.$el.offsetwidth},outerheight:function(){return this.$el.offsetheight}};return selectpanel});bizqqwpa.define("util.css","util.contains",function(require){var contains=require("contains");var getstyle=document.defaultview&&document.defaultview.getcomputedstyle?function(node,style){style=style.replace(/([a-z])/g,"-$1").tolowercase();var s=document.defaultview.getcomputedstyle(node,"");return s&&s.getpropertyvalue(style)}:function(node,style){return node.currentstyle[style]};var indom=function(node,fn){if(!contains(node,document)){return fn()}var invisible={opacity:0,filter:"alpha(opacity=0)"},parent=node.parentnode,nextsibling=node.nextsibling,div=document.createelement("div"),returnvalue;div.appendchild(node);css(div,invisible);css(node,invisible);document.body.appendchild(div);returnvalue=fn();nextsibling?parent.insertbefore(node,nextsibling):parent.appendchild(node);div.parentnode.removechild(div);return returnvalue};var css=function(node,style,value){var csstext;if(!value){if(typeof style==="string"){return indom(node,function(){return getstyle(node,style)})}if(typeof style!=="object"){new typeerror("arg style should be string or object")}csstext=[];for(var stylename in style){csstext.push(stylename+":"+style[stylename])}csstext=csstext.join(";")}else{csstext=style+":"+value}csstext=csstext.replace(/([a-z])/g,"-$1").tolowercase();node.style.csstext+=";"+csstext;return node};return css});bizqqwpa.define("lang.extend","lang.each,lang.typeenhance",function(require){var each=require("each"),typeenhance=require("typeenhance");return function(){var args=array.prototype.slice.call(arguments),deep=false,base=args.shift(),override=typeenhance.type(args[args.length-1])==="boolean"?args.pop():false;if(base===true){deep=true;base=args.shift()}var extend=override?function(base,ext){each(ext,function(i,p){base[i]=p})}:function(base,ext){each(ext,function(i,p){if(typeof base[i]!=="undefined"){return}base[i]=p})};var extendrecursive=override?function(base,ext){each(ext,function(i,p){if(typeenhance.type(p)!=="object"){base[i]=p;return}base[i]=arguments.callee({},p)})}:function(base,ext){each(ext,function(i,p){if(typeof base[i]!=="undefined"){return}if(typeenhance.type(p)!=="object"){base[i]=p;return}base[i]=arguments.callee({},p)})};each(args,function(i,obj){deep?extendrecursive(base,obj):extend(base,obj)});return base}});bizqqwpa.define("util.contains",function(){return document.documentelement.contains?function(node,context){var adown=node.nodetype===9?node.documentelement:node,bup=context&&context.parentnode;return node===bup||!!(bup&&bup.nodetype===1&&adown.contains&&adown.contains(bup))}:document.documentelement.comparedocumentposition?function(node,context){return context&&!!(node.comparedocumentposition(context)&16)}:function(node,context){while(context=context.parentnode){if(context===node){return true}}return false}});