function UpdateAlarmTrigger(d,c,g,f){for(i=0;i<d.length;i++){if(c==d[i].attributes.getNamedItem("name").nodeValue){curIndex=d[i].attributes.getNamedItem("index").nodeValue;if(g_bUpdataChannel[curIndex]==1){var b=document.getElementsByName(g);if(f){var a=d[i].childNodes[0].nodeValue.toString();for(j=0;j<b.length;j++){var e=parseInt(b[j].value,10);if(a.charAt(e)=="1"){b[j].checked=true}else{b[j].checked=false}}}else{var a=new Array(64);for(j=0;j<a.length;j++){a[j]="0"}for(j=0;j<b.length;j++){var e=parseInt(b[j].value,10);if(b[j].checked){a[e]="1"}}d[i].childNodes[0].nodeValue=a.join("")}}}}}function UpdateBigView(e,d,h,g){for(i=0;i<e.length;i++){if(d==e[i].attributes.getNamedItem("name").nodeValue){curIndex=e[i].attributes.getNamedItem("index").nodeValue;if(g_bUpdataChannel[curIndex]){var c=document.getElementById(h);if(g){var b=e[i].childNodes[0].nodeValue.toString();c.value=-1;for(var a=0;a<c.options.length;a++){var f=c.options[a].value;if(b.charAt(f)=="1"){c.value=c.options[a].value;break}}}else{var b=new Array(64);for(a=0;a<b.length;a++){b[a]="0"}var f=parseInt(c.value,10);if(f!=-1){b[f]="1"}e[i].childNodes[0].nodeValue=b.join("")}}}}}function UpdateAlarmToPtz(d,e){var g=document.getElementsByName("ptz_number");var c=document.getElementsByName("ptz_type");for(i=0;i<d.length;i++){if((STR_MOTION_TO_PTZ==d[i].attributes.getNamedItem("name").nodeValue)||(STR_SENSOR_IN_TO_PTZ==d[i].attributes.getNamedItem("name").nodeValue)||(STR_VLOSS_TO_PTZ==d[i].attributes.getNamedItem("name").nodeValue)){var b=d[i].attributes.getNamedItem("index").nodeValue;if(g_bUpdataChannel[b]==1){htmlName=d[i].attributes.getNamedItem("name").nodeValue;htmlElementsNodeName=document.getElementsByName(HtmlName);var a=d[i].childNodes[0].nodeValue.toString().split("*");for(j=0;j<g_channelList.length;j++){if(e){var f=a[j].split("+");if(f[2]=="1"){c[j].value="3";g[j].disabled=false;g[j].innerHTML="";GenSelectListEx(g[j],g_presetList);g[j].value=f[0]}else{if(f[5]=="1"){c[j].value="6";g[j].disabled=false;g[j].innerHTML="";if(g_cruiseList[j].length==0){GenSelectListEx(g[j],new Array(new CSelectOptionInfo("- - -",-1)));continue}GenSelectListEx(g[j],g_cruiseList[j]);g[j].value=f[4]}else{if(f[6]=="1"){c[j].value="7";g[j].disabled=false;g[j].innerHTML="";GenSelectListEx(g[j],g_trackList)}else{g[j].innerHTML="";g[j].disabled=true;c[j].value="-1"}}}}else{var f=a[j].split("+");if((b==j)&&(STR_MOTION_TO_PTZ==d[i].attributes.getNamedItem("name").nodeValue)){f[0]="0";f[1]="0";f[2]="0";f[3]="0";f[4]="0";f[5]="0";f[6]="0"}else{if(c[j].value=="3"){f[2]="1";f[0]=g[j].value;f[1]="0";f[3]="0";f[4]="0";f[5]="0";f[6]="0"}else{if(c[j].value=="6"){f[5]="1";f[4]=g[j].value;f[0]="0";f[1]="0";f[2]="0";f[3]="0";f[6]="0"}else{if(c[j].value=="7"){f[6]="1";f[0]="0";f[1]="0";f[2]="0";f[3]="0";f[4]="0";f[5]="0"}else{f[0]="0";f[1]="0";f[2]="0";f[3]="0";f[4]="0";f[5]="0";f[6]="0"}}}}a[j]=f.join("+");d[i].childNodes[0].nodeValue=a.join("*")}}}}}}function UpdateBooleanTrigger(c,b,f,e){var d=0;for(i=0;i<c.length;i++){if(b==c[i].attributes.getNamedItem("name").nodeValue){curIndex=c[i].attributes.getNamedItem("index").nodeValue;if(g_bUpdataChannel[curIndex]==1){var a=document.getElementsByName(f);if(e){if(c[i].childNodes[0].nodeValue=="0"){a[0].checked=0}else{a[0].checked=1}}else{if((c[i].childNodes[0].nodeValue=="0")||(c[i].childNodes[0].nodeValue=="1")){if(a[0].checked){c[i].childNodes[0].nodeValue="1"}else{c[i].childNodes[0].nodeValue="0"}}}}}}}function BuzzerEnable(b){var a=document.getElementsByName("buzzer_hold_time");a[0].disabled=!b.checked}function AlarmGetCruiseList(r){var l=/msie/i.test(navigator.userAgent);g_cruiseList=new Array(const_channel_num);for(var g=0;g<r.length;g++){if(STR_PTZ_CRUISE_INFO==r[g].attributes.getNamedItem("name").nodeValue){var h=r[g].attributes.getNamedItem("index").nodeValue;g_cruiseList[h]=new Array();if(r[g].childNodes[0]==null){r[g].parentNode.removeChild(r[g]);if(!l){g-=1}continue}var s=r[g].childNodes[0].nodeValue;var b=0;while(s.length>0){var m=s.indexOf("(");var a=s.substr(m+1);var n=parseInt(a,10);var p=a.indexOf("+");var f=a.substr(p);var q=parseInt(f,10);var d=q.toString().length;var k=f.indexOf(":")+1;var o=f.SubStringOfBytes(k,q);var e=f.substr(k+o.length);var c=e.indexOf(")");s=e.substr(c+1);g_cruiseList[h][b]=new CSelectOptionInfo(cruise_string+(n+1),n);b++}r[g].parentNode.removeChild(r[g]);if(!l){g-=1}}}};