(function(e){if(e.WebVideoCtrl){return}var t=function(){var t="100%";var s="100%";var n="";var o="";var i={szContainerID:"",szColorProperty:"",szOcxClassId:"clsid:FDF0038A-CF64-4634-81AB-80F0A7946D6C",szMimeTypes:"application/webvideo-plugin-kit",iWndowType:1,iPlayMode:2,bWndFull:true,bDebugMode:false,cbSelWnd:null,cbEvent:null};var a=null;var u=0;var c=[];var l=[];var p=[];var d=null;var f=null;var P=null;var h=null;var I=this;var v=null;var m=1;var C=2;var S=200;var y=403;var g=0;var x=1;var T=2;var z=3;var D=4;var A=5;var b=6;var M=0;var q=2;var L=3;var R=21;var G=0;var X=1;var H="IPCamera";var w="IPDome";var Z="IPZoom";var k=""+""+"3,0,6,1"+"3,0,6,1"+"7,3,0,81"+"1,1,3,5"+"2,5,1,7"+"1,0,5,59"+""+"";e.GetSelectWndInfo=function(e){var t=h.loadXML(e);u=parseInt(r.$XML(t).find("SelectWnd").eq(0).text(),10);if(null===v){N()}var s=[];s.push("");s.push(""+u+"");s.push("");if(i.cbSelWnd){i.cbSelWnd(h.loadXML(s.join("")))}};e.ZoomInfoCallback=function(e){var t=I.findWndIndexByIndex(u);if(t!=-1){var r=l[t];t=I.findDeviceIndexByIP(r.szIP);if(t!=-1){var s=c[t];s.oProtocolInc.set3DZoom(s,r,e,{success:function(e){},error:function(){}})}}};e.PluginEventHandler=function(e,t,r){W("插件事件:PluginEventHandler iEventType:%s iParam1: %s, iParam2: %s",e,t,r);if(M==e||q==e){I.I_Stop(t)}else if(R==e){I.I_StopRecord(t)}else if(L==e){I.I_StopVoiceTalk()}else{}if(i.cbEvent){i.cbEvent(e,t,r)}};e.GetHttpInfo=function(e,t,r){W("http响应返回:http状态:%s, http数据:%s",e,t);nt.prototype.processCallback(e,t)};var W=function(){if(i.bDebugMode){var e=_(arguments);d._alert(e)}};var _=function(){var e=arguments[0];for(var t=1;t"}}}else{e=""}return e};var N=function(){if(a!==null){var e=a.HWP_GetLocalConfig();v=h.loadXML(e)}};var F=function(e){I.I_GetDeviceInfo(e.szIP,{success:function(t){e.szDeviceType=r.$XML(t).find("deviceType").eq(0).text()}});I.I_GetAnalogChannelInfo(e.szIP,{success:function(t){e.iAnalogChannelNum=r.$XML(t).find("VideoInputChannel",true).length}});I.I_GetAudioInfo(e.szIP,{success:function(t){var s=r.$XML(t).find("audioCompressionType",true);if(s.length>0){var n=r.$XML(s).eq(0).text(),o=0;if("G.711ulaw"==n){o=1}else if("G.711alaw"==n){o=2}else if("G.726"==n){o=3}e.iAudioType=o}}})};var U=function(){var e=i.bWndFull?1:0;a.HWP_SetCanFullScreen(e)};var V=function(e){var t=-1,r=-1,s=-1,n=null;if(Y(e)){n=O(e);t=n.iRtspPort;s=n.iDevicePort}else{var o=K(e);var i=false;for(var a=0;a0){t=true}else if(r.$XML(e).find("ipv6Address",true).length>0){t=true}else{t=false}},error:function(){t=false}});return t};var J=function(){for(var e=0,t=l.length;e0){e.oStreamCapa.iIpChanBase=parseInt(r.$XML(t).find("ipChanBase").eq(0).text(),10)}},error:function(){e.oStreamCapa.bObtained=true}})}}};var et=function(e){var t={TransFrameRate:"",TransResolution:"",TransBitrate:""};h.extend(t,e);if(t.TransFrameRate==""||t.TransResolution==""||t.TransBitrate==""){return""}var r=[];r.push("");r.push("");r.push(""+t.TransFrameRate+"");r.push(""+t.TransResolution+"");r.push(""+t.TransBitrate+"");r.push("");return r.join("")};this.I_InitPlugin=function(e,r,n){t=e;s=r;h.extend(i,n)};this.I_InsertOBJECTPlugin=function(t){if(!E(t)){i.szContainerID=t}if(document.getElementById(i.szContainerID)==null){return-1}if(document.getElementById(n)!=null||document.getElementsByName(n).length!=0){return-1}document.getElementById(i.szContainerID).innerHTML=B();if(!h.browser().msie){a=document.getElementsByName(o)[0]}else{a=document.getElementById(n)}if(a==null&&a.object==null){return-1}else{if(typeof e.attachEvent=="object"&&h.browser().msie){a.attachEvent("GetSelectWndInfo",GetSelectWndInfo);a.attachEvent("ZoomInfoCallback",ZoomInfoCallback);a.attachEvent("GetHttpInfo",GetHttpInfo);a.attachEvent("PluginEventHandler",PluginEventHandler)}else{}}N();return 0};this.I_WriteOBJECT_XHTML=function(){document.writeln(B());if(!h.browser().msie){a=document.getElementsByName(o)[0]}else{a=document.getElementById(n)}if(a==null&&a.object==null){return-1}else{if(h.browser().msie){a.attachEvent("GetSelectWndInfo",GetSelectWndInfo);a.attachEvent("ZoomInfoCallback",ZoomInfoCallback);a.attachEvent("GetHttpInfo",GetHttpInfo);a.attachEvent("PluginEventHandler",PluginEventHandler)}}N();return 0};this.I_OpenFileDlg=function(e){var t=a.HWP_OpenFileBrowser(e,"");if(t!=null){if(1==e){if(t.length>100){return-1}}else{if(t.length>130){return-1}}}else{return""}return t};this.I_GetLocalCfg=function(){var e=a.HWP_GetLocalConfig(),t=[];v=h.loadXML(e);t.push("");t.push(""+r.$XML(v).find("ProtocolType").eq(0).text()+"");t.push(""+r.$XML(v).find("PackgeSize").eq(0).text()+"");t.push(""+r.$XML(v).find("PlayWndType").eq(0).text()+"");t.push(""+r.$XML(v).find("BuffNumberType").eq(0).text()+"");t.push(""+r.$XML(v).find("RecordPath").eq(0).text()+"");t.push(""+r.$XML(v).find("CapturePath").eq(0).text()+"");t.push(""+r.$XML(v).find("PlaybackFilePath").eq(0).text()+"");t.push(""+r.$XML(v).find("PlaybackPicPath").eq(0).text()+"");t.push(""+r.$XML(v).find("DownloadPath").eq(0).text()+"");t.push(""+r.$XML(v).find("IVSMode").eq(0).text()+"");t.push(""+r.$XML(v).find("CaptureFileFormat").eq(0).text()+"");t.push("");return h.loadXML(t.join(""))};this.I_SetLocalCfg=function(e){var t=h.loadXML(e),s=-1;r.$XML(v).find("ProtocolType").eq(0).text(r.$XML(t).find("ProtocolType").eq(0).text());r.$XML(v).find("PackgeSize").eq(0).text(r.$XML(t).find("PackgeSize").eq(0).text());r.$XML(v).find("PlayWndType").eq(0).text(r.$XML(t).find("PlayWndType").eq(0).text());r.$XML(v).find("BuffNumberType").eq(0).text(r.$XML(t).find("BuffNumberType").eq(0).text());r.$XML(v).find("RecordPath").eq(0).text(r.$XML(t).find("RecordPath").eq(0).text());r.$XML(v).find("CapturePath").eq(0).text(r.$XML(t).find("CapturePath").eq(0).text());r.$XML(v).find("PlaybackFilePath").eq(0).text(r.$XML(t).find("PlaybackFilePath").eq(0).text());r.$XML(v).find("PlaybackPicPath").eq(0).text(r.$XML(t).find("PlaybackPicPath").eq(0).text());r.$XML(v).find("DownloadPath").eq(0).text(r.$XML(t).find("DownloadPath").eq(0).text());r.$XML(v).find("IVSMode").eq(0).text(r.$XML(t).find("IVSMode").eq(0).text());r.$XML(v).find("CaptureFileFormat").eq(0).text(r.$XML(t).find("CaptureFileFormat").eq(0).text());s=a.HWP_SetLocalConfig(h.toXMLStr(v));return s?0:-1};var tt=function(e,t,r,s,n,o,i){var a={protocol:t,success:null,error:null};h.extend(a,i);h.extend(a,{success:function(a){var u=new rt;u.szIP=e;if(t==2){u.szHttpProtocol="https://";u.iHttpsPort=r}else{u.szHttpProtocol="http://";u.iHttpPort=r}u.iCGIPort=r;u.szAuth=s;u.iDeviceProtocol=n;u.oProtocolInc=o;c.push(u);W("使用%s协议登录成功",n);F(u);U();if(i.success){i.success(a)}},error:function(e,t){if(i.error){i.error(e,t)}}});o.login(e,r,s,a)};this.I_Login=function(e,t,r,s,n,o){var i=this.findDeviceIndexByIP(e);if(i!=-1){W("设备已经登录过");return-1}var a=f;var u=m;if(!E(o.cgi)){if(m==o.cgi){a=f;u=m}else{a=P;u=C}}var c="";if(m==u){c=h.Base64.encode(":"+s+":"+n);var l={success:null,error:null};h.extend(l,o);h.extend(l,{error:function(i,l){c=h.Base64.encode(s+":"+n);u=m;a=f;var p={success:null,error:null};h.extend(p,o);h.extend(p,{error:function(){if(!E(o.cgi)){if(o.error){o.error(i,l)}return}c=h.Base64.encode(":"+s+":"+n);u=C;a=P;var p={success:null,error:null};h.extend(p,o);h.extend(p,{error:function(i,l){c=h.Base64.encode(s+":"+n);u=C;a=P;var p={success:null,error:null};h.extend(p,o);h.extend(p,{error:function(){if(o.error){o.error(i,l)}}});tt(e,t,r,c,u,a,p)}});tt(e,t,r,c,u,a,p)}});tt(e,t,r,c,u,a,p)}});tt(e,t,r,c,u,a,l)}else{c=h.Base64.encode(":"+s+":"+n);u=C;a=P;var l={success:null,error:null};h.extend(l,o);h.extend(l,{error:function(i,l){c=h.Base64.encode(s+":"+n);u=C;a=P;var p={success:null,error:null};h.extend(p,o);h.extend(p,{error:function(){if(o.error){o.error(i,l)}}});tt(e,t,r,c,u,a,p)}});tt(e,t,r,c,u,a,l)}};this.I_Logout=function(e){var t=this.findDeviceIndexByIP(e);if(t!=-1){c.splice(t,1);return 0}return-1};this.I_GetAudioInfo=function(e,t){var r=this.findDeviceIndexByIP(e);if(r!=-1){var s=c[r];var n={success:null,error:null};h.extend(n,t);s.oProtocolInc.getAudioInfo(s,n)}};this.I_GetDeviceInfo=function(e,t){var r=this.findDeviceIndexByIP(e);if(r!=-1){var s=c[r];var n={success:null,error:null};h.extend(n,t);s.oProtocolInc.getDeviceInfo(s,n)}};this.I_GetAnalogChannelInfo=function(e,t){var r=this.findDeviceIndexByIP(e);if(r!=-1){var s=c[r];var n={success:null,error:null};h.extend(n,t);s.oProtocolInc.getAnalogChannelInfo(s,n)}};this.I_GetDigitalChannelInfo=function(e,t){var r=this.findDeviceIndexByIP(e);if(r!=-1){var s=c[r];var n={success:null,error:null};h.extend(n,t);s.oProtocolInc.getDigitalChannelInfo(s,n)}};this.I_GetZeroChannelInfo=function(e,t){var r=this.findDeviceIndexByIP(e);if(r!=-1){var s=c[r];var n={success:null,error:null};h.extend(n,t);s.oProtocolInc.getZeroChannelInfo(s,n)}};this.I_StartRealPlay=function(e,t){var s=this.findDeviceIndexByIP(e),n=-1,o="",i="",a=-1,p=0,d=0,f=false;var P={iWndIndex:u,iStreamType:1,iChannelID:1,bZeroChannel:false};h.extend(P,t);if(s!=-1){Q(c[s]);var I=c[s];var m=parseInt(r.$XML(v).find("ProtocolType").eq(0).text(),10);if(m==G&&I.oStreamCapa.bSupportShttpPlay){W("SHTTP RealPlay");o=I.oProtocolInc.CGI.startShttpRealPlay;i="http://";d=P.iStreamType-1;if(P.iChannelID<=I.iAnalogChannelNum){p=P.iChannelID}else{p=I.oStreamCapa.iIpChanBase+parseInt(P.iChannelID,10)-I.iAnalogChannelNum-1}f=true;if(!E(P.iPort)){I.iHttpPort=P.iPort;a=P.iPort}else{if(I.szHttpProtocol=="https://"){if(-1==I.iHttpPort){I.iHttpPort=V(I).iHttpPort}a=I.iHttpPort}else{a=I.iCGIPort}}}else{W("RTSP RealPlay");o=I.oProtocolInc.CGI.startRealPlay;i="rtsp://";d=P.iStreamType;p=P.iChannelID;if(!E(P.iPort)){I.iRtspPort=P.iPort}if(-1==I.iRtspPort){I.iRtspPort=V(I).iRtspPort}a=I.iRtspPort}if(-1==a){W("获取端口号失败");return n}h.extend(P,{urlProtocol:i,cgi:o,iPort:a,iStreamType:d,iChannelID:p});s=this.findWndIndexByIndex(P.iWndIndex);if(-1==s){n=I.oProtocolInc.startRealPlay(I,P)}if(-1==n){I.iRtspPort=-1}else{s=this.findWndIndexByIndex(P.iWndIndex);var C=l[s];C.bShttpIPChannel=f}}return n};this.I_Stop=function(e){e=E(e)?u:e;var t=this.findWndIndexByIndex(e),r=-1;if(t!=-1){var s=l[t];if(s.bRecord){a.HWP_StopSave(s.iIndex)}if(s.bSound){a.HWP_CloseSound()}if(s.bEZoom){a.HWP_DisableZoom(s.iIndex)}r=a.HWP_Stop(e);if(0==r){l.splice(t,1)}}return r};this.I_OpenSound=function(e){e=E(e)?u:e;var t=this.findWndIndexByIndex(e),r=-1;if(t!=-1){var s=l[t];if(!s.bSound){r=a.HWP_OpenSound(e);if(0==r){s.bSound=true}}}return r};this.I_CloseSound=function(e){e=E(e)?u:e;var t=this.findWndIndexByIndex(e),r=-1;if(t!=-1){var s=l[t];if(s.bSound){r=a.HWP_CloseSound();if(0==r){s.bSound=false}}}return r};this.I_SetVolume=function(e,t){var r=-1;if(isNaN(parseInt(e,10))){return r}t=E(t)?u:t;var s=this.findWndIndexByIndex(t);if(s!=-1){r=a.HWP_SetVolume(t,e)}return r};this.I_CapturePic=function(e,t){t=E(t)?u:t;var r=this.findWndIndexByIndex(t),s=-1;if(r!=-1){s=a.HWP_CapturePicture(t,e)}return s};this.I_StartRecord=function(e,t){t=E(t)?u:t;var r=this.findWndIndexByIndex(t),s=-1;if(r!=-1){var n=l[r];if(!n.bRecord){s=a.HWP_StartSave(t,e);if(0==s){n.bRecord=true}}}return s};this.I_StopRecord=function(e){e=E(e)?u:e;var t=this.findWndIndexByIndex(e),r=-1;if(t!=-1){var s=l[t];if(s.bRecord){r=a.HWP_StopSave(e);if(0==r){s.bRecord=false}}}return r};this.I_StartVoiceTalk=function(e,t){if(isNaN(parseInt(t,10))){return-1}var r=this.findDeviceIndexByIP(e),s=-1;if(r!=-1){var n=c[r];if(!n.bVoiceTalk){s=n.oProtocolInc.startVoiceTalk(n,t);if(0==s){c[r].bVoiceTalk=true}}}return s};this.I_StopVoiceTalk=function(){var e=a.HWP_StopVoiceTalk();for(var t=0,r=c.length;t45){return-2}if(t.msie){try{var r=new ActiveXObject("WebVideoKitActiveX.WebVideoKitActiveXCtrl.1");e=0}catch(s){}}else{for(var n=0,o=navigator.mimeTypes.length;n"+""+o.iLan+""+""+e+""+""+n+""+""+u+""+""+h.Base64.encode(l)+"";return a.HWP_ShowRemConfig(p)}return s};this.I_ChangeWndNum=function(e){if(isNaN(parseInt(e,10))){return-1}a.HWP_ArrangeWindow(e);return 0};this.I_GetLastError=function(){return a.HWP_GetLastError()};this.I_GetWindowStatus=function(e){if(E(e)){var t=[];h.extend(t,l);return t}else{var r=this.findWndIndexByIndex(e);if(r!=-1){var t={};h.extend(t,l[r]);return t}else{return null}}};this.I_GetIPInfoByMode=function(e,t,r,s){return a.HWP_GetIpInfoByMode(e,t,r,s)};this.findDeviceIndexByIP=function(e){for(var t=0;t");s.push(""+h.escape(r.$XML(e).find("deviceName").eq(0).text())+"");s.push(""+r.$XML(e).find("deviceID").eq(0).text()+"");s.push(""+r.$XML(e).find("deviceType").eq(0).text()+"");s.push(""+r.$XML(e).find("model").eq(0).text()+"");s.push(""+r.$XML(e).find("serialNumber").eq(0).text()+"");s.push(""+r.$XML(e).find("macAddress").eq(0).text()+"");s.push(""+r.$XML(e).find("firmwareVersion").eq(0).text()+"");s.push(""+r.$XML(e).find("firmwareReleasedDate").eq(0).text()+"");s.push(""+r.$XML(e).find("encoderVersion").eq(0).text()+"");s.push(""+r.$XML(e).find("encoderReleasedDate").eq(0).text()+"");s.push("");e=h.loadXML(s.join(""));if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});n.setRequestParam(o);n.submitRequest()};ot.prototype.getAnalogChannelInfo=function(e,t){var s=_(this.CGI.getAnalogChannelInfo,e.szHttpProtocol,e.szIP,e.iCGIPort);var n=new nt;var o={type:"GET",url:s,auth:e.szAuth,success:null,error:null};h.extend(o,t);h.extend(o,{success:function(e){var s=[];s.push("");var n=r.$XML(e).find("VideoInputChannel",true);for(var o=0,i=n.length;o");s.push(""+r.$XML(a).find("id").eq(0).text()+"");s.push(""+r.$XML(a).find("inputPort").eq(0).text()+"");s.push(""+h.escape(r.$XML(a).find("name").eq(0).text())+"");s.push(""+r.$XML(a).find("videoFormat").eq(0).text()+"");s.push("")}s.push("");e=h.loadXML(s.join(""));if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});n.setRequestParam(o);n.submitRequest()};ot.prototype.getDigitalChannel=function(e,t){var s=_(this.CGI.getDigitalChannel,e.szHttpProtocol,e.szIP,e.iCGIPort);var n=new nt;var o={type:"GET",url:s,auth:e.szAuth,success:null,error:null};h.extend(o,t);h.extend(o,{success:function(e){var s=[];s.push("");var n=r.$XML(e).find("InputProxyChannel",true);for(var o=0,i=n.length;o");s.push(""+r.$XML(a).find("id").eq(0).text()+"");s.push(""+h.escape(r.$XML(a).find("name").eq(0).text())+"");s.push("")}s.push("");e=h.loadXML(s.join(""));if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});n.setRequestParam(o);n.submitRequest()};ot.prototype.getDigitalChannelInfo=function(e,t){var s=null,n={};this.getDigitalChannel(e,{async:false,success:function(e){s=e;var t=r.$XML(s).find("InputProxyChannel",true);for(var o=0,i=t.length;o");var o=r.$XML(e).find("InputProxyChannelStatus",true);for(var i=0,a=o.length;i");s.push(""+c+"");s.push("");s.push(""+r.$XML(u).find("proxyProtocol").eq(0).text()+"");s.push(""+r.$XML(u).find("addressingFormatType").eq(0).text()+"");s.push(""+r.$XML(u).find("ipAddress").eq(0).text()+"");s.push(""+r.$XML(u).find("managePortNo").eq(0).text()+"");s.push(""+r.$XML(u).find("srcInputPort").eq(0).text()+"");s.push(""+h.escape(r.$XML(u).find("userName").eq(0).text())+"");s.push(""+r.$XML(u).find("streamType").eq(0).text()+"");s.push(""+r.$XML(u).find("online").eq(0).text()+"");s.push(""+h.escape(n[c])+"");s.push("");s.push("")}s.push("");e=h.loadXML(s.join(""));if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});i.setRequestParam(a);i.submitRequest()};ot.prototype.getZeroChannelInfo=function(e,t){var r=_(this.CGI.getZeroChannelInfo,e.szHttpProtocol,e.szIP,e.iCGIPort);var s=new nt;var n={type:"GET",url:r,auth:e.szAuth,success:null,error:null};h.extend(n,t);h.extend(n,{success:function(e){if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});s.setRequestParam(n);s.submitRequest()};ot.prototype.getStreamChannels=function(e,t){if(e.iAnalogChannelNum!=0){var r=_(this.CGI.getStreamChannels.analog,e.szHttpProtocol,e.szIP,e.iCGIPort)}else{var r=_(this.CGI.getStreamChannels.digital,e.szHttpProtocol,e.szIP,e.iCGIPort)}var s=new nt;var n={type:"GET",url:r,auth:e.szAuth,success:null,error:null};h.extend(n,t);h.extend(n,{success:function(e){if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});s.setRequestParam(n);s.submitRequest()};ot.prototype.getPPPoEStatus=function(e,t){var r=_(this.CGI.getPPPoEStatus,e.szHttpProtocol,e.szIP,e.iCGIPort);var s=new nt;var n={type:"GET",url:r,auth:e.szAuth,success:null,error:null};h.extend(n,t);h.extend(n,{success:function(e){if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});s.setRequestParam(n);s.submitRequest()};ot.prototype.getUPnPPortStatus=function(e,t){var r=_(this.CGI.getUPnPPortStatus,e.szHttpProtocol,e.szIP,e.iCGIPort);var s=new nt;var n={type:"GET",url:r,auth:e.szAuth,success:null,error:null};h.extend(n,t);h.extend(n,{success:function(e){if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});s.setRequestParam(n);s.submitRequest()};ot.prototype.getNetworkBond=function(e,t){var r=_(this.CGI.getNetworkBond,e.szHttpProtocol,e.szIP,e.iCGIPort);var s=new nt;var n={type:"GET",url:r,auth:e.szAuth,success:null,error:null};h.extend(n,t);h.extend(n,{success:function(e){if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});s.setRequestParam(n);s.submitRequest()};ot.prototype.getNetworkInterface=function(e,t){var r=_(this.CGI.getNetworkInterface,e.szHttpProtocol,e.szIP,e.iCGIPort);var s=new nt;var n={type:"GET",url:r,auth:e.szAuth,success:null,error:null};h.extend(n,t);h.extend(n,{success:function(e){if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});s.setRequestParam(n);s.submitRequest()};ot.prototype.getPortInfo=function(e,t){var r=_(this.CGI.getPortInfo,e.szHttpProtocol,e.szIP,e.iCGIPort);var s=new nt;var n={type:"GET",url:r,auth:e.szAuth,success:null,error:null};h.extend(n,t);h.extend(n,{success:function(e){if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});s.setRequestParam(n);s.submitRequest()};ot.prototype.startRealPlay=function(e,t){var r=t.iChannelID*100+t.iStreamType,s="";if(t.bZeroChannel){s=_(t.cgi.zeroChannels,t.urlProtocol,e.szIP,t.iPort,r)}else{s=_(t.cgi.channels,t.urlProtocol,e.szIP,t.iPort,r)}var n=a.HWP_Play(s,e.szAuth,t.iWndIndex,"","");if(0==n){var o=new st;o.iIndex=t.iWndIndex;o.szIP=e.szIP;o.iChannelID=t.iChannelID;o.iPlayStatus=x;l.push(o)}return n};ot.prototype.startVoiceTalk=function(e,t){var r=_(this.CGI.startVoiceTalk.open,e.szHttpProtocol,e.szIP,e.iCGIPort,t),s=_(this.CGI.startVoiceTalk.close,e.szHttpProtocol,e.szIP,e.iCGIPort,t),n=_(this.CGI.startVoiceTalk.audioData,e.szHttpProtocol,e.szIP,e.iCGIPort,t);var o=a.HWP_StartVoiceTalk(r,s,n,e.szAuth,e.iAudioType);return o};ot.prototype.ptzAutoControl=function(e,t,r,s){var n=r.iChannelID,o="",i="";s.iPTZSpeed=s.iPTZSpeed<7?s.iPTZSpeed*15:100;if(t){s.iPTZSpeed=0}if(e.szDeviceType!=w){if(n<=e.iAnalogChannelNum){o=_(this.CGI.ptzAutoControl.analog,e.szHttpProtocol,e.szIP,e.iCGIPort,r.iChannelID)}else{if(r.bShttpIPChannel){o=_(this.CGI.ptzAutoControl.digital,e.szHttpProtocol,e.szIP,e.iCGIPort,r.iChannelID-e.oStreamCapa.iIpChanBase+1+e.iAnalogChannelNum)}else{o=_(this.CGI.ptzAutoControl.digital,e.szHttpProtocol,e.szIP,e.iCGIPort,r.iChannelID)}}i=""+""+""+s.iPTZSpeed+""+""}else{var a=99;if(t){a=96}o=_(this.CGI.ptzAutoControl.ipdome,e.szHttpProtocol,e.szIP,e.iCGIPort,r.iChannelID,a)}var u=new nt;var c={type:"PUT",url:o,async:false,auth:e.szAuth,data:i,success:null,error:null};var l=this;h.extend(c,s);h.extend(c,{success:function(e){r.bPTZAuto=!r.bPTZAuto;if(s.success){s.success(e)}},error:function(t,n){if(H==e.szDeviceType||Z==e.szDeviceType){if(r.bShttpIPChannel){o=_(l.CGI.ptzControl.analog,e.szHttpProtocol,e.szIP,e.iCGIPort,r.iChannelID-e.oStreamCapa.iIpChanBase+1+e.iAnalogChannelNum)}else{o=_(l.CGI.ptzControl.analog,e.szHttpProtocol,e.szIP,e.iCGIPort,r.iChannelID)}i=""+""+""+s.iPTZSpeed+""+""+0+""+"";var a=new nt;var u={type:"PUT",url:o,async:false,auth:e.szAuth,data:i,success:null,error:null};h.extend(u,s);a.setRequestParam(u);a.submitRequest()}else{if(s.error){s.error(t,n)}}}});u.setRequestParam(c);u.submitRequest()};ot.prototype.ptzControl=function(e,t,r,s){var n=r.iChannelID,o="";if(r.bPTZAuto){this.ptzAutoControl(e,true,r,{iPTZSpeed:0})}if(t){s.iPTZSpeed=0}else{s.iPTZSpeed=s.iPTZSpeed<7?s.iPTZSpeed*15:100}var i=[{},{pan:0,tilt:s.iPTZSpeed},{pan:0,tilt:-s.iPTZSpeed},{pan:-s.iPTZSpeed,tilt:0},{pan:s.iPTZSpeed,tilt:0},{pan:-s.iPTZSpeed,tilt:s.iPTZSpeed},{pan:-s.iPTZSpeed,tilt:-s.iPTZSpeed},{pan:s.iPTZSpeed,tilt:s.iPTZSpeed},{pan:s.iPTZSpeed,tilt:-s.iPTZSpeed},{},{speed:s.iPTZSpeed},{speed:-s.iPTZSpeed},{speed:s.iPTZSpeed},{speed:-s.iPTZSpeed},{speed:s.iPTZSpeed},{speed:-s.iPTZSpeed}];var a="";var u={};switch(s.iPTZIndex){case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:u=this.CGI.ptzControl;a=""+""+""+i[s.iPTZIndex].pan+""+""+i[s.iPTZIndex].tilt+""+"";break;case 10:case 11:u=this.CGI.ptzControl;a=""+""+""+i[s.iPTZIndex].speed+""+"";break;case 12:case 13:u=this.CGI.ptzFocus;a=""+""+""+i[s.iPTZIndex].speed+""+"";break;case 14:case 15:u=this.CGI.ptzIris;a=""+""+""+i[s.iPTZIndex].speed+""+"";break;default:if(E(s.error)){s.error()}return}if((u==this.CGI.ptzFocus||u==this.CGI.ptzIris)&&(e.szDeviceType==H||e.szDeviceType==w||e.szDeviceType==Z)){o=_(u.ipc,e.szHttpProtocol,e.szIP,e.iCGIPort,r.iChannelID)}else{if(n<=e.iAnalogChannelNum){o=_(u.analog,e.szHttpProtocol,e.szIP,e.iCGIPort,r.iChannelID)}else{if(r.bShttpIPChannel){o=_(u.digital,e.szHttpProtocol,e.szIP,e.iCGIPort,r.iChannelID-e.oStreamCapa.iIpChanBase+1+e.iAnalogChannelNum)}else{o=_(u.digital,e.szHttpProtocol,e.szIP,e.iCGIPort,r.iChannelID)}}}var c=new nt;var l={type:"PUT",url:o,async:false,auth:e.szAuth,data:a,success:null,error:null};h.extend(l,s);h.extend(l,{success:function(e){if(s.success){s.success(e)}},error:function(e,t){if(s.error){s.error(e,t)}}});c.setRequestParam(l);c.submitRequest()};ot.prototype.setPreset=function(e,t,r){var s=t.iChannelID,n="",o="";if(s<=e.iAnalogChannelNum){n=_(this.CGI.setPreset.analog,e.szHttpProtocol,e.szIP,e.iCGIPort,t.iChannelID,r.iPresetID)}else{if(t.bShttpIPChannel){n=_(this.CGI.setPreset.digital,e.szHttpProtocol,e.szIP,e.iCGIPort,t.iChannelID-e.oStreamCapa.iIpChanBase+1+e.iAnalogChannelNum,r.iPresetID)}else{n=_(this.CGI.setPreset.digital,e.szHttpProtocol,e.szIP,e.iCGIPort,t.iChannelID,r.iPresetID)}}o="";o+="";o+=""+r.iPresetID+"";if(e.szDeviceType!=w){o+=""+"Preset"+r.iPresetID+""}o+="";var i=new nt;var a={type:"PUT",url:n,auth:e.szAuth,data:o,success:null,error:null};h.extend(a,r);h.extend(a,{success:function(e){if(r.success){r.success(e)}},error:function(e,t){if(r.error){r.error(e,t)}}});i.setRequestParam(a);i.submitRequest()};ot.prototype.goPreset=function(e,t,r){var s=t.iChannelID,n="";if(s<=e.iAnalogChannelNum){n=_(this.CGI.goPreset.analog,e.szHttpProtocol,e.szIP,e.iCGIPort,t.iChannelID,r.iPresetID)}else{if(t.bShttpIPChannel){n=_(this.CGI.goPreset.digital,e.szHttpProtocol,e.szIP,e.iCGIPort,t.iChannelID-e.oStreamCapa.iIpChanBase+1+e.iAnalogChannelNum,r.iPresetID)}else{n=_(this.CGI.goPreset.digital,e.szHttpProtocol,e.szIP,e.iCGIPort,t.iChannelID,r.iPresetID)}}var o=new nt;var i={type:"PUT",url:n,auth:e.szAuth,success:null,error:null};h.extend(i,r);h.extend(i,{success:function(e){if(r.success){r.success(e)}},error:function(e,t){if(r.error){r.error(e,t)}}});o.setRequestParam(i);o.submitRequest()};ot.prototype.recordSearch=function(e,t){var s="",n="",o=t.iChannelID,i=t.szStartTime.replace(" ","T")+"Z",a=t.szEndTime.replace(" ","T")+"Z";s=_(this.CGI.recordSearch,e.szHttpProtocol,e.szIP,e.iCGIPort);n=""+""+""+new ct+""+""+(o*100+1)+""+""+""+""+i+""+""+a+""+""+""+"40"+""+t.iSearchPos+""+""+"//metadata.ISAPI.org/VideoMotion"+""+"";var u=new nt;var c={type:"POST",url:s,auth:e.szAuth,data:n,success:null,error:null};h.extend(c,t);h.extend(c,{success:function(e){var s=[];s.push("");s.push(""+r.$XML(e).find("responseStatus").eq(0).text()+"");s.push(""+r.$XML(e).find("responseStatusStrg").eq(0).text()+"");s.push(""+r.$XML(e).find("numOfMatches").eq(0).text()+"");s.push("");var n=r.$XML(e).find("searchMatchItem",true);for(var o=0,i=n.length;o");s.push(""+r.$XML(a).find("trackID").eq(0).text()+"");s.push(""+r.$XML(a).find("startTime").eq(0).text()+"");s.push(""+r.$XML(a).find("endTime").eq(0).text()+"");s.push(""+h.escape(r.$XML(a).find("playbackURI").eq(0).text())+"");s.push(""+r.$XML(a).find("metadataDescriptor").eq(0).text().split("/")[1]+"");s.push("")}s.push("");s.push("");e=h.loadXML(s.join(""));if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});u.setRequestParam(c);u.submitRequest()};ot.prototype.startPlayback=function(e,t){var r=t.iWndIndex,s=t.szStartTime,n=t.szEndTime;var o=_(t.cgi,t.urlProtocol,e.szIP,t.iPort,t.iChannelID,s,n);if(!E(t.oTransCodeParam)){var i=et(t.oTransCodeParam);if(i==""){return-1}a.HWP_SetTrsPlayBackParam(r,i)}var u=a.HWP_Play(o,e.szAuth,r,s,n);if(0==u){var c=new st;c.iIndex=r;c.szIP=e.szIP;c.iChannelID=t.iChannelID;c.iPlayStatus=T;l.push(c)}return u};ot.prototype.reversePlayback=function(e,t){var r=t.iWndIndex,s=t.szStartTime,n=t.szEndTime;var o=_(t.cgi,t.urlProtocol,e.szIP,t.iPort,t.iChannelID,s,n);var i=a.HWP_ReversePlay(o,e.szAuth,r,s,n);if(0==i){var u=new st;u.iIndex=r;u.szIP=e.szIP;u.iChannelID=t.iChannelID;u.iPlayStatus=A;l.push(u)}return i};ot.prototype.startDownloadRecord=function(e,t){var r=_(this.CGI.startDownloadRecord,e.szHttpProtocol,e.szIP,e.iCGIPort);var s=""+""+" "+h.escape(t.szPlaybackURI)+""+"";return a.HWP_StartDownload(r,e.szAuth,t.szFileName,s)};ot.prototype.exportDeviceConfig=function(e){var t=_(this.CGI.deviceConfig,e.szHttpProtocol,e.szIP,e.iCGIPort);return a.HWP_ExportDeviceConfig(t,e.szAuth,"",0)};ot.prototype.importDeviceConfig=function(e,t){var r=_(this.CGI.deviceConfig,e.szHttpProtocol,e.szIP,e.iCGIPort);return a.HWP_ImportDeviceConfig(r,e.szAuth,t.szFileName,0)};ot.prototype.restart=function(e,t){var r=_(this.CGI.restart,e.szHttpProtocol,e.szIP,e.iCGIPort);var s=new nt;var n={type:"PUT",url:r,auth:e.szAuth,success:null,error:null};h.extend(n,t);h.extend(n,{success:function(e){if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});s.setRequestParam(n);s.submitRequest()};ot.prototype.restore=function(e,t,r){var s=_(this.CGI.restore,e.szHttpProtocol,e.szIP,e.iCGIPort,t);var n=new nt;var o={type:"PUT",url:s,auth:e.szAuth,success:null,error:null};h.extend(o,r);h.extend(o,{success:function(e){if(r.success){r.success(e)}},error:function(e,t){if(r.error){r.error(e,t)}}});n.setRequestParam(o);n.submitRequest()};ot.prototype.startUpgrade=function(e,t){var r=_(this.CGI.startUpgrade.upgrade,e.szHttpProtocol,e.szIP,e.iCGIPort),s=_(this.CGI.startUpgrade.status,e.szHttpProtocol,e.szIP,e.iCGIPort);return a.HWP_StartUpgrade(r,s,e.szAuth,t.szFileName)};ot.prototype.set3DZoom=function(e,t,s,n){var o=t.iChannelID,i="";if(o<=e.iAnalogChannelNum){i=_(this.CGI.set3DZoom,e.szHttpProtocol,e.szIP,e.iCGIPort,t.iChannelID)}else{if(t.bShttpIPChannel){i=_(this.CGI.set3DZoom,e.szHttpProtocol,e.szIP,e.iCGIPort,t.iChannelID-e.oStreamCapa.iIpChanBase+1+e.iAnalogChannelNum)}else{i=_(this.CGI.set3DZoom,e.szHttpProtocol,e.szIP,e.iCGIPort,t.iChannelID)}}var a=h.loadXML(s),u=parseInt(r.$XML(a).find("StartPoint").eq(0).find("positionX").eq(0).text(),10),c=parseInt(r.$XML(a).find("StartPoint").eq(0).find("positionY").eq(0).text(),10),l=parseInt(r.$XML(a).find("EndPoint").eq(0).find("positionX").eq(0).text(),10),p=parseInt(r.$XML(a).find("EndPoint").eq(0).find("positionY").eq(0).text(),10);var d=""+""+""+""+u+""+""+(255-c)+""+""+""+""+l+""+""+(255-p)+""+""+"";var f=new nt;var P={type:"PUT",url:i,data:d,auth:e.szAuth,success:null,error:null};h.extend(P,n);h.extend(P,{success:function(e){if(n.success){n.success(e)}},error:function(e,t){if(n.error){n.error(e,t)}}});f.setRequestParam(P);f.submitRequest()};ot.prototype.getSDKCapa=function(e,t){var r=_(this.CGI.SDKCapabilities,e.szHttpProtocol,e.szIP,e.iCGIPort);var s=new nt;var n={type:"GET",url:r,auth:e.szAuth,success:null,error:null};h.extend(n,t);h.extend(n,{success:function(e){if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});s.setRequestParam(n);s.submitRequest()};var it=function(){};it.prototype.CGI={login:"%s%s:%s/PSIA/Custom/SelfExt/userCheck",getAudioInfo:"%s%s:%s/PSIA/Custom/SelfExt/TwoWayAudio/channels",getDeviceInfo:"%s%s:%s/PSIA/System/deviceInfo",getAnalogChannelInfo:"%s%s:%s/PSIA/System/Video/inputs/channels",getDigitalChannel:"%s%s:%s/PSIA/Custom/SelfExt/ContentMgmt/DynVideo/inputs/channels",getDigitalChannelInfo:"%s%s:%s/PSIA/Custom/SelfExt/ContentMgmt/DynVideo/inputs/channels/status",getZeroChannelInfo:"%s%s:%s/PSIA/Custom/SelfExt/ContentMgmt/ZeroVideo/channels",getStreamChannels:{analog:"%s%s:%s/PSIA/Streaming/channels",digital:"%s%s:%s/PSIA/Custom/SelfExt/ContentMgmt/DynStreaming/channels"},getStreamDynChannels:"%s%s:%s/PSIA/Custom/SelfExt/ContentMgmt/DynStreaming/channels",startRealPlay:{channels:"%s%s:%s/PSIA/streaming/channels/%s",zeroChannels:"%s%s:%s/PSIA/Custom/SelfExt/ContentMgmt/ZeroStreaming/channels/%s"},startVoiceTalk:{open:"%s%s:%s/PSIA/Custom/SelfExt/TwoWayAudio/channels/%s/open",close:"%s%s:%s/PSIA/Custom/SelfExt/TwoWayAudio/channels/%s/close",audioData:"%s%s:%s/PSIA/Custom/SelfExt/TwoWayAudio/channels/%s/audioData"},ptzControl:"%s%s:%s/PSIA/PTZ/channels/%s/continuous",ptzAutoControl:"%s%s:%s/PSIA/Custom/SelfExt/PTZ/channels/%s/autoptz",setPreset:"%s%s:%s/PSIA/PTZ/channels/%s/presets/%s",goPreset:"%s%s:%s/PSIA/PTZ/channels/%s/presets/%s/goto",ptzFocus:"%s%s:%s/PSIA/System/Video/inputs/channels/%s/focus",ptzIris:"%s%s:%s/PSIA/System/Video/inputs/channels/%s/iris",getNetworkBond:"%s%s:%s/PSIA/Custom/SelfExt/Bond",getNetworkInterface:"%s%s:%s/PSIA/System/Network/interfaces",getUPnPPortStatus:"%s%s:%s/PSIA/Custom/SelfExt/UPnP/ports/status",getPPPoEStatus:"%s%s:%s/PSIA/Custom/SelfExt/PPPoE/1/status",getPortInfo:"%s%s:%s/PSIA/Security/AAA/adminAccesses",recordSearch:"%s%s:%s/PSIA/ContentMgmt/search",startPlayback:"%s%s:%s/PSIA/streaming/tracks/%s?starttime=%s&endtime=%s",startDownloadRecord:"%s%s:%s/PSIA/Custom/SelfExt/ContentMgmt/download",deviceConfig:"%s%s:%s/PSIA/System/configurationData",restart:"%s%s:%s/PSIA/System/reboot",restore:"%s%s:%s/PSIA/System/factoryReset?mode=%s",startUpgrade:{upgrade:"%s%s:%s/PSIA/System/updateFirmware",status:"%s%s:%s/PSIA/Custom/SelfExt/upgradeStatus"},set3DZoom:"%s%s:%s/PSIA/Custom/SelfExt/PTZ/channels/%s/Set3DZoom"};it.prototype.login=function(e,t,s,n){var o=n.protocol==2?"https://":"http://";var i=_(this.CGI.login,o,e,t);var a=new nt;var u={type:"GET",url:i,auth:s,success:null,error:null};h.extend(u,n);h.extend(u,{success:function(e){if("200"==r.$XML(e).find("statusValue").eq(0).text()){if(n.success){n.success(e)}}else{if(n.error){n.error(401,e)}}},error:function(e,t){if(n.error){n.error(e,t)}}});a.setRequestParam(u);a.submitRequest()};it.prototype.getAudioInfo=function(e,t){var r=_(this.CGI.getAudioInfo,e.szHttpProtocol,e.szIP,e.iCGIPort);var s=new nt;var n={type:"GET",url:r,auth:e.szAuth,success:null,error:null};h.extend(n,t);h.extend(n,{success:function(e){if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});s.setRequestParam(n);s.submitRequest()};it.prototype.getDeviceInfo=function(e,t){var s=_(this.CGI.getDeviceInfo,e.szHttpProtocol,e.szIP,e.iCGIPort);var n=new nt;var o={type:"GET",url:s,auth:e.szAuth,success:null,error:null};h.extend(o,t);h.extend(o,{success:function(e){var s=[];s.push("");s.push(""+h.escape(r.$XML(e).find("deviceName").eq(0).text())+"");s.push(""+r.$XML(e).find("deviceID").eq(0).text()+"");s.push(""+r.$XML(e).find("deviceDescription").eq(0).text()+"");s.push(""+r.$XML(e).find("model").eq(0).text()+"");s.push(""+r.$XML(e).find("serialNumber").eq(0).text()+"");s.push(""+r.$XML(e).find("macAddress").eq(0).text()+"");s.push(""+r.$XML(e).find("firmwareVersion").eq(0).text()+"");s.push(""+r.$XML(e).find("firmwareReleasedDate").eq(0).text()+"");s.push(""+r.$XML(e).find("logicVersion").eq(0).text()+"");s.push(""+r.$XML(e).find("logicReleasedDate").eq(0).text()+"");s.push("");e=h.loadXML(s.join(""));if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});n.setRequestParam(o);n.submitRequest()};it.prototype.getAnalogChannelInfo=function(e,t){var s=_(this.CGI.getAnalogChannelInfo,e.szHttpProtocol,e.szIP,e.iCGIPort);var n=new nt;var o={type:"GET",url:s,auth:e.szAuth,success:null,error:null};h.extend(o,t);h.extend(o,{success:function(e){var s=[];s.push("");var n=r.$XML(e).find("VideoInputChannel",true);for(var o=0,i=n.length;o");s.push(""+r.$XML(a).find("id").eq(0).text()+"");s.push(""+r.$XML(a).find("inputPort").eq(0).text()+"");s.push(""+h.escape(r.$XML(a).find("name").eq(0).text())+"");s.push(""+r.$XML(a).find("videoFormat").eq(0).text()+"");s.push("")}s.push("");e=h.loadXML(s.join(""));if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});n.setRequestParam(o);n.submitRequest()};it.prototype.getDigitalChannel=function(e,t){var s=_(this.CGI.getDigitalChannel,e.szHttpProtocol,e.szIP,e.iCGIPort);var n=new nt;var o={type:"GET",url:s,auth:e.szAuth,success:null,error:null};h.extend(o,t);h.extend(o,{success:function(e){var s=[];s.push("");var n=r.$XML(e).find("DynVideoInputChannel",true);for(var o=0,i=n.length;o");s.push(""+r.$XML(a).find("id").eq(0).text()+"");s.push(""+h.escape(r.$XML(a).find("name").eq(0).text())+"");s.push("")}s.push("");e=h.loadXML(s.join(""));if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});n.setRequestParam(o);n.submitRequest()};it.prototype.getDigitalChannelInfo=function(e,t){var s=null,n={};this.getDigitalChannel(e,{async:false,success:function(e){s=e;var t=r.$XML(s).find("InputProxyChannel",true);for(var o=0,i=t.length;o");var o=r.$XML(e).find("DynVideoInputChannelStatus",true);for(var i=0,a=o.length;i");s.push(""+c+"");s.push("");s.push(""+r.$XML(u).find("adminProtocol").eq(0).text()+"");s.push(""+r.$XML(u).find("addressingFormatType").eq(0).text()+"");s.push(""+r.$XML(u).find("ipAddress").eq(0).text()+"");s.push(""+r.$XML(u).find("adminPortNo").eq(0).text()+"");s.push(""+r.$XML(u).find("srcInputPort").eq(0).text()+"");s.push(""+h.escape(r.$XML(u).find("userName").eq(0).text())+"");s.push(""+r.$XML(u).find("streamType").eq(0).text()+"");s.push(""+r.$XML(u).find("online").eq(0).text()+"");s.push(""+h.escape(n[c])+"");s.push("");s.push("")}s.push("");e=h.loadXML(s.join(""));if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});i.setRequestParam(a);i.submitRequest()};it.prototype.getZeroChannelInfo=function(e,t){var r=_(this.CGI.getZeroChannelInfo,e.szHttpProtocol,e.szIP,e.iCGIPort);var s=new nt;var n={type:"GET",url:r,auth:e.szAuth,success:null,error:null};h.extend(n,t);h.extend(n,{success:function(e){if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});s.setRequestParam(n);s.submitRequest()};it.prototype.getPPPoEStatus=function(e,t){var r=_(this.CGI.getPPPoEStatus,e.szHttpProtocol,e.szIP,e.iCGIPort);var s=new nt;var n={type:"GET",url:r,auth:e.szAuth,success:null,error:null};h.extend(n,t);h.extend(n,{success:function(e){if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});s.setRequestParam(n);s.submitRequest()};it.prototype.getUPnPPortStatus=function(e,t){var r=_(this.CGI.getUPnPPortStatus,e.szHttpProtocol,e.szIP,e.iCGIPort);var s=new nt;var n={type:"GET",url:r,auth:e.szAuth,success:null,error:null};h.extend(n,t);h.extend(n,{success:function(e){if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});s.setRequestParam(n);s.submitRequest()};it.prototype.getNetworkBond=function(e,t){var r=_(this.CGI.getNetworkBond,e.szHttpProtocol,e.szIP,e.iCGIPort);var s=new nt;var n={type:"GET",url:r,auth:e.szAuth,success:null,error:null};h.extend(n,t);h.extend(n,{success:function(e){if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});s.setRequestParam(n);s.submitRequest()};it.prototype.getNetworkInterface=function(e,t){var r=_(this.CGI.getNetworkInterface,e.szHttpProtocol,e.szIP,e.iCGIPort);var s=new nt;var n={type:"GET",url:r,auth:e.szAuth,success:null,error:null};h.extend(n,t);h.extend(n,{success:function(e){if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});s.setRequestParam(n);s.submitRequest()};it.prototype.getPortInfo=function(e,t){var s=_(this.CGI.getPortInfo,e.szHttpProtocol,e.szIP,e.iCGIPort);var n=new nt;var o={type:"GET",url:s,auth:e.szAuth,success:null,error:null};h.extend(o,t);h.extend(o,{success:function(s){var n=[];n.push("");var o=r.$XML(s).find("AdminAccessProtocol",true);for(var i=0,a=o.length;i");n.push(""+r.$XML(s).find("id").eq(0).text()+"");n.push(""+r.$XML(s).find("enabled").eq(0).text()+"");n.push(""+r.$XML(s).find("protocol").eq(0).text().toUpperCase()+"");n.push(""+r.$XML(s).find("portNo").eq(0).text()+"");n.push("")}P.getStreamChannels(e,{async:false,success:function(s){if(r.$XML(s).find("rtspPortNo",true).length>0){var o=parseInt(r.$XML(s).find("rtspPortNo").eq(0).text(),10);n.push("");n.push(""+4+"");n.push(""+"true"+"");n.push(""+"RTSP"+"");n.push(""+o+"");n.push("");n.push("");var i=h.loadXML(n.join(""));if(t.success){t.success(i)}}else{P.getStreamDynChannels(e,{async:false,success:function(e){if(r.$XML(e).find("rtspPortNo",true).length>0){var s=parseInt(r.$XML(e).find("rtspPortNo").eq(0).text(),10);n.push("");n.push(""+4+"");n.push(""+"true"+"");n.push(""+"RTSP"+"");n.push(""+s+"");n.push("");n.push("");var o=h.loadXML(n.join(""));if(t.success){t.success(o)}}},error:function(){if(t.error){t.error()}}})}},error:function(){if(t.error){t.error()}}})},error:function(){var s=[];s.push("");P.getStreamChannels(e,{async:false,success:function(n){if(r.$XML(n).find("rtspPortNo",true).length>0){var o=parseInt(r.$XML(n).find("rtspPortNo").eq(0).text(),10);s.push("");s.push(""+4+"");s.push(""+"true"+"");s.push(""+"RTSP"+"");s.push(""+o+"");s.push("");s.push("");var i=h.loadXML(s.join(""));if(t.success){t.success(i)}}else{P.getStreamDynChannels(e,{async:false,success:function(e){if(r.$XML(e).find("rtspPortNo",true).length>0){var n=parseInt(r.$XML(e).find("rtspPortNo").eq(0).text(),10);s.push("");s.push(""+4+"");s.push(""+"true"+"");
s.push(""+"RTSP"+"");s.push(""+n+"");s.push("");s.push("");var o=h.loadXML(s.join(""));if(t.success){t.success(o)}}},error:function(){if(t.error){t.error()}}})}},error:function(){if(t.error){t.error()}}})}});n.setRequestParam(o);n.submitRequest()};it.prototype.getStreamChannels=function(e,t){if(e.iAnalogChannelNum!=0){var r=_(this.CGI.getStreamChannels.analog,e.szHttpProtocol,e.szIP,e.iCGIPort)}else{var r=_(this.CGI.getStreamChannels.digital,e.szHttpProtocol,e.szIP,e.iCGIPort)}var s=new nt;var n={type:"GET",url:r,auth:e.szAuth,success:null,error:null};h.extend(n,t);h.extend(n,{success:function(e){if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});s.setRequestParam(n);s.submitRequest()};it.prototype.getStreamDynChannels=function(e,t){var r=_(this.CGI.getStreamDynChannels,e.szHttpProtocol,e.szIP,e.iCGIPort);var s=new nt;var n={type:"GET",url:r,auth:e.szAuth,success:null,error:null};h.extend(n,t);h.extend(n,{success:function(e){if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});s.setRequestParam(n);s.submitRequest()};it.prototype.startRealPlay=function(e,t){var r=t.iChannelID*100+t.iStreamType,s="";if(t.bZeroChannel){s=_(t.cgi.zeroChannels,t.urlProtocol,e.szIP,t.iPort,r)}else{s=_(t.cgi.channels,t.urlProtocol,e.szIP,t.iPort,r)}var n=a.HWP_Play(s,e.szAuth,t.iWndIndex,"","");if(0==n){var o=new st;o.iIndex=t.iWndIndex;o.szIP=e.szIP;o.iChannelID=t.iChannelID;o.iPlayStatus=x;l.push(o)}return n};it.prototype.startVoiceTalk=function(e,t){var r=_(this.CGI.startVoiceTalk.open,e.szHttpProtocol,e.szIP,e.iCGIPort,t),s=_(this.CGI.startVoiceTalk.close,e.szHttpProtocol,e.szIP,e.iCGIPort,t),n=_(this.CGI.startVoiceTalk.audioData,e.szHttpProtocol,e.szIP,e.iCGIPort,t);var o=a.HWP_StartVoiceTalk(r,s,n,e.szAuth,e.iAudioType);return o};it.prototype.ptzAutoControl=function(e,t,r,s){var n=r.iChannelID,o="",i="";s.iPTZSpeed=s.iPTZSpeed<7?s.iPTZSpeed*15:100;if(t){s.iPTZSpeed=0}if(e.szDeviceType!=w){o=_(this.CGI.ptzAutoControl,e.szHttpProtocol,e.szIP,e.iCGIPort,n);i=""+""+""+s.iPTZSpeed+""+"0"+""}else{var a=99;if(t){a=96}o=_(this.CGI.goPreset,e.szHttpProtocol,e.szIP,e.iCGIPort,n,a)}var u=new nt;var c={type:"PUT",url:o,async:false,auth:e.szAuth,data:i,success:null,error:null};var l=this;h.extend(c,s);h.extend(c,{success:function(e){r.bPTZAuto=!r.bPTZAuto;if(s.success){s.success(e)}},error:function(t,n){if(e.szDeviceType!=w){o=_(l.CGI.ptzControl,e.szHttpProtocol,e.szIP,e.iCGIPort,r.iChannelID);var a=new nt;var u={type:"PUT",url:o,async:false,auth:e.szAuth,data:i,success:null,error:null};h.extend(u,s);a.setRequestParam(u);a.submitRequest()}else{if(s.error){s.error(t,n)}}}});u.setRequestParam(c);u.submitRequest()};it.prototype.ptzControl=function(e,t,r,s){var n=r.iChannelID,o="";if(r.bPTZAuto){this.ptzAutoControl(e,true,r,{iPTZSpeed:0})}if(t){s.iPTZSpeed=0}else{s.iPTZSpeed=s.iPTZSpeed<7?s.iPTZSpeed*15:100}var i=[{},{pan:0,tilt:s.iPTZSpeed},{pan:0,tilt:-s.iPTZSpeed},{pan:-s.iPTZSpeed,tilt:0},{pan:s.iPTZSpeed,tilt:0},{pan:-s.iPTZSpeed,tilt:s.iPTZSpeed},{pan:-s.iPTZSpeed,tilt:-s.iPTZSpeed},{pan:s.iPTZSpeed,tilt:s.iPTZSpeed},{pan:s.iPTZSpeed,tilt:-s.iPTZSpeed},{},{speed:s.iPTZSpeed},{speed:-s.iPTZSpeed},{speed:s.iPTZSpeed},{speed:-s.iPTZSpeed},{speed:s.iPTZSpeed},{speed:-s.iPTZSpeed}];var a="";var u={};switch(s.iPTZIndex){case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:u=this.CGI.ptzControl;a=""+""+""+i[s.iPTZIndex].pan+""+""+i[s.iPTZIndex].tilt+""+"";break;case 10:case 11:u=this.CGI.ptzControl;a=""+""+""+i[s.iPTZIndex].speed+""+"";break;case 12:case 13:u=this.CGI.ptzFocus;a=""+""+""+i[s.iPTZIndex].speed+""+"";break;case 14:case 15:u=this.CGI.ptzIris;a=""+""+""+i[s.iPTZIndex].speed+""+"";break;default:if(E(s.error)){s.error()}return}o=_(u,e.szHttpProtocol,e.szIP,e.iCGIPort,r.iChannelID);var c=new nt;var l={type:"PUT",url:o,async:false,auth:e.szAuth,data:a,success:null,error:null};h.extend(l,s);h.extend(l,{success:function(e){if(s.success){s.success(e)}},error:function(e,t){if(s.error){s.error(e,t)}}});c.setRequestParam(l);c.submitRequest()};it.prototype.setPreset=function(e,t,r){var s=t.iChannelID,n="",o="";n=_(this.CGI.setPreset,e.szHttpProtocol,e.szIP,e.iCGIPort,t.iChannelID,r.iPresetID);o="";o+="";o+=""+r.iPresetID+"";if(e.szDeviceType!=w){o+=""+"Preset"+r.iPresetID+""}o+="";var i=new nt;var a={type:"PUT",url:n,auth:e.szAuth,data:o,success:null,error:null};h.extend(a,r);h.extend(a,{success:function(e){if(r.success){r.success(e)}},error:function(e,t){if(r.error){r.error(e,t)}}});i.setRequestParam(a);i.submitRequest()};it.prototype.goPreset=function(e,t,r){var s=t.iChannelID,n="";n=_(this.CGI.goPreset,e.szHttpProtocol,e.szIP,e.iCGIPort,t.iChannelID,r.iPresetID);var o=new nt;var i={type:"PUT",url:n,auth:e.szAuth,success:null,error:null};h.extend(i,r);h.extend(i,{success:function(e){if(r.success){r.success(e)}},error:function(e,t){if(r.error){r.error(e,t)}}});o.setRequestParam(i);o.submitRequest()};it.prototype.recordSearch=function(e,t){var s="",n="",o=t.iChannelID,i=t.szStartTime.replace(" ","T")+"Z",a=t.szEndTime.replace(" ","T")+"Z";s=_(this.CGI.recordSearch,e.szHttpProtocol,e.szIP,e.iCGIPort);n=""+""+""+new ct+""+""+(o*100+1)+""+""+""+""+i+""+""+a+""+""+""+"40"+""+t.iSearchPos+""+""+"//metadata.psia.org/VideoMotion"+""+"";var u=new nt;var c={type:"POST",url:s,auth:e.szAuth,data:n,success:null,error:null};h.extend(c,t);h.extend(c,{success:function(e){var s=[];s.push("");s.push(""+r.$XML(e).find("responseStatus").eq(0).text()+"");s.push(""+r.$XML(e).find("responseStatusStrg").eq(0).text()+"");s.push(""+r.$XML(e).find("numOfMatches").eq(0).text()+"");s.push("");var n=r.$XML(e).find("searchMatchItem",true);for(var o=0,i=n.length;o");s.push(""+r.$XML(a).find("trackID").eq(0).text()+"");s.push(""+r.$XML(a).find("startTime").eq(0).text()+"");s.push(""+r.$XML(a).find("endTime").eq(0).text()+"");s.push(""+h.escape(r.$XML(a).find("playbackURI").eq(0).text())+"");s.push(""+r.$XML(a).find("metadataDescriptor").eq(0).text().split("/")[1]+"");s.push("")}s.push("");s.push("");e=h.loadXML(s.join(""));if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});u.setRequestParam(c);u.submitRequest()};it.prototype.startPlayback=function(e,t){var r=t.iWndIndex,s=t.szStartTime,n=t.szEndTime;var o=_(t.cgi,t.urlProtocol,e.szIP,t.iPort,t.iChannelID,s,n);var i=a.HWP_Play(o,e.szAuth,r,s,n);if(0==i){var u=new st;u.iIndex=r;u.szIP=e.szIP;u.iChannelID=t.iChannelID;u.iPlayStatus=T;l.push(u)}return i};it.prototype.reversePlayback=function(e,t){var r=t.iWndIndex,s=t.szStartTime,n=t.szEndTime;var o=_(t.cgi,t.urlProtocol,e.szIP,t.iPort,t.iChannelID,s,n);var i=a.HWP_ReversePlay(o,e.szAuth,r,s,n);if(0==i){var u=new st;u.iIndex=r;u.szIP=e.szIP;u.iChannelID=t.iChannelID;u.iPlayStatus=A;l.push(u)}return i};it.prototype.startDownloadRecord=function(e,t){var r=_(this.CGI.startDownloadRecord,e.szHttpProtocol,e.szIP,e.iCGIPort);var s=""+""+" "+h.escape(t.szPlaybackURI)+""+"";return a.HWP_StartDownload(r,e.szAuth,t.szFileName,s)};it.prototype.exportDeviceConfig=function(e){var t=_(this.CGI.deviceConfig,e.szHttpProtocol,e.szIP,e.iCGIPort);return a.HWP_ExportDeviceConfig(t,e.szAuth,"",0)};it.prototype.importDeviceConfig=function(e,t){var r=_(this.CGI.deviceConfig,e.szHttpProtocol,e.szIP,e.iCGIPort);return a.HWP_ImportDeviceConfig(r,e.szAuth,t.szFileName,0)};it.prototype.restart=function(e,t){var r=_(this.CGI.restart,e.szHttpProtocol,e.szIP,e.iCGIPort);var s=new nt;var n={type:"PUT",url:r,auth:e.szAuth,success:null,error:null};h.extend(n,t);h.extend(n,{success:function(e){if(t.success){t.success(e)}},error:function(e,r){if(t.error){t.error(e,r)}}});s.setRequestParam(n);s.submitRequest()};it.prototype.restore=function(e,t,r){var s=_(this.CGI.restore,e.szHttpProtocol,e.szIP,e.iCGIPort,t);var n=new nt;var o={type:"PUT",url:s,auth:e.szAuth,success:null,error:null};h.extend(o,r);h.extend(o,{success:function(e){if(r.success){r.success(e)}},error:function(e,t){if(r.error){r.error(e,t)}}});n.setRequestParam(o);n.submitRequest()};it.prototype.startUpgrade=function(e,t){var r=_(this.CGI.startUpgrade.upgrade,e.szHttpProtocol,e.szIP,e.iCGIPort),s=_(this.CGI.startUpgrade.status,e.szHttpProtocol,e.szIP,e.iCGIPort);return a.HWP_StartUpgrade(r,s,e.szAuth,t.szFileName)};it.prototype.set3DZoom=function(e,t,r,s){var n=_(this.CGI.set3DZoom,e.szHttpProtocol,e.szIP,e.iCGIPort,t.iChannelID);var o=new nt;var i={type:"PUT",url:n,data:r,auth:e.szAuth,success:null,error:null};h.extend(i,s);h.extend(i,{success:function(e){if(s.success){s.success(e)}},error:function(e,t){if(s.error){s.error(e,t)}}});o.setRequestParam(i);o.submitRequest()};var at=function(){};at.prototype._alert=function(e){if(i.bDebugMode){console.log(e)}};(function(t){var r=function(e){this.elems=[];this.length=0;this.length=this.elems.push(e)};r.prototype.find=function(e,t){var r=this.elems[this.length-1].getElementsByTagName(e);this.length=this.elems.push(r);if(t){return r}else{return this}};r.prototype.eq=function(e,t){var r=this.elems[this.length-1].length,s=null;if(r>0&&e0&&a[1].indexOf("trident")>-1){a[1]="msie"}var u={};u[a[1]]=true;u.version=a[2];return u};ut.prototype.loadXML=function(t){if(null==t||""==t){return null}var r=null;if(e.DOMParser){var s=new DOMParser;r=s.parseFromString(t,"text/xml")}else{r=new ActiveXObject("Microsoft.XMLDOM");r.async=false;r.loadXML(t)}return r};ut.prototype.toXMLStr=function(e){var t="";try{var r=new XMLSerializer;t=r.serializeToString(e)}catch(s){try{t=e.xml}catch(s){return""}}if(t.indexOf(""+t}return t};ut.prototype.escape=function(e){return e.replace(/&/g,"&").replace(//g,">")};ut.prototype.dateFormat=function(e,t){var r={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};if(/(y+)/.test(t)){t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length))}for(var s in r){if(new RegExp("("+s+")").test(t)){t=t.replace(RegExp.$1,RegExp.$1.length==1?r[s]:("00"+r[s]).substr((""+r[s]).length))}}return t};ut.prototype.Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){var t="";var r,s,n,o,i,a,u;var c=0;e=ut.prototype.Base64._utf8_encode(e);while(c>2;i=(r&3)<<4|s>>4;a=(s&15)<<2|n>>6;u=n&63;if(isNaN(s)){a=u=64}else if(isNaN(n)){u=64}t=t+this._keyStr.charAt(o)+this._keyStr.charAt(i)+this._keyStr.charAt(a)+this._keyStr.charAt(u)}return t},decode:function(e){var t="";var r,s,n;var o,i,a,u;var c=0;e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");while(c>4;s=(i&15)<<4|a>>2;n=(a&3)<<6|u;t=t+String.fromCharCode(r);if(a!=64){t=t+String.fromCharCode(s)}if(u!=64){t=t+String.fromCharCode(n)}}t=ut.prototype.Base64._utf8_decode(t);return t},_utf8_encode:function(e){e=e.replace(/\r\n/g,"\n");var t="";for(var r=0;r127&&s<2048){t+=String.fromCharCode(s>>6|192);t+=String.fromCharCode(s&63|128)}else{t+=String.fromCharCode(s>>12|224);t+=String.fromCharCode(s>>6&63|128);t+=String.fromCharCode(s&63|128)}}return t},_utf8_decode:function(e){var t="";var r=0;var s=c1=c2=0;while(r191&&s<224){c2=e.charCodeAt(r+1);t+=String.fromCharCode((s&31)<<6|c2&63);r+=2}else{c2=e.charCodeAt(r+1);c3=e.charCodeAt(r+2);t+=String.fromCharCode((s&15)<<12|(c2&63)<<6|c3&63);r+=3}}return t}};function ct(){this.id=this.createUUID()}ct.prototype.valueOf=function(){return this.id};ct.prototype.toString=function(){return this.id};ct.prototype.createUUID=function(){var e=new Date(1582,10,15,0,0,0,0);var t=new Date;var r=t.getTime()-e.getTime();var s="-";var n=ct.getIntegerBits(r,0,31);var o=ct.getIntegerBits(r,32,47);var i=ct.getIntegerBits(r,48,59)+"1";var a=ct.getIntegerBits(ct.rand(4095),0,7);var u=ct.getIntegerBits(ct.rand(4095),0,7);var c=ct.getIntegerBits(ct.rand(8191),0,7)+ct.getIntegerBits(ct.rand(8191),8,15)+ct.getIntegerBits(ct.rand(8191),0,7)+ct.getIntegerBits(ct.rand(8191),8,15)+ct.getIntegerBits(ct.rand(8191),0,15);return n+s+o+s+i+s+a+u+s+c};ct.getIntegerBits=function(e,t,r){var s=ct.returnBase(e,16);var n=new Array;var o="";var i=0;for(i=0;i=t)var s=this.returnBase(n,t)+r[o];else var s=r[n]+r[o]}return s};ct.rand=function(e){return Math.floor(Math.random()*e)};f=new ot;P=new it;d=new at;h=new ut;var lt=h.dateFormat(new Date,"yyyyMMddhhmmss");n="webVideoCtrl"+lt;o="webVideoCtrl"+lt;if(typeof e.attachEvent!="object"&&h.browser().msie){var pt="";pt+="";pt+="";pt+="";document.write(pt)}return this}();var r=e.WebVideoCtrl=t;r.version="1.0.9"})(this);