1var HelpOptionsVar = "width=480,height=420,scrollbars,toolbar,resizable,dependent=yes"; 2var GlossOptionsVar = "width=420,height=180,scrollbars,toolbar,resizable,dependent=yes"; 3var bigsub = "width=540,height=440,scrollbars,menubar,resizable,status,dependent=yes"; 4var smallsub = "width=440,height=320,scrollbars,resizable,dependent=yes"; 5var sersub = "width=500,height=380,scrollbars,resizable,status,dependent=yes"; 6var memsub = "width=630,height=320,scrollbars,menubar,resizable,status,dependent=yes"; 7var helpWinVar = null; 8var glossWinVar = null; 9var datSubWinVar = null; 10var ValidStr = 'abcdefghijklmnopqrstuvwxyz-'; 11var ValidStr_ddns = 'abcdefghijklmnopqrstuvwxyz-1234567890'; 12var hex_str = "ABCDEFabcdef0123456789"; 13 14if (document.layers) document.captureEvents(Event.KEYPRESS); 15 document.onkeypress = checkKey; 16function checkKey(evt) 17{ 18 var lastkeypressed; 19 evt = (evt) ? evt : ((window.event) ? window.event : null); 20 if (evt) 21 lastkeypressed = (evt.keyCode) ? evt.keyCode : (evt.which ) ? evt.which : null; 22 else 23 lastkeypressed = null; 24 25 if ((lastkeypressed == 27)) /* ESC */ 26 { 27 if (document.forms[0].elements[0].focus) 28 document.forms[0].elements[0].focus(); 29 30 return false; 31 } 32 33 return true; 34} 35 36function showMsg() 37{ 38 var msgVar=document.forms[0].message.value; 39 if (msgVar.length > 1) 40 alert(msgVar); 41} 42 43function closeWin(win_var) 44{ 45 if ( ((win_var != null) && (win_var.close)) || ((win_var != null) && (win_var.closed==false)) ) 46 win_var.close(); 47} 48 49function openHelpWin(file_name) 50{ 51 helpWinVar = window.open(file_name,'help_win',HelpOptionsVar); 52 if (helpWinVar && helpWinVar.focus) 53 setTimeout('helpWinVar.focus()',200); 54} 55 56function openGlossWin() 57{ 58 glossWinVar = window.open('','gloss_win',GlossOptionsVar); 59 if (glossWinVar && glossWinVar.focus) 60 setTimeout('glossWinVar.focus()',200); 61} 62 63function openDataSubWin(filename,win_type) 64{ 65 datSubWinVar = window.open(filename,'datasub_win',win_type); 66 if (datSubWinVar && datSubWinVar.focus) 67 setTimeout('datSubWinVar.focus()',200); 68} 69 70function closeSubWins() 71{ 72 if (helpWinVar) 73 closeWin(helpWinVar); 74 if (glossWinVar) 75 closeWin(glossWinVar); 76 if (datSubWinVar) 77 closeWin(datSubWinVar); 78} 79 80function checkBlank(fieldObj, fname) 81{ 82 var msg = ""; 83 if (fieldObj.value.length < 1){ 84 msg = addstr(msg_blank,fname); 85 } 86 return msg; 87} 88 89function checkNoBlanks(fObj, fname) 90{ 91 var space = " "; 92 if (fObj.value.indexOf(space) >= 0 ) 93 return msg_space; 94 else return ""; 95} 96 97function checkValid(text_input_field, field_name, Valid_Str, max_size, mustFill) 98{ 99 var error_msg= ""; 100 var size = text_input_field.value.length; 101 var str = text_input_field.value; 102 103 if ((mustFill) && (size != max_size) ) 104 error_msg = addstr(msg_blank_in,field_name); 105 for (var i=0; i < size; i++) 106 { 107 if (!(Valid_Str.indexOf(str.charAt(i)) >= 0)) 108 { 109 error_msg = addstr(msg_invalid,field_name,Valid_Str); 110 break; 111 } 112 } 113 return error_msg; 114} 115function checkInt(text_input_field, field_name, min_value, max_value, required) 116{ 117 var str = text_input_field.value; 118 var error_msg= ""; 119 120 if (text_input_field.value.length==0) 121 { 122 if (required) 123 error_msg = addstr(msg_blank,field_name); 124 } 125 else 126 { 127 for (var i=0; i < str.length; i++) 128 { 129 if ((str.charAt(i) < '0') || (str.charAt(i) > '9')) 130 error_msg = addstr(msg_check_invalid,field_name); 131 } 132 if (error_msg.length < 2) 133 { 134 var int_value = parseInt(str,10); 135 if (int_value < min_value) 136 { 137 if(current_gui_language == "Japanese") 138 error_msg = addstr(msg_greater,field_name, min_value); 139 else 140 error_msg = addstr(msg_greater,field_name,(min_value - 1)); 141 } 142 if (int_value > max_value) 143 error_msg = addstr(msg_less,field_name,(max_value + 1)); 144 } 145 } 146 if (error_msg.length > 1) 147 error_msg = error_msg + "\n"; 148 return(error_msg); 149} 150function chkMacLen(mac){ 151 if((mac.value.length != 12) || (mac.value=="000000000000")){ 152 alert("<%0%>"); 153 mac.value = ""; 154 return false; 155 } 156 else 157 { 158 return true; 159 } 160} 161function sumvalue(F) 162{ 163 if (F.MACAssign[2].checked) 164 { 165 if ((F.Spoofmac.value.indexOf(':')!=-1)||(F.Spoofmac.value.indexOf('-')!=-1)) 166 { 167 if (MACAddressBlur(F.Spoofmac)) 168 { 169 return true; 170 } 171 else 172 return false; 173 } 174 else 175 { 176 if (chkMacLen(F.Spoofmac)) 177 { 178 return true; 179 } 180 else 181 return false; 182 } 183 } 184 return true; 185} 186function sumvalue1(F) 187{ 188 if ((F.Spoofmac.value.indexOf(':')!=-1)||(F.Spoofmac.value.indexOf('-')!=-1)) 189 { 190 if (MACAddressBlur(F.Spoofmac)) 191 { 192 return true; 193 } 194 else 195 return false; 196 } 197 else 198 { 199 if (chkMacLen(F.Spoofmac)) 200 { 201 return true; 202 } 203 else 204 return false; 205 } 206 return true; 207} 208function MACAddressBlur(address) 209{ 210 var MAC = address.value; 211 MAC = MAC.replace(/:/g,""); 212 MAC = MAC.replace(/-/g,""); 213 address.value = MAC; 214 if ((address.value.length != 12) || (address.value=="000000000000")) 215 { 216 alert("<%0%>"); 217 return false; 218 } 219 else 220 { 221 return true; 222 } 223} 224function loadhelp(fname,anchname) 225{ 226 if (top.helpframe) 227 { 228 if ((loadhelp.arguments.length == 1 ) || (anchname == "" )) 229 top.helpframe.location.href=fname+"_h.htm"; 230 else 231 top.helpframe.location.href=fname+"_h.htm#" + anchname; 232 } 233} 234 235/* jump to next text for IPv6 */ 236function jumpcheckv6(txtobj,isEnd) 237{ 238 if (txtobj.value.length>3 || txtobj.value.indexOf(":")>=0) 239 { 240 if (txtobj.value.indexOf(":")>=0) 241 { 242 txtobj.value= txtobj.value.replace(":",""); 243 } 244 if (isEnd || txtobj.value.length==0) 245 return true; 246 for (i=0;i<document.forms[0].elements.length;i++) 247 { 248 if (document.forms[0].elements[i]==txtobj) 249 { 250 document.forms[0].elements[i+1].select(); 251 document.forms[0].elements[i+1].focus(); 252 } 253 } 254 } 255 return true; 256} 257 258var need_to_switch; 259/* jump to next text for IPv4 */ 260function jumpcheck(txtobj,isEnd) 261{ 262 //return true; 263 if (txtobj.value.length>2 || txtobj.value.indexOf(".")>=0) 264 { 265 if (txtobj.value.indexOf(".")>=0) 266 { 267 txtobj.value= txtobj.value.replace(".",""); 268 } 269 if (isEnd || txtobj.value.length==0 || need_to_switch==0) 270 return true; 271 for (i=0;i<document.forms[0].elements.length;i++) 272 { 273 if (document.forms[0].elements[i]==txtobj) 274 { 275 document.forms[0].elements[i+1].select(); 276 document.forms[0].elements[i+1].focus(); 277 } 278 } 279 } 280 return true; 281} 282 283/* check backspace */ 284function bscheck(e,txtobj,isStart) 285{ 286 var keynum; 287 288 if(window.event) 289 { 290 keynum = e.keyCode 291 } 292 else if(e.which) 293 { 294 keynum = e.which 295 } 296 297 if (keynum == 8 && txtobj.value.length==0) 298 { 299 if (isStart) 300 return true; 301 for (i=0;i<document.forms[0].elements.length;i++) 302 { 303 if (document.forms[0].elements[i]==txtobj && document.forms[0].elements[i-1].disabled!=true) 304 { 305 document.forms[0].elements[i-1].select(); 306 document.forms[0].elements[i-1].focus(); 307 } 308 } 309 310 } 311 312 if (e.keyCode==9 ) /* tab key */ 313 need_to_switch = 0; 314 else 315 need_to_switch = 1; 316 317 return true; 318} 319 320function setDisabled(OnOffFlag,formFields) 321{ 322 for (var i = 1; i < setDisabled.arguments.length; i++) 323 setDisabled.arguments[i].disabled = OnOffFlag; 324} 325