var obj_AutoLogout=null;function AutoLogout(){this._timer=null;this._time=-1;this._worst_timer=null;this._worst_time=0;this._mutex=false;this._notify_time=15;this._notify_user=true;this._user_message=PHP_AUTOLOGOUT_STRING;this._user_message_interval_timer=null;this._page_request_reciver="/web/ajax/system.autologout.ajax.php";this.constructor=function(){if(obj_AutoLogout!=null){if(obj_AutoLogout.destructor()!=true){return false}}this.__refresh_static_variable();return true};this.__refresh_static_variable=function(){obj_AutoLogout=this;return true};this.tickTimer=function(){if(this._notify_user==false){return this.__execute_logout()}else{this.showUserNotification()}};this.__execute_logout=function(){document.location.href="login.php?act=autologout"};this.showUserNotification=function(){if(this._checkNotificationWindow()){this.__execute_logout()}else{this._user_message_interval_timer=showNotificationWithTimer(this._user_message,true,this._notify_time,"obj_AutoLogout.action","obj_AutoLogout.showUserNotification");return true}};this._checkNotificationWindow=function(){if(this._user_message_interval_timer!=null){showErrorMsg(false);clearInterval(this._user_message_interval_timer);this._user_message_interval_timer=null;return true}else{return false}};this.action=function(){this._checkNotificationWindow();this.restartTimer()};this.restartTimer=function(){if(this._time==-1){return false}if(!this._time&&this._time!=0){throw"Timer must be defined"}if(this._timer){if(this.__clear_timeout()!=true){throw"Cannot clear timeout , system problem"}}if(this._time!=0){if(this.__set_timeout()!=true){throw"Cannot set new timeout, system problem "}}return true};this.resumeTimer=function(){if(this.__clear_worst_timeout()==true){return true}else{return false}};this.__clear_worst_timeout=function(){if(this._worst_timer){clearTimeout(this._worst_timer);this._worst_timer=null}if(this._time==0){return false}return true};this.pauseTimer=function(){if(this._time==0){return true}if(this.__clear_worst_timeout()==true){this.__clear_timeout();this._worst_timer=setTimeout("obj_AutoLogout.resumeTimer();",this._worst_time);return true}else{return false}};this.fromMinutesToMSeconds=function(A){if(A<=0){return A}var B=(A*60);if(this._notify_user==true){B=B-this._notify_time}return(B*1000)};this.refreshTimeout=function(B,A){if(!B){if(this._mutex==true){return false}doAjaxAction(this._page_request_reciver,"task=get_auto_logout_params&","",function(D){obj_AutoLogout.refreshTimeout(D)},0)}else{var C=parseJSON(B);if((!C.auto_logout&&C.auto_logout!=0)||(!C.worst_case_pause&&C.worst_case_pause!=0)){throw"Bad response from php side"}this._worst_time=this.fromMinutesToMSeconds(C.worst_case_pause);this._time=this.fromMinutesToMSeconds(C.auto_logout);obj_AutoLogout.restartTimer();this._mutex=false}};this.__set_timeout=function(){if(this._worst_timer){return true}this._timer=setTimeout("obj_AutoLogout.tickTimer();",this._time);if(this._timer){return true}return false};this.__clear_timeout=function(){if(!this._timer||this._worst_timer){return true}clearTimeout(this._timer);this._timer=null;return true};this.destructor=function(){if(this.__clear_timeout()==true){obj_autologout=null}else{return false}return true}};
var DHTML=(document.getElementById||document.all||document.layers);var tmpImageLoader=document.getElementById("tmpImageLoader_Image");var numsStr="0123456789";var can_start=0;function hideIE(A){A.style.display="none";A.style.visibility="hidden"}function showIE(A){A.style.display="block";A.style.visibility="visible"}function isIE(){return(navigator.appName=="Microsoft Internet Explorer"&&navigator.userAgent.indexOf("Opera")<0)}function getIEVer(){version=999;if(navigator.appVersion.indexOf("MSIE")!=-1){version=parseFloat(navigator.appVersion.split("MSIE")[1])}return version}function fixIEScroll(A){if(isIE()&&(A.firstChild.clientHeight-10>A.clientHeight)){A.style.overflowY="scroll";if(getIEVer()<8){A.firstChild.style.width="98%"}}else{if(isIE()){A.style.overflowY="auto";A.firstChild.style.width="100%"}}}function isIEObject(A){return isObject(A)&&typeof A.constructor!="function"}function isArray(A){return isObject(A)&&A.constructor==Array}function isBoolean(A){return typeof A=="boolean"}function isEmpty(B){if(isObject(B)){for(var A in B){return false}}return true}function isFunction(A){return typeof A=="function"}function isNull(A){return typeof A=="object"&&!A}function isNumber(A){return typeof A=="number"&&isFinite(A)}function isDigit(A){return(numsStr.indexOf(A)>-1)}function isObject(A){return(typeof A=="object"&&!!A)||isFunction(A)}function isString(A){return typeof A=="string"}function isUndefined(A){return typeof A=="undefined"}function getRandom(){return Math.floor(Math.random()*10001)+"_"+Math.floor(Math.random()*10001)}function putElementContent(A,B){if(document.getElementById){x=document.getElementById(B);x.innerHTML="";x.innerHTML=A}else{if(document.all){x=document.all[B];x.innerHTML=A}else{if(document.layers){x=document.layers[B];text2='<P CLASS="testclass">'+A+"</P>";x.document.open();x.document.write(text2);x.document.close()}}}}function SetupBrowser(){var A=navigator.userAgent.toLowerCase();this.mac=(A.indexOf("mac")!=-1);this.win=!this.mac;this.winax=(window.ActiveXObject)?true:false;this.w3c=(document.getElementById)?true:false;this.iex=(document.all)?true:false;this.ns4=(document.layers)?true:false;this.images=(document.images)?true:false;this.ce=(document.createElement)?true:false;this.AllProps=function(){return("Agent: "+this.agent+"\nActiveXObject: "+winax+"\nW3C:"+this.w3c+"\nIEX:"+this.iex+"\nNetscape4:"+this.ns4+"\nimages:"+this.images+"\ncreateElement:"+this.ce)}}function numeralsOnly(A){A=(A)?A:event;var B=(A.charCode)?A.charCode:((A.keyCode)?A.keyCode:((A.which)?A.which:0));if(B>31&&(B<48||B>57)){alert("Enter numerals only in this field.");return false}return true}function lettersOnly(A){A=(A)?A:event;var B=(A.charCode)?A.charCode:((A.keyCode)?A.keyCode:((A.which)?A.which:0));if(B>31&&(B<65||B>90)&&(B<97||B>122)){alert("Enter letters only.");return false}return true}function ynOnly(A){A=(A)?A:event;var B=(A.charCode)?A.charCode:((A.keyCode)?A.keyCode:((A.which)?A.which:0));if(B>31&&B!=78&&B!=89&&B!=110&&B!=121){alert('Enter "Y" or "N" only.');return false}return true}function Left(A,B){if(B<=0){return""}else{if(B>String(A).length){return A}else{return String(A).substring(0,B)}}}function Right(B,C){if(C<=0){return""}else{if(C>String(B).length){return B}else{var A=String(B).length;return String(B).substring(A,A-C)}}}var showWaitMsg_Mode=true,showWaitForceClose=null;function showWaitMsg(D,C,A,B){clearTimeout(showWaitForceClose);showWaitMsg_Mode=D;if(D){B=(B>0)?B:60000;C=(A&&typeof C!="undefined"&&C!="undefined")?C:"";document.getElementById("showWait_Custom").innerHTML=C;showWaitForceClose=setTimeout("showWaitMsg(false, 'force close')",B);objshowWait_Msg.style.display="block";centerPopup(objshowWait_Msg);document.getElementById("FloatMask_Wait").style.display="block"}else{if(objshowWait_Msg.style.display!="none"){objshowWait_Msg.style.display="none";document.getElementById("FloatMask_Wait").style.display="none"}}}var showErrorMsg_Mode=true;function showErrorMsg_Clocker(onclose_callback){if(showErrorMsg_Mode){objshowError_Msg.style.display="block";centerPopup(objshowError_Msg);document.getElementById("FloatMask_Error").style.display="block";close_button=document.getElementById("btnError_TryAgain");if(typeof onclose_callback!="undefined"&&onclose_callback!="undefined"&&onclose_callback!=""){try{eval("close_button.onclick = function () {showErrorMsg(false);"+onclose_callback+"();func_Alarms_CheckStatus(true);}")}catch(e){}}else{close_button.onclick=function(){showErrorMsg(false);func_Alarms_CheckStatus(true)}}try{close_button.focus()}catch(e){}}else{if(objshowError_Msg.style.display!="none"){objshowError_Msg.style.display="none";document.getElementById("FloatMask_Error").style.display="none"}}}function showErrorMsg(A){if(A){objerrMsgContent.innerHTML=errMsgContent_Default}showErrorMsg_Mode=A;if(A){setTimeout("showErrorMsg_Clocker();",50)}else{showErrorMsg_Clocker()}}function showNotificationWithTimer(F,E,G,C,A){if(typeof isNotify=="undefined"){isNotify=false}var D="error_timer";showErrCustomMsg(F+"<span id='"+D+"'>"+G+"</span>",false,C);var B=setInterval("__showNotificationWithTimerUpdater('"+D+"','"+A+"');",1000);return B}function __showNotificationWithTimerUpdater(div_timer_id,tick_function){var obj=document.getElementById(div_timer_id);var time=obj.innerHTML;if(time<1){return eval(tick_function+"();")}else{obj.innerHTML=time-1}}function showErrCustomMsg(C,A,B){if(typeof A=="undefined"){A=false}objerrMsgContent.innerHTML=C;showErrorMsg_Mode=true;setTimeout("showErrorMsg_Clocker('"+B+"');",50)}function printDebug(){}function getArrayElementID(A,B){for(elm in A){if(A[elm]==B){return(elm)}}return(0)}function IsEmail(A){return(A.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)!=-1)}function IsPhone(A,B){symbols="0123456789";if(B){symbols+="+";if(A.indexOf("+",1)!=-1){return false}if(A.indexOf("+")!=-1&&A.length==1){return false}}return(ChkStrBy(A,symbols))}function IsAlphaNumeric(A){return(A.search(/^[A-Za-z0-9]+$/)!=-1)}function ChkStrBy(B,C){var A=true;if(B.length==0){return(false)}for(i=0;i<(B.length)&&(A==true);i++){if(C.indexOf(B.charAt(i))==-1){A=false}}return(A)}function countSubnetMask(A){ipPattern=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;triads=A.match(ipPattern);if(triads==null){return -1}size=32;found_zero=0;for(i=1;i<=4;i++){if(found_zero&&triads[i]!=0){return -1}switch(Number(triads[i])){case 255:size-=8;break;case 254:size-=7;found_zero=1;break;case 252:size-=6;found_zero=1;break;case 248:size-=5;found_zero=1;break;case 240:size-=4;found_zero=1;break;case 224:size-=3;found_zero=1;break;case 192:size-=2;found_zero=1;break;case 128:size-=1;found_zero=1;break;case 0:found_zero=1;break;default:return -1}}return size}function IsIP(A){ipPattern=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;if(triads=A.match(ipPattern)){if(triads[1]>0&&triads[1]<=223&&triads[4]>0&&triads[4]<255&&triads[2]>=0&&triads[2]<=255&&triads[3]>=0&&triads[3]<=255){return true}}else{return false}}function isIpSubnet(B,C,A){ipPattern=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;if((B=B.match(ipPattern))&&(C=C.match(ipPattern))&&(A=A.match(ipPattern))){B=(+B[1]<<24)+(+B[2]<<16)+(+B[3]<<8)+(+B[4]);C=(+C[1]<<24)+(+C[2]<<16)+(+C[3]<<8)+(+C[4]);A=(+A[1]<<24)+(+A[2]<<16)+(+A[3]<<8)+(+A[4]);return((B&A)==(C&A))}else{return false}}function IsHex(A){return(A.search(/^[A-Fa-f0-9]+$/)!=-1)}function splitString(C,A){if(document.all){return(C)}var B=0;B=B+A;while(B<C.length){C=C.substring(0,B-1)+"\n"+C.substring(B-1);B=B+A+1}return(C)}function hintString(B,A){if(B.length>A){B='<span title="'+B+'">'+B.substring(0,A-1)+"...</span>"}return(B)}var tmpImgElement;function imagesCache_New(B){try{tmpImgElement=document.createElement("img");tmpImgElement.src="/web/img/"+B}catch(A){}};
var xmlhttp;var xhttp;var ajaxBusy=false;var ajaxBusyStallTimer=null;function ajaxMutex(A){if(A==true){if(ajaxBusy){return false}ajaxBusy=true;ajaxBusyStallTimer=setTimeout("ajaxMutex(false)",30000);return true}clearTimeout(ajaxBusyStallTimer);ajaxBusy=false;return true}function doAjaxAction(A,C,G,E,F){if(!ajaxMutex(true)){if(A.indexOf("alarm.chkstatus.ajax.php")==-1){setTimeout(function(){doAjaxAction(A,C,G,E,F)},700)}return false}if((G!="")&&document.getElementById(G)){var B=document.getElementById(G).innerHTML}if(window.XMLHttpRequest){try{xmlhttp=new XMLHttpRequest()}catch(D){xmlhttp=false}}else{if(window.ActiveXObject){try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP")}catch(D){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")}catch(D){xmlhttp=false}}}}if(xmlhttp){xmlhttp.open("POST",A,true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){if(xmlhttp.status==200){if((G!="")&&document.getElementById(G)){document.getElementById(G).innerHTML=xmlhttp.responseText}else{if(typeof E=="function"){try{if(!F){E(xmlhttp.responseText)}else{E(xmlhttp.responseXML)}}catch(H){}}}}ajaxMutex(false)}};xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xmlhttp.send(C);return(true)}else{alert("error init");return(false)}}function runSet_Back(A){}function parseJSON(ajax){eval("var json = "+ajax);return json};
var objareaAlarms_Main_Title,objareaAlarms_Main_Images;var was_InAlarmsScreen=true;var should_ShowAlarmsDetails=false;var is_InAlarmsScreen=false;var is_InAlarmsCamerasScreen=false;var areaAlarms_TimerID=0;var areaAlarms_Text_Array,areaAlarms_Text_Array_Index=0;var arr_Alarms_Array;function func_Alarms_Main_onLoad(){func_Alarms_Main_ShineText();if(areaAlarms_TimerID==0){areaAlarms_TimerID=setInterval("func_Alarms_Main_ShineText()",PHP_TIMER_ALARMS_SHOWTXT)}is_InAlarmsScreen=true}function func_Alarms_Main_onUnload(){try{clearInterval(areaAlarms_TimerID);areaAlarms_TimerID=0}catch(A){}}function func_Alarms_Cameras_onLoad(){func_Cameras_Obj_onLoad("Alarm")}function func_Alarms_Cameras_onUnload(){func_Cameras_Obj_onUnload("Alarm")}function func_Alarms_Main_Close(){was_InAlarmsScreen=true;is_InAlarmsScreen=false;func_Alarms_Main_onUnload();cngPanel("pnlMain")}function func_Alarms_Mute(){doAjaxAction("ajax/alarm.main.mute.ajax.php","","",runSet_Back)}function func_Alarms_Lights_On(){sendStr="";flag_remove_comma=false;for(i in arr_Home_Devices){if(arr_Home_Devices[i]["func"]==PHP_HOME_FUNC_LIGHTS){sendStr+=i.substring(2)+",";flag_remove_comma=true}}if(flag_remove_comma){sendStr=sendStr.substring(0,sendStr.length-1)}sendStr="mode=on&devices="+sendStr;doAjaxAction("ajax/alarm.main.lights.ajax.php",sendStr,"",runSet_Back)}function func_Alarms_Lights_Off(){sendStr="";for(i in arr_Home_Devices){if(arr_Home_Devices[i]["func"]==PHP_HOME_FUNC_LIGHTS){sendStr+=i.substring(2)+","}}sendStr="mode=off&devices="+sendStr;doAjaxAction("ajax/alarm.main.lights.ajax.php",sendStr,"",runSet_Back)}function func_Alarms_Show_Panel(){document.getElementById("pnlMain").style.display="none";setTimeout("objscrnAlarm_AlarmMain.style.display = 'block'",10);func_Alarms_Main_onLoad()}function func_Alarms_Hide_Panel(){func_Alarms_Main_onUnload();document.getElementById("pnlMain").style.display="block";objscrnAlarm_AlarmMain.style.display="none"}function func_Alarms_Cameras(){func_Alarms_Hide_Panel();cngAlarmCameras(true)}function func_Alarms_Cameras_Close(){func_Alarms_Show_Panel();cngAlarmCameras(false)}function func_Alarms_Disarm(){doAjaxAction("ajax/security.main.status.ajax.php","set=Disarm","",runSet_Back)}function func_Alarms_Main_ShineText(){try{if(areaAlarms_Text_Array instanceof Array){areaAlarms_Text_Array_Index++;if(areaAlarms_Text_Array_Index>=areaAlarms_Text_Array.length){areaAlarms_Text_Array_Index=0}objareaAlarms_Main_Title.innerHTML=areaAlarms_Text_Array[areaAlarms_Text_Array_Index]}}catch(A){}}function func_Alarms_UpdateDisplay(){if(arr_Alarms_Array.length==1){document.getElementById("areaAlarms_Content_Holder").className="";document.getElementById("areaAlarms_One_Image").innerHTML='<img src="/web/img/empty.gif" class="i_alarm" id="'+arr_Alarms_Array[0]["img_id"]+'">';document.getElementById("areaAlarms_Main_Images").innerHTML="";document.getElementById("areaAlarms_Main_Images").style.display="none";areaAlarms_Text_Array=new Array(arr_Alarms_Array.length);areaAlarms_Text_Array=objareaAlarms_Main_Title.innerHTML=arr_Alarms_Array[0]["text"];objareaAlarms_Main_Title.style.height="120px"}else{document.getElementById("areaAlarms_Main_Images").innerHTML="";areaAlarms_Text_Array=new Array(arr_Alarms_Array.length);var B="";var A="";temp_count=0;for(i=0;i<arr_Alarms_Array.length;i++){if(B.indexOf(arr_Alarms_Array[i]["small"])==-1){temp_count++;B=B+","+arr_Alarms_Array[i]["small"];A+='<img src="/web/img/empty.gif" class="i_alarm_s" id="'+arr_Alarms_Array[i]["img_id"]+'">'}areaAlarms_Text_Array[i]=arr_Alarms_Array[i]["text"]}if(temp_count==1){document.getElementById("areaAlarms_Content_Holder").className="";document.getElementById("areaAlarms_One_Image").innerHTML='<img src="/web/img/empty.gif" class="i_alarm" id="'+arr_Alarms_Array[0]["img_id"]+'">';document.getElementById("areaAlarms_Main_Images").innerHTML="";objareaAlarms_Main_Title.style.height="120px";document.getElementById("areaAlarms_Main_Images").style.display="none"}else{document.getElementById("areaAlarms_Content_Holder").className="textC";document.getElementById("areaAlarms_One_Image").innerHTML="";document.getElementById("areaAlarms_Main_Images").innerHTML=A;document.getElementById("areaAlarms_Main_Images").style.display="block";objareaAlarms_Main_Title.style.height="85px"}areaAlarms_Text_Array_Index=0}}function func_Alarms_Popup(A){if(A&&!isCanCngScreen&&!confirm(PHP_CNGSCREEN_CONFIRM)){return }showFloat(0);func_Alarms_UpdateDisplay();cngPanel("pnlAlarm",0);func_Alarms_Main_onLoad()};
function chkInlineStatusHome(){xmlSection_Home_Section=null;xmlSection_Home_Collection=null;temp_is_sec=false;temp_home_count=0;if(sysCheckBy==PHP_STATUS_CHECK_CONFIG){arr_Home_Devices=new Array();temp_is_sec=false;xmlSection_Home_Section=null;try{xmlSection_Home_Collection=xmlDoc.getElementsByTagName(sysCheckBy).item(0).getElementsByTagName("home_device");temp_home_count=xmlSection_Home_Collection.length}catch(A){xmlSection_Home_Collection=null;temp_home_count=0}}else{try{xmlSection_Home_Section=xmlDoc.getElementsByTagName("home_devices").item(0);temp_is_sec=(xmlSection_Home_Section!=null)}catch(A){xmlSection_Home_Section=null;temp_is_sec=false}if(temp_is_sec){try{xmlSection_Home_Collection=xmlSection_Home_Section.getElementsByTagName("home_device");if(xmlSection_Home_Collection!=null){temp_home_count=xmlSection_Home_Collection.length}else{temp_home_count=0}}catch(A){xmlSection_Home_Collection=null;temp_home_count=0}}else{xmlSection_Home_Collection=null;temp_home_count=0}}if(temp_home_count==0&&xmlDoc.getElementsByTagName("configuration").length>0){temp_is_sec=true}if(temp_home_count>0||temp_is_sec){tmp="";if(sysCheckBy==PHP_STATUS_CHECK_CONFIG){home_Location_UsedNum=0;arr_Home_Devices=new Array(temp_home_count);tmp_arr=new Array()}for(temp_index=0;temp_index<temp_home_count;temp_index++){temp_obj=xmlSection_Home_Collection.item(temp_index);try{temp[0]=(t=temp_obj.getElementsByTagName("index"))?(t.item(0).firstChild.data):""}catch(A){temp[0]=""}try{temp[1]=(t=temp_obj.getElementsByTagName("name"))?(t.item(0).firstChild.data):""}catch(A){temp[1]=""}try{temp[2]=(t=temp_obj.getElementsByTagName("status"))?(t.item(0).firstChild.data):""}catch(A){temp[2]=""}try{temp[3]=(t=temp_obj.getElementsByTagName("status_bool"))?(t.item(0).firstChild.data):""}catch(A){temp[3]=""}try{temp[4]=(t=temp_obj.getElementsByTagName("functionality"))?(t.item(0).firstChild.data):""}catch(A){temp[4]=""}try{temp[5]=(t=temp_obj.getElementsByTagName("location"))?(t.item(0).firstChild.data):""}catch(A){temp[5]=""}if(temp[0]>0){if(sysCheckBy==PHP_STATUS_CHECK_CONFIG){arr_Home_Devices["h_"+temp[0]]=new Array(5)}temp[4]=getArrayElementID(arr_Home_DvcTypes,temp[4]);temp[5]=getArrayElementID(arr_Home_DvcLocs,temp[5]);arr_Home_Devices["h_"+temp[0]]["status"]=temp[2];arr_Home_Devices["h_"+temp[0]]["statusbool"]=temp[3];arr_Home_Devices["h_"+temp[0]]["id"]=temp[0];if(sysCheckBy==PHP_STATUS_CHECK_CONFIG){arr_Home_Devices["h_"+temp[0]]["name"]=temp[1];arr_Home_Devices["h_"+temp[0]]["func"]=temp[4];arr_Home_Devices["h_"+temp[0]]["loc"]=temp[5];if(typeof tmp_arr[temp[5]]=="undefined"){tmp_arr[temp[5]]=new Array()}tmp_arr[temp[5]][tmp_arr[temp[5]].length]=arr_Home_Devices["h_"+temp[0]];if(tmp.indexOf("home_Loc_"+arr_Home_Devices["h_"+temp[0]]["loc"]+'"')==-1){home_Location_UsedNum++;tmp=tmp+crtBtn_Square(arr_Home_DvcLocs[arr_Home_Devices["h_"+temp[0]]["loc"]],'onclick="func_Home_Loc_CngLoc('+arr_Home_Devices["h_"+temp[0]]["loc"]+');return false;"',"home_Loc_"+arr_Home_Devices["h_"+temp[0]]["loc"],"home_LocsList_"+home_Location_UsedNum,((home_Location_UsedNum>home_Location_Visible)?' style="display:none"':""))}}}}arr_Home_Devices=new Array(temp_home_count);for(i in tmp_arr){for(j in tmp_arr[i]){if(typeof arr_Home_Devices["h_"+tmp_arr[i][j]["id"]]=="undefined"){arr_Home_Devices["h_"+tmp_arr[i][j]["id"]]=new Array()}arr_Home_Devices["h_"+tmp_arr[i][j]["id"]]=tmp_arr[i][j]}}if(sysCheckBy==PHP_STATUS_CHECK_CONFIG){objwrap_Home_Loc_LocsList.innerHTML=tmp;func_Home_Edit_onLoad()}func_Home_LoadLists_Quickview();func_Home_LoadLists_byStatus();func_Home_LoadLists_byType();func_Home_LoadLists_byLocation();func_Home_DoSearch();if(showWaitMsg_Mode){showWaitMsg(false,"home update - 1")}}};
function chkInlineStatusCameras(){temp_cams_count=cameras_CamsNum;is_cameras_update=false;try{if(xmlSection_Cameras_Section=xmlDoc.getElementsByTagName("cameras").item(0)){if(xmlSection_Cameras_Collection=xmlSection_Cameras_Section.getElementsByTagName("camera")){arr_Cameras_Cameras=func_Cameras_BuildArray(xmlSection_Cameras_Collection);temp_cams_count=xmlSection_Cameras_Collection.length;is_cameras_update=true}else{temp_cams_count=cameras_CamsNum}}}catch(A){temp_cams_count=cameras_CamsNum}if(is_cameras_update){if(showWaitMsg_Mode){showWaitMsg(false,"cameras update")}if(showErrorMsg_Mode){showErrorMsg(false)}cameras_CamsNum=temp_cams_count;tmp="";if(cameras_CamsNum>0){tmp=_wrap_Cameras_Quickview(xmlSection_Cameras_Collection,cameras_CamsNum)}objwrap_Quick_Cameras.innerHTML=tmp;arr_Cameras_Cameras=func_Cameras_BuildArray(xmlSection_Cameras_Collection);func_Cameras_Edit_Reset()}};
function chkInlineStatusSecurity(){last_isArmAwayMode=isArmAwayMode;isArmAwayMode=false;is_update=false;try{if(xmlDoc.getElementsByTagName("update").item(0)){is_update=true}}catch(A){}try{if((xmlDoc.getElementsByTagName(sysCheckBy).item(0).getElementsByTagName("system").item(0).getElementsByTagName("arm").item(0).firstChild.data==1)&&(xmlDoc.getElementsByTagName(sysCheckBy).item(0).getElementsByTagName("system").item(0).getElementsByTagName("away").length==1)){isArmAwayMode=true}else{isArmAwayMode=false}last_isArmAwayMode=isArmAwayMode}catch(A){isArmAwayMode=last_isArmAwayMode}if(base!=""){if(base=="ArmBypass"){base="ArmAway"}else{if(base=="ArmHomeBypass"){base="ArmHome"}}if(document.getElementById("i"+security_CurrentArmMode)){document.getElementById("i"+security_CurrentArmMode).className=""}if(document.getElementById("i"+base)){document.getElementById("i"+base).className="on"}security_CurrentArmMode=base;last_security_CurrentArmMode=security_CurrentArmMode;security_ClickedArmMode=""}if(isArmAwayMode){try{clearTimeout(system_Status_Shine_Timer);system_Status_Shine_Timer=0}catch(A){}document.getElementById("fltSecurityReadyOrNot").className="security";try{objsecurity_Panel_Text.innerHTML=xmlDoc.getElementsByTagName(sysCheckBy).item(0).getElementsByTagName("system").item(0).getElementsByTagName("status").item(0).firstChild.data}catch(A){}}else{try{if(secPnlStr=xmlDoc.getElementsByTagName(sysCheckBy).item(0).getElementsByTagName("system").item(0).getElementsByTagName("status").item(0).firstChild.data){if(xmlDoc.getElementsByTagName(sysCheckBy).item(0).getElementsByTagName("system").item(0).getElementsByTagName("not_ready").item(0)){document.getElementById("fltSecurityReadyOrNot").className=""}else{document.getElementById("fltSecurityReadyOrNot").className="security"}func_System_Rebuild();func_System_AddStatus(secPnlStr);try{func_System_AddStatus(xmlDoc.getElementsByTagName(sysCheckBy).item(0).getElementsByTagName("system").item(0).getElementsByTagName("memory").item(0).firstChild.data)}catch(A){}try{func_System_AddStatus(xmlDoc.getElementsByTagName(sysCheckBy).item(0).getElementsByTagName("system").item(0).getElementsByTagName("trouble").item(0).firstChild.data)}catch(A){}try{func_System_AddStatus(xmlDoc.getElementsByTagName(sysCheckBy).item(0).getElementsByTagName("system").item(0).getElementsByTagName("last10secs").item(0).firstChild.data)}catch(A){}if(system_Status_Shine_Timer==0){system_Status_Shine_Timer=setInterval("func_System_Shine()",PHP_TIMER_SYSTEM_SHINE)}}}catch(A){}}temp_security_count=0;temp_is_sec=false;try{if(xmlSection_Detectors_Section=xmlDoc.getElementsByTagName("detectors").item(0)){temp_is_sec=true;xmlSection_Detectors_Collection=xmlSection_Detectors_Section.getElementsByTagName("detector");temp_security_count=xmlSection_Detectors_Collection.length}}catch(A){}if(temp_is_sec){if(temp_security_count>0){security_Shine_Arr=new Array(xmlSection_Detectors_Collection.length);security_Shine_Index_Arr=new Array(xmlSection_Detectors_Collection.length);tmp="";for(secutiry_temp_index=0;secutiry_temp_index<xmlSection_Detectors_Collection.length;secutiry_temp_index++){temp_obj=xmlSection_Detectors_Collection.item(secutiry_temp_index);try{temp[0]=temp_obj.getElementsByTagName("loc").item(0).firstChild.data}catch(A){temp[0]=""}try{temp[1]=temp_obj.getElementsByTagName("zone").item(0).firstChild.data}catch(A){temp[1]=""}try{temp[2]=temp_obj.getElementsByTagName("type").item(0).firstChild.data}catch(A){temp[2]=""}try{temp[3]=temp_obj.getElementsByTagName("status").item(0).firstChild.data}catch(A){temp[3]=""}try{temp[4]=temp_obj.getElementsByTagName("isalarm").item(0).firstChild.data}catch(A){temp[4]=""}if(temp[3]=="undefined"||typeof temp[3]=="undefined"){temp[3]=""}if(temp_obj.getElementsByTagName("status").item(0).firstChild&&temp_obj.getElementsByTagName("status").item(0).firstChild.nodeName!="#text"){add_status=temp_obj.getElementsByTagName("status").item(0).firstChild.nodeName;if(add_status=="ac_failure"){add_status=PHP_AC_FAILURE}temp[3]=(temp[3]!="")?temp[3]+","+add_status:add_status}first_status="";if(temp[3]!=""){first_status=temp[3];offset=temp[3].indexOf(",");if(offset>0){first_status=temp[3].substring(0,offset)}}else{temp[3]=PHP_STRINGS_ok;first_status=temp[3]}setLocationByzone(temp[1],temp[0],temp[2],temp[3],temp[4]);tmp+=_wrap_Security_Detectors_Inner(temp[0],temp[1],temp[2],first_status,(temp[4]=="yes"),secutiry_temp_index);try{security_Shine_Arr[secutiry_temp_index]=temp[3].split(",")}catch(A){security_Shine_Arr[secutiry_temp_index]=new Array(0)}security_Shine_Index_Arr[secutiry_temp_index]=0}objwrap_Security_Detectors.innerHTML=_wrap_Security_Detectors_Begin()+tmp+_wrap_Security_Detectors_End()}else{objwrap_Security_Detectors.innerHTML="";try{clearTimeout(security_Shine_Timer);security_Shine_Timer=0}catch(A){}}}temp_security_count=0;temp_is_sec=false;xmlSection_Sensors_Section=null;try{if(xmlSection_Sensors_Collection=xmlDoc.getElementsByTagName(sysCheckBy).item(0).getElementsByTagName("sensors")){temp_security_count=xmlSection_Sensors_Collection.length}}catch(A){}if(temp_security_count>0){arr_Sensors_Array=new Array();for(secutiry_temp_index=0;secutiry_temp_index<temp_security_count;secutiry_temp_index++){temp_obj=xmlSection_Sensors_Collection.item(secutiry_temp_index);try{temp[0]=temp_obj.getElementsByTagName("index").item(0).firstChild.data}catch(A){temp[0]=""}try{temp[1]=temp_obj.getElementsByTagName("location").item(0).firstChild.data}catch(A){temp[1]=""}if(temp[0]!=""){arr_Sensors_Array[temp[0]]=new Array();arr_Sensors_Array[temp[0]]["loc"]=temp[1]}try{temp[2]=temp_obj.getElementsByTagName("status");for(i=0;i<temp[2].length;i++){if(temp[2][i].firstChild.data=="Open"){func_System_AddStatus(getLocationByZone([temp[0]])+" Open");break}}}catch(A){temp[2]=""}}}temp_security_count=0;temp_is_sec=false;try{if(xmlSection_Faileds_Section=xmlDoc.getElementsByTagName("faileds").item(0)){temp_is_sec=true;xmlSection_Faileds_Collection=xmlSection_Faileds_Section.getElementsByTagName("failed");temp_security_count=xmlSection_Faileds_Collection.length}}catch(A){}if(is_update){security_Access_Shine_Arr=new Array(SecurityAccessoriesList.length);security_Access_Shine_Index_Arr=new Array(SecurityAccessoriesList.length);if(accessories_status){for(secutiry_temp_index=0;secutiry_temp_index<SecurityAccessoriesList.length;secutiry_temp_index++){if(typeof SecurityAccessoriesList[secutiry_temp_index]!="undefined"){update_Security_Access_Inner(SecurityAccessoriesList[secutiry_temp_index],"");security_Access_Shine_Arr[secutiry_temp_index]=new Array(PHP_STRINGS_ok);security_Access_Shine_Index_Arr[secutiry_temp_index]=0}}accessories_status=false}if(temp_security_count>0){accessories_status=true;for(secutiry_temp_index=0;secutiry_temp_index<xmlSection_Faileds_Collection.length;secutiry_temp_index++){temp_obj=xmlSection_Faileds_Collection.item(secutiry_temp_index);try{temp[0]=temp_obj.getElementsByTagName("type").item(0).firstChild.data}catch(A){temp[0]=""}try{temp[1]=temp_obj.getElementsByTagName("status").item(0).firstChild.data}catch(A){temp[1]=""}if(temp[1]=="undefined"||typeof temp[1]=="undefined"){temp[1]=""}first_status="";if(temp[1]!=""){first_status=temp[1];offset=temp[1].indexOf(",");if(offset>0){first_status=temp[1].substring(0,offset)}}else{temp[1]=PHP_STRINGS_ok;first_status=temp[1]}update_Security_Access_Inner(temp[0],first_status);acc_idx=get_Security_Access_Index(temp[0]);if(acc_idx>=0){try{security_Access_Shine_Arr[acc_idx]=temp[1].split(",")}catch(A){security_Access_Shine_Arr[acc_idx]=new Array(0)}security_Access_Shine_Index_Arr[acc_idx]=0}}}}else{if(temp_is_sec){security_Access_Shine_Arr=new Array(temp_security_count);security_Access_Shine_Index_Arr=new Array(temp_security_count);objwrap_Security_Access.innerHTML="";if(temp_security_count>0){accessories_status=true;tmp="";for(secutiry_temp_index=0;secutiry_temp_index<xmlSection_Faileds_Collection.length;secutiry_temp_index++){temp_obj=xmlSection_Faileds_Collection.item(secutiry_temp_index);try{temp[0]=temp_obj.getElementsByTagName("type").item(0).firstChild.data}catch(A){temp[0]=""}try{temp[1]=temp_obj.getElementsByTagName("status").item(0).firstChild.data}catch(A){temp[1]=""}SecurityAccessoriesList[secutiry_temp_index]=temp[0];first_status="";if(typeof temp[1]!="undefined"&&temp[1]!=""){first_status=temp[1];offset=temp[1].indexOf(",");if(offset>0){first_status=temp[1].substring(0,offset)}}else{temp[1]=PHP_STRINGS_ok;first_status=temp[1]}tmp+=_wrap_Security_Access_Inner(temp[0],first_status);try{security_Access_Shine_Arr[secutiry_temp_index]=temp[1].split(",")}catch(A){security_Access_Shine_Arr[secutiry_temp_index]=new Array(0)}security_Access_Shine_Index_Arr[secutiry_temp_index]=0}objwrap_Security_Access.innerHTML=_wrap_Security_Access_Begin()+tmp+_wrap_Security_Access_End()}}}};
var Alarms_StatusCheck_TimerID;var setup_PLID_Timer=0,setup_SysLog_Timer=0;var currStatusIndex=0;var lastCheckedSystemStatusID=-1;var syschk_IsFirstTime=true;var is_cameras_update=false;var armStatusId="",armStatusIdOld;var SecurityAccessoriesList=new Array(64);var accessories_status=false;var xmlSection_Home_Collection,xmlSection_Home_Section,xmlSection_Cameras_Collection,xmlSection_Cameras_Section,xmlSection_Alerts_Section,xmlSection_Alerts_Collection,xmlSection_Alarms_Section,xmlSection_Alarms_Collection,xmlSection_Sensors_Section,xmlSection_Sensors_Collection,xmlSection_Detectors_Section,xmlSection_Detectors_Collection,xmlSection_Faileds_Section,xmlSection_Faileds_Collection,xmlSection_System_Section,xmlSection_System_Collection,xmlSection_Update_Section,xmlSection_Update_Collection,xmlSection_Conf_Section,xmlSection_Conf_Collection,xmlSection_Users_Section,xmlSection_Users_Collection,xmlSection_Setup_Section,xmlSection_Setup_Collection;xmlDoc=null;var temp=new Array();var temp_count,temp_cams_count,temp_alarms_count,temp_users_count,temp_home_count,temp_security_count;var temp_obj,temp_is_sec;var temp_is_ALARMS_sec;var enroll_Final_Func_Timeout=false,enroll_Final_Func_Ok=false,enroll_Final_Func_Err=false;var flag_Finished_Enrolling=false,flag_Finished_Enrolling_Wifi=false,flag_Finished_Enrolling_Lan=false;var func_setCameraEnrollClock_isDone=false;var enroll_Final_Func_isCustom=false;var call_func_error=0;var server_not_response=0;var isArmAwayMode=false,last_isArmAwayMode=false;var timer_tick=0;var statusCheckTimeout=null;var checkDeny=false;function func_Alarms_CheckStatus(A){clearTimeout(statusCheckTimeout);if(A){startTimers()}if(!isAjaxTimerRunning&&!checkDeny){isAjaxTimerRunning=true;ajaxTimer=setTimeout("ajaxTimeout(false)",PHP_TIMEOUT_MAIN_CHKSTAT*(syschk_IsFirstTime==true?2:1));syschk_IsFirstTime=false;if((setup_PLID_Timer>0)||(setup_SysLog_Timer>0)){try{clearTimeout(ajaxCommTimer);ajaxCommTimer=0}catch(B){}}else{lastCheckedSystemStatusID=currStatusIndex;send_param="curindex="+currStatusIndex+"&sesid="+sesid+"&sesusername="+sesusername+"&sesusermanager="+sesusermanager;if(call_func_error==0){call_func_error=1;server_not_response=0;doAjaxAction("/web/ajax/alarm.chkstatus.ajax.php",send_param,"",func_Alarms_CheckStatus_Back,true)}else{doAjaxAction("/web/ajax/alarm.chkstatus.ajax.php",send_param,"",func_Alarms_CheckStatus_Back,true);if(server_not_response>PHP_TIMEOUT_MAIN_CHKSTAT_COMM){func_Alarms_serverCommError()}server_not_response++}}}};
function chkInlineStatusSecurityArmMode(){base="";bypass_mode=false;try{if(xmlDoc.getElementsByTagName(sysCheckBy).item(0).getElementsByTagName("system").item(0).getElementsByTagName("disarm").length==1){armStatusId=2;base="Disarm"}}catch(A){}try{if(xmlDoc.getElementsByTagName(sysCheckBy).item(0).getElementsByTagName("system").item(0).getElementsByTagName("bypass").length==1){bypass_mode=true}}catch(A){}try{if(xmlDoc.getElementsByTagName(sysCheckBy).item(0).getElementsByTagName("system").item(0).getElementsByTagName("away").length==1){armStatusId=0;if(bypass_mode){base="ArmBypass"}else{base="ArmAway"}}}catch(A){}try{if(xmlDoc.getElementsByTagName(sysCheckBy).item(0).getElementsByTagName("system").item(0).getElementsByTagName("home").length==1){armStatusId=1;if(bypass_mode){base="ArmHomeBypass"}else{base="ArmHome"}}}catch(A){}try{if((base=="")&&(xmlDoc.getElementsByTagName(sysCheckBy).item(0).getElementsByTagName("system").item(0).getElementsByTagName("arm").item(0).data=="0")&&(xmlDoc.getElementsByTagName(sysCheckBy).item(0).getElementsByTagName("system").item(0).getElementsByTagName("status").length==1)){armStatusId=2;base="Disarm"}}catch(A){}};
function chkInlineStatusAlarms(){temp_alarms_count=0;temp_is_ALARMS_sec=false;try{if(xmlSection_Alarms_Section=xmlDoc.getElementsByTagName("alarms").item(0)){temp_is_ALARMS_sec=true;if(xmlSection_Alarms_Collection=xmlSection_Alarms_Section.getElementsByTagName("alarm")){temp_alarms_count=xmlSection_Alarms_Collection.length}else{temp_alarms_count=0;xmlSection_Alarms_Collection=null}}else{temp_is_ALARMS_sec=false;xmlSection_Alarms_Collection=null;xmlSection_Alarms_Section=null;temp_alarms_count=0}}catch(A){xmlSection_Alarms_Section=null;xmlSection_Alarms_Collection=null;temp_alarms_count=0;temp_is_ALARMS_sec=false}if(temp_is_ALARMS_sec){arr_Alarms_Array=new Array();if(temp_alarms_count>0){for(temp_index=0;temp_index<temp_alarms_count;temp_index++){temp_obj=xmlSection_Alarms_Collection.item(temp_index);try{temp[0]=temp_obj.getElementsByTagName("module").item(0).firstChild.data}catch(A){temp[0]=""}try{temp[1]=temp_obj.getElementsByTagName("text").item(0).firstChild.data}catch(A){temp[1]=""}try{temp[2]=temp_obj.getElementsByTagName("picture_text").item(0).firstChild.data}catch(A){temp[2]=""}try{temp[3]=temp_obj.getElementsByTagName("index").item(0).firstChild.data}catch(A){temp[3]=""}try{temp[4]=temp_obj.getElementsByTagName("small_picture").item(0).firstChild.data}catch(A){temp[4]=""}try{temp[5]=temp_obj.getElementsByTagName("large_picture").item(0).firstChild.data}catch(A){temp[5]=""}arr_Alarms_Array[temp_index]=new Array();arr_Alarms_Array[temp_index]["module"]=temp[0];arr_Alarms_Array[temp_index]["text"]=temp[1];arr_Alarms_Array[temp_index]["picture"]=temp[2];arr_Alarms_Array[temp_index]["index"]=temp[3];arr_Alarms_Array[temp_index]["small"]=temp[4];arr_Alarms_Array[temp_index]["large"]=temp[5];switch(temp[5]){case"AlarmsEmergency.gif":arr_Alarms_Array[temp_index]["img_id"]="aEmergency";break;case"AlarmsFire.gif":arr_Alarms_Array[temp_index]["img_id"]="aFire";break;case"AlarmsFlood.gif":arr_Alarms_Array[temp_index]["img_id"]="aFlood";break;case"AlarmsGas.gif":arr_Alarms_Array[temp_index]["img_id"]="aGas";break;case"AlarmsPanic.gif":arr_Alarms_Array[temp_index]["img_id"]="aPanic";break;default:arr_Alarms_Array[temp_index]["img_id"]="aBurgler";break}}should_ShowAlarmsDetails=true;was_InAlarmsScreen=false;if((lastCheckedSystemStatusID==0)||(sysCheckBy!=PHP_STATUS_CHECK_CONFIG)){if(!flag_Finished_Enrolling){func_Alarms_Popup()}else{isshowquick=-1;cngPanel("pnlMain",isshowquick);if(currScreenID.indexOf("objscrnSetup_Cam")==-1){cngScreen("Cameras","_men3");func_Cameras_Goto_Edit()}}}cngSideImageUpdate()}else{if(flag_Finished_Enrolling){isshowquick=-1;cngPanel("pnlMain",isshowquick)}if(currPanelID=="pnlAlarm"){func_Alarms_Main_Close()}should_ShowAlarmsDetails=false;was_InAlarmsScreen=true;is_InAlarmsScreen=false;cngSideImageUpdate(currScreenID.substring(7,currScreenID.lastIndexOf("_")))}}};

function func_setReloginSystem(){killAllTimers();showErrCustomMsg("Time of session has expired!");window.setTimeout("document.location.href = 'login.php'",3000)}function func_Alarms_serverCommError(){call_func_error=1;killAllTimers();if(document.getElementById("checking")){document.getElementById("checking").src=web_path+"mylog.php?text=ErrorTimeOut"}showErrCustomMsg("Error with server communication occured\n\nRefresh this page to try again")}function startTimers(){checkDeny=false}function killAllTimers(){if(showWaitMsg_Mode){showWaitMsg(false,"kill timers")}if(showErrorMsg_Mode){showErrorMsg(false)}try{clearTimeout(ajaxCommTimer);ajaxCommTimer=0}catch(A){}try{clearTimeout(customTimer);customTimer=0}catch(A){}try{clearTimeout(ajaxTimer);ajaxTimer=0}catch(A){}isAjaxTimerRunning=false;try{if(typeof security_Shine_Timer!="undefined"){clearTimeout(security_Shine_Timer);security_Shine_Timer=0}}catch(A){}checkDeny=true;statusCheckTimeout=setTimeout("checkDeny = false",124000);try{clearTimeout(areaAlarms_TimerID);areaAlarms_TimerID=0}catch(A){}try{clearTimeout(alerts_Shine_Timer);alerts_Shine_Timer=0}catch(A){}try{clearTimeout(system_Status_Shine_Timer);system_Status_Shine_Timer=0}catch(A){}};

function chkInlineStatusAlerts(){temp_is_sec=false;try{if(xmlSection_Alerts_Section=xmlDoc.getElementsByTagName("alerts").item(0)){temp_is_sec=true;xmlSection_Alerts_Collection=xmlSection_Alerts_Section.getElementsByTagName("alert")}}catch(A){}if(temp_is_sec){arr_Alerts_Array=new Array();for(temp_index=0;temp_index<xmlSection_Alerts_Collection.length;temp_index++){temp_obj=xmlSection_Alerts_Collection.item(temp_index);try{temp[0]=temp_obj.getElementsByTagName("module").item(0).firstChild.data}catch(A){temp[0]=""}try{temp[1]=temp_obj.getElementsByTagName("text").item(0).firstChild.data}catch(A){temp[1]=""}try{temp[2]=temp_obj.getElementsByTagName("picture").item(0).firstChild.data}catch(A){temp[2]=""}try{temp[3]=temp_obj.getElementsByTagName("dismiss_button").item(0).firstChild.data}catch(A){temp[3]=""}arr_Alerts_Array[temp_index]=new Array();arr_Alerts_Array[temp_index]["module"]=temp[0];arr_Alerts_Array[temp_index]["text"]=temp[1];arr_Alerts_Array[temp_index]["picture"]=temp[2];arr_Alerts_Array[temp_index]["dismiss_button"]=temp[3]}alerts_Close_After_Show=false;func_Alerts_Panel_Update();if(arr_Alerts_Array.length>0&&currPanelID!="pnlAlarm"){func_Alerts_Panel_Open()}}};
var wrap_Alerts_Panel_List_FixedHeight=47;var wrap_Alerts_Panel_Inner_FixedHeight=71;var wrap_Alerts_Panel_List_Num_Limit=7;var objwrap_Alerts_Panel,objwrap_Alerts_Panel_List;var wrap_Alerts_Panel_List_Tmp="",wrap_Alerts_Panel_List_Num=0;var arr_Alerts_Array;var alerts_Shine_Timer=0;var alerts_Shine,alerts_Shine_Index;var Alerts_PosToGo=0;var alerts_Close_After_Show=false;var alerts_Panel_Closed=false;var camera_module_index=0;function alertDismiss(A){document.getElementById(A).className="gray";doAjaxAction("/web/ajax/alert.dismiss.ajax.php","id="+A,"",alertDismissBack,true)}function alertDismissBack(){}function func_Alerts_Panel_Update(){wrap_Alerts_Panel_List_Tmp="";wrap_Alerts_Panel_List_Num=0;var A="";alerts_Shine=new Array();alerts_Shine_Index=new Array();wrap_Alerts_Panel_List_Tmp=_wrap_Alerts_Panel_Start(arr_Alerts_Array.length);document.getElementById("cntAlertsFloat").innerHTML=document.getElementById("cntAlertsBtn").innerHTML="["+arr_Alerts_Array.length+"]";if(arr_Alerts_Array.length==0){wrap_Alerts_Panel_List_Tmp+=_wrap_Alerts_Panel_Entry_Not_Found()}else{for(i=0;i<arr_Alerts_Array.length;i++){wrap_Alerts_Panel_List_Tmp+=_wrap_Alerts_Panel_Entry_Inner(arr_Alerts_Array[i]["module"],arr_Alerts_Array[i]["text"],arr_Alerts_Array[i]["picture"],arr_Alerts_Array[i]["dismiss_button"])}}wrap_Alerts_Panel_List_Tmp+=_wrap_Alerts_Panel_End();objwrap_Alerts_Panel_List.innerHTML=wrap_Alerts_Panel_List_Tmp}function func_Alerts_Panel_Open(){alerts_Panel_Closed=false;showFloat(1)};
function _wrap_Alerts_Panel_Entry_Start(){return""}function _wrap_Alerts_Panel_Entry_Start_LastLine(){return""}function _wrap_Alerts_Panel_Entry_Inner(D,C,A,B){dis="";p_id="";if(B!=""){dis='<a href="#" class="AlertDismiss" onClick="alertDismiss(\''+B+"');return false;\">"+PHP_ALERTS_DISMISS+"</a>";p_id='id="'+B+'"'}ret="<p "+p_id+' style="position:relative"><strong>'+D+"</strong><br />"+C+dis+'</p><div class="hr"></div>';return(ret)}function _wrap_Alerts_Panel_Entry_Not_Found(){ret='<p class="empty">&nbsp;<br/>'+PHP_ALERTS_NOT_FOUND+'</p><div class="hr"></div>';return(ret)}function _wrap_Alerts_Panel_Entry_End(){return""}function _wrap_Alerts_Panel_Start(A){add_style=(A>4)?' style="overflow-y: auto; height:350px; position:relative"':"";ret='<div class="message clear"><div class="corn_lt"></div><div class="corn_rt"></div><div class="corn_lb"></div><div class="corn_rb"></div><div'+add_style+">";return ret}function _wrap_Alerts_Panel_End(){ret="</div></div>";return ret};
var cameras_CamsNum=0,cameras_CamsNum_Temp=-1,cameras_CurrentSlideID=0,cameras_CurrentSlideID_StateArray=new Array();var objshowSlctCamLoc_Inner,objshowSlctCamLoc_Msg;var objbtn_Cameras_Apply;var objflt_Cameras_Area_Plc_CamerasScrn,objflt_Cameras_Area_Plc_AlarmScrn,objflt_Cameras_Area;var flt_Cameras_Area_Plc_CamerasScrn_PosX=0,flt_Cameras_Area_Plc_CamerasScrn_PosY=0;var flt_Cameras_Area_Plc_AlarmScrn_PosX=0,flt_Cameras_Area_Plc_AlarmScrn_PosY=0;var fld_Cameras_Edit_CamLoc=0;var fld_Cameras_Edit_CamType=0;var arr_Cameras_Cameras,arr_Cameras_Mode,arr_Cameras_Index,arr_Cameras_Cameras_StateArray=new Array(),arr_Cameras_Mode_StateArray=new Array(),arr_Cameras_Index_StateArray=new Array();var objwrap_Cameras_Edit_List;var is_InCamerasCamerasScreen=false;var thumb_idx=frame_idx=main_frame_idx=0;var thumb_motion_timeout=null;var thumb_motion_maxtimeout=null;var main_motion_timeout=null;var main_motion_maxtimeout=null;var main_camera_errors=0;var thumb_camera_errors=0;var motion_stop=0;var off_timer=new Array(16);var on_thumb=new Array(16);function f0(A){return A<10?"0"+A:A}function getCurrentDate(){var A=new Date();return f0(A.getDate())+"/"+f0(A.getMonth()+1)+"/"+A.getFullYear()+" "+f0(A.getHours())+":"+f0(A.getMinutes())+":"+f0(A.getSeconds())}function func_cameras_thumbs_error(A){document.getElementById("cameras_thumb_"+A).style.display="none";if(!isCamAllowed(A)){document.getElementById("cameras_nd_thumb_"+A).style.display="none";document.getElementById("cameras_na_thumb_"+A).style.display="block"}else{document.getElementById("cameras_na_thumb_"+A).style.display="none";document.getElementById("cameras_nd_thumb_"+A).style.display="block"}}function cameras_thumb_toggle(A){objThumbOff=document.getElementById("cameras_thumb_off_"+A);if(objThumbOff.className=="btn_on"){objThumbOff.className="btn_off";on_thumb[A]=1}else{objThumbOff.className="btn_on";on_thumb[A]=0;clearTimeout(off_timer[A])}}function cameras_thumb_over(A,C,B){if(C==1){clearTimeout(off_timer[A]);document.getElementById("cameras_thumb_off_"+A).style.display="block"}else{if(B==1){document.getElementById("cameras_thumb_off_"+A).style.display="none"}else{if(document.getElementById("cameras_thumb_off_"+A).className=="btn_off"){off_timer[A]=setTimeout("cameras_thumb_over("+A+", 0, 1)",50)}}}}function func_Cameras_Thumbs_Motion(cam_num,Scrn){clearTimeout(thumb_motion_timeout);clearTimeout(thumb_motion_maxtimeout);if(document.getElementById("cameras_thumb_off_"+thumb_idx)){if(motion_stop){return }thumb_idx++;if(thumb_idx>=cam_num){thumb_idx=0;frame_idx++}if(document.getElementById("cameras_thumb_off_"+thumb_idx).className=="btn_on"){thumb_motion_timeout=setTimeout("func_Cameras_Thumbs_Motion('"+cam_num+"', '"+Scrn+"')",1000);return }if(frame_idx>13){frame_idx=0}cam_id=xmlSection_Cameras_Collection.item(thumb_idx).getElementsByTagName("index").item(0).firstChild.data;if(!isCamAllowed(thumb_idx)){cam_url="";thumb_motion_timeout=setTimeout("func_Cameras_Thumbs_Motion("+cam_num+", '"+Scrn+"')",1000);display_na="block";display_img="none"}else{if(Scrn=="Alarm"){cam_url=pathCameraAlarm+cam_id+"_"+frame_idx+".jpg?random="+thumb_alarm_random;display_na="none";display_img="block"}else{cam_url=pathCameraNormal+cam_id+".jpg?random="+getRandom();display_na="none";display_img="block"}}document.getElementById("cameras_na_thumb_"+thumb_idx).style.display=display_na;if(display_img=="none"){document.getElementById("cameras_thumb_"+thumb_idx).style.display="none"}objCam=document.getElementById("cameras_thumb_"+thumb_idx);objCam.src=cam_url;str='objCam.onload = function (evt) {document.getElementById("cameras_nd_thumb_'+thumb_idx+'").style.display = "none";document.getElementById("cameras_thumb_'+thumb_idx+'").style.display = "'+display_img+'";thumb_motion_timeout = setTimeout("func_Cameras_Thumbs_Motion(\''+cam_num+"', '"+Scrn+"')\", 500);}";eval(str);str="objCam.onerror = function (evt) {func_cameras_thumbs_error ('"+thumb_idx+"');thumb_motion_timeout = setTimeout(\"func_Cameras_Thumbs_Motion('"+cam_num+"', '"+Scrn+"')\", 500);}";eval(str)}thumb_motion_maxtimeout=setTimeout("func_Cameras_Thumbs_Motion("+cam_num+", '"+Scrn+"')",30000)}function mainCameraMotion(A,B){if(typeof (A)=="undefined"){A="Main"}clearTimeout(main_motion_timeout);clearTimeout(main_motion_maxtimeout);if(B>0){motion_stop=0}if(motion_stop&&((B==0)||typeof B=="undefined")){return }document.getElementById(A+"CameraTime").innerHTML=getCurrentDate();camIndex=document.getElementById(A+"CameraIndex").value;if(!xmlSection_Cameras_Collection.item(camIndex)){mainCameraError(A);return }cam_id=xmlSection_Cameras_Collection.item(camIndex).getElementsByTagName("index").item(0).firstChild.data;is_allowed=isCamAllowed(camIndex);if(!is_allowed){document.getElementById(A+"CameraImage").style.display="none";document.getElementById(A+"CameraNoData").style.display="none";document.getElementById(A+"CameraNotAllowed").style.display="block"}mainCameraImage=document.getElementById(A+"CameraImage");mode=(document.getElementById(A+"CameraArea").className=="camera bgOrange")?"alarm":"normal";if(mode=="alarm"){main_frame_idx++;if(main_frame_idx>13){main_frame_idx=0}mainCameraImage.src=pathCameraAlarm+cam_id+"_"+main_frame_idx+".jpg?random="+getRandom();mainCameraFrameTime()}else{mainCameraImage.src=pathCameraNormal+cam_id+".jpg?random="+getRandom()}mainCameraImage.onload=function(C){if(!C){C=window.event}if(C.target&&C.target.id){target=C.target}else{if(C.srcElement){target=C.srcElement}else{if(C.currentTarget&&C.currentTarget.id){target=C.currentTarget}}}str_indx=target.id.indexOf("CameraImage");if(str_indx==0){A="Main"}else{A=target.id.substr(0,str_indx)}if(isCamAllowed(document.getElementById(A+"CameraIndex").value)){document.getElementById(A+"CameraImage").style.display="block";document.getElementById(A+"CameraNotAllowed").style.display="none"}else{document.getElementById(A+"CameraImage").style.display="none";document.getElementById(A+"CameraNotAllowed").style.display="block"}document.getElementById(A+"CameraNoData").style.display="none";main_motion_timeout=setTimeout("mainCameraMotion('"+A+"')",600)};mainCameraImage.onerror=function(C){if(!C){C=window.event}if(C.target&&C.target.id){target=C.target}else{if(C.srcElement){target=C.srcElement}else{if(C.currentTarget&&C.currentTarget.id){target=C.currentTarget}}}str_indx=target.id.indexOf("CameraImage");if(str_indx==0){A="Main"}else{A=target.id.substr(0,str_indx)}mainCameraError(A)};main_motion_maxtimeout=setTimeout("mainCameraError('"+A+"')",30000)}function isMainCameraMoving(){idx=document.getElementById("MainCameraIndex").value;camtype=xmlSection_Cameras_Collection.item(idx).getElementsByTagName("type").item(0).firstChild.data;return(camtype.indexOf("PT")>-1)?true:false}function mainCameraAction(A,B){obj_AutoLogout.action();idx=document.getElementById("MainCameraIndex").value;camtype=xmlSection_Cameras_Collection.item(idx).getElementsByTagName("type").item(0).firstChild.data;cam_id=xmlSection_Cameras_Collection.item(idx).getElementsByTagName("index").item(0).firstChild.data;isMoving=isMainCameraMoving();strAction="&indx="+cam_id;switch(A){case"up":strAction="set=up"+strAction;if(isMoving){doAjaxAction("/web/ajax/cameras.turn.ajax.php",strAction)}break;case"down":strAction="set=down"+strAction;if(isMoving){doAjaxAction("/web/ajax/cameras.turn.ajax.php",strAction)}break;case"left":strAction="set=left"+strAction;if(isMoving){doAjaxAction("/web/ajax/cameras.turn.ajax.php",strAction)}break;case"right":strAction="set=right"+strAction;if(isMoving){doAjaxAction("/web/ajax/cameras.turn.ajax.php",strAction)}break;case"next":mainCameraMotion("Main",-1);break;case"prev":main_frame_idx-=2;if(main_frame_idx<-1){main_frame_idx=12}mainCameraMotion("Main",-1);break;case"pause":mainCameraNavigation("pause");mainCameraStop();break;case"play":mainCameraNavigation("play");mainCameraMotion("Main",1);break}}function mainCameraNavigation(A){switch(A){case"play":showIE(document.getElementById("cam_nav_play"));hideIE(document.getElementById("cam_nav_pause"));hideIE(document.getElementById("cam_nav_normal"));break;case"pause":hideIE(document.getElementById("cam_nav_play"));showIE(document.getElementById("cam_nav_pause"));hideIE(document.getElementById("cam_nav_normal"));break;default:hideIE(document.getElementById("cam_nav_play"));hideIE(document.getElementById("cam_nav_pause"));showIE(document.getElementById("cam_nav_normal"));document.getElementById("cam_nav_normal").className=isMainCameraMoving()?"nav":"nav_grey"}}function mainCameraSave(){obj_AutoLogout.action();is_alarm=(document.getElementById("MainCameraArea").className=="camera bgOrange")?true:false;if(isCamAllowed(document.getElementById("MainCameraIndex").value)){if(is_alarm){file=pathCameraAlarm+cam_id+"_"+main_frame_idx+".jpg"}else{file=pathCameraNormal+cam_id+".jpg"}document.location="/web/forcedownload.php?src="+escape(file)}}function mainCameraError(A){if(typeof (A)=="undefined"){A="Main"}document.getElementById(A+"CameraImage").style.display="none";if(!isCamAllowed(document.getElementById(A+"CameraIndex").value)){document.getElementById(A+"CameraNotAllowed").style.display="block";document.getElementById(A+"CameraNoData").style.display="none"}else{document.getElementById(A+"CameraNoData").style.display="block";document.getElementById(A+"CameraNotAllowed").style.display="none"}clearTimeout(main_motion_timeout);main_motion_timeout=setTimeout("mainCameraMotion('"+A+"')",5000)}function setMainCamera(A,B){motion_stop=0;obj_AutoLogout.action();if(typeof (B)=="undefined"){B="Main"}if(!xmlSection_Cameras_Collection.item(A)){if(!xmlSection_Cameras_Collection.item(A+1)){if(!xmlSection_Cameras_Collection.item(0)){mainCameraError(B,B)}else{setMainCamera(0,B)}}else{setMainCamera(A+1,B)}}else{document.getElementById(B+"CameraIndex").value=A;document.getElementById(B+"CameraTitle").innerHTML=xmlSection_Cameras_Collection.item(A).getElementsByTagName("location").item(0).firstChild.data+"&nbsp;";if(B=="Main"){document.getElementById("cam_nav_normal").className=isMainCameraMoving()?"nav":"nav_grey"}if(document.getElementById("MainCameraArea").className=="camera bgOrange"){mainCameraNavigation("play")}mainCameraMotion(B)}}function mainCameraToggleMode(A){obj_AutoLogout.action();set_mode="";if(document.getElementById("MainCameraArea").className=="camera"){set_mode="alarm"}if((A=="normal")||(A=="alarm")){set_mode=A}if(set_mode=="alarm"){document.getElementById("MainCameraArea").className="camera bgOrange";showIE(document.getElementById("MainCameraAlarmTime"));hideIE(document.getElementById("MainCameraTime"));mainCameraNavigation("play")}else{document.getElementById("MainCameraArea").className="camera";hideIE(document.getElementById("MainCameraAlarmTime"));showIE(document.getElementById("MainCameraTime"));mainCameraNavigation("normal");if(motion_stop==1){mainCameraMotion("Main",true)}}document.getElementById("MainCameraImage").src="/web/img/empty.gif"}function mainCameraFrameTime(){camIndex=document.getElementById("MainCameraIndex").value;if(isCamAllowed(camIndex)){cam_id=xmlSection_Cameras_Collection.item(camIndex).getElementsByTagName("index").item(0).firstChild.data;strImgTime="indx="+cam_id+"&m=a&ci="+main_frame_idx+"&random="+thumb_alarm_random;doAjaxAction("/web/ajax/cameras.gettime.ajax.php",strImgTime,"MainCameraAlarmTime")}else{document.getElementById("MainCameraAlarmTime").innerHTML="&nbsp;"}}function mainCameraStop(){clearTimeout(main_motion_timeout);clearTimeout(main_motion_maxtimeout);clearTimeout(thumb_motion_timeout);clearTimeout(thumb_motion_maxtimeout);motion_stop=1}function func_Cameras_onLoad(){thumb_alarm_random=getRandom();if(!is_InCamerasCamerasScreen){is_InCamerasCamerasScreen=true;func_Cameras_Obj_onLoad("Cameras")}}function func_Cameras_onUnload(){if(is_InCamerasCamerasScreen){is_InCamerasCamerasScreen=false;func_Cameras_Obj_onUnload("Cameras")}}function isCamAllowed(A){is_allowed=false;if(typeof security_CurrentArmMode=="undefined"){return true}if(!xmlSection_Cameras_Collection.item(A)){return true}switch(security_CurrentArmMode){case"ArmHome":case"ArmHomeBypass":is_allowed=(xmlSection_Cameras_Collection.item(A).getElementsByTagName("active_home").length>0)?false:true;break;case"ArmAway":case"ArmBypass":is_allowed=(xmlSection_Cameras_Collection.item(A).getElementsByTagName("active_away").length>0)?false:true;break;case"Disarm":is_allowed=(xmlSection_Cameras_Collection.item(A).getElementsByTagName("active_disarm").length>0)?false:true;break}return is_allowed}function func_Cameras_Edit_Reset(){try{document.getElementById("cameras_CamType_0").value="2";document.getElementById("cameras_CamType_Text_0").value=PHP_CAPS_camera_name;document.getElementById("cameras_CamLoc_0").value="1";document.getElementById("cameras_CamLoc_Text_0").value=PHP_CAPS_zone_name;document.getElementById("btn_Cameras_Edit_Apply").style.display="block"}catch(C){}var A="",B="";try{if(arr_Cameras_Cameras.length>0){A=_wrap_Cameras_Edit_Begin();for(B in arr_Cameras_Cameras){A=A+_wrap_Cameras_Edit_Inner(B.substring(2),arr_Cameras_Cameras[B][4],arr_Cameras_Cameras[B][3],(arr_Cameras_Cameras[B][0]==1),(arr_Cameras_Cameras[B][1]==1),(arr_Cameras_Cameras[B][2]==1),(arr_Cameras_Cameras[B][6]==1),(arr_Cameras_Cameras[B][7]==1))}A=A+_wrap_Cameras_Edit_End();objwrap_Cameras_Edit_List.innerHTML=A}else{objwrap_Cameras_Edit_List.innerHTML=""}}catch(C){objwrap_Cameras_Edit_List.innerHTML=""}printDebug("settings cams edit list")}function func_Cameras_Goto_Edit(){func_Cameras_onUnload();func_Cameras_Edit_Reset();cngScreenStruct("objscrnCameras_Edit")}function func_Cameras_Edit_BtnClicked(A){isCanCngScreen=false;A.childNodes[0].className=(A.childNodes[0].className=="on")?"":"on"}function func_Cameras_Edit_Apply(){obj_AutoLogout.action();if(func_Setup_NoChanges()){return false}sendStr="";for(var A=1;A<=PHP_CAMERAS_NUM_LIMIT;A++){if(document.getElementById("cameras_CamLoc_"+A)){if(sendStr!=""){sendStr=sendStr+"&"}flip_mirror="&flip_mirror"+A+"=i";if(document.getElementById("cameras_CamLoc_Flip_Mirror"+A).childNodes[0].className!=document.getElementById("cameras_CamLoc_Flip_Mirror"+A+"_original").value){flip_mirror="&flip_mirror"+A+"="+(document.getElementById("cameras_CamLoc_Flip_Mirror"+A).childNodes[0].className=="on"?1:0)}sendStr=sendStr+"zoneid"+A+"="+document.getElementById("cameras_CamLoc_"+A).value+"&away"+A+"="+(document.getElementById("cameras_CamLoc_Away_"+A).childNodes[0].className=="on"?0:1)+"&home"+A+"="+(document.getElementById("cameras_CamLoc_Home_"+A).childNodes[0].className=="on"?0:1)+"&disarm"+A+"="+(document.getElementById("cameras_CamLoc_Disarm_"+A).childNodes[0].className=="on"?0:1)+flip_mirror}}if(sendStr!=""){killAllTimers();showWaitMsg(true);flag_Finished_Enrolling=true;isCanCngScreen=true;cameras_CamsNum=-1;doAjaxAction("ajax/cameras.edit.save.ajax.php",sendStr,"",func_Cameras_Edit_Apply_Back)}}function func_Cameras_Edit_Apply_Back(){startTimers()}function func_Cameras_Edit_Add(){add_btn=document.getElementById("btn_Cameras_Edit_Apply");if(add_btn.className=="btn_add_disabled"){showErrCustomMsg(PHP_ONLY_ONE_ENROLL);return }isCanCngScreen=true;add_btn.className="btn_add_disabled";setTimeout(function(){document.getElementById("btn_Cameras_Edit_Apply").className="btn_add"},120000);showWaitMsg(true,PHP_STRINGS_camera_enrolling_text,true,5000);doAjaxAction("ajax/cameras.edit.enroll.ajax.php","zoneid="+document.getElementById("cameras_CamLoc_0").value+"&typeid="+document.getElementById("cameras_CamType_0").value+"&away="+(document.getElementById("cameras_CamLoc_Away_0").childNodes[0].className=="on"?0:1)+"&home="+(document.getElementById("cameras_CamLoc_Home_0").childNodes[0].className=="on"?0:1)+"&disarm="+(document.getElementById("cameras_CamLoc_Disarm_0").childNodes[0].className=="on"?0:1),"",func_Cameras_Edit_Add_Back,false)}function func_Cameras_Edit_Add_Back(A){showWaitMsg(false);if(A!="OK::"){showErrCustomMsg(A.substr(5))}}function func_Cameras_Edit_Remove(A){obj_AutoLogout.action();if(confirm(PHP_STRINGS_cameras_title_remove_confirm)){showWaitMsg(true);flag_Finished_Enrolling=true;doAjaxAction("ajax/cameras.edit.remove.ajax.php","camid="+A,"",runSet_Back)}}function func_Cameras_Edit_keyPressed(A){isCanCngScreen=false}function func_Cameras_Edit_fieldBlur(C,A,B){}function func_Cameras_SelectCamLoc(A){isCanCngScreen=false;try{document.getElementById("cameras_CamLoc_"+fld_Cameras_Edit_CamLoc).value=A;document.getElementById("cameras_CamLoc_Text_"+fld_Cameras_Edit_CamLoc).value=arr_Cameras_Locs[A-1]}catch(B){}func_ShowSlctCamLocMsg(false,fld_Cameras_Edit_CamLoc)}var showSlctCamLocMsg_Mode=true;function showSlctCamLocMsg_Clocker(){if(showSlctCamLocMsg_Mode){objshowSlctCamLoc_Msg.style.display="block";centerPopup(objshowSlctCamLoc_Msg);document.getElementById("FloatMask").style.display="block"}else{if(objshowSlctCamLoc_Msg.style.display!="none"){objshowSlctCamLoc_Msg.style.display="none";document.getElementById("FloatMask").style.display="none"}}}function func_Cameras_SelectCamType(A){isCanCngScreen=false;try{document.getElementById("cameras_CamType_"+fld_Cameras_Edit_CamType).value=A;document.getElementById("cameras_CamType_Text_"+fld_Cameras_Edit_CamType).value=arr_Cameras_Types[A-1]}catch(B){}func_ShowSlctCamTypeMsg(false,fld_Cameras_Edit_CamType)}var showSlctCamTypeMsg_Mode=true;function showSlctCamTypeMsg_Clocker(){if(showSlctCamTypeMsg_Mode){objshowSlctCamType_Msg.style.display="block";centerPopup(objshowSlctCamType_Msg);document.getElementById("FloatMask").style.display="block"}else{if(objshowSlctCamType_Msg.style.display!="none"){objshowSlctCamType_Msg.style.display="none";document.getElementById("FloatMask").style.display="none"}}}function func_Cameras_BuildArray(D){cameras_CamsNum=D.length;if(cameras_CamsNum>0){arr_Cameras_Cameras=new Array(cameras_CamsNum);arr_Cameras_Index=new Array(cameras_CamsNum);arr_Cameras_Mode=new Array(cameras_CamsNum);var B=1;for(temp_index=0;temp_index<D.length;temp_index++){temp_obj=D.item(temp_index);try{var A;temp[0]=((A=temp_obj.getElementsByTagName("index"))&&A.length)?A.item(0).firstChild.data:""}catch(C){temp[0]=""}try{var A;temp[1]=((A=temp_obj.getElementsByTagName("active_away"))&&A.length)?A.item(0).firstChild.data:""}catch(C){temp[1]=0}try{var A;temp[2]=((A=temp_obj.getElementsByTagName("active_home"))&&A.length)?A.item(0).firstChild.data:""}catch(C){temp[2]=0}try{var A;temp[3]=((A=temp_obj.getElementsByTagName("active_disarm"))&&A.length)?A.item(0).firstChild.data:""}catch(C){temp[3]=0}try{var A;temp[4]=((A=temp_obj.getElementsByTagName("location"))&&A.length)?A.item(0).firstChild.data:""}catch(C){temp[4]=""}try{var A;temp[5]=((A=temp_obj.getElementsByTagName("type"))&&A.length)?A.item(0).firstChild.data:""}catch(C){temp[5]=""}try{var A;temp[6]=((A=temp_obj.getElementsByTagName("flip"))&&A.length)?A.item(0).firstChild.data:""}catch(C){temp[5]=""}try{var A;temp[7]=((A=temp_obj.getElementsByTagName("mirror"))&&A.length)?A.item(0).firstChild.data:""}catch(C){temp[5]=""}temp[4]=getArrayElementID(arr_Cameras_Locs,temp[4]);arr_Cameras_Cameras["c_"+temp[0]]=new Array();arr_Cameras_Cameras["c_"+temp[0]][0]=temp[1];arr_Cameras_Cameras["c_"+temp[0]][1]=temp[2];arr_Cameras_Cameras["c_"+temp[0]][2]=temp[3];arr_Cameras_Cameras["c_"+temp[0]][3]=temp[4];arr_Cameras_Cameras["c_"+temp[0]][4]=temp[5];arr_Cameras_Cameras["c_"+temp[0]][5]=temp[6];arr_Cameras_Cameras["c_"+temp[0]][6]=temp[7];arr_Cameras_Index[B]="";arr_Cameras_Mode[B++]="n"}}else{arr_Cameras_Cameras=new Array();arr_Cameras_Mode=new Array()}return arr_Cameras_Cameras}function isArrayEqual(B,A){if(((!B)&&(!B!==!A))||(!A)){return false}if(!A){return false}if((typeof (B)=="object")&&(typeof (A)=="object")){if(B.length!=A.length){return false}for(var C in B){if(typeof (B[C])=="object"){return isArrayEqual(B[C],A[C])}else{if(B[C]!=A[C]){return false}else{}}}}else{return(B==A)}return true};
function _wrap_Cameras_Quickview(B,A){tmp_lst='<ul class="List bgBlue clear">';for(camIndex=0;camIndex<A;camIndex++){cam_id=B.item(camIndex).getElementsByTagName("index").item(0).firstChild.data;cam_loc=B.item(camIndex).getElementsByTagName("location").item(0).firstChild.data;tmp_lst+='<li><a href="#" onclick="setMainCamera('+camIndex+", 'Quick');return false;\">"+cam_loc+"</a></li>"}tmp_lst+="</ul>";return tmp_lst}function _wrap_Cameras_Thumbs(B,A){tmp="";A=(A=="Alarm")?"a":"n";for(camIndex=0;camIndex<B;camIndex++){isThumbAllowed=isCamAllowed(camIndex);cam_id=xmlSection_Cameras_Collection.item(camIndex).getElementsByTagName("index").item(0).firstChild.data;cam_loc=xmlSection_Cameras_Collection.item(camIndex).getElementsByTagName("location").item(0).firstChild.data;cam_loc_id=getArrayElementID(arr_Cameras_Locs,cam_loc);if(A=="a"){cam_url=pathCameraAlarm+cam_id+"_0.jpg?random="+getRandom();img_display="block";na_display="none"}else{if(!isThumbAllowed){cam_url="";img_display="none";na_display="block"}else{cam_url=pathCameraNormal+cam_id+".jpg?random="+getRandom();img_display="block";na_display="none"}}tmp+='<dl class="cameraView"><dt>'+cam_loc+'</dt><input type="hidden" id="cameras_thumb_id_'+camIndex+'" value="'+cam_id+'"><dd style="position:relative"><a href="#" onclick="setMainCamera('+camIndex+');return false;"><img src="'+cam_url+'" style="display:'+img_display+'" id="cameras_thumb_'+camIndex+'"  onmouseover="cameras_thumb_over('+camIndex+',1)" onmouseout="cameras_thumb_over('+camIndex+',0)" onerror="func_cameras_thumbs_error ('+camIndex+');"/><div id="cameras_na_thumb_'+camIndex+'" style="display:'+na_display+'">'+PHP_STRINGS_cameras_not_allowed+'</div><div id="cameras_nd_thumb_'+camIndex+'" onmouseover="cameras_thumb_over('+camIndex+',1)" onmouseout="cameras_thumb_over('+camIndex+',0)" style="display:none">'+PHP_STRINGS_cameras_nodata+"</div></a>";if(on_thumb[camIndex]==1||!isThumbAllowed){tmp+='<a onmouseover="cameras_thumb_over('+camIndex+',1)" onmouseout="cameras_thumb_over('+camIndex+',0)" id="cameras_thumb_off_'+camIndex+'" style="border: 0;top: 52px; left:63px;width: 33px; height:22px;position:absolute;display:none" href="#" class="btn_off" onclick="cameras_thumb_toggle('+camIndex+');return false;"><img src="/web/img/empty.gif" class="on" style="border: 0px none;padding: 0;width:33px;height:22px;"></a>'}else{tmp+='<a onmouseover="cameras_thumb_over('+camIndex+',1)" onmouseout="cameras_thumb_over('+camIndex+',0)" id="cameras_thumb_off_'+camIndex+'" style="border: 0;top: 52px; left:63px;width: 33px; height:22px;position:absolute;display:block" href="#" class="btn_on" onclick="cameras_thumb_toggle('+camIndex+');return false;"><img src="/web/img/empty.gif" class="on" style="border: 0px none;padding: 0;width:33px;height:22px;"></a>'}tmp+="</dd></dl>"}return tmp}function _wrap_Cameras_Edit_Begin(){return'<table class="Table">'}function _wrap_Cameras_Edit_Inner(I,A,G,E,D,H,F,B){I++;if(F){F=1}var C='<tr><td style="width:140px;">'+A+'</td>		<td style="width:170px"><input type="hidden" id="cameras_CamLoc_'+I+'" value="'+(parseInt(G)+1)+'" /><input type="text" readonly="readonly" id="cameras_CamLoc_Text_'+I+'" value="'+arr_Cameras_Locs[G]+'" class="styleInput" onkeypress="func_Cameras_Edit_keyPressed(event);" onblur="func_Cameras_Edit_fieldBlur(event,this.id,\'\');" style="width:125px;cursor:pointer;cursor:hand;" onclick="func_ShowSlctCamLocMsg(true,'+I+');" />&nbsp;<img src="/web/img/select.gif" width="18" height="15" align="absmiddle" border="0" style="cursor:pointer;cursor:hand;" onclick="func_ShowSlctCamLocMsg(true,'+I+');" /></td>        <td style="width: 85px">'+crtBtn_FlipOpt(F,PHP_STRINGS_cameras_flip_mirror,"btn_flip","cameras_CamLoc_Flip_Mirror"+I)+'</td>		<td style="width: 50px"> '+crtBtn_ArmOpt(E,PHP_STRINGS_cameras_btn_away,"btn_arm_away","cameras_CamLoc_Away_"+I)+'</td>		<td style="width: 50px">'+crtBtn_ArmOpt(D,PHP_STRINGS_cameras_btn_home,"btn_arm_home","cameras_CamLoc_Home_"+I)+'</td>		<td style="width: 50px">'+crtBtn_ArmOpt(H,PHP_STRINGS_cameras_btn_disarm,"btn_disarm","cameras_CamLoc_Disarm_"+I)+"</td>		<td>"+crtBtn_DelUser('onclick="func_Cameras_Edit_Remove('+I+');"')+"</td></tr>";return C}function _wrap_Cameras_Edit_End(){return"</table>"};
function func_Cameras_Obj_onLoad(A){A=(A=="Cameras")?"Cameras":(A=="Alarm"?"Alarm":"Cameras");document.getElementById("MainCameraImage").src="/web/img/empty.gif";if(A=="Alarm"){mainCameraToggleMode("alarm")}else{mainCameraToggleMode("normal")}document.getElementById("cameras_thumbs").innerHTML=_wrap_Cameras_Thumbs(cameras_CamsNum,A);camIndex=document.getElementById("MainCameraIndex").value;if(camIndex==""){camIndex=0}setMainCamera(camIndex);if(thumb_motion_timeout){clearTimeout(thumb_motion_timeout)}thumb_motion_timeout=setTimeout("func_Cameras_Thumbs_Motion("+cameras_CamsNum+", '"+A+"')",1000)}function func_Cameras_Obj_onUnload(A){clearTimeout(thumb_motion_timeout);clearTimeout(thumb_motion_maxtimeout);mainCameraStop()};
var old_loc_group="";var _loc_maxlength=11;function _wrap_cutString(B,A){if(B&&(B.length>A)){return'<acronym  title="'+B+'">'+B.substr(0,A)+"...</acronym>"}else{return B}}function _wrap_Home_Msg(A){if(A){return'<div class="centered notFound">'+PHP_WAIT_MSG+"</div>"}return'<div class="centered notFound">'+PHP_CAP_HOME_SEARCH_NORSLT+"</div>"}function _wrap_Home_Lists_Begin(){return('<table class="Table">')}function _wrap_Home_Lists_Inner(H,C,A,D,I,E,F,B){var G="";if(H==""){H=0}switch(H){case 0:G=_wrap_Home_Lists_Inner_Quick(C,A,D,I,E,F,B);break;case 1:G=_wrap_Home_Lists_Inner_Status(C,A,D,I,E,F,B);break;case 2:G=_wrap_Home_Lists_Inner_Type(C,A,D,I,E,F,B);break;case 3:G=_wrap_Home_Lists_Inner_Loc(C,A,D,I,E,F,B);break;case 4:G=_wrap_Home_Lists_Inner_Search(C,A,D,I,E,F,B);break}return("<tr>"+G+"</tr>\n")}function _wrap_Home_Lists_End(){return("</table>")}function _wrap_Home_Edit_Inner(A,B,C,D){ret='<tr><td style="width: 200px;"><input type="text" id="home_DeviceName_'+D+'" class="input w100" onchange="func_Home_Edit_keyPressed(event);" onblur="func_Home_Edit_fieldBlur(event,this.id,\'\');" value="'+A+'" maxlength='+PHP_INPUT_HOMEDEVICE_NAME+' /></td><td style="width: 240px;"><input type="hidden" id="home_DvcType_'+D+'" value="'+(parseInt(B)+1)+'" /><input type="text" readonly="readonly" id="home_DvcType_Text_'+D+'" value="'+arr_Home_DvcTypes[B]+'" class="input w90" onkeypressed="func_Home_Edit_keyPressed(event);" onblur="func_Home_Edit_fieldBlur(event,this.id,\'\');" onclick="home_CurrentDeviceID='+D+'; func_ShowSlctDvcTypeMsg(true);" /><img src="/web/img/select.gif" width="18" height="15" align="absmiddle" border="0" style="cursor:pointer;cursor:hand;" onclick="home_CurrentDeviceID='+D+'; func_ShowSlctDvcTypeMsg(true);" /></td><td style="width: 100px;">'+arr_Home_DvcLocs[C]+"</td><td>"+D+"</td></tr>";return ret}function _wrap_Home_Lists_Inner_Quick(G,A,E,B,D,F,C){ret=(F?('<td class="bgBlue" rowspan="'+F+'">'+_wrap_cutString(arr_Home_DvcLocs[E],_loc_maxlength)+"</td>"):"")+'<td class="w100"><div class="HomeDevName">'+A+"</div></td>"+_wrap_Home_Lists_Inner_Cmds(G,B,D);return(ret)}function _wrap_Home_Lists_Inner_Status(G,A,E,B,D,F,C){ret=(F?('<td class="bgBlue" rowspan="'+F+'">'+_wrap_cutString(arr_Home_DvcLocs[E],_loc_maxlength)+"</td>"):"")+'<td class="w100"><div class="HomeDevName">'+A+"</div></td>"+_wrap_Home_Lists_Inner_Cmds(G,B,D,C?"":"");return(ret)}function _wrap_Home_Lists_Inner_Type(G,A,E,B,D,F,C){ret=(F?("<td "+(C?'style="width: 120px;"':"")+' class="bgBlue" rowspan="'+F+'">'+arr_Home_DvcLocs[E]+"</td>"):"")+"<td "+(C?'style="width: 420px;"':"")+" >&nbsp;&nbsp;"+A+"</td>"+_wrap_Home_Lists_Inner_Cmds(G,B,D,C?'style="width: 50px;"':"");return(ret)}function _wrap_Home_Lists_Inner_Search(G,A,E,B,D,F,C){ret=(F?("<td "+(C?'style="width: 120px;"':"")+' class="bgBlue" rowspan="'+F+'">'+arr_Home_DvcLocs[E]+"</td>"):"")+"<td "+(C?'style="width: 480px;"':"")+" >&nbsp;&nbsp;"+A+"</td>"+_wrap_Home_Lists_Inner_Cmds(G,B,D);return(ret)}function _wrap_Home_Lists_Inner_Loc(G,A,E,B,D,F,C){ret=(F?("<td "+(C?'style="width: 170px;"':"")+' class="bgBlue" rowspan="'+F+'">'+_wrap_Home_DvcTypeImage(B)+arr_Home_DvcTypes[B]+"</td>"):"")+"<td "+(C?'style="width: 350px;"':"")+" >"+A+"</td>"+_wrap_Home_Lists_Inner_Cmds(G,B,D,C?'style="width: 50px"':"");return(ret)}function _wrap_Home_DvcTypeImage(B){var A="";switch(parseInt(B)){case 0:A="cLights";break;case 1:A="cHeaters";break;case 2:A="cSunshades";break;case 3:A="cAir";break;case 4:A="cApliances";break;default:A="";break}return'<img src="/web/img/empty.gif" class="ico '+A+'">'}function _wrap_Home_Lists_Inner_Cmds(E,C,D,A){var B;if(typeof A=="undefined"){A=""}switch(parseInt(C)){case 0:B="<td "+A+' class="controls">'+crtBtn_Dbl_Command(E,"MORE","btn_bright",PHP_BRIGHT)+'</td><td class="slice"><img class="slice" width="1" src="/web/img/empty.gif"/></td><td '+A+' class="controls">'+crtBtn_Dbl_Command(E,"LESS","btn_dim",PHP_DIM)+"</td><td>"+crtBtn_Dbl_OnOff(D,E)+"</td>";break;case 1:B="<td "+A+' class="controls">'+crtBtn_Dbl_Command(E,"LESS","btn_bright",PHP_WARM)+'</td><td class="slice"><img class="slice" width="1" src="/web/img/empty.gif"/></td><td '+A+' class="controls">'+crtBtn_Dbl_Command(E,"MORE","btn_dim",PHP_COOL)+"</td><td>"+crtBtn_Dbl_OnOff(D,E)+"</td>";break;case 2:B="<td "+A+' class="controls">'+crtBtn_Dbl_Command(E,"MORE","btn_bright",PHP_UP)+'</td><td class="slice"><img class="slice" width="1" src="/web/img/empty.gif"/></td><td '+A+' class="controls">'+crtBtn_Dbl_Command(E,"LESS","btn_dim",PHP_DOWN)+"</td><td>"+crtBtn_Dbl_OnOff(D,E)+"</td>";break;case 3:B="<td "+A+' class="controls">'+crtBtn_Dbl_Command(E,"MORE","btn_bright",PHP_WARM)+'</td><td class="slice"><img class="slice" width="1" src="/web/img/empty.gif"/></td><td '+A+' class="controls">'+crtBtn_Dbl_Command(E,"LESS","btn_dim",PHP_COOL)+"</td><td>"+crtBtn_Dbl_OnOff(D,E)+"</td>";break;case 4:B="<td "+A+'></td><td class="slice"></td><td></td><td>'+crtBtn_Dbl_OnOff(D,E)+"</td>";break;default:B="<td "+A+"></td><td>"+C+"</td>";break}return(B)};
var home_CurrentDeviceID,objbtn_Home_Apply,objhome_Find_SrcBox;var home_Current_LocID=-1,home_Current_TypeID=-1;var home_Location_UsedNum=0,home_Location_Visible=5,home_Location_VisibleOffset=0;var objframe_Home_Find_List,objhome_Find_SrcBox,objwrap_Home_Editting_List,objwrap_Home_YesAct_List,objwrap_Home_NotAct_List,objwrap_Home_Type_LIst,objwrap_Home_Loc_LIst,objwrap_Home_Loc_LocsList;function home_Find_Submit(A){objhome_Find_SrcBox.value=document.getElementById(A+"home_Find_SrcBox").value;if(A!=""){document.getElementById(A+"home_Find_SrcBox").value=""}cngScreenStruct("objscrnHome_Find");func_Home_DoSearch();return false}function func_Home_onLoad(){func_Home_LoadLists_byStatus()}function func_Home_onUnload(){func_Home_LoadLists_byStatus()}function func_Home_Loc_LocsListShift(E){var C=home_Location_VisibleOffset;var D=home_Location_VisibleOffset;var A=home_Location_Visible;var B=home_Location_UsedNum;if(B<=A){return }if(E=="left"){shift=D-A>=0?-A:-D;i=0;while(-shift>i){func_Home_Loc_LocsList_Hide(D+A-i,true);func_Home_Loc_LocsList_Hide(D-i,false);i++}}else{shift=(D+2*A<=B)?A:B-A-D;i=1;while(shift>=i){func_Home_Loc_LocsList_Hide(D+A+i,false);func_Home_Loc_LocsList_Hide(D+i,true);i++}}home_Location_VisibleOffset+=shift}function func_Home_Loc_LocsList_Hide(D,C){var A=C?"none":"";var B;if(B=document.getElementById("home_LocsList_"+D)){B.style.display=A}}function func_Home_Loc_CngLoc(C){var B,A;if(B=document.getElementById("home_Loc_"+home_Current_LocID)){if(A=B.firstChild){A.className=""}}if(B=document.getElementById("home_Loc_"+C)){if(A=B.firstChild){A.className="on"}}home_Current_LocID=C;func_Home_LoadLists_byLocation(home_Current_LocID)}function func_Home_Type_CngType(A){var C,B;if(C=document.getElementById(arr_Home_DvcTypes_CSS[home_Current_TypeID])){C.className=""}if(B=document.getElementById(arr_Home_DvcTypes_CSS[A])){B.className="on"}home_Current_TypeID=A;func_Home_LoadLists_byType(home_Current_TypeID)}function func_Home_LoadLists_Quickview(){objwrap_Quickview_Home_Active_List.innerHTML=_func_Home_LoadLists_byFilter("",0,0)}function func_Home_LoadLists_byStatus(){objwrap_Home_NotAct_List.innerHTML=_func_Home_LoadLists_byFilter("statusbool",0,1);objwrap_Home_YesAct_List.innerHTML=_func_Home_LoadLists_byFilter("statusbool",0,1,true);fixIEScroll(objwrap_Home_NotAct_List);fixIEScroll(objwrap_Home_YesAct_List)}function func_Home_LoadLists_byType(A){if(typeof A=="undefined"){A=home_Current_TypeID}if(A>-1){objwrap_Home_Type_List.innerHTML=_func_Home_LoadLists_byFilter("func",A,2)}else{objwrap_Home_Type_List.innerHTML=""}fixIEScroll(objwrap_Home_Type_List)}function func_Home_LoadLists_byLocation(A){if(typeof A=="undefined"){A=home_Current_LocID}if(A>-1){objwrap_Home_Loc_List.innerHTML=_func_Home_LoadLists_byFilter("loc",A,3)}else{objwrap_Home_Loc_List.innerHTML=""}fixIEScroll(objwrap_Home_Loc_List)}var _home_sortOrder="";function _func_Home_LoadLists_byFilter(D,A,K,N,R){var L;var I=new Array();var G=new Array();var J=new Array();var H=0;var Q=(D!="loc"?"loc":"func");var P=Q;_home_sortOrder=P;var E="";var B=H;var F=0;var O=F;var M=new Array();var C=false;if(typeof N=="undefined"){N=false}if(typeof R=="undefined"){C=false}else{C=true}for(i in arr_Home_Devices){i=i.substring(2);L=arr_Home_Devices["h_"+i];if((C&&R.indexOf(":"+i+":")!=-1)||((!D&&!C)||((((!N)&&(L[D]==A)))||(N&&(L[D]!=A))))){I[H]=[i];if(M["r_"+L[Q]]){M["r_"+L[Q]]++}else{M["r_"+L[Q]]=1}H++}}G=I.sort(_comparex);H=0;for(i in I){L=arr_Home_Devices["h_"+I[i][0]];r_c=(L[Q]!=E)?(M["r_"+L[Q]]):0;J[H]=_wrap_Home_Lists_Inner(K,I[i][0],L.name,L.loc,L.func,L.statusbool,r_c,H?false:true);E=L[Q];H++}content=J.join("");if(content.length<1&&(C||D=="func")){return _wrap_Home_Msg()}return(_wrap_Home_Lists_Begin()+J.join("")+_wrap_Home_Lists_End())}function _comparex(B,A){var C=this.arr_Home_Devices["h_"+B[0]][this._home_sortOrder];var D=this.arr_Home_Devices["h_"+A[0]][this._home_sortOrder];return C-D}function func_Home_DoSearch(){if(objhome_Find_SrcBox.value!=""){objframe_Home_Find_List.innerHTML=_wrap_Home_Msg(true);doAjaxAction(web_path+"ajax/home.search.ajax.php","q="+objhome_Find_SrcBox.value,"",func_Home_DoSearch_Back,false)}else{objhome_Find_SrcBox.focus()}}function func_Home_DoSearch_Back(A){objframe_Home_Find_List.innerHTML=_func_Home_LoadLists_byFilter("",0,4,false,A);fixIEScroll(objframe_Home_Find_List)}function func_Home_Find_keyPressed(C){var A=C?C:window.event;var B=(A.charCode)?A.charCode:((A.keyCode)?A.keyCode:((A.which)?A.which:0));if(B==13){func_Home_DoSearch()}}function func_Home_Edit_keyPressed(A){isCanCngScreen=false}function func_Home_Edit_fieldBlur(C,A,B){}function func_Home_Edit_onLoad(){isCanCngScreen=true;var C="";var B=new Array();var A=0;for(C in arr_Home_Devices){B[A++]=_wrap_Home_Edit_Inner(arr_Home_Devices[C]["name"],arr_Home_Devices[C]["func"],arr_Home_Devices[C]["loc"],C.substring(2))}objwrap_Home_Editting_List.innerHTML=_wrap_Home_Lists_Begin()+B.join("")+_wrap_Home_Lists_End()}function func_Home_Edit_Search_onLoad(){func_Home_DoSearch()}function func_Home_Edit_Back(){cngScreenStruct("scrnHome_Main")}function func_Home_Edit_Apply(){if(func_Setup_NoChanges()){return false}sendStr="";temp=new Array(3);temp[0]="";temp[1]="";temp[2]="";if(arr_Home_Devices.length>0){var A=false;for(i in arr_Home_Devices){i=i.substring(2);temp[0]+=i+",";temp[1]+=document.getElementById("home_DvcType_"+i).value+",";temp[2]+=document.getElementById("home_DeviceName_"+i).value+",";if(!IsAlphaNumeric(document.getElementById("home_DeviceName_"+i).value)){alert(PHP_STRINGS_home_edit_name_error+i);document.getElementById("home_DeviceName_"+i).focus();i=-1;break}for(j=i;j<=arr_Home_Devices.length;j++){if(document.getElementById("home_DeviceName_"+j)){if(document.getElementById("home_DeviceName_"+i).value==document.getElementById("home_DeviceName_"+j).value&&arr_Home_Devices["h_"+i]["loc"]==arr_Home_Devices["h_"+j]["loc"]&&i!=j){alert(PHP_STRINGS_setup_home_location_message+arr_Home_DvcLocs[arr_Home_Devices["h_"+j]["loc"]]+PHP_STRINGS_setup_home_duplicated_message+document.getElementById("home_DeviceName_"+j).value);if(document.getElementById("home_DeviceName_"+i).value!=arr_Home_Devices["h_"+i]["name"]){document.getElementById("home_DeviceName_"+i).value=arr_Home_Devices["h_"+i]["name"]}if(document.getElementById("home_DeviceName_"+j).value!=arr_Home_Devices["h_"+j]["name"]){document.getElementById("home_DeviceName_"+j).value=arr_Home_Devices["h_"+j]["name"]}A=true}}}if(A){i=-1;break}}sendStr+="indexes="+temp[0]+"&names="+temp[2]+"&types="+temp[1];if((i>-1)&&(temp.length>0)){isCanCngScreen=true;showWaitMsg(true);doAjaxAction("ajax/home.edit.save.ajax.php",sendStr,"",func_Home_Edit_Apply_Back,false)}}}function func_Home_Edit_Apply_Back(){}function func_Home_SelectDvcType(A){isCanCngScreen=false;try{document.getElementById("dvctype_opt_"+document.getElementById("home_DvcType_"+home_CurrentDeviceID).value).className="dvctype_white"}catch(B){}document.getElementById("home_DvcType_"+home_CurrentDeviceID).value=A;document.getElementById("home_DvcType_Text_"+home_CurrentDeviceID).value=arr_Home_DvcTypes[A-1];document.getElementById("dvctype_opt_"+document.getElementById("home_DvcType_"+home_CurrentDeviceID).value).className="dvctype_green";func_ShowSlctDvcTypeMsg(false)}var showSlctDvcTypeMsg_Mode=true;function showSlctDvcTypeMsg_Clocker(){if(showSlctDvcTypeMsg_Mode){document.getElementById("FloatMask").style.display="block";objshowSlctDvcType_Msg.style.display="block";centerPopup(objshowSlctDvcType_Msg)}else{if(objshowSlctDvcType_Msg.style.display!="none"){objshowSlctDvcType_Msg.style.display="none";document.getElementById("FloatMask").style.display="none"}}}function func_Home_Cmd_ON(A){doAjaxAction("ajax/home.general.cngstatus.ajax.php","deviceid="+A+"&status=on","",runSet_Back)}function func_Home_Cmd_OFF(A){doAjaxAction("ajax/home.general.cngstatus.ajax.php","deviceid="+A+"&status=off","",runSet_Back)}function func_Home_Cmd_MORE(A){doAjaxAction("ajax/home.general.cngstatus.ajax.php","deviceid="+A+"&status=bright","",runSet_Back)}function func_Home_Cmd_LESS(A){doAjaxAction("ajax/home.general.cngstatus.ajax.php","deviceid="+A+"&status=dim","",runSet_Back)};
function getLoginResponse(B){if(isAjaxTimerRunning){try{clearTimeout(ajaxTimer)}catch(A){}showWait(false);if(B!="[ERROR]"){if(B=="OK"){tryAgain(5);document.location.href=web_path+"panel.php"+params}else{tryAgain(1);try{document.getElementById("str_SERVER_login_errorlogin").innerHTML=B.substring(5).replace("\\n","<br />")}catch(A){alert(A.message)}}}else{tryAgain(2);try{document.getElementById("str_SERVER_login_timeoutlogin").innerHTML=B.replace("\\n","<br />")}catch(A){}}}}function ajaxTimeout(){isAjaxTimerRunning=false;try{clearTimeout(ajaxTimer)}catch(A){}showWait(false);tryAgain(2)}function showWait(A){if(A){objBtn.style.cursor="wait";objBtn.disabled=true;objPass.style.cursor="wait";objPass.disabled=true;objUser.style.cursor="wait";objUser.disabled=true;document.body.style.cursor="wait"}else{objBtn.style.cursor="";objBtn.disabled=false;objPass.style.cursor="";objPass.disabled=false;objUser.style.cursor="";objUser.disabled=false;document.body.style.cursor=""}}function tryAgain(A){if(A==0){objOriginal.style.display="block";objError.style.display="none";objTimeout.style.display="none";objProgress.style.display="none";objLoginOK.style.display="none";objLoginLoader.style.display="none";objNoAccess.style.display="none";objPass.value="";objUser.value="";objUser.focus()}else{if(A==1){objError.style.display="block";objOriginal.style.display="none";objTimeout.style.display="none";objProgress.style.display="none";objLoginOK.style.display="none";objLoginLoader.style.display="none";objNoAccess.style.display="none";document.getElementById("str_SERVER_login_tryagain1").focus()}else{if(A==2){objOriginal.style.display="none";objError.style.display="none";objTimeout.style.display="block";objProgress.style.display="none";objLoginOK.style.display="none";objLoginLoader.style.display="none";objNoAccess.style.display="none";document.getElementById("str_SERVER_login_tryagain2").focus()}else{if(A==3){objOriginal.style.display="none";objError.style.display="none";objTimeout.style.display="none";objProgress.style.display="block";objLoginOK.style.display="none";objLoginLoader.style.display="none";objNoAccess.style.display="none"}else{if(A==4){objOriginal.style.display="none";objError.style.display="none";objTimeout.style.display="none";objProgress.style.display="none";objLoginOK.style.display="none";objLoginLoader.style.display="none";objNoAccess.style.display="block"}else{objOriginal.style.display="none";objError.style.display="none";objTimeout.style.display="none";objProgress.style.display="none";objLoginOK.style.display="block";objLoginLoader.style.display="none";objNoAccess.style.display="none"}}}}}}function keyPressed(C){var A=C?C:window.event;var B=(A.charCode)?A.charCode:((A.keyCode)?A.keyCode:((A.which)?A.which:0));if(B==13){if(objOriginal.style.display=="block"){doLogin()}else{if((objError.style.display=="block")||(objTimeout.style.display=="block")){tryAgain(0)}else{}}}}function SideImg_Loaded(){isSideImgLoaded=true}function SideImg_Error(){objSideImg.style.display="none"};
var objshowWait_Msg,objshowError_Msg;var objwrap_Quick_Cameras;
function _wrap_Security_Detectors_Begin(){return('<table class="Table">')}function _wrap_Security_Detectors_Inner(F,B,C,E,D,A){ret='<tr><td style="width:120px;">'+F+'</td><td style="width:50px;">'+B+'</td><td style="width:95px;">'+C+'</td><td id="security_Detectors_Status_'+A+'" '+(D?'class="red"':'class="green"')+">"+E+"</td></tr>";return(ret)}function _wrap_Security_Detectors_End(){return("</table>")}function _wrap_Security_Access_Begin(){return('<table class="Table">')}function _wrap_Security_Access_Inner(B,A){color=(A==PHP_STRINGS_ok)?"green":"red";ret='<tr><td style="width: 130px;">'+B+'</td><td><span class="'+color+'" id="secAcc'+B+'">'+A+"</span></td></tr>";return(ret)}function _wrap_Security_Access_End(){return("</table>")};
var security_CurrentArmMode="Disarm";var security_ClickedArmMode="";var last_security_ClickedArmMode="";var objsecurity_Panel_ArmHome,objsecurity_Panel_ArmAway,objsecurity_Panel_ArmBypass,objsecurity_Panel_ArmHomeBypass,objsecurity_Panel_Disarm;var objsecurity_Panel_Text,objsecurity_Panel_Img,security_Shine_Timer=0;var security_Shine_Arr,security_Shine_Index_Arr;var system_Status_Shine_Timer=0,system_Status_Shine_Holder="";var system_Status_Shine,system_Status_Shine_Index=0;var objfltSecurity_ControlPanel_Plc,objfltQuickview_ControlPanel_Plc,objfltSecurity_ControlPanel;var arr_Sensors_Array;var detectors_info=Array(32);var objwrap_Security_Detectors,objwrap_Security_Access;function func_Security_onLoad(){func_Security_ControlPanel_Show(true);fixIEScroll(objwrap_Security_Detectors);fixIEScroll(document.getElementById("wrap_Security_Access"));if(security_Shine_Timer==0){security_Shine_Timer=setInterval("func_Security_Shine()",PHP_TIMER_SECURITY_SHINE)}if(system_Status_Shine_Timer==0){system_Status_Shine_Timer=setInterval("func_System_Shine()",PHP_TIMER_SYSTEM_SHINE)}}function func_Security_onUnload(){func_Security_ControlPanel_Hide();try{clearTimeout(security_Shine_Timer);security_Shine_Timer=0}catch(A){}try{clearTimeout(system_Status_Shine_Timer);system_Status_Shine_Timer=0}catch(A){}}function func_Security_Panel_Select(A){last_security_ClickedArmMode=security_ClickedArmMode;security_ClickedArmMode=A;doAjaxAction("ajax/security.main.status.ajax.php","set="+A,"",runSet_Back)}function get_Security_Access_Index(A){for(temp_index=0;temp_index<SecurityAccessoriesList.length;temp_index++){if(SecurityAccessoriesList[temp_index]==A){return temp_index}}return -1}function func_Security_Shine(){for(temp_index in security_Shine_Arr){try{if(security_Shine_Arr.length>0){security_Shine_Index_Arr[temp_index]++;try{if(security_Shine_Index_Arr[temp_index]>security_Shine_Arr[temp_index].length){security_Shine_Index_Arr[temp_index]=0}}catch(A){security_Shine_Index_Arr[temp_index]=0}sendStr=security_Shine_Arr[temp_index][security_Shine_Index_Arr[temp_index]];if(sendStr=="undefined"||typeof sendStr=="undefined"){sendStr=""}if(sendStr!=""){document.getElementById("security_Detectors_Status_"+temp_index).innerHTML=sendStr}}else{document.getElementById("security_Detectors_Status_"+temp_index).innerHTML=""}}catch(A){}}if(typeof security_Access_Shine_Arr=="undefined"){return }for(temp_index in security_Access_Shine_Arr){try{if(security_Access_Shine_Arr.length>0){security_Access_Shine_Index_Arr[temp_index]++;try{if(security_Access_Shine_Index_Arr[temp_index]>security_Access_Shine_Arr[temp_index].length){security_Access_Shine_Index_Arr[temp_index]=0}}catch(A){security_Access_Shine_Index_Arr[temp_index]=0}sendStr=security_Access_Shine_Arr[temp_index][security_Access_Shine_Index_Arr[temp_index]];if(sendStr=="undefined"||typeof sendStr=="undefined"){sendStr=""}if(sendStr!=""){update_Security_Access_Inner(SecurityAccessoriesList[temp_index],sendStr)}}else{update_Security_Access_Inner(SecurityAccessoriesList[temp_index],"")}}catch(A){}}}function moveNode_DOM(C,A){try{A.appendChild(C.parentNode.removeChild(C));return true}catch(B){return false}}function func_Security_ControlPanel_Show(A){if("objscrnQuickview_Main"==currScreenID){moveNode_DOM(objfltSecurity_ControlPanel,objfltQuickview_ControlPanel_Plc)}else{moveNode_DOM(objfltSecurity_ControlPanel,objfltSecurity_ControlPanel_Plc)}objfltSecurity_ControlPanel.style.display="block";if(A){document.getElementById("iSecurityLink").style.display="none"}else{document.getElementById("iSecurityLink").style.display="block"}}function func_Security_ControlPanel_Hide(){objfltSecurity_ControlPanel.style.display="none"}function func_System_Shine(){if(!last_isArmAwayMode){try{system_Status_Shine_Index++;try{if(system_Status_Shine_Index>system_Status_Shine.length){system_Status_Shine_Index=0}}catch(A){system_Status_Shine_Index=0}sendStr=system_Status_Shine[system_Status_Shine_Index];if(typeof sendStr=="undefined"){sendStr=""}if(sendStr!=""){objsecurity_Panel_Text.innerHTML=sendStr}}catch(A){}}}function update_Security_Access_Inner(C,A){try{obj=document.getElementById("secAcc"+C);if(obj){obj.innerHTML=A;obj.className=(A==PHP_STRINGS_ok)?"green":"red"}}catch(B){}}function func_System_AddStatus(B){try{if(system_Status_Shine_Holder.indexOf(B)==-1){system_Status_Shine[system_Status_Shine.length]=B;system_Status_Shine_Holder+=","+B}}catch(A){printDebug("err sys stat")}}function func_System_ResetStatus(){system_Status_Shine=new Array();system_Status_Shine_Holder=""}function func_System_Rebuild(){func_System_ResetStatus();for(temp_index=0;temp_index<arr_Alerts_Array.length;temp_index++){if(arr_Alerts_Array[temp_index]["module"]=="Control Panel"){func_System_AddStatus(arr_Alerts_Array[temp_index]["text"])}}for(temp_index=0;temp_index<arr_Alarms_Array.length;temp_index++){if(arr_Alarms_Array[temp_index][0]=="sensors"){func_System_AddStatus(arr_Alarms_Array[temp_index][1])}}}function getLocationByZone(A){return detectors_info[A]["loc"]}function setLocationByzone(C,A,B,D,E){detectors_info[C]={loc:A,type:B,status:D,alarm:E}};
var objbtn_Setup_Lan_Apply,objbtn_Setup_Wifi_Apply,objbtn_Setup_Mng_Reset,objbtn_Setup_Mng_Save,objopt_Setup_Lan_Manual,objopt_Setup_Lan_Auto;var objsetup_Wepstr,objsetup_Dns1,objsetup_SSID,objsetup_IPAdr,objsetup_Subnet,objsetup_Gateway,objsetup_Weptype,objsetup_Channel,objsetup_Wepbits,objsetup_Weptype_Text,objsetup_Channel_Text,objsetup_Wepbits_Text;var isCanCngLanScreen=false;var isCanCngWifiScreen=false;var encryptionType="wep";var isLogLoaded=false;var host_change_result="";var arr_encryptionType=new Array();arr_encryptionType[0]="none";arr_encryptionType[2]="wep";arr_encryptionType[3]="wep";arr_encryptionType[4]="wpa";var setup_defaulft_mng,setup;function func_Setup_onLoad(){cngScreenStruct("objscrnSetup_Main");func_Setup_Mng_onLoad()}function func_Setup_onUnload(){}function func_Setup_Users_onLoad(){func_Users_onLoad()}function func_Setup_Mng_onLoad(){objsetup_PLID.value=def_Values.setup_PLID;setup_PLID_Holder=def_Values.setup_PLID;objsetup_HTTPS_Port.value=def_Values.setup_HTTPS_Port;objsetup_HTTP_Port.value=def_Values.setup_HTTP_Port;objsetup_upnp_HTTP.checked=def_Values.setup_upnp_HTTP;objsetup_upnp_HTTPS.checked=def_Values.setup_upnp_HTTPS;objsetup_Time_Logout.value=def_Values.setup_Time_Logout}function func_Setup_NetWork_onLoad(){killAllTimers();showWaitMsg(true);isCanCngWifiScreen=false;objsetup_Wepstr.disabled=false;doAjaxAction(web_path+"ajax/setup.network.load.ajax.php",send_param,"",func_Setup_NetWork_Back,true)}function func_Setup_NetWork_Back(A){try{tmp=A.getElementsByTagName("hostname").item(0).firstChild.data;if(objsetup_Hostname){objsetup_Hostname.value=tmp}if(objsetup_Hostname_default){objsetup_Hostname_default.value=tmp}}catch(B){}temp_is_sec=false;try{if(xmlSection_Setup_Section=A.getElementsByTagName("setup_lan").item(0)){temp_is_sec=true}}catch(B){xmlSection_Setup_Section=null;temp_is_sec=false}if(temp_is_sec){try{tmp=xmlSection_Setup_Section.getElementsByTagName("mode").item(0).firstChild.data}catch(B){tmp=""}if(tmp=="manual"){func_Setup_Lan_Manual(false)}else{func_Setup_Lan_Auto(false)}try{tmp=xmlSection_Setup_Section.getElementsByTagName("dns1").item(0).firstChild.data}catch(B){tmp=""}if(objsetup_Dns1){objsetup_Dns1.value=tmp}try{tmp=xmlSection_Setup_Section.getElementsByTagName("ipadr").item(0).firstChild.data}catch(B){tmp=""}if(objsetup_IPAdr){objsetup_IPAdr.value=tmp}try{tmp=xmlSection_Setup_Section.getElementsByTagName("subnet").item(0).firstChild.data}catch(B){tmp=""}if(objsetup_Subnet){objsetup_Subnet.value=tmp}try{tmp=xmlSection_Setup_Section.getElementsByTagName("gateway").item(0).firstChild.data}catch(B){tmp=""}if(objsetup_Gateway){objsetup_Gateway.value=tmp}}temp_is_sec=false;try{if(xmlSection_Setup_Section=A.getElementsByTagName("setup_wifi").item(0)){temp_is_sec=true}}catch(B){xmlSection_Setup_Section=null;temp_is_sec=false}if(temp_is_sec){try{tmp=xmlSection_Setup_Section.getElementsByTagName("error").item(0).firstChild.data}catch(B){tmp=""}if(tmp!=""){showErrCustomMsg(tmp)}else{try{tmp=xmlSection_Setup_Section.getElementsByTagName("ssid").item(0).firstChild.data}catch(B){tmp=""}if(objsetup_SSID){objsetup_SSID.value=tmp}try{tmp=xmlSection_Setup_Section.getElementsByTagName("wepchannel").item(0).firstChild.data}catch(B){tmp=0}tmp=parseInt(tmp);if(objsetup_Channel_Text){objsetup_Channel_Text.value=tmp}if(objsetup_Channel){objsetup_Channel.value=tmp}try{tmp=xmlSection_Setup_Section.getElementsByTagName("weptype").item(0).firstChild.data}catch(B){tmp=0}tmp=parseInt(tmp);if(objsetup_Weptype&&typeof (arr_Setup_Weptypes[tmp])!="undefined"){objsetup_Weptype.value=tmp+1}tmp=arr_Setup_Weptypes[tmp];if(tmp!=""&&typeof (tmp)!="undefined"){if(objsetup_Weptype_Text){objsetup_Weptype_Text.value=tmp}}try{tmp=xmlSection_Setup_Section.getElementsByTagName("wepbits").item(0).firstChild.data}catch(B){tmp=0}tmp=parseInt(tmp);if(objsetup_Wepbits&&typeof (arr_Setup_Wepbits[tmp])!="undefined"){if(typeof (arr_encryptionType[tmp])!="undefined"){encryptionType=arr_encryptionType[tmp];switch(encryptionType){case"none":func_Setup_None();break;case"wep":func_Setup_Wep();break;case"wpa":func_Setup_Wpatkip();break}}objsetup_Wepbits.value=tmp+1}tmp=arr_Setup_Wepbits[tmp];if(tmp!=""&&typeof (tmp)!="undefined"){if(objsetup_Wepbits_Text){objsetup_Wepbits_Text.value=tmp}}try{tmp=xmlSection_Setup_Section.getElementsByTagName("wepstr").item(0).firstChild.data}catch(B){tmp=""}if(objsetup_Wepstr){objsetup_Wepstr.value=decodeHex(tmp)}}}showWaitMsg(false,"load network setup");startTimers()}function func_Setup_Cam_onLoad(){func_Cameras_Edit_Reset()}function func_Setup_HD_onLoad(){func_Home_Edit_onLoad()}function func_Setup_Log_onLoad(){if(isLogLoaded){return }try{document.getElementById("frame_Setup_Log_List").contentWindow.func_clicker_Log();isLogLoaded=true;return }catch(A){}}function func_Setup_Mng_Save(){if(func_Setup_NoChanges()){return false}var A=0;var D="";if(def_Values.setup_PLID!=objsetup_PLID.value){if(!func_Setup_Mng_ChkInput_PMUID()){return false}else{D+="pmid="+objsetup_PLID.value+"&";def_Values.setup_PLID=objsetup_PLID.value}}if(!func_Setup_Mng_ChkInput_Autologout()){return false}if(objsetup_Time_Logout.value!=""&&def_Values.setup_Time_Logout!=objsetup_Time_Logout.value){D+="timer="+objsetup_Time_Logout.value+"&";def_Values.setup_Time_Logout=objsetup_Time_Logout.value}var C=false;var G=false;var F=false;var B=false;http_upnp=objsetup_upnp_HTTP.checked?true:false;https_upnp=objsetup_upnp_HTTPS.checked?true:false;F=(def_Values.setup_upnp_HTTP!=http_upnp)?true:false;B=(def_Values.setup_upnp_HTTPS!=https_upnp)?true:false;if(!(A=func_Setup_Http_Https_Check(objsetup_HTTPS_Port.value,objsetup_HTTP_Port.value))){return false}else{C=(def_Values.setup_HTTP_Port!=A.http_port)?true:false;G=(def_Values.setup_HTTPS_Port!=A.https_port)?true:false;if(C||G||(F&&http_upnp)||(B&&https_upnp)){D+="http_port="+A.http_port+"&https_port="+A.https_port+"&";def_Values.setup_HTTP_Port=A.http_port;def_Values.setup_HTTPS_Port=A.https_port}}if(F||B||(C&&http_upnp)||(G&&https_upnp)){D+="upnp_changed=true&";if(http_upnp){D+="http_upnp="+http_upnp+"&"}if(https_upnp){D+="https_upnp="+https_upnp+"&"}def_Values.setup_upnp_HTTP=http_upnp;def_Values.setup_upnp_HTTPS=https_upnp}if(D==""){return showErrCustomMsg(PHP_STRINGS_error_setup_no_changes)}isCanCngScreen=true;try{setup_PLID_Timer=setTimeout("func_Setup_Mng_Save_Timeout()",PHP_POWERLINKID_CHANGE_TIMEOUT)}catch(E){}showWaitMsg(true);doAjaxAction("ajax/setup.mng.save.ajax.php",D,"",function(J){showWaitMsg(false,"mng save finished");var I=parseJSON(J);var K="";var L=false;if(I.length>0&&I[0].is_error){for(var H=0;H<I.length;H++){if(I[H].is_error==1){K+=I[H].error_msg+"<br/>";L=true;if(I[H].addit){if(document.getElementById(I[H].addit.id)){document.getElementById(I[H].addit.id).value=I[H].addit.old;def_Values[I[H].addit.id]=I[H].addit.old}else{if(document.getElementById(I[H].addit.checkbox_id)){document.getElementById(I[H].addit.checkbox_id).checked=I[H].addit.old;def_Values[I[H].addit.checkbox_id]=I[H].addit.old}}}}}return showErrCustomMsg(K)}else{if(I.is_error&&I.addit&&I.is_error==0){if(I.addit.action&&I.addit.data&&I.addit.action=="chpmid"){parent.document.title=project_title+I.addit.data;setup_PLID_Holder=objsetup_PLID.value}else{if(I.addit.action&&I.addit.action=="autologout"){obj_AutoLogout.refreshTimeout()}}}}})}function func_Setup_Mng_DefaultVals(A){if(!A){throw"Must be an array"}def_Values=A}function func_Setup_Http_Https_Check(A,F){var E=65530;var D=80;var G=443;var C=1024;if(!F||!A){showErrCustomMsg(PHP_STRINGS_error_http_https_empty)}else{if(F<1||A<1){showErrCustomMsg(PHP_STRINGS_error_http_https_below_eq_zero)}else{if(F==A){showErrCustomMsg(PHP_STRINGS_error_http_https_same)}else{if(F>E||A>E){showErrCustomMsg(PHP_STRINGS_error_http_https_biger_then_range)}else{if(F!=D&&F<C){showErrCustomMsg(PHP_STRINGS_error_http_wellknown)}else{if(A!=G&&A<C){showErrCustomMsg(PHP_STRINGS_error_https_wellknown)}else{if(!F.match("^[0-9]{1,}$")){showErrCustomMsg(PHP_STRINGS_error_http_numeric)}else{if(!A.match("^[0-9]{1,}$")){showErrCustomMsg(PHP_STRINGS_error_https_numeric)}else{if(F==7520||F==2530||F==2531){showErrCustomMsg(PHP_STRINGS_error_https_wellknown)}else{if(A==7520||A==2530||A==2531){showErrCustomMsg(PHP_STRINGS_error_https_wellknown)}else{var B=new Array();B.http_port=F;B.https_port=A;return B}}}}}}}}}}return false}function func_Setup_Mng_Save_Timeout(){showWaitMsg(false,"Mng save timeout");try{clearTimeout(setup_PLID_Timer);setup_PLID_Timer=0}catch(A){}}function func_Setup_Mng_Reset(){if(confirm(PHP_STRINGS_setup_reset)){doAjaxAction("ajax/setup.mng.reset.ajax.php","","",runSet_Back)}}var redirectionTime;function func_Setup_Nw_Apply(){if(func_Setup_NoChanges()){return false}isError=false;host_change_result="";if(isCanCngLanScreen){isError=!(func_Setup_Nw_ChkInput_Hostname()&&func_Setup_Lan_ChkInput_IPAdr()&&func_Setup_Lan_ChkInput_Subnet()&&func_Setup_Lan_ChkInput_Gateway()&&func_Setup_Lan_ChkInput_Dns1())}if(!isError&&isCanCngWifiScreen){isError=!(isCanCngWifiScreen&&func_Setup_Wifi_ChkInput_Wepstr()&&func_Setup_Wifi_ChkInput_SSID())}if(!isError){sendStr="";if(isCanCngLanScreen){sendStr+="ipadr="+objsetup_IPAdr.value;sendStr+="&subnet="+objsetup_Subnet.value;sendStr+="&gateway="+objsetup_Gateway.value;sendStr+="&dns1="+objsetup_Dns1.value;if(objsetup_Hostname){var B=objsetup_Hostname;var A=objsetup_Hostname_default.value;if(A!=B.value&&B.value!=""){sendStr+="&hostname="+B.value}}if(objopt_Setup_Lan_Auto.className=="on"){sendStr+="&mode=dynamic"}else{sendStr+="&mode=manual"}isCanCngLanScreen=false;if(objsetup_oldIPAdr.value!=objsetup_IPAdr.value){redirectionTime=setTimeout("parent.location = 'http://"+objsetup_IPAdr.value+"'",30000)}}if(isCanCngWifiScreen){if(sendStr!=""){sendStr+="&"}sendStr+="ssid="+objsetup_SSID.value;if(objsetup_Channel){sendStr+="&chnl="+objsetup_Channel.value}if(objsetup_Wepbits){sendStr+="&wbits="+objsetup_Wepbits.value}if(objsetup_Weptype){sendStr+="&wtype="+objsetup_Weptype.value}if(objsetup_Wepstr){sendStr+="&wstr="+encodeHex(objsetup_Wepstr.value)}testDebStr=sendStr;isCanCngWifiScreen=false}if(sendStr!=""){showWaitMsg(true,PHP_STRINGS_setup_lan_enrolling_text,true,20000);doAjaxAction("ajax/setup.lan.save.ajax.php",sendStr,"",func_Setup_Nw_Apply_Back,false)}isCanCngScreen=true}}function func_Setup_Nw_Apply_Back(A){showWaitMsg(false);if(A.indexOf("OK::")==-1){clearTimeout(redirectionTime);showErrCustomMsg(A.substr(5),false,"func_Setup_NetWork_onLoad")}}function func_Setup_Lan_keyPressed(A){isCanCngLanScreen=true;func_Setup_Nw_keyPressed()}function func_Setup_Wifi_keyPressed(A){isCanCngWifiScreen=true;func_Setup_Nw_keyPressed()}function func_Setup_Nw_keyPressed(A){isCanCngScreen=false}function func_Setup_Mng_keyPressed(A){isCanCngScreen=false}function func_Setup_Mng_fieldBlur(C,A,B){}function func_Setup_Lan_fieldBlur(C,A,B){}function func_Setup_Wifi_fieldBlur(C,A,B){}function func_Setup_Mng_ChkInput_Autologout(){str=document.getElementById("setup_Time_Logout").value;strint=parseInt(str);if(str==strint&&strint>=0&&strint<9999){return true}else{if(str==""||str=="undefined"){showErrCustomMsg(PHP_STRINGS_error_autologout_empty)}}showErrCustomMsg(PHP_STRINGS_error_autologout_alpha);return false}function func_Setup_Mng_ChkInput_PMUID(){if(objsetup_PLID.value==""){showErrCustomMsg(PHP_STRINGS_error_pmid_empty);objsetup_PLID.value=setup_PLID_Holder;return false}else{if(!IsAlphaNumeric(objsetup_PLID.value)){showErrCustomMsg(PHP_STRINGS_error_pmid_alpha);objsetup_PLID.value=setup_PLID_Holder;return false}else{if(objsetup_PLID.value.length>PHP_INPUT_SETUP_PMUID||objsetup_PLID.value.length<1){showErrCustomMsg(PHP_STRINGS_error_pmid_less_INPUT_SETUP_PMUID);objsetup_PLID.value=setup_PLID_Holder;return false}else{return true}}}}function func_Setup_Wifi_ChkInput_SSID(){if((objsetup_SSID.value!="")&&(IsAlphaNumeric(objsetup_SSID.value))&&(objsetup_SSID.value.length<=PHP_INPUT_SETUP_SSID)){return(true)}else{showErrCustomMsg(PHP_STRINGS_error_wep_err_ssid);return(false)}}function func_Setup_Nw_ChkInput_Hostname(){if((objsetup_Hostname.value!="")&&(IsAlphaNumeric(objsetup_Hostname.value))&&(objsetup_Hostname.value.length<=PHP_INPUT_SETUP_SSID)){return(true)}else{showErrCustomMsg(PHP_STRINGS_error_hostname);return(false)}}function func_Setup_isASCII(B){if(B&&B.length>0){for(var A=0;A<B.length;A++){code=B.charCodeAt(A);if(code<32||code>126){return false}}}return true}function func_Setup_Wifi_ChkInput_Wepstr(){var A=objsetup_Wepstr.value.length;var B=objsetup_Wepstr.value;if("none"==encryptionType){objsetup_Wepbits.value=(0+1);return(true)}if(!func_Setup_isASCII(B)){showErrCustomMsg("	 "+PHP_STRINGS_error_len_must+"\nHEX: "+PHP_INPUT_SETUP_WEPSTR_128_HEX+", "+PHP_INPUT_SETUP_WEPSTR_64_HEX+"\nASCII: "+PHP_INPUT_SETUP_WEPSTR_64_ASCII+", "+PHP_INPUT_SETUP_WEPSTR_128_ASCII);return(false)}if("wpa"==encryptionType){if((A>=PHP_INPUT_SETUP_WAPSTR_ASCII_MIN)&&(A<=PHP_INPUT_SETUP_WAPSTR_ASCII_MAX)){objsetup_Wepbits.value=(4+1);objsetup_Weptype.value=(1+1);return(true)}else{showErrCustomMsg(PHP_STRINGS_error_wap_len_range);return false}}if("wep"==encryptionType){if(IsHex(B)){objsetup_Weptype.value=(0+1);switch(A){case PHP_INPUT_SETUP_WEPSTR_64_HEX:objsetup_Wepbits.value=(2+1);return(true);break;case PHP_INPUT_SETUP_WEPSTR_128_HEX:objsetup_Wepbits.value=(3+1);return(true);break;default:break}}objsetup_Weptype.value=(1+1);switch(A){case PHP_INPUT_SETUP_WEPSTR_64_ASCII:objsetup_Wepbits.value=(2+1);return(true);break;case PHP_INPUT_SETUP_WEPSTR_128_ASCII:objsetup_Wepbits.value=(3+1);return(true);break;default:break}showErrCustomMsg("	 "+PHP_STRINGS_error_len_must+"\nHEX: "+PHP_INPUT_SETUP_WEPSTR_128_HEX+", "+PHP_INPUT_SETUP_WEPSTR_64_HEX+"\nASCII: "+PHP_INPUT_SETUP_WEPSTR_64_ASCII+", "+PHP_INPUT_SETUP_WEPSTR_128_ASCII);return(false)}}function func_Setup_Lan_ChkInput_IPAdr(){if((objsetup_IPAdr.value!="")&&(IsIP(objsetup_IPAdr.value))){return true}else{showErrCustomMsg(PHP_STRINGS_error_setup_lan_ipadr);return false}}function func_Setup_Lan_ChkInput_Subnet(){if((objsetup_Subnet.value!="")&&(countSubnetMask(objsetup_Subnet.value)>-1)&&isIpSubnet(objsetup_Gateway.value,objsetup_IPAdr.value,objsetup_Subnet.value)){return true}else{showErrCustomMsg(PHP_STRINGS_error_setup_lan_subnet);return false}}function func_Setup_Lan_ChkInput_Gateway(){if((objsetup_Gateway.value!="")&&IsIP(objsetup_Gateway.value)){if(objsetup_Gateway.value==objsetup_IPAdr.value){showErrCustomMsg(PHP_STRINGS_error_setup_lan_ipadr+"<br/>"+PHP_STRINGS_error_setup_lan_gateway);return false}return true}else{showErrCustomMsg(PHP_STRINGS_error_setup_lan_gateway);return false}}function func_Setup_Lan_ChkInput_Dns1(){if((objsetup_Dns1.value!="")&&(IsIP(objsetup_Dns1.value))){return true}else{showErrCustomMsg(PHP_STRINGS_error_setup_lan_dns);return false}}function func_Setup_Lan_Auto(A){if(objopt_Setup_Lan_Auto.className==""){objopt_Setup_Lan_Auto.className="on";objopt_Setup_Lan_Manual.className="";if(objsetup_IPAdr){objsetup_IPAdr.disabled=true}if(objsetup_Subnet){objsetup_Subnet.disabled=true}if(objsetup_Gateway){objsetup_Gateway.disabled=true}if(objsetup_Dns1){objsetup_Dns1.disabled=true}}else{}isCanCngLanScreen=A}function func_Setup_Lan_Manual(A){if(objopt_Setup_Lan_Manual.className==""){objopt_Setup_Lan_Auto.className="";objopt_Setup_Lan_Manual.className="on";if(objsetup_IPAdr){objsetup_IPAdr.disabled=false}if(objsetup_Subnet){objsetup_Subnet.disabled=false}if(objsetup_Gateway){objsetup_Gateway.disabled=false}if(objsetup_Dns1){objsetup_Dns1.disabled=false}}else{}isCanCngLanScreen=A}function func_Setup_Wep(){if(objopt_Setup_Wep.className==""){objopt_Setup_Wep.className="on";objopt_Setup_Wpatkip.className="";objopt_Setup_None.className="";encryptionType="wep";objsetup_Wepstr.disabled=false}else{}}function func_Setup_Wpatkip(){if(objopt_Setup_Wpatkip.className==""){objopt_Setup_Wep.className="";objopt_Setup_Wpatkip.className="on";objopt_Setup_None.className="";encryptionType="wpa";objsetup_Wepstr.disabled=false}else{}}function func_Setup_None(){if(objopt_Setup_None.className==""){objopt_Setup_Wep.className="";objopt_Setup_Wpatkip.className="";objopt_Setup_None.className="on";encryptionType="none";objsetup_Wepstr.disabled=true}else{}}function func_Setup_NoChanges(){if(isCanCngScreen){showErrCustomMsg(PHP_STRINGS_error_setup_no_changes);return true}else{return false}}var digitArray=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f");function toHex(E){var B="";var D=true;for(var A=32;A>0;){A-=4;var C=(E>>A)&15;if(!D||C!=0){D=false;B+=digitArray[C]}}return(B==""?"0":B)}function pad(E,A,D){var C=E;for(var B=E.length;B<A;B++){C=D+C}return C}function encodeHex(C){var B="";for(var A=0;A<C.length;A++){B+=pad(toHex(C.charCodeAt(A)&255),2,"0")}return B}var hexv={"00":0,"01":1,"02":2,"03":3,"04":4,"05":5,"06":6,"07":7,"08":8,"09":9,"0A":10,"0B":11,"0C":12,"0D":13,"0E":14,"0F":15,"10":16,"11":17,"12":18,"13":19,"14":20,"15":21,"16":22,"17":23,"18":24,"19":25,"1A":26,"1B":27,"1C":28,"1D":29,"1E":30,"1F":31,"20":32,"21":33,"22":34,"23":35,"24":36,"25":37,"26":38,"27":39,"28":40,"29":41,"2A":42,"2B":43,"2C":44,"2D":45,"2E":46,"2F":47,"30":48,"31":49,"32":50,"33":51,"34":52,"35":53,"36":54,"37":55,"38":56,"39":57,"3A":58,"3B":59,"3C":60,"3D":61,"3E":62,"3F":63,"40":64,"41":65,"42":66,"43":67,"44":68,"45":69,"46":70,"47":71,"48":72,"49":73,"4A":74,"4B":75,"4C":76,"4D":77,"4E":78,"4F":79,"50":80,"51":81,"52":82,"53":83,"54":84,"55":85,"56":86,"57":87,"58":88,"59":89,"5A":90,"5B":91,"5C":92,"5D":93,"5E":94,"5F":95,"60":96,"61":97,"62":98,"63":99,"64":100,"65":101,"66":102,"67":103,"68":104,"69":105,"6A":106,"6B":107,"6C":108,"6D":109,"6E":110,"6F":111,"70":112,"71":113,"72":114,"73":115,"74":116,"75":117,"76":118,"77":119,"78":120,"79":121,"7A":122,"7B":123,"7C":124,"7D":125,"7E":126,"7F":127,"80":128,"81":129,"82":130,"83":131,"84":132,"85":133,"86":134,"87":135,"88":136,"89":137,"8A":138,"8B":139,"8C":140,"8D":141,"8E":142,"8F":143,"90":144,"91":145,"92":146,"93":147,"94":148,"95":149,"96":150,"97":151,"98":152,"99":153,"9A":154,"9B":155,"9C":156,"9D":157,"9E":158,"9F":159,A0:160,A1:161,A2:162,A3:163,A4:164,A5:165,A6:166,A7:167,A8:168,A9:169,AA:170,AB:171,AC:172,AD:173,AE:174,AF:175,B0:176,B1:177,B2:178,B3:179,B4:180,B5:181,B6:182,B7:183,B8:184,B9:185,BA:186,BB:187,BC:188,BD:189,BE:190,BF:191,C0:192,C1:193,C2:194,C3:195,C4:196,C5:197,C6:198,C7:199,C8:200,C9:201,CA:202,CB:203,CC:204,CD:205,CE:206,CF:207,D0:208,D1:209,D2:210,D3:211,D4:212,D5:213,D6:214,D7:215,D8:216,D9:217,DA:218,DB:219,DC:220,DD:221,DE:222,DF:223,E0:224,E1:225,E2:226,E3:227,E4:228,E5:229,E6:230,E7:231,E8:232,E9:233,EA:234,EB:235,EC:236,ED:237,EE:238,EF:239,F0:240,F1:241,F2:242,F3:243,F4:244,F5:245,F6:246,F7:247,F8:248,F9:249,FA:250,FB:251,FC:252,FD:253,FE:254,FF:255};function ntos(A){A=A.toString(16);if(A.length==1){A="0"+A}A="%"+A;return unescape(A)}function decodeHex(D){D=D.toUpperCase().replace(new RegExp("s/[^0-9A-Z]//g"));var C="";var A="";for(var B=0;B<D.length;B++){A+=D.charAt(B);if(A.length==2){C+=ntos(hexv[A]);A=""}}return C};
var objshowSlctPMUID_Msg,objshowSlctPMUID_Inner;var objbtn_Users_Apply,objbtn_Users_Alerts_Apply,objuser_PowerMaxUID,objuser_PowerMaxUID_Text,objuser_Username,objuser_Password,objuser_PassConf,objuser_Mobile,objuser_Email,objuser_Info_Title;var objchk_UserAlerts_Alarms_MMS,objchk_UserAlerts_Alarms_SMS,objchk_UserAlerts_Alarms_Email,objchk_UserAlerts_Alerts_SMS,objchk_UserAlerts_Alerts_Email,objchk_UserAlerts_OpenClose_SMS,objchk_UserAlerts_OpenClose_Email,objchk_UserAlerts_Camera_SMS,objchk_UserAlerts_Camera_Email,objchk_UserAlerts_Trouble_SMS,objchk_UserAlerts_Trouble_Email,objchk_UserAlerts_Home_SMS,objchk_UserAlerts_Home_Email,objchk_UserAlerts_HomeTwo_SMS,objchk_UserAlerts_HomeTwo_Email;var users_EditAlerts_Username,objusers_EditAlerts_Notifier;var users_List_Count=0;var users_TmpStr="";var objwrap_Users_Main_List,objwrap_Users_Main_Name,objwrap_Users_Main_Email,objwrap_Users_Main_Mobile,objwrap_Users_Main_PMUID;var users_CurrentUserID=0;var old_username="";var old_pmid=false;var arr_Users=new Array();var arr_Users_actual_PMID=new Array();function func_Users_onLoad(){killAllTimers();showWaitMsg(true,"func_Users_onLoad");send_param="userslist=1";doAjaxAction(web_path+"ajax/alarm.chkstatus.users.ajax.php",send_param,"",func_UserList_Back,true)}function func_check_user_alert(A){document.getElementById(A).className=(document.getElementById(A).className=="on")?"":"on"}function func_UserList_Back(A){showWaitMsg(false,"func_UserList_Back");temp_users_count=0;try{xmlSection_Users_Collection=A.getElementsByTagName("user");temp_users_count=xmlSection_Users_Collection.length;arr_Users=new Array();arr_Users_actual_PMID=new Array();for(temp_index=0;temp_index<temp_users_count;temp_index++){name="";try{name=xmlSection_Users_Collection.item(temp_index).getElementsByTagName("name").item(0).firstChild.data}catch(B){name=""}try{pmid=xmlSection_Users_Collection.item(temp_index).getElementsByTagName("pmuid").item(0).firstChild.data}catch(B){pmid=""}arr_Users[temp_index]=name;arr_Users_actual_PMID[temp_index]=pmid}}catch(B){}if(temp_users_count>0){temp_index=0;temp_obj=xmlSection_Users_Collection.item(temp_index);try{temp[0]=temp_obj.getElementsByTagName("name").item(0).firstChild.data}catch(B){temp[0]=""}try{temp[1]=temp_obj.getElementsByTagName("mobile").item(0).firstChild.data}catch(B){temp[1]=""}try{temp[2]=temp_obj.getElementsByTagName("email").item(0).firstChild.data}catch(B){temp[2]=""}try{temp[3]=temp_obj.getElementsByTagName("pmuid").item(0).firstChild.data}catch(B){temp[3]=""}objwrap_Users_Main_Name.innerHTML=hintString(temp[0],PHP_USERS_WRAP_NAME);objwrap_Users_Main_Mobile.innerHTML=hintString(temp[1],PHP_USERS_WRAP_MOBILE);objwrap_Users_Main_Email.innerHTML=hintString(temp[2],PHP_USERS_WRAP_EMAIL);objwrap_Users_Main_PMUID.innerHTML=temp[3];users_List_Count=temp_users_count;tmp=_wrap_Users_List_Entry_Begin();for(temp_index=1;temp_index<temp_users_count;temp_index++){temp_obj=xmlSection_Users_Collection.item(temp_index);try{temp[0]=temp_obj.getElementsByTagName("name").item(0).firstChild.data}catch(B){temp[0]=""}try{temp[1]=temp_obj.getElementsByTagName("mobile").item(0).firstChild.data}catch(B){temp[1]=""}try{temp[2]=temp_obj.getElementsByTagName("email").item(0).firstChild.data}catch(B){temp[2]=""}try{temp[3]=temp_obj.getElementsByTagName("pmuid").item(0).firstChild.data}catch(B){temp[3]=""}try{temp[4]=temp_obj.getElementsByTagName("key").item(0).firstChild.data}catch(B){temp[4]=""}tmp=tmp+_wrap_Users_List_Entry_Inner(temp[4],temp[0],temp[1],temp[2],temp[3],users_List_Count)}tmp=tmp+_wrap_Users_List_Entry_End();objwrap_Users_Main_List.innerHTML=tmp;tmpUserList=tmp;if(temp_users_count>=PHP_USERS_NUM_LIMIT){document.getElementById("users_Add_Button").style.display="none"}else{document.getElementById("users_Add_Button").style.display=""}}showWaitMsg(false,"func_UserList_Back");returnToNormal()}function func_Users_Main_Remove(){if(confirm(PHP_STRINGS_users_conf_remove)){isCanCngScreen=true;killAllTimers();send_param="id="+users_CurrentUserID+"&act=remove";doAjaxAction(web_path+"ajax/alarm.chkstatus.users.ajax.php",send_param,"",func_UserList_Back,true);showWaitMsg(true,"func_Users_Main_Remove")}}function func_Users_Main_Add(){users_CurrentUserID=0;objuser_Info_Title.innerHTML=PHP_STRINGS_users_add_title;func_Users_Edit_Reset();cngScreenStruct("scrnUsers_Profile");objuser_Username.focus()}function func_Users_Edit_Apply(){if(func_Setup_NoChanges()){return false}if(func_Users_Edit_CheckAllInputs()){killAllTimers();users_TmpStr=objuser_Mobile.value;while(users_TmpStr.indexOf("+")>-1){users_TmpStr=users_TmpStr.replace("+","PLUS")}sendStr="id="+users_CurrentUserID;sendStr=sendStr+"&name="+objuser_Username.value;sendStr=sendStr+"&pass="+objuser_Password.value;sendStr=sendStr+"&mobile="+users_TmpStr;sendStr=sendStr+"&email="+objuser_Email.value;sendStr=sendStr+"&index="+objuser_PowerMaxUID.value;sendStr+="&act=update";doAjaxAction(web_path+"ajax/alarm.chkstatus.users.ajax.php",sendStr,"",func_UserList_Back,true);isCanCngScreen=true;showWaitMsg(true,"func_Users_Edit_Apply");cngScreenStruct("scrnSetup_Users")}}function func_Users_Main_Alerts(){killAllTimers();showWaitMsg(true,"func_Users_Main_Alerts");objusers_EditAlerts_Notifier.innerHTML=PHP_STRINGS_users_alerts_notify;sendStr="id="+users_CurrentUserID+"&shouldload_Users_Alerts=1";doAjaxAction(web_path+"ajax/alarm.chkstatus.users.ajax.php",sendStr,"",func_UserAlert_Back,true);func_Users_Alerts_Reset();cngScreenStruct("scrnUsers_Alerts")}function func_UserAlert_Back(A){temp_users_count=0;try{xmlSection_Users_Section=A.getElementsByTagName("users_alerts").item(0);xmlSection_Users_Collection=xmlSection_Users_Section.getElementsByTagName("user");temp_users_count=xmlSection_Users_Collection.length}catch(B){}if(temp_users_count>0){temp_index=0;temp_obj=xmlSection_Users_Collection.item(temp_index);try{temp[0]=temp_obj.getElementsByTagName("key").item(0).firstChild.data}catch(B){temp[0]=""}if(temp[0]>=0){users_CurrentUserID=temp[0];try{temp[1]=temp_obj.getElementsByTagName("alarm_mms").item(0).firstChild.data}catch(B){temp[1]=""}try{temp[2]=temp_obj.getElementsByTagName("alarm_sms").item(0).firstChild.data}catch(B){temp[2]=""}try{temp[3]=temp_obj.getElementsByTagName("alarm_email").item(0).firstChild.data}catch(B){temp[3]=""}try{temp[4]=temp_obj.getElementsByTagName("alert_sms").item(0).firstChild.data}catch(B){temp[4]=""}try{temp[5]=temp_obj.getElementsByTagName("alert_email").item(0).firstChild.data}catch(B){temp[5]=""}try{temp[6]=temp_obj.getElementsByTagName("arm_sms").item(0).firstChild.data}catch(B){temp[6]=""}try{temp[7]=temp_obj.getElementsByTagName("arm_email").item(0).firstChild.data}catch(B){temp[7]=""}try{temp[8]=temp_obj.getElementsByTagName("camv_sms").item(0).firstChild.data}catch(B){temp[8]=""}try{temp[9]=temp_obj.getElementsByTagName("camv_email").item(0).firstChild.data}catch(B){temp[9]=""}try{temp[10]=temp_obj.getElementsByTagName("camt_sms").item(0).firstChild.data}catch(B){temp[10]=""}try{temp[11]=temp_obj.getElementsByTagName("camt_email").item(0).firstChild.data}catch(B){temp[11]=""}try{temp[12]=temp_obj.getElementsByTagName("x10o_sms").item(0).firstChild.data}catch(B){temp[12]=""}try{temp[13]=temp_obj.getElementsByTagName("x10o_email").item(0).firstChild.data}catch(B){temp[13]=""}try{temp[14]=temp_obj.getElementsByTagName("x10t_sms").item(0).firstChild.data}catch(B){temp[14]=""}try{temp[15]=temp_obj.getElementsByTagName("x10t_email").item(0).firstChild.data}catch(B){temp[15]=""}try{temp[16]=temp_obj.getElementsByTagName("name").item(0).firstChild.data}catch(B){temp[16]=""}if(temp[1]=="yes"){objchk_UserAlerts_Alarms_MMS.className="on"}if(temp[2]=="yes"){objchk_UserAlerts_Alarms_SMS.className="on"}if(temp[3]=="yes"){objchk_UserAlerts_Alarms_Email.className="on"}if(temp[4]=="yes"){objchk_UserAlerts_Alerts_SMS.className="on"}if(temp[5]=="yes"){objchk_UserAlerts_Alerts_Email.className="on"}if(temp[6]=="yes"){objchk_UserAlerts_OpenClose_SMS.className="on"}if(temp[7]=="yes"){objchk_UserAlerts_OpenClose_Email.className="on"}if(temp[8]=="yes"){objchk_UserAlerts_Camera_SMS.className="on"}if(temp[9]=="yes"){objchk_UserAlerts_Camera_Email.className="on"}if(temp[10]=="yes"){objchk_UserAlerts_Trouble_SMS.className="on"}if(temp[11]=="yes"){objchk_UserAlerts_Trouble_Email.className="on"}if(temp[12]=="yes"){objchk_UserAlerts_Home_SMS.className="on"}if(temp[13]=="yes"){objchk_UserAlerts_Home_Email.className="on"}if(temp[14]=="yes"){objchk_UserAlerts_HomeTwo_SMS.className="on"}if(temp[15]=="yes"){objchk_UserAlerts_HomeTwo_Email.className="on"}users_EditAlerts_Username=temp[16];objusers_EditAlerts_Notifier.innerHTML=objusers_EditAlerts_Notifier.innerHTML.replace("[USER]",users_EditAlerts_Username);showWaitMsg(false,"func_UserAlert_Back-1")}}if(showWaitMsg_Mode){showWaitMsg(false,"func_UserAlert_Back-2")}returnToNormal()}function func_Users_Main_Edit(){killAllTimers();showWaitMsg(true,"func_Users_Main_Edit");objuser_Info_Title.innerHTML=PHP_STRINGS_users_add_title_edit;cngScreenStruct("scrnUsers_Profile");func_Users_Edit_Reset();sendStr="id="+users_CurrentUserID+"&shouldload_Users_Profile=1";doAjaxAction(web_path+"ajax/alarm.chkstatus.users.ajax.php",sendStr,"",func_UserProfile_Back,true)}function func_UserProfile_Back(A){temp_users_count=0;try{xmlSection_Users_Section=A.getElementsByTagName("users_profile").item(0);xmlSection_Users_Collection=xmlSection_Users_Section.getElementsByTagName("user");temp_users_count=xmlSection_Users_Collection.length}catch(B){}if(temp_users_count>0){temp_index=0;temp_obj=xmlSection_Users_Collection.item(temp_index);try{temp[0]=temp_obj.getElementsByTagName("key").item(0).firstChild.data}catch(B){temp[0]=""}try{temp[1]=temp_obj.getElementsByTagName("name").item(0).firstChild.data}catch(B){temp[1]=""}try{temp[2]=temp_obj.getElementsByTagName("mobile").item(0).firstChild.data}catch(B){temp[2]=""}try{temp[3]=temp_obj.getElementsByTagName("email").item(0).firstChild.data}catch(B){temp[3]=""}try{temp[4]=temp_obj.getElementsByTagName("pmuid").item(0).firstChild.data}catch(B){temp[4]=""}try{temp[5]=temp_obj.getElementsByTagName("pass").item(0).firstChild.data}catch(B){temp[5]=""}users_CurrentUserID=temp[0];old_pmid=objuser_PowerMaxUID.value=temp[4];objuser_PowerMaxUID_Text.value=arr_Users_PMUIDs[(temp[4]-1)];old_username=objuser_Username.value=temp[1];objuser_Mobile.value=temp[2];objuser_Email.value=temp[3];objuser_Password.value=temp[5];objuser_PassConf.value=temp[5]}showWaitMsg(false,"func_UserProfile_Back");objuser_Username.focus();returnToNormal()}function func_Users_Alerts_Apply(){if(func_Setup_NoChanges()){return false}killAllTimers();showWaitMsg(true,"func_Users_Alerts_Apply");sendStr="id="+users_CurrentUserID+"&act=update";if(objchk_UserAlerts_Alarms_MMS.className=="on"){sendStr+="&alarm_mms=yes"}else{sendStr+="&alarm_mms=0"}if(objchk_UserAlerts_Alarms_SMS.className=="on"){sendStr+="&alarm_sms=yes"}else{sendStr+="&alarm_sms=0"}if(objchk_UserAlerts_Alarms_Email.className=="on"){sendStr+="&alarm_email=yes"}else{sendStr+="&alarm_email=0"}if(objchk_UserAlerts_Alerts_SMS.className=="on"){sendStr+="&alert_sms=yes"}else{sendStr+="&alert_sms=0"}if(objchk_UserAlerts_Alerts_Email.className=="on"){sendStr+="&alert_email=yes"}else{sendStr+="&alert_email=0"}if(objchk_UserAlerts_OpenClose_SMS.className=="on"){sendStr+="&arm_sms=yes"}else{sendStr+="&arm_sms=0"}if(objchk_UserAlerts_OpenClose_Email.className=="on"){sendStr+="&arm_email=yes"}else{sendStr+="&arm_email=0"}if(objchk_UserAlerts_Camera_SMS.className=="on"){sendStr+="&camv_sms=yes"}else{sendStr+="&camv_sms=0"}if(objchk_UserAlerts_Camera_Email.className=="on"){sendStr+="&camv_email=yes"}else{sendStr+="&camv_email=0"}if(objchk_UserAlerts_Trouble_SMS.className=="on"){sendStr+="&camt_sms=yes"}else{sendStr+="&camt_sms=0"}if(objchk_UserAlerts_Trouble_Email.className=="on"){sendStr+="&camt_email=yes"}else{sendStr+="&camt_email=0"}if(objchk_UserAlerts_Home_SMS.className=="on"){sendStr+="&x10o_sms=yes"}else{sendStr+="&x10o_sms=0"}if(objchk_UserAlerts_Home_Email.className=="on"){sendStr+="&x10o_email=yes"}else{sendStr+="&x10o_email=0"}if(objchk_UserAlerts_HomeTwo_SMS.className=="on"){sendStr+="&x10t_sms=yes"}else{sendStr+="&x10t_sms=0"}if(objchk_UserAlerts_HomeTwo_Email.className=="on"){sendStr+="&x10t_email=yes"}else{sendStr+="&x10t_email=0"}doAjaxAction(web_path+"ajax/alarm.chkstatus.users.ajax.php",sendStr,"",func_UserAlertApply_Back,true);isCanCngScreen=true;cngScreenStruct("scrnSetup_Users")}function func_UserAlertApply_Back(A){if(showWaitMsg_Mode){showWaitMsg(false,"func_UserAlertApply_Back")}returnToNormal()}function func_Users_Edit_keyPressed(A){isCanCngScreen=false}function func_Users_Edit_Reset(){objuser_PowerMaxUID.value=1;objuser_PowerMaxUID_Text.value=arr_Users_PMUIDs[0];objuser_Username.value="";objuser_Password.value="";objuser_PassConf.value="";objuser_Mobile.value="";objuser_Email.value=""}function func_Users_Alerts_Reset(){objchk_UserAlerts_Alarms_MMS.className="";objchk_UserAlerts_Alarms_SMS.className="";objchk_UserAlerts_Alarms_Email.className="";objchk_UserAlerts_Alerts_SMS.className="";objchk_UserAlerts_Alerts_Email.className="";objchk_UserAlerts_OpenClose_SMS.className="";objchk_UserAlerts_OpenClose_Email.className="";objchk_UserAlerts_Camera_SMS.className="";objchk_UserAlerts_Camera_Email.className="";objchk_UserAlerts_Trouble_SMS.className="";objchk_UserAlerts_Trouble_Email.className="";objchk_UserAlerts_Home_SMS.className="";objchk_UserAlerts_Home_Email.className="";objchk_UserAlerts_HomeTwo_SMS.className="";objchk_UserAlerts_HomeTwo_Email.className=""}function func_Users_Edit_Back(){cngScreenStruct("scrnSetup_Users")}function func_Users_Alerts_Back(){cngScreenStruct("scrnSetup_Users")}function func_Users_Edit_fieldBlur(C,A,B){}function func_Users_Is_Element_Exists(A,B){if(!B){return null}for(i=0;i<B.length;i++){if(B[i]==A){return B[i]}}return false}function func_Is_DuplicateUsername(A,B){return((uname=func_Users_Is_Element_Exists(A,arr_Users))!==false)?(B>0?!(old_username==uname):true):false}function func_Is_DuplicatePMID(A,B){return((uname=func_Users_Is_Element_Exists(A,arr_Users_actual_PMID))!==false)?(B>0?!(old_pmid==uname):true):false}function func_Users_Edit_CheckAllInputs(){if(objuser_Username.value!=""&&IsAlphaNumeric(objuser_Username.value)){if((users_CurrentUserID>0)||(objuser_Password.value!=""&&IsAlphaNumeric(objuser_Password.value))){if(!func_Is_DuplicateUsername(objuser_Username.value,users_CurrentUserID)){if(!func_Is_DuplicatePMID(objuser_PowerMaxUID.value,users_CurrentUserID)){if(objuser_Password.value==""||(objuser_PassConf.value!=""&&IsAlphaNumeric(objuser_PassConf.value)&&objuser_PassConf.value==objuser_Password.value)){if(objuser_Mobile.value==""||IsPhone(objuser_Mobile.value,true)){if(objuser_Email.value==""||IsEmail(objuser_Email.value)){return(true)}else{alert(PHP_STRINGS_users_add_email+PHP_STRINGS_users_add_conf);objuser_Email.focus();return(false)}}else{alert(PHP_STRINGS_users_add_mobile+PHP_STRINGS_users_add_conf);objuser_Mobile.focus();return(false)}}else{alert(PHP_STRINGS_users_add_match);objuser_PassConf.focus();return(false)}}else{alert(PHP_STRINGS_error_duplicate_pmid);objuser_Username.focus();return(false)}}else{alert(PHP_STRINGS_error_duplicate_username);objuser_Username.focus();return(false)}}else{alert(PHP_STRINGS_users_add_pass+PHP_STRINGS_users_add_conf);objuser_Password.focus();return(false)}}else{alert(PHP_STRINGS_users_add_name+PHP_STRINGS_users_add_conf);objuser_Username.focus();return(false)}}function func_Users_SelectPMUID(A){isCanCngScreen=false;if(objuser_PowerMaxUID){try{document.getElementById("pmuid_opt_"+objuser_PowerMaxUID.value).style.fontWeight="normal"}catch(B){}}objuser_PowerMaxUID.value=A;objuser_PowerMaxUID_Text.value=arr_Users_PMUIDs[A-1];document.getElementById("pmuid_opt_"+objuser_PowerMaxUID.value).style.fontWeight="bold";func_ShowSlctPMUIDMsg(false)}var showSlctPMUIDMsg_Mode=true;function showSlctPMUIDMsg_Clocker(){if(showSlctPMUIDMsg_Mode){objshowSlctPMUID_Msg.style.display="block";centerPopup(objshowSlctPMUID_Msg);document.getElementById("FloatMask").style.display="block"}else{if(objshowSlctPMUID_Msg.style.display!="none"){objshowSlctPMUID_Msg.style.display="none";document.getElementById("FloatMask").style.display="none"}}}function returnToNormal(){startTimers()};
var alxcount1=0;var alxcount2=1;var domDebalx=null;var alxstopper=false;var htmldebugtext='<div id="debControl" style="position:fixed;top:2px;right:40px;font-size:8px;text-align:left;vertical-align:top;border-width:1px;border-style:dashed;z-index:2000;display:none"> <input type="button" value="hide" onclick="alxHide();" /><input type="button" value="show" onclick="alxShow();" /><input type="button" value="clear" onclick="alxClear();" /><input type="button" id="alxbutton" value="stop" onclick="alxstopper=(alxstopper?false:true);document.getElementById(\'alxFlag\').innerHTML=alxstopper" /><span id="alxFlag">none</span> </div><div id="debalx" style="position:fixed;top:50px;left:2px;font-size:8px;text-align:left;vertical-align:top;width:200px;border-width:1px;border-style:dashed;display:none">nothing;</div>';function alx(A){return ;if(alxstopper){return }if(!domDebalx){debdiv=document.createElement("div");document.body.appendChild(debdiv);debdiv.innerHTML=htmldebugtext;domDebalx=document.getElementById("debalx");alxShow();domDebalx.style.color="red";domDebalx.style.width="500px";document.getElementById("debControl").style.display="block"}domDebalx.innerHTML=alxcount2+":"+alxcount1+++":"+A+"<br>"+domDebalx.innerHTML;if(alxcount1==300){alxClear()}}function alxClear(){alxcount1=0;domDebalx.innerHTML=""}function alxHide(){try{domDebalx.style.display="none"}catch(A){}}function alxShow(){try{domDebalx.style.display="block"}catch(A){}}function alxStop(){alxstopper=alxstopper?false:true};
function crtBtn_Edit(B,A,C){if(typeof A=="undefined"){A=""}if(typeof C=="undefined"){C=""}return'<div id="'+C+'" href="#" '+A+' class="btn_edit">'+B+"</div>"}function crtBtn_Apply(B,A,C){return('<div id="'+C+'" class="btn floatR" '+(A!=""?A:"")+'><img src="/web/img/empty.gif"/><span>'+B+"</span></div>")}function crtBtn_FlipOpt(C,B,A,D){cls=(C)?"on":"";return'<input type="hidden" id="'+D+'_original" name="'+D+'_original" value="'+cls+'"/><a href="#" id="'+D+'" class="'+A+'" onclick="func_Cameras_Edit_BtnClicked(this);"><img src="/web/img/empty.gif" class="'+cls+'" alt="'+B+'" title="'+B+'"></a>'}function crtBtn_ArmOpt(C,B,A,D){if(typeof D=="undefined"){D=""}cls=(C)?"":"on";return'<a href="#" id="'+D+'" class="'+A+'" onclick="func_Cameras_Edit_BtnClicked(this);"><img src="/web/img/empty.gif" class="'+cls+'" alt="'+B+'" title="'+B+'"></a>'}function crtBtn_DelUser(A,B){if(typeof A=="undefined"){A=""}if(typeof B=="undefined"){B=""}return'<a href="#" '+A+' id="'+B+'" class="btn_remove"><img src="/web/img/empty.gif"></a>'}function crtBtn_ChkUserAlert(A,B){if(typeof A=="undefined"){A=""}if(typeof B=="undefined"){B=""}return'<a href="#" class="checkbox margin0" onclick="isCanCngScreen=false;func_check_user_alert(\''+B+'\');return false"><img id="'+B+'" src="/web/img/empty.gif" '+A+' class="on"></a>'}function crtBtn_CamerasNav(B,A,C){if(typeof A=="undefined"){A=""}if(typeof C=="undefined"){C=""}return('<img id="'+C+'" src="'+web_path+"images/"+B+"_Off.gif\" onmouseover=\"if (this.src.indexOf('_Off')==-1) this.src='"+web_path+"images/"+B+"_MO.gif';\" onmouseout=\"if (this.src.indexOf('_MO')>-1) this.src='"+web_path+"images/"+B+'.gif\';" width="23" height="22" align="absmiddle" border="0" class="btnCamNav_D" '+A+" />")}function crtBtn_AddCam(A,B){if(typeof A=="undefined"){A=""}if(typeof B=="undefined"){B=""}return'<a href="#" class="btn_add" '+A+' id="'+B+'"><img src="/web/img/empty.gif" /></a>'}function crtBtn_Square(E,A,D,B,C){if(typeof A=="undefined"){A=""}return('<span id="'+B+'" '+C+'><a href="#" class="checkbox" '+A+' id="'+D+'"><img src="/web/img/empty.gif"/></a>'+E+"</span>")}function crtBtn_Dbl_Command(D,B,A,C){return('<a href="#" class="'+A+'" onclick="func_Home_Cmd_'+B+"("+D+');return false;">'+C+"</a>")}function crtBtn_Dbl_OnOff(B,A){if(typeof B=="undefined"){B=0}ret='<a href="" onclick="func_Home_Cmd_ON('+A+');return false;" class="btn_on"><img src="/web/img/empty.gif" '+(B!=0?' class="on"':"")+'></a> <a href="" class="btn_off" onclick="func_Home_Cmd_OFF('+A+');return false;"><img src="/web/img/empty.gif" '+((B==0)?' class="on"':"")+"></a>";return(ret)};

