canApply = false;
canCancel = false;

function setEnvironment() {
 setApplyButtonOff();
 setCancelButtonOff();
}

function apLockedMessage() {
  location.href = location.href
  alert('The Access Point is currently locked. Unlock your Access Point by pressing the reset button on the device itself and click OK.')
}

function getOidRowId(oid) {
  return oid.substr(oid.lastIndexOf('_')+1,2);
}

function getOidRadio(oid) {
  return oid.substr(oid.lastIndexOf('_')-1,1);
}

function setPostButtonsOn() {
  
    canApply = true;
    canCancel = true;
    enableCtl('postApply','postCancel');
  
}
function setApplyButtonOff() {
 canApply = false;
 //This is used to grey the apply button but only for browsers that support this
 disableCtl('postApply');
}
function setCancelButtonOff() {
 canCancel = false;
 //This is used to grey the post buttons but only for browsers that support this
 disableCtl('postCancel');
}

function setPopupOKOn() {
  enableCtl('bOKPopup');
}

function setPopupOKOff() {
  disableCtl('bOKPopup');
}

function clickCancel() {
 if (canCancel) {
  parent.location.href = parent.location.href
 }
}

function enableCtl() {
  var arg = enableCtl.arguments;
  var obj = new Array();
  for (var i=0; i<arg.length; i++) {
    if (typeof(arg[i]) == 'object') {
      for (var j in arg[i])
        obj[obj.length] = arg[i][j];
    } else
        obj[obj.length] = arg[i];
  }
  for (var i=0; i< obj.length; i++) {
    var ctl = MM_findObj(obj[i]);
    if(ctl != null) ctl.disabled = false;
  }
}

function disableCtl() {
  var arg = disableCtl.arguments;
  var obj = new Array();
  for (var i=0; i<arg.length; i++) {
    if (typeof(arg[i]) == 'object') {
      for (var j in arg[i])
        obj[obj.length] = arg[i][j];
    } else
        obj[obj.length] = arg[i];
  }
  for (var i=0; i< obj.length; i++) {
    var ctl = MM_findObj(obj[i]);
    if(ctl != null) ctl.disabled = true; 
  }
}

function changeProp(obj, prop, val) {
  var ids = new Array();
  if (typeof(obj) == 'object') 
    for (var j in obj)
      ids[ids.length] = obj[j];
  else
    ids[ids.length] = obj;

  for (var j in ids)
    MM_changeProp(ids[j],'',prop,val);
}

function MM_findObj(n, d) { //v4.01
 var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
   d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
 if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
 for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
 if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_showHideLayers() { //v3.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
obj.visibility=v; }
}

function MM_changeProp(objName,x,theProp,theValue) { //v3.0
var obj = MM_findObj(objName);
if (obj && (theProp.indexOf("style.")==-1 || obj.style)) eval("obj."+theProp+"='"+theValue+"'");
}

function openWindow(dir, size) {
  var winSize = "";
  if (this.size) {
    winSize = this.size.split(',');
    winSize = 'width='+winSize[0]+', height='+winSize[1];
  } else
    winSize = 'width=380,height=280';
  var winProperties = 'toolbar=0,location=0,directories=0,status=0,scrollbars=1,personalbar=0,menubar=0,resizable,copyhistory=0';
  winProperties += ', '+winSize;
  openedWindow = window.open(dir+'/index.shtml','popup',winProperties);
  return openedWindow;
}
