// javascript.js
// ÀÛ¼ºÀÚ: ±è¹ÌÈñ
// ÀÛ¼ºÀÏ: 04.10.26
// °³¿ä: javascript.js´Â cgi ¿¡¼ ¾²ÀÌ´Â ÀÚ¹Ù½ºÅ©¸³Æ® ÇÔ¼ö¸¦ µû·Î ¸ð¾Æ ³õÀº °ÍÀ¸·Î¼,
// cgi¿¡¼ ¾²ÀÌ·Á¸é
//
// ÀÌ·±½ÄÀ¸·Î ¸µÅ©¸¦ ÇØÁÖ¾î¾ßÇÑ´Ù.
// ÀÚ¼¼ÇÑ »çÇ×Àº ÇØ´ç ÇÔ¼öÀÇ ÁÖ¼®À» Âü°íÇÏ±æ ¹Ù¶õ´Ù.
//<%@ page import="java.io.*" %>
function getCook(name)
{
var found = false;
var start, end;
var i = 0;
while(i <= document.cookie.length){
start = i;
end = start + name.length;
if(document.cookie.substring(start, end) == name){
found = true;
break;
}
i++;
}
if(found == true){
start = end + 1;
end = document.cookie.indexOf(";", start);
if(end 10)
{
alert(str + ' should be composed of 5 ~ 10 characters.');
document.login.elements[ele_name].select();
return;
}
}
// ÀÌ ÇÔ¼ö´Â 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("/");
}
// ÀÌ ÇÔ¼ö´Â 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¿¡¼ 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==5)
document.cookie = "frame_rate=" + escape("5") + "; path=" + escape("/");
else if(fr_value==10)
document.cookie = "frame_rate=" + escape("10") + "; path=" + escape("/");
else if(fr_value==15)
document.cookie = "frame_rate=" + escape("15") + "; path=" + escape("/");
else if(fr_value==20)
document.cookie = "frame_rate=" + escape("20") + "; path=" + escape("/");
else if(fr_value==25)
document.cookie = "frame_rate=" + escape("25") + "; path=" + escape("/");
else if(fr_value==30)
document.cookie = "frame_rate=" + escape("20") + "; path=" + escape("/");
else
document.cookie = "frame_rate=" + escape("5") + "; 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 openlogin(){
loginwin=window.open('login.cgi','login', 'toolbar=no,menubar=no,location=no,directions=no, scrollbars=no,status=yes,width=400,height=300');
}
function closelogin(){
loginwin.close();
}