// javascript.js // ÀÛ¼ºÀÚ: ±è¹ÌÈñ // ÀÛ¼ºÀÏ: 04.10.26 // °³¿ä: javascript.js´Â cgi ¿¡¼­ ¾²ÀÌ´Â ÀÚ¹Ù½ºÅ©¸³Æ® ÇÔ¼ö¸¦ µû·Î ¸ð¾Æ ³õÀº °ÍÀ¸·Î¼­, // cgi¿¡¼­ ¾²ÀÌ·Á¸é // // ÀÌ·±½ÄÀ¸·Î ¸µÅ©¸¦ ÇØÁÖ¾î¾ßÇÑ´Ù. // ÀÚ¼¼ÇÑ »çÇ×Àº ÇØ´ç ÇÔ¼öÀÇ ÁÖ¼®À» Âü°íÇÏ±æ ¹Ù¶õ´Ù. // ÀÌ ÇÔ¼ö´Â index.c ¿¡¼­ ÀÔ·ÂÇÑ id,passwordÀÇ ±æÀ̸¦ Ã¼Å©ÇØ¼­ ±æÀ̰¡ 5~10ÀÌ ¾Æ´Ò°æ¿ì // alert ¸Þ¼¼Áö¸¦ ³¯·ÁÁØ´Ù. function check_form(num, str) { if( document.index.elements[num].value.length != 0 && document.index.elements[num].value.length < 5 || document.index.elements[num].value.length > 10) { alert(str + ' should be composed of 5 ~ 10 characters.'); document.index.elements[num].select(); return; } } // ÀÌ ÇÔ¼ö´Â main.c ¿¡¼­ Activex ¸ðµåÀ϶§ stopsave ¹öưÀ» Ŭ¸¯ÇÏ¸é ½ÇÇàµÇ´Â ÇÔ¼ö·Î¼­ // ÇØ´ç ÀÎÀÚ¸¦ activex·Î Àü¼ÛÇÑ´Ù. function doSaveStop(direction) { document.LNCActiveX.doSaveStop(direction) } // ÀÌ ÇÔ¼ö´Â main.c ¿¡¼­ Activex ¸ðµåÀ϶§ ptz°¡ enabled µÇ¾îÀÖÀ»¶§ ½ÇÇàµÇ´Â ÇÔ¼öÀÌ´Ù. function doPTZ(direct) { document.PTZ.MovePTZ(direct) } // ÀÌ ÇÔ¼ö´Â main.c¿¡¼­ Activex ¸ðµåÀ϶§ framerate¸¦ º¯°æÇÒ °æ¿ì ½ÇÇàµÇ´Â ÇÔ¼öÀÌ´Ù. // º¯°æµÈ framerate°ªÀ» ¹Þ¾Æ¿Í¼­ ±×µ¥ ÇØ´çÇÏ´Â maxFRÀ» ¼³Á¤ÇÑ´ÙÀ½ ActivexÀ¸·Î Àü¼ÛÇÑ´Ù. function setMaxFrameRate(temp) { if(temp==1){ maxFR = 0.1; } else if(temp == 2){ maxFR = 0.2; } else if(temp==3){ maxFR=0.5; } else if(temp==4){ maxFR=1; } else if(temp==5){ maxFR=2; } else if(temp==6){ maxFR=5; } else if(temp==7){ maxFR=10; } else if(temp==8){ maxFR=15; } else{ maxFR=30; } document.LNCActiveX.maxFrameRate = maxFR; document.LNCActiveX.setMaxFrameRate(maxFR); } // ÀÌ ÇÔ¼ö´Â main.c¿¡¼­ Applet ¸ðµåÀ϶§ framerate¸¦ º¯°æÇÒ °æ¿ì ½ÇÇàµÇ´Â ÇÔ¼öÀÌ´Ù. // º¯°æµÈ framerate°ªÀ» ¹Þ¾Æ¿Í¼­ ±×µ¥ ÇØ´çÇÏ´Â maxFRÀ» ¼³Á¤ÇÑ´ÙÀ½ ApppletÀ¸·Î Àü¼ÛÇÑ´Ù. function setMaxFrameRateApplet(temp) { if(temp==1){ maxFR = 0.1; } else if(temp == 2){ maxFR = 0.2; } else if(temp==3){ maxFR=0.5; } else if(temp==4){ maxFR=1; } else if(temp==5){ maxFR=2; } else if(temp==6){ maxFR=5; } else if(temp==7){ maxFR=10; } else if(temp==8){ maxFR=15; } else{ maxFR=30; } document.LNCApplet.setExternalFPS(maxFR); } // ÀÌ ÇÔ¼ö´Â showOnlyImageActivex¸¦ Ŭ¸¯ÇÏ¸é ½ÇÇàµÇ´Â ÇÔ¼öÀÌ´Ù. // »ç¿ëÀÚ°¡ showOnlyImageActivex¸¦ Ŭ¸¯Çϸé show_only_image=1 À¸·Î Äí۸¦ ¼³Á¤ÇÑ´Ù. // show_only_image=1À¸·Î ¼³Á¤ÇѵÚ, showOnlyImage¸¦ ½ÇÇàÇÑ µÚ¿¡´Â „‰ change_cookie()¸¦ ½ÇÇàÇØ¼­ // show_only_image=0À¸·Î ¼³Á¤ÇؾßÇÑ´Ù. function showOnlyImage() { document.cookie = "show_only_image=" + escape("1") + "; path=" + escape("/"); if(document.LNCActiveX.TimeStamp==true) { window.open("./main_activex.cgi", "", "width="+document.LNCActiveX.ImageWidth+",height="+(document.LNCActiveX.ImageHeight+20)+",resizable=yes,status=yes,scrollbar=auto"); } else { window.open("./main_activex.cgi", "", "width="+document.LNCActiveX.ImageWidth+",height="+document.LNCActiveX.ImageHeight+",resizable=yes,status=yes,scrollbar=auto"); } } // ÀÌ ¾Æ·¡ÀÇ ÀÚ¹Ù½ºÅ©¸³Æ® ÇÔ¼öµéÀº applet¿¡¼­ ptz¸¦ ¶ç¿üÀ»¶§, ptz ¹öưÀÌ Å¬¸¯µÉ ¶§¸¶´Ù // ±×¿¡ ÇØ´çÇÏ´Â actionÀ» ÇÏ´Â ÇÔ¼öµéÀÌ´Ù. function ff_onclick() { document.LNCApplet.moveFF(); } function fn_onclick() { document.LNCApplet.moveFN(); } function left_onclick() { document.LNCApplet.moveLeft(); } function right_onclick() { document.LNCApplet.moveRight(); } function zi_onclick() { document.LNCApplet.moveZI(); } function zo_onclick() { document.LNCApplet.moveZO(); } function button1_onclick() { document.LNCApplet.moveUp(); } function button2_onclick() { document.LNCApplet.moveDown(); } // applet ptz ÀÚ¹Ù½ºÅ©¸³Æ® ÇÔ¼ö ³¡ // ÀÌ ÇÔ¼ö´Â activex ¸¦ disconnect ÇÏ´Â ÇÔ¼öÀÌ´Ù. // ÆäÀÌÁö¸¦ À̵¿ÇÒ¶§ ȤÀº refresh ÇÒ¶§ »ç¿ëµÈ´Ù. function disConnect() { document.LNCActiveX.doDisconnect(); } // ÀÌ ÇÔ¼ö´Â auth_levelÀÌ admin ±ÇÇÑÀÌ ÀÖ´ÂÁö üũÇÑÈÄ, activeX ¸ðµåÀ̸é disconnect¸¦ ÇÑ ÈÄ admin page¿¡ Á¢¼ÓÇÑ´Ù. // ±×·¸Áö ¾ÊÀ» °æ¿ì, alert ¸Þ¼¼Áö¸¦ »Ñ·ÁÁØ´Ù. function AdminAuthCheck(mode,auth_level) { if(auth_level < 43) { alert('You are not administrator'); return false; } else if(mode ==10) { // activex mode À϶§ disConnect(); } } // ÀÌ ÇÔ¼ö´Â main.c ¿¡¼­ administrator menu¸¦ Ŭ¸¯ÇßÀ» ¶§ È£Ãâ ÇÏ´Â ÇÔ¼öÀÌ´Ù. // cookie¿¡ ¼³Á¤µÈ user_auth_level °ªÀ» Àоî¿Í admin authority°¡ adminÀÏ °æ¿ì¿¡´Â admin page·Î ¸µÅ© ½Ã۰í, // ±×·¸Áö ¾ÊÀ» °æ¿ì, alert ¸Þ¼¼Áö¸¦ »Ñ·ÁÁØ´Ù. function AdminConf(val) { var vStart = 0; var vSemi = 0; var status_no=0; vStart = document.cookie.indexOf("user_auth_level", 0 ); if(vStart!=-1) vSemi = document.cookie.indexOf(";", vStart); // Äí۰ª Áß¿¡¼­ current_status_noÀÇ ±æÀ̸¦ ¾Ë¾Æ³½´Ù. if(vStart!=-1) status_no = document.cookie.indexOf("=", vStart); if( vSemi == -1 ) vSemi = document.cookie.length; var val=document.cookie.substring( vStart + status_no+1, vSemi); var val_num=parseInt(val,10); if((vStart==-1)||(val_num < 43)) { alert('You are not administrator'); return false; } if(val==10) { // activex mode À϶§ disConnect(); } } // ÀÌ ÇÔ¼ö´Â main.c¿¡¼­ expansionÀ» º¯°æÇÒ °æ¿ì È£ÃâµÇ´Â ÇÔ¼öÀÌ´Ù. // »ç¿ëÀÚ°¡ expansion°ªÀ» º¯°æÇÒ °æ¿ì, º¯°æµÈ expansion °ªÀ» cookie·Î ¼³Á¤ÇÑ´Ù. function ExpansionChange(val){ if(document.formCtrl.Expansion.value==0.5){ document.cookie = "expansion=" + escape("5") + "; path=" + escape("/"); } else if(document.formCtrl.Expansion.value==1){ document.cookie = "expansion=" + escape("10") + "; path=" + escape("/"); } else if(document.formCtrl.Expansion.value==1.5){ document.cookie = "expansion=" + escape("15") + "; path=" + escape("/"); } else if(document.formCtrl.Expansion.value==2){ document.cookie = "expansion=" + escape("20") + "; path=" + escape("/"); } if(val==10) { // activex mode À϶§ disConnect(); } document.location ="./main_activex.cgi"; } // ÀÌ ÇÔ¼ö´Â main.c¿¡¼­ framerate¸¦ º¯°æÇÒ °æ¿ì È£ÃâµÇ´Â ÇÔ¼öÀÌ´Ù. // »ç¿ëÀÚ°¡ framerate°ªÀ» º¯°æÇÒ °æ¿ì, º¯°æµÈ framerate °ªÀ» cookie·Î ¼³Á¤ÇÑ´Ù. function ChangeFramerateCookie(fr_value){ if(fr_value==1) document.cookie = "frame_rate=" + escape("1") + "; path=" + escape("/"); else if(fr_value==2) document.cookie = "frame_rate=" + escape("2") + "; path=" + escape("/"); else if(fr_value==3) document.cookie = "frame_rate=" + escape("3") + "; path=" + escape("/"); else if(fr_value==4) document.cookie = "frame_rate=" + escape("4") + "; path=" + escape("/"); else if(fr_value==5) document.cookie = "frame_rate=" + escape("5") + "; path=" + escape("/"); else if(fr_value==6) document.cookie = "frame_rate=" + escape("6") + "; path=" + escape("/"); else if(fr_value==7) document.cookie = "frame_rate=" + escape("7") + "; path=" + escape("/"); else if(fr_value==8) document.cookie = "frame_rate=" + escape("8") + "; path=" + escape("/"); else if(fr_value==9) document.cookie = "frame_rate=" + escape("9") + "; path=" + escape("/"); else document.cookie = "frame_rate=" + escape("4") + "; path=" + escape("/"); } // ÀÌ ÇÔ¼ö´Â main.c ¿¡¼­ logoutÀ» Ŭ¸¯ÇÒ ¶§ ½ÇÇàµÇ´Â ÇÔ¼öÀÌ´Ù. // »ç¿ëÀÚ°¡ logout À» Ŭ¸¯Çϸé, ±âÁ¸¿¡ ¼³Á¤µÈ Äí۸¦ null °ªÀ̳ª, not À¸·Î ¼³Á¤ÇÑ´Ù. function ResetCookie(val){ document.cookie = "frame_rate=" + escape("") + "; path=" + escape("/"); document.cookie = "expansion=" + escape("") + "; path=" + escape("/"); document.cookie = "mode=" + escape("not") + "; path=" + escape("/"); document.cookie = "user_id=" + escape("") + "; path=" + escape("/"); document.cookie = "user_auth_code=" + escape("") + "; path=" + escape("/"); document.cookie = "user_auth_level=" + escape("") + "; path=" + escape("/"); document.cookie = "behindfirewall=" + escape("") + "; path=" + escape("/"); document.cookie = "show_only_image=" + escape("") + "; path=" + escape("/"); if(val==10) { // activex mode À϶§ disConnect(); } } // ÀÌ ÇÔ¼ö´Â showOnlyImageActivex ½ÇÇàÇÑ µÚ¿¡ show_only_image=1·Î µÇ¾îÀÖ´Â °ÍÀ» // ´Ù½Ã 0À¸·Î ¼³Á¤Çϱâ À§ÇØ ½ÇÇàµÇ´Â ÇÔ¼öÀÌ´Ù. // show_only_image=0À¸·Î ¼³Á¤ÇØ¾ß main.c¿¡¼­ showOnlyimage°¡ ¾Æ´Ñ main ÆäÀÌÁö¸¦ º¸¿©Áֱ⠶§¹®ÀÌ´Ù. function change_cookie() { document.cookie = "show_only_image=" + escape("0") + "; path=" + escape("/"); } // ÀÌ ¾Æ·¡ÀÇ ÇÔ¼öµéÀº ±âº»ÀûÀ¸·Î Á¦°øµÇ´Â ÀÚ¹Ù½ºÅ©¸³Æ® ÇÔ¼öÀÌ´Ù. function MM_findObj(n, d) { //v4.0 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 2) { if ((img = MM_findObj(args[2])) != null && !img.MM_init) { img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src; if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array(); nbArr[nbArr.length] = img; for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) { if (!img.MM_up) img.MM_up = img.src; img.src = img.MM_dn = args[i+1]; nbArr[nbArr.length] = img; } } } else if (event == "over") { document.MM_nbOver = nbArr = new Array(); for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) { if (!img.MM_up) img.MM_up = img.src; img.src = (img.MM_dn && args[i+2]) ? args[i+2] : args[i+1]; nbArr[nbArr.length] = img; } } else if (event == "out" ) { for (i=0; i < document.MM_nbOver.length; i++) { img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; } } else if (event == "down") { if ((nbArr = document[grpName]) != null) for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; } document[grpName] = nbArr = new Array(); for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) { if (!img.MM_up) img.MM_up = img.src; img.src = img.MM_dn = args[i+1]; nbArr[nbArr.length] = img; } } } // ±âº» ÀÚ¹Ù ½ºÅ©¸³Æ® ÇÔ¼ö ³¡