var MJsonp=function(){};MJsonp.prototype={instanceName:null,timeout:0,resultInfo:null,resultTime:new Date().getTime(),init:function(A,B){if(useString(A)==false){return -1}if(isNull(B)&&isNumeric(""+B)==true){this.timeout=B}else{this.timeout=0}this.instanceName=trim(A);return 0},destroy:function(){this.instanceName=null;this.timeout=0;this.resultInfo=null;this.resultTime=null},getJson:function(B,D,C){if(useString(this.instanceName)==false||useString(B)==false){return -1}if(useString(D)==true){D=trim(D)}else{D=null}if(useString(C)==false){C=""}else{if(startsWith(C,"&")){C=C.substring(1)}}if(useString(C)==false){C="ins="+this.instanceName+".resultJson"}else{C+="&ins="+this.instanceName+".resultJson"}if(D!=null){if(useString(C)==false){C="method="+D}else{C+="&method="+D}}if(this.timeout>0){if(useString(C)==false){C="timeout="+this.timeout}else{C+="&timeout="+this.timeout}}if(this.resultInfo!=null){for(var A in this.resultInfo){C+="&"+A+"="+this.resultInfo[A]}}return jsonp(B,C)},resultJson:function(A){if(isNull(A)==false){this.resultInfo=A}else{this.resultInfo=null}this.resultTime=new Date().getTime()}};var MJComet=function(){};MJComet.prototype={instanceName:null,groupId:null,url:null,params:null,addParams:null,mjsonp:null,mjconn:null,init:function(A,B,E,C,D){if(useString(A)==false||useString(B)==false){return -1}if(useString(E)==false){E=null}if(useString(C)==false){C=null}if(isNull(C)){C="jsonp~"+MD5_hexhash(B)+"~"+B.length}this.instanceName=trim(A);this.groupId=C;this.url=B;if(isNull(E)){E="groupId="+C}else{E+="&groupId="+C}this.params=E;this.mjconn=new MjConnector();this.mjsonp=new MJsonp();this.mjconn.startup();return this.mjsonp.init(A+".mjsonp",D)},destroy:function(){if(isNull(this.mjsonp)==false){this.mjsonp.destroy()}if(isNull(this.mjcon)==false){this.mjcon.destroy()}this.mjsonp=null;this.mjcon=null;this.instanceName=null;this.url=null;this.params=null},send:function(A,C,B){if(useString(A)==false||useString(C)==false){return -1}if(useString(B)==false){B=null}C=trim(C);if(useString(B)==false){B="method="+C+"&groupId="+this.groupId}else{B+="&method="+C+"&groupId="+this.groupId}return jsonp(A,B)},callback:function(A){},start:function(A){if(isNull(this.instanceName)==true){return -1}if(isNull(A)){A=null}this.addParams=A;this.mjconn.connection(this);return 0},private_call:function(A){if(isNull(A)){A=null}if(A!=null){this.addParams=this.mjsonp.resultInfo;this.callback(A)}this.private_exec()},private_exec:function(){var B=this.params;if(this.addParams!=null&&this.addParams.length==1){var C=this.addParams[0];for(var A in C){B+="&"+A+"="+C[A]}}return this.mjsonp.getJson(this.url,this.instanceName+".private_call",B)}};var MjConnector=function(){};MjConnector.prototype={jcomet:null,settingTime:null,handle:null,startup:function(){if(isOPERA==false){this.handle=setInterval(this.interval.bind(this),500)}},shutdown:function(){if(isOPERA==false){if(this.handle!=null){clearInterval(this.handle);this.mjcon=null}}},connection:function(A){if(isOPERA==true){A.private_exec()}else{this.settingTime=new Date().getTime();this.jcomet=A}},interval:function(){if(this.jcomet!=null&&(this.settingTime+500)<=new Date().getTime()){var A=this.jcomet;this.jcomet=null;A.private_exec()}}};