function sw_po(obj){
var gobj0 = document.getElementById('t_openvpn_sv_port');
var gobj1 = document.getElementById('t_openvpn_sv_udpfment');
var gobj2 = document.getElementById('c_openvpn_sv_mssfix_EN');
if(arguments.length == 1){ gobj0.value = (obj.value == 1)?4430:1194; }
gobj1.disabled = (obj.value == 1)
gobj2.disabled = (obj.value == 1)
}
function PXYswNM(){
var gobj0 = document.getElementById('s_openvpn_sv_nm');
var obj0 = document.getElementById('c_openvpn_sv_dhcppxy_EN');
var obj1 = document.getElementById('s_openvpn_sv_authmode');
var obj0req = ((obj0.checked)&&(!obj0.disabled));
gobj0.disabled = ( obj0req||(obj1.value==0) )
}
function sw_advcfig(obj,sw){
var gobj0 = document.getElementById('tb_advcfig');
var gobj1 = document.getElementById('h_advcfig');
var _sw = "none" ;
if(sw!=null){
_sw = (gobj0.style.display == "none")?'':"none";
gobj1.value = (_sw == '')?1:0;
}
else{  _sw = (obj.value == 1)?"":"none"; }
gobj0.style.display = _sw
}
function cli_AUTH_MODE(obj){
var gs0_lip = document.getElementById('stacky0_lip')
var gs0_rip = document.getElementById('stacky0_rip')
var gs0_sk = document.getElementById('stacky0_sk')
var gtls1 = document.getElementById('tls1')
var gid1 = document.getElementById('tr_cli2cli')
var gid2 = document.getElementById('tr_dup_cn')
var gid3 = document.getElementById('tr_tls_cip')
gs0_lip.style.display = (obj.value == 0)?"":"none";
gs0_rip.style.display = (obj.value == 0)?"":"none";
gs0_sk.style.display = (obj.value == 0)?"":"none";
gtls1.style.display = (obj.value == 1)?"":"none";
gid1.style.display = (obj.value == 1)?"":"none";
gid2.style.display = (obj.value == 1)?"":"none";
gid3.style.display = (obj.value == 1)?"":"none";
}
function setSVR_AuthMode(obj){
var gobjid0 = document.getElementById('s_openvpn_sv_authmode')
/*
obj=TAP = 1 selected ,Static Key = 0 off , TLS = 1 on
obj=TUN = 0 selected ,Static Key = 0 on , TLS = 1 on
*/
if(obj.value != 0){
for(var a=0;a<gobjid0.length;a++){
if(gobjid0.options[a].value == 0){ gobjid0.options[a].disabled = true ; }
}
gobjid0.value = (gobjid0.value == 0)?1:gobjid0.value
}
else{
for(var a=0;a<gobjid0.length;a++){
if(gobjid0.options[a].value == 0){ gobjid0.options[a].disabled = false ; }
}
}
cli_AUTH_MODE(gobjid0);
setcliIP();
}
function setcliIP(){
var ctral_id0 = document.getElementById('s_openvpn_sv_tun_dev');//Tunnel Scenario <TAP=1 ; TUN=0>
var ctral_id1 = document.getElementById('s_openvpn_sv_authmode');//Authorization Mode <TLS=1 ; Static Key=0>
var ctral_id2 = document.getElementById('c_openvpn_sv_dhcppxy_EN');//DHCP-Proxy Mode <ck=1 ; ck=0>
var cg_id0 = document.getElementById('t_openvpn_sv_svrip');//Server Virtual IP
var cg_id1 = document.getElementById('c_openvpn_sv_dhcppxy_EN');//DHCP-Proxy Mode
var cg_id2 = document.getElementById('t_openvpn_sv_ippools');//Starting Address
var cg_id3 = document.getElementById('t_openvpn_sv_ippoole');//Ending Address
var cg_id4 = document.getElementById('t_openvpn_sv_gw'); //Gateway
var cg_id5 = document.getElementById('t_openvpn_sv_tlskey'); //TLS Auth. Key
cg_id0.disabled = !((ctral_id0.value == 0) && (ctral_id1.value == 1))
cg_id1.disabled = !((ctral_id0.value ==1) && (ctral_id1.value == 1))
cg_id2.disabled = !((ctral_id0.value ==1) && (!ctral_id2.checked) && (ctral_id1.value == 1))
cg_id3.disabled = !((ctral_id0.value ==1) && (!ctral_id2.checked) && (ctral_id1.value == 1))
cg_id4.disabled = !((ctral_id0.value ==1) && (!ctral_id2.checked) && (ctral_id1.value == 1))
cg_id5.disabled = !(ctral_id1.value == 1)
PXYswNM();
}
function chk(obj){
var gobj0 = document.getElementById('s_openvpn_sv_authmode');
var gobj1 = document.getElementById('t_sslvpn_cli_username');
var gobj2 = document.getElementById('p_sslvpn_cli_pw');
var gobj3 = document.getElementById('t_sslvpn_cc_tname');
var str_meg = "";
var sw0 = false;
if(!((gobj1.value == "" )&&(gobj2.value == "" ))){
sw0 =(!((gobj1.value != "" )&&(gobj2.value != "" )))
}
if(gobj3.value == "" ){ str_meg = GetElmCont("opvpnclilang_0","SSL VPN Client Name can not be empty") }
else if((gobj0.value == 1)&& sw0){ str_meg = GetElmCont("opvpnclilang_0","User Name or Password can not be empty") }
if(str_meg != ""){
alert(str_meg);
return false;
}
return true;
}
function setmask(obj){
var obj0 = document.getElementById("s_openvpn_sv_nm");
var obj1 = document.getElementById("h_openvpn_sv_nm");
if(arguments.length==1){
var objtextv = obj.options[obj.selectedIndex].text;
var sear_env=objtextv.lastIndexOf("(");
obj1.value = objtextv.substring(0,sear_env)
}
else{
for(i=0;i<=obj0.length;i++){
var obj0textv = obj0.options[i].text;
if(obj0textv.indexOf(obj1.value) != -1){
obj0.options[i].selected = true;
break;
}
}
}
}