function reset_sip_password(A,C){var D=confirm(t("confirm_reset_sip_password"));if(D!=true){return false}$("#sip_reset_password").hide();$("#sip_reset_password_loading").show();xhr=$.ajax({type:"POST",cache:false,url:"/ajax_reset_sip_password.cgi",data:"server_id="+A+"&ext="+C,error:function(F,H,G){$("#sip_reset_password_loading").hide();$("#sip_reset_password").show();E("An error has occurred making the request: "+G)},success:function(F){$("#sip_reset_password_loading").hide();$("#sip_reset_password").show();B(F)}});function B(F){alert(F)}function E(F){alert(F);return false}}function checkASCIIform(B){var A=B.elements.length;for(i=0;i=48&&A<=57)||(A>=97&&A<=122)||(A>=65&&A<=90)||(A>=33&&A<=40)||A==45||A==46||A==8||A==9||A==95||A==64||A==13){B=0}if(!F&&A==32){B=0}if(B){alert(D+" must only contain "+C+".");E.cancelBubble=true;E.returnValue=false;return false}return true}function checkNum(D,C,A){if(!A){var A=window.event}if(!D){D="This field"}if(A.keyCode){charCode=A.keyCode}else{if(A.which){charCode=A.which}}var B=0;if(((charCode<48)||(charCode>57))&&charCode!=13&&charCode!=8&&charCode!=192&&charCode!=46&&charCode!=37&&charCode!=39&&charCode!=91&&charCode!=9){B=1}if(C){if((charCode==42)||(charCode==35)||(charCode==43)||(charCode==119)){B=0}}if(!C){C=""}if(B){alert(D+" accepts only numbers"+C+".");A.cancelBubble=true;return false}}function checkPhoneNum(D,C,A){if(!A){var A=window.event}if(!D){D="This field"}if(A.keyCode){charCode=A.keyCode}else{if(A.which){charCode=A.which}}var B=0;if(((charCode<48)||(charCode>57))&&charCode!=32&&charCode!=40&&charCode!=41&&charCode!=45&&charCode!=13&&charCode!=8&&charCode!=192&&charCode!=46&&charCode!=37&&charCode!=39&&charCode!=91&&charCode!=9){B=1}if(C){if((charCode==42)||(charCode==35)||(charCode==43)||(charCode==119)){B=0}}if(!C){C=""}if(B){alert(D+" accepts only numbers"+C+".");A.cancelBubble=true;return false}}function placeFocus2(form_name,field_name){var this_form=eval("document.forms."+form_name+"."+field_name);this_form.focus()}function confirmSubmit(B){var A=confirm(B);if(A){return true}else{return false}}function setValueSubmit(A){return prompt(A)}function div_display(A,B){var C=document.getElementById(A);if(!C){return }if(B==1){C.style.display="block"}else{C.style.display="none"}}function MM_preloadImages(){var D=document;if(D.images){if(!D.MM_p){D.MM_p=new Array()}var C,B=D.MM_p.length,A=MM_preloadImages.arguments;for(C=0;C0&&parent.frames.length){D=parent.frames[E.substring(C+1)].document;E=E.substring(0,C)}if(!(A=D[E])&&D.all){A=D.all[E]}for(B=0;!A&&B2){if((A=MM_findObj(B[2]))!=null&&!A.MM_init){A.MM_init=true;A.MM_up=B[3];A.MM_dn=A.src;if((F=document[D])==null){F=document[D]=new Array()}F[F.length]=A;for(C=4;C"+F+"
'+G+'
 
";document.getElementById("prompt_text").focus();document.getElementById("prompt_text").select()}function setTableWidth(A){var B=document.getElementById(A);if(!B.new_width){B.new_width=B.rows[0].offsetWidth}B.style.width=B.new_width}function Browser(){var B,C,A;this.isIE=false;this.isNS=false;this.version=null;B=navigator.userAgent;C="MSIE";if((A=B.indexOf(C))>=0){this.isIE=true;this.version=parseFloat(B.substr(A+C.length));return }C="Netscape6/";if((A=B.indexOf(C))>=0){this.isNS=true;this.version=parseFloat(B.substr(A+C.length));return }C="Gecko";if((A=B.indexOf(C))>=0){this.isNS=true;this.version=6.1;return }}var browser=new Browser();var dragObj=new Object();dragObj.zIndex=0;function dragStart(C,E){var B;var A,D;if(E){dragObj.elNode=document.getElementById(E)}else{if(browser.isIE){dragObj.elNode=window.event.srcElement}if(browser.isNS){dragObj.elNode=C.target}if(dragObj.elNode.nodeType==3){dragObj.elNode=dragObj.elNode.parentNode}}if(browser.isIE){A=window.event.clientX+document.documentElement.scrollLeft+document.body.scrollLeft;D=window.event.clientY+document.documentElement.scrollTop+document.body.scrollTop}if(browser.isNS){A=C.clientX+window.scrollX;D=C.clientY+window.scrollY}dragObj.cursorStartX=A;dragObj.cursorStartY=D;dragObj.elStartLeft=parseInt(dragObj.elNode.style.left,10);dragObj.elStartTop=parseInt(dragObj.elNode.style.top,10);if(isNaN(dragObj.elStartLeft)){dragObj.elStartLeft=0}if(isNaN(dragObj.elStartTop)){dragObj.elStartTop=0}dragObj.elNode.style.zIndex=++dragObj.zIndex;if(browser.isIE){document.attachEvent("onmousemove",dragGo);document.attachEvent("onmouseup",dragStop);window.event.cancelBubble=true;window.event.returnValue=false}if(browser.isNS){document.addEventListener("mousemove",dragGo,true);document.addEventListener("mouseup",dragStop,true);C.preventDefault()}}function dragGo(B){var A,C;if(browser.isIE){A=window.event.clientX+document.documentElement.scrollLeft+document.body.scrollLeft;C=window.event.clientY+document.documentElement.scrollTop+document.body.scrollTop}if(browser.isNS){A=B.clientX+window.scrollX;C=B.clientY+window.scrollY}dragObj.elNode.style.left=(dragObj.elStartLeft+A-dragObj.cursorStartX)+"px";dragObj.elNode.style.top=(dragObj.elStartTop+C-dragObj.cursorStartY)+"px";if(browser.isIE){window.event.cancelBubble=true;window.event.returnValue=false}if(browser.isNS){B.preventDefault()}}function dragStop(A){if(browser.isIE){document.detachEvent("onmousemove",dragGo);document.detachEvent("onmouseup",dragStop)}if(browser.isNS){document.removeEventListener("mousemove",dragGo,true);document.removeEventListener("mouseup",dragStop,true)}}local=false;function setLocal(A){local=A}function localURL(B,C,A){if(local==true){B.href=C}else{B.href=A}}function disableText(A){A.disabled=true;A.style.backgroundColor=inputTextColorDisabled()}function enableText(A){A.disabled=false;A.style.backgroundColor=inputTextColorEnabled()}function inputTextColorEnabled(){for(h in document.styleSheets){var A=new Array();if(document.styleSheets[h].cssRules){A=document.styleSheets[h].cssRules}else{if(document.styleSheets[h].rules){A=document.styleSheets[h].rules}}for(i in A){if(A[i]["selectorText"]=="input.input_text"||A[i]["selectorText"]=="INPUT.input_text"){return A[i].style.backgroundColor}}}}function inputTextColorDisabled(){for(h in document.styleSheets){var A=new Array();if(document.styleSheets[h].cssRules){A=document.styleSheets[h].cssRules}else{if(document.styleSheets[h].rules){A=document.styleSheets[h].rules}}for(i in A){if(A[i]["selectorText"]=="input.input_text_disabled"||A[i]["selectorText"]=="INPUT.input_text_disabled"){return A[i].style.backgroundColor}}}}function showAllRows(C){var B=document.getElementById(C);for(var A=0;AH}else{I=A0){J=D;A=H}}if(J>F){G=C.removeChild(C.rows[J]);C.insertBefore(G,C.rows[F])}}C.style.display=K;return false}function clog(A){}function up_down(A){up_id=document.getElementById("up"+A);down_id=document.getElementById("down"+A);down_id.style.display=down_id.style.display=="none"?"inline":"none";var B=up_id.style.display=="none"?"inline":"none";up_id.style.display=B;if(B=="none"){sort_table("tbody",A,0)}else{sort_table("tbody",A,1)}}function validPhoneNumber(A){var B=/\D/g;A=A.replace(/[()\- ]/g,"");A=A.replace(/^\s*\+/,"");if(A.length<10){return false}else{if(A.match(B)){return false}else{return true}}}function fixTableWidths(A){var B=0;for(i=0;iB){B=$(A[i]).offsetWidth}}}for(i=0;i";$("callforward").value=$("call_forward_ext").value}else{if(document.getElementById("call_forward")&&document.getElementById("call_forward").value=="-keycode-"){call_fwd_exten=1;document.getElementById("call_fwd").innerHTML="";$("callforward").value=$("call_forward_ext").value}else{if($("call_forward")){$("callforward").value=$("call_forward").value}}}}function checkExten(){if(document.getElementById("call_forward_ext").value==""){call_fwd_exten=0;document.getElementById("call_fwd").innerHTML=call_fwd_list;if($("call_forward")){$("callforward").value=$("call_forward").value}}else{$("callforward").value=$("call_forward_ext").value}}var changedCID=0;function matchCID(B){if(changedCID==1){return false}if(B.selectedIndex==0){document.forms.f.caller_id.selectedIndex=0}didValue=B.options[B.selectedIndex].value;for(var A=1;A0&&E.length<6){alert("The length of alternate admin name is short, must be more than 6 characters");return false}if(E.length>16){alert("The length of alternate admin name is too long, must be less than 16");return false}var C=/[^A-Za-z0-9\_\-]/;if(E.length>0&&C.test(E)==true){alert('Only dash, underscore, alphabetical and digital characters are allowed, for example "test_1234"');return false}var D=/^admin|^tbadmin/;if(E.length>0&&D.test(E)==true){alert('Alternate server name can not begin with "admin" or "tbadmin" prefix');return false}var A=0;if(document.getElementById("yes_mac").checked){A=1}var B=0;if(A!=document.getElementById("current_phone_display_mac").value){B=2}if(B==2){if(kUNBOUND==1){alert("In order for changes to take place, all the phones connected to this server must be restarted.")}else{if(confirm("In order for changes to take place, all the phones connected to this server must be restarted. Press OK to automatically restart your phone or hit Cancel to manually do it.")){B=1}}}if(B&&document.forms.f.reboot_phone){document.forms.f.reboot_phone.value=B}return true}function switchLanguage(C){var D=C.value;document.getElementById("current-flag").src="/images/flags/"+D+".png";var B=window.location.search;if(B==null){B="?set_language="+D}else{if(B.indexOf("set_language")>-1){B=B.replace(/set_language=\w+/g,"")}if(B.length){B+="&set_language="+D}else{B="?set_language="+D}}var A=window.location+"";if(A.indexOf("?")>-1){A=A.substring(0,A.indexOf("?"))}window.location=A+B}function get_ext_info(B,G,A,D,C){var F="/ajax_get_ext_info.cgi?server_id="+B+"&extension="+G+"&action="+A+"&type="+D;var H=document.getElementById(C+"_loading");var E=document.getElementById(C);H.style.display="inline";E.style.display="none";ajax=new Ajax();ajax.onDone=function(K,I){var J=I.split("\n");if(J[0]==1){alert(J[1])}else{alert("You are not logged in correctly")}H.style.display="none";E.style.display="inline"};ajax.get(F);return false}function get_device_info(B,A,D,C){var F="/ajax_get_device_info.cgi?server_id="+B+"&device_id="+A+"&type="+D;var G=document.getElementById(C+"_loading");var E=document.getElementById(C);G.style.display="inline";E.style.display="none";ajax=new Ajax();ajax.onDone=function(J,H){var I=H.split("\n");if(I[0]==1){alert(I[1])}else{alert("You are not logged in correctly")}G.style.display="none";E.style.display="inline"};ajax.get(F);return false}function get_ftp_info(A,B){var D="/ajax_get_ftp_info.cgi?server_id="+A;var E=document.getElementById(B+"_loading");var C=document.getElementById(B);E.style.display="inline";C.style.display="none";ajax=new Ajax();ajax.onDone=function(H,F){var G=F.split("\n");if(G[0]==1){var I=G[1]+"\n"+G[2]+"\n"+G[3];alert(I)}else{alert("You are not logged in correctly")}E.style.display="none";C.style.display="inline"};ajax.get(D);return false}function check_reset_password_form(){var B=document.getElementById("email").value;var A=document.getElementById("username").value;if(B==""||A==""){alert(t("reset_enter_user_email","Please enter your username and email"));return false}else{return true}}function check_update_password_form(){var B=document.getElementById("new_pass").value;var A=document.getElementById("confirm_pass").value;if(B==""){alert(t("reset_enter_pass","Please enter a new password"));return false}else{if(B!=A){alert(t("reset_pw_dont_match","Passwords do not match"));return false}else{return true}}}function check_lan_access(D,C,B){var A=document.createElement("img");A.src="http://"+D+"/phone/spacer.gif";A.style.display="none";A.onload=C;if(B!=undefined){A.onerror=B}document.body.appendChild(A)}var viewport={getWinWidth:function(){this.width=0;if(window.innerWidth){this.width=window.innerWidth-18}else{if(document.documentElement&&document.documentElement.clientWidth){this.width=document.documentElement.clientWidth}else{if(document.body&&document.body.clientWidth){this.width=document.body.clientWidth}}}},getWinHeight:function(){this.height=0;if(window.innerHeight){this.height=window.innerHeight-18}else{if(document.documentElement&&document.documentElement.clientHeight){this.height=document.documentElement.clientHeight}else{if(document.body&&document.body.clientHeight){this.height=document.body.clientHeight}}}},getScrollX:function(){this.scrollX=0;if(typeof window.pageXOffset=="number"){this.scrollX=window.pageXOffset}else{if(document.documentElement&&document.documentElement.scrollLeft){this.scrollX=document.documentElement.scrollLeft}else{if(document.body&&document.body.scrollLeft){this.scrollX=document.body.scrollLeft}else{if(window.scrollX){this.scrollX=window.scrollX}}}}},getScrollY:function(){this.scrollY=0;if(typeof window.pageYOffset=="number"){this.scrollY=window.pageYOffset}else{if(document.documentElement&&document.documentElement.scrollTop){this.scrollY=document.documentElement.scrollTop}else{if(document.body&&document.body.scrollTop){this.scrollY=document.body.scrollTop}else{if(window.scrollY){this.scrollY=window.scrollY}}}}},getAll:function(){this.getWinWidth();this.getWinHeight();this.getScrollX();this.getScrollY()}};var dw_event={add:function(D,C,A,B){B=B||false;if(D.addEventListener){D.addEventListener(C,A,B)}else{if(D.attachEvent){D.attachEvent("on"+C,A)}}},remove:function(D,C,A,B){B=B||false;if(D.removeEventListener){D.removeEventListener(C,A,B)}else{if(D.detachEvent){D.detachEvent("on"+C,A)}}},DOMit:function(A){A=A?A:window.event;A.tgt=A.srcElement?A.srcElement:A.target;if(!A.preventDefault){A.preventDefault=function(){return false}}if(!A.stopPropagation){A.stopPropagation=function(){if(window.event){window.event.cancelBubble=true}}}return A}};var RollTip={followMouse:true,overlaySelects:true,offX:12,offY:12,ID:"rolltipDiv",showAni:400,hideAni:200,ovTimer:0,ready:false,timer:null,tip:null,shim:null,supportsOverlay:false,init:function(){var C=navigator.userAgent;var B=C.indexOf("Opera");var A=(B==-1||parseFloat(C.slice(B+6))>7.5)?true:false;if(document.createElement&&document.body&&typeof document.body.appendChild!="undefined"&&A){var D=document.createElement("DIV");D.id=this.ID;document.body.appendChild(D);this.showMult=D.offsetWidth/this.showAni/this.showAni;this.hideMult=D.offsetWidth/this.hideAni/this.hideAni;D.style.clip="rect(0, 0, 0, 0)";D.style.visibility="visible";this.supportsOverlay=this.checkOverlaySupport();this.ready=true}},reveal:function(D,B,C,A,E){if(this.timer){clearTimeout(this.timer);this.timer=0}if(this.overlaySelects&&this.supportsOverlay){if(this.ovTimer){clearTimeout(this.ovTimer);this.ovTimer=0}this.ovTimer=setTimeout("RollTip.toggleOverlay("+1+")",10)}this.tip=document.getElementById(this.ID);this.writeTip("");this.writeTip(D);viewport.getAll();this.w=this.tip.offsetWidth;this.h=this.tip.offsetHeight;this.startTime=(new Date()).getTime();this.positionTip(B);if(this.tip){if(C){this.tip.style.backgroundColor=C}if(A){this.tip.style.width=A}if(E){this.tip.style.textAlign=E}}if(this.followMouse){dw_event.add(document,"mousemove",this.trackMouse,true)}this.timer=setInterval("RollTip.rollOut()",10)},rollOut:function(){var B=(new Date()).getTime()-this.startTime;if(Bviewport.width+viewport.scrollX){A=A-this.tip.offsetWidth-this.offX}else{A=A+this.offX}if(C+this.tip.offsetHeight+this.offY>viewport.height+viewport.scrollY){C=C-this.tip.offsetHeight-this.offY;if(C