
<? if eq 1 1 '<script language="JavaScript">' '' ?>
<? if eq 1 1 '<? include ../html/js/jsl.js ?>'   '<script language="JavaScript" src="../html/js/jsl.js"></script>' ?>
<? if eq 1 1 '<? include ../html/js/error.js ?>' '<script language="JavaScript" src="../html/js/error.js"></script>' ?>

<? include ../html/wireless/wireless_mgmt.js ?>

var MaxSSIDList;
var privacy_type;

function uiDoOnLoad()
{
	var SSIDList = new Array();
	var i=0;

	privacy_type = <? query ap:settings/privacy_type ?>

	jslPostToViewCheckBox("uiViewEnableMSSID","uiPostEnableMSSID");

  	<? multiquery ap:status/mssid_list "SSIDList[i++]='$01';" ?>
	MaxSSIDList = i;

	if (privacy_type != 0)
	{
		alert ("Multiple SSID support is Disabled since Privacy is On.");
		jslDisable("uiViewEnableMSSID");
		jslDisable("uiViewAddSSID");
		jslDisable("uiViewAddSSIDButton");
		if(MaxSSIDList>0) {
		document.getElementById("uiViewDeleteAllStatus").value="off";
	  	document.getElementById("uiViewDeleteAllStatus").src="<? echo $var:btnCheckBoxOff ?>";
		jslDisable("uiViewDeleteAllStatus");
		}
		for (i=0; i < MaxSSIDList; i++)
			jslDisable("uiViewSSID"+i);
	}
}

function uiDoSave()
{
	jslViewToPostCheckBox("uiPostEnableMSSID","uiViewEnableMSSID");
	document.getElementById("SSIDError").value = "";
	jslFormSubmit("uiPostForm");
    return;
}

function uiDoAddSSID()
{
	jslEnable ("uiPostAddSSID");
	jslSetValue("uiPostAddSSID","uiViewAddSSID");
	jslViewToPostCheckBox("uiPostEnableMSSID","uiViewEnableMSSID");

    if(MaxSSIDList==16) 
	{ 
       	alert("Maximum 16 number of SSID supported");
       	return; 
    } 
	if (document.getElementById("uiPostAddSSID").value.length == 0)
	{
		alert ("Invalid SSID");
		return;
	}	
	jslDisable("uiPostDelSSID");
	document.getElementById("SSIDError").value = "";
	jslFormSubmit("uiPostForm");
	return;	
}

function uiDoDelSSID(arg)
{
	if(confirm("Delete SSID ?"))
	{
		jslDisable("uiPostAddSSID");
		jslEnable ("uiPostDelSSID");
		jslViewToPostCheckBox("uiPostEnableMSSID","uiViewEnableMSSID");
		document.getElementById("uiPostDelSSID").value = arg;
		document.getElementById("SSIDError").value = "";
		jslFormSubmit("uiPostForm");
	}
	return;	
}

function uiViewDeleteAll(value)
{
   switch(value) {
   	case "on":
		     jslEnable("uiPostFlush");
		     break;
	case "off":
	default:
		     jslDisable("uiPostFlush");
		     break;
   }
}

function uiDoCancel()
{
  jslGoTo(null,"home");
}
</script>
