if (typeof(COMMON_JS) == 'undefined') { // 한번만 실행
    var COMMON_JS = true;

    // 전역 변수
    var errmsg = "";
    var errfld;

    // 필드 검사
    function check_field(fld, msg) 
    {
        if ((fld.value = trim(fld.value)) == "") 			   
            error_field(fld, msg);
        else
            clear_field(fld);
        return;
    }

    // 필드 오류 표시
    function error_field(fld, msg) 
    {
        if (msg != "")
            errmsg += msg + "\n";
        if (!errfld) errfld = fld;
        fld.style.background = "#BDDEF7";
    }

    // 필드를 깨끗하게
    function clear_field(fld) 
    {
        fld.style.background = "#FFFFFF";
    }

    function trim(s)
    {
        var t = "";
        var from_pos = to_pos = 0;

        for (i=0; i<s.length; i++)
        {
            if (s.charAt(i) == ' ')
                continue;
            else 
            {
                from_pos = i;
                break;
            }
        }

        for (i=s.length; i>=0; i--)
        {
            if (s.charAt(i-1) == ' ')
                continue;
            else 
            {
                to_pos = i;
                break;
            }
        }	

        t = s.substring(from_pos, to_pos);
        //				alert(from_pos + ',' + to_pos + ',' + t+'.');
        return t;
    }

    // 자바스크립트로 PHP의 number_format 흉내를 냄
    // 숫자에 , 를 출력
    function number_format(data) 
    {
        
        var tmp = '';
        var number = '';
        var cutlen = 3;
        var comma = ',';
        var i;
       
        len = data.length;
        mod = (len % cutlen);
        k = cutlen - mod;
        for (i=0; i<data.length; i++) 
        {
            number = number + data.charAt(i);
            
            if (i < data.length - 1) 
            {
                k++;
                if ((k % cutlen) == 0) 
                {
                    number = number + comma;
                    k = 0;
                }
            }
        }

        return number;
    }

    // 새 창
    function popup_window(url, winname, opt)
    {
        window.open(url, winname, opt);
    }


    // 폼메일 창
    function popup_formmail(url)
    {
        opt = 'scrollbars=yes,width=417,height=385,top=10,left=20';
        popup_window(url, "wformmail", opt);
    }

    // , 를 없앤다.
    function no_comma(data)
    {
        var tmp = '';
        var comma = ',';
        var i;

        for (i=0; i<data.length; i++)
        {
            if (data.charAt(i) != comma)
                tmp += data.charAt(i);
        }
        return tmp;
    }

    // 삭제 검사 확인
    function del(href) 
    {
        if(confirm("한번 삭제한 자료는 복구할 방법이 없습니다.\n\n정말 삭제하시겠습니까?")) 
            document.location.href = href;
    }

    // 쿠키 입력
    function set_cookie(name, value, expirehours, domain) 
    {
        var today = new Date();
        today.setTime(today.getTime() + (60*60*1000*expirehours));
        document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + today.toGMTString() + ";";
        if (domain) {
            document.cookie += "domain=" + domain + ";";
        }
    }

    // 쿠키 얻음
    function get_cookie(name) 
    {
        var find_sw = false;
        var start, end;
        var i = 0;

        for (i=0; i<= document.cookie.length; i++)
        {
            start = i;
            end = start + name.length;

            if(document.cookie.substring(start, end) == name) 
            {
                find_sw = true
                break
            }
        }

        if (find_sw == true) 
        {
            start = end + 1;
            end = document.cookie.indexOf(";", start);

            if(end < start)
                end = document.cookie.length;

            return document.cookie.substring(start, end);
        }
        return "";
    }

    // 쿠키 지움
    function delete_cookie(name) 
    {
        var today = new Date();

        today.setTime(today.getTime() - 1);
        var value = get_cookie(name);
        if(value != "")
            document.cookie = name + "=" + value + "; path=/; expires=" + today.toGMTString();
    }

    // 이미지의 크기에 따라 새창의 크기가 변경됩니다.
    // zzzz님께서 알려주셨습니다. 2005/04/12
    function image_window(img)
    {
        var w = img.tmp_width; 
        var h = img.tmp_height; 
        var winl = (screen.width-w)/2; 
        var wint = (screen.height-h)/3; 

        if (w >= screen.width) { 
            winl = 0; 
            h = (parseInt)(w * (h / w)); 
        } 

        if (h >= screen.height) { 
            wint = 0; 
            w = (parseInt)(h * (w / h)); 
        } 

        var js_url = "<script language='JavaScript1.2'> \n"; 
            js_url += "<!-- \n"; 
            js_url += "var ie=document.all; \n"; 
            js_url += "var nn6=document.getElementById&&!document.all; \n"; 
            js_url += "var isdrag=false; \n"; 
            js_url += "var x,y; \n"; 
            js_url += "var dobj; \n"; 
            js_url += "function movemouse(e) \n"; 
            js_url += "{ \n"; 
            js_url += "  if (isdrag) \n"; 
            js_url += "  { \n"; 
            js_url += "    dobj.style.left = nn6 ? tx + e.clientX - x : tx + event.clientX - x; \n"; 
            js_url += "    dobj.style.top  = nn6 ? ty + e.clientY - y : ty + event.clientY - y; \n"; 
            js_url += "    return false; \n"; 
            js_url += "  } \n"; 
            js_url += "} \n"; 
            js_url += "function selectmouse(e) \n"; 
            js_url += "{ \n"; 
            js_url += "  var fobj      = nn6 ? e.target : event.srcElement; \n"; 
            js_url += "  var topelement = nn6 ? 'HTML' : 'BODY'; \n"; 
            js_url += "  while (fobj.tagName != topelement && fobj.className != 'dragme') \n"; 
            js_url += "  { \n"; 
            js_url += "    fobj = nn6 ? fobj.parentNode : fobj.parentElement; \n"; 
            js_url += "  } \n"; 
            js_url += "  if (fobj.className=='dragme') \n"; 
            js_url += "  { \n"; 
            js_url += "    isdrag = true; \n"; 
            js_url += "    dobj = fobj; \n"; 
            js_url += "    tx = parseInt(dobj.style.left+0); \n"; 
            js_url += "    ty = parseInt(dobj.style.top+0); \n"; 
            js_url += "    x = nn6 ? e.clientX : event.clientX; \n"; 
            js_url += "    y = nn6 ? e.clientY : event.clientY; \n"; 
            js_url += "    document.onmousemove=movemouse; \n"; 
            js_url += "    return false; \n"; 
            js_url += "  } \n"; 
            js_url += "} \n"; 
            js_url += "document.onmousedown=selectmouse; \n"; 
            js_url += "document.onmouseup=new Function('isdrag=false'); \n"; 
            js_url += "//--> \n"; 
            js_url += "</"+"script> \n"; 

        var settings;

        if (g4_is_gecko) {
            settings  ='width='+(w+10)+','; 
            settings +='height='+(h+10)+','; 
        } else {
            settings  ='width='+w+','; 
            settings +='height='+h+','; 
        }
        settings +='top='+wint+','; 
        settings +='left='+winl+','; 
        settings +='scrollbars=no,'; 
        settings +='resizable=yes,'; 
        settings +='status=no'; 


        win=window.open("","image_window",settings); 
        win.document.open(); 
        win.document.write ("<html><head> \n<meta http-equiv='imagetoolbar' CONTENT='no'> \n<meta http-equiv='content-type' content='text/html; charset="+g4_charset+"'>\n"); 
        var size = "이미지 사이즈 : "+w+" x "+h;
        win.document.write ("<title>"+size+"</title> \n"); 
        if(w >= screen.width || h >= screen.height) { 
            win.document.write (js_url); 
            var click = "ondblclick='window.close();' style='cursor:move' title=' "+size+" \n\n 이미지 사이즈가 화면보다 큽니다. \n 왼쪽 버튼을 클릭한 후 마우스를 움직여서 보세요. \n\n 더블 클릭하면 닫혀요. '"; 
        } 
        else 
            var click = "onclick='window.close();' style='cursor:pointer' title=' "+size+" \n\n 클릭하면 닫혀요. '"; 
        win.document.write ("<style>.dragme{position:relative;}</style> \n"); 
        win.document.write ("</head> \n\n"); 
        win.document.write ("<body leftmargin=0 topmargin=0 bgcolor=#dddddd style='cursor:arrow;'> \n"); 
        win.document.write ("<table width=100% height=100% cellpadding=0 cellspacing=0><tr><td align=center valign=middle><img src='"+img.src+"' width='"+w+"' height='"+h+"' border=0 class='dragme' "+click+"></td></tr></table>");
        win.document.write ("</body></html>"); 
        win.document.close(); 

        if(parseInt(navigator.appVersion) >= 4){win.window.focus();} 
    }

    // a 태그에서 onclick 이벤트를 사용하지 않기 위해
    function win_open(url, name, option)
    {
        var popup = window.open(url, name, option);
        popup.focus();
    }

    // 우편번호 창
    function win_zip(frm_name, frm_zip1, frm_zip2, frm_addr1, frm_addr2)
    {
        url = g4_path + "/" + g4_bbs + "/zip.php?frm_name="+frm_name+"&frm_zip1="+frm_zip1+"&frm_zip2="+frm_zip2+"&frm_addr1="+frm_addr1+"&frm_addr2="+frm_addr2;
        win_open(url, "winZip", "left=50,top=50,width=616,height=460,scrollbars=1");
    }

    // 쪽지 창
    function win_memo(url)
    {
        if (!url)
            url = g4_path + "/" + g4_bbs + "/memo.php";
        win_open(url, "winMemo", "left=50,top=50,width=616,height=460,scrollbars=1");
    }

    // 포인트 창
    function win_point(url)
    {
        win_open(g4_path + "/" + g4_bbs + "/point.php", "winPoint", "left=20, top=20, width=616, height=635, scrollbars=1");
    }

    // 스크랩 창
    function win_scrap(url)
    {
        if (!url)
            url = g4_path + "/" + g4_bbs + "/scrap.php";
        win_open(url, "scrap", "left=20, top=20, width=616, height=500, scrollbars=1");
    }

    // 패스워드 분실 창
    function win_password_forget()
    {
        win_open(g4_path + "/" + g4_bbs + "/password_forget.php", 'winPasswordForget', 'left=50, top=50, width=616, height=500, scrollbars=1');
    }

    // 코멘트 창
    function win_comment(url)
    {
        win_open(url, "winComment", "left=50, top=50, width=800, height=600, scrollbars=1");
    }

    // 폼메일 창
    function win_formmail(mb_id, name, email)
    {
		if (g4_charset.toLowerCase() == 'euc-kr')
	        win_open(g4_path+"/" + g4_bbs + "/formmail.php?mb_id="+mb_id+"&name="+name+"&email="+email, "winFormmail", "left=50, top=50, width=600, height=480, scrollbars=0");
		else
	        win_open(g4_path+"/" + g4_bbs + "/formmail.php?mb_id="+mb_id+"&name="+encodeURIComponent(name)+"&email="+email, "winFormmail", "left=50, top=50, width=600, height=480, scrollbars=0");
    }

    // 달력 창
    function win_calendar(fld, cur_date, delimiter, opt)
    {
        if (!opt)
            opt = "left=50, top=50, width=240, height=230, scrollbars=0,status=0,resizable=0";
        win_open(g4_path+"/" + g4_bbs + "/calendar.php?fld="+fld+"&cur_date="+cur_date+"&delimiter="+delimiter, "winCalendar", opt);
    }

    // 설문조사 창
    function win_poll(url)
    {
        if (!url)
            url = "";
        win_open(url, "winPoll", "left=50, top=50, width=616, height=500, scrollbars=1");
    }

    // 자기소개 창
    function win_profile(mb_id)
    {
        win_open(g4_path+"/" + g4_bbs + "/profile.php?mb_id="+mb_id, 'winProfile', 'left=50,top=50,width=616,height=500,scrollbars=1');
    }

    var last_id = null;
    function menu(id)
    {
        if (id != last_id)
        {
            if (last_id != null)
                document.getElementById(last_id).style.display = "none";
            document.getElementById(id).style.display = "block";
            last_id = id;
        }
        else
        {
            document.getElementById(id).style.display = "none";
            last_id = null;
        }
    }

    function textarea_decrease(id, row)
    {
        if (document.getElementById(id).rows - row > 0)
            document.getElementById(id).rows -= row;
    }

    function textarea_original(id, row)
    {
        document.getElementById(id).rows = row;
    }

    function textarea_increase(id, row)
    {
        document.getElementById(id).rows += row;
    }

    // 글숫자 검사
    function check_byte(content, target)
    {
        var i = 0;
        var cnt = 0;
        var ch = '';
        var cont = document.getElementById(content).value;

        for (i=0; i<cont.length; i++) {
            ch = cont.charAt(i);
            if (escape(ch).length > 4) {
                cnt += 2;
            } else {
                cnt += 1;
            }
        }
        // 숫자를 출력
        document.getElementById(target).innerHTML = cnt;

        return cnt;
    }

    // 브라우저에서 오브젝트의 왼쪽 좌표
    function get_left_pos(obj)
    {
        var parentObj = null;
        var clientObj = obj;
        //var left = obj.offsetLeft + document.body.clientLeft;
        var left = obj.offsetLeft;

        while((parentObj=clientObj.offsetParent) != null)
        {
            left = left + parentObj.offsetLeft;
            clientObj = parentObj;
        }

        return left;
    }

    // 브라우저에서 오브젝트의 상단 좌표
    function get_top_pos(obj)
    {
        var parentObj = null;
        var clientObj = obj;
        //var top = obj.offsetTop + document.body.clientTop;
        var top = obj.offsetTop;

        while((parentObj=clientObj.offsetParent) != null)
        {
            top = top + parentObj.offsetTop;
            clientObj = parentObj;
        }

        return top;
    }

    function flash_movie(src, ids, width, height, wmode)
    {
        var wh = "";
        if (parseInt(width) && parseInt(height)) 
            wh = " width='"+width+"' height='"+height+"' ";
        return "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' "+wh+" id="+ids+"><param name=wmode value="+wmode+"><param name=movie value="+src+"><param name=quality value=high><embed src="+src+" quality=high wmode="+wmode+" type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash' "+wh+"></embed></object>";
    }

    function obj_movie(src, ids, width, height, autostart)
    {
        var wh = "";
        if (parseInt(width) && parseInt(height)) 
            wh = " width='"+width+"' height='"+height+"' ";
        if (!autostart) autostart = false;
        return "<embed src='"+src+"' "+wh+" autostart='"+autostart+"'></embed>";
    }

    function doc_write(cont)
    {
        document.write(cont);
    }
	function layer_onoff(name){
		obj=document.getElementById(name).style;
		if(obj.display=="block"){
			obj.display="none";
		}else{
			obj.display='block';
		}
	}
	function layer_on(name){
		obj=document.getElementById(name);
		obj.style.display="block";
	}
	function layer_off(name){
		obj=document.getElementById(name);
		obj.style.display="none";
	}
	function date_chk(sdate,edate){
		if(sdate>edate){
			return false;
		}else{
			return true;
		}
	}

    function numeric_chk(fld){
		tmsg="";
        if (fld.value.length > 0) 
        { 
            for (i = 0; i < fld.value.length; i++) 
            { 
                if (fld.value.charAt(i) < '0' || fld.value.charAt(i) > '9') 
                { 
                    tmsg = "숫자만 입력하세요."; 
                }
            }
        }
		if(tmsg){
			alert(tmsg);
			fld.focus();
//			return false;
		}else{
///			return true;
		}
    }

	function value_chk(obj){
		if(obj.value==''){
			return false;
		}else{
			return true;
		}
	}

	function viewCalendar(year, month,obj_name) { 
		//alert('year:'+year+'m'+month);
		obj = document.getElementById(obj_name);
		div_left = get_left_pos(obj);
		div_top = get_top_pos(obj);

		obj_div = document.getElementById("cal_div");
		obj_style = eval(obj_div.style);
		obj_style.left=div_left;
		obj_style.top=div_top;
		obj_style.display='block';
		obj_style.width=170;
		obj_style.height=160;

		min_y=1970;
		var now=new Date(); 
		var y=now.getYear();
		//alert(g4_year);
		max_y=(g4_year *1)+10;
		
		if (month < 1) { month += 12; year -= 1; } 
		if (month > 12) { month -= 12; year += 1; }


		select_y = "<select name=y onchange=javascript:viewCalendar(this.value," + month + ",'"+obj_name+"')>";
		for(i=min_y;i<=max_y;i++){
			if(year==i){
				select_y += "<option value="+i+" selected>"+i+"</option>";
			}else{
				select_y += "<option value="+i+">"+i+"</option>";
			}
		}
		select_y += "</select>";

		select_m = "<select name=m onchange=javascript:viewCalendar(" + year + ",this.value,'"+obj_name+"')>";
		for(i=1;i<=12;i++){
			if(month==i){
				select_m += "<option value="+i+" selected>"+i+"</option>";
			}else{
				select_m += "<option value="+i+">"+i+"</option>";
			}
		}
		select_m += "</select>";

		//select_m="<select name=m onchange=javascript:viewCalendar(this.value," + month + ",'"+obj_name+"')><option value=1>1</option></select>";

		selectBoxHidden("cal_div");

		var text = '<table class=cal_table cellspacing=0 cellpadding=2 border=0>\n<colgroup width=18><colgroup width=18><colgroup width=18><colgroup width=18><colgroup width=18><colgroup width=18><colgroup width=18><tr><td colspan=7 class=bgcol1 style="text-align:right"><table border=0 cellpadding=0 cellspacing=0 width=100%><tr>'; 
		//text += "&nbsp;<a href=javascript:viewCalendar(" + (year-1) + "," + month + ",'"+obj_name+"')>◀</a>&nbsp;"; 
		text += "<td>&nbsp;<a href=javascript:viewCalendar(" + year + "," + (month-1) + ",'"+obj_name+"')>◁</a>&nbsp;</td>"; 
		//text += '&nbsp;' + year + '/' + ((month < 10) ? ('0' + month) : month) + '&nbsp;'; 

		text += '<td>' + select_y + '</td>'; 
		text += '<td>' + select_m + '</td>'; 
//		text += '<td>' + select_y + '</td><td>' + select_m + '</td>'; 

		text += "<td>&nbsp;<a href=javascript:viewCalendar(" + year + "," + (month+1) + ",'"+obj_name+"')>▷</a>&nbsp;</td>"; 
		//text += "&nbsp;<a href=javascript:viewCalendar(" + (year+1) + "," + month + ",'"+obj_name+"')>▶</a>&nbsp;"; 
		text += "<td class=r><a href=javascript:hiddenCalendar()><b>x</b></a></td>"; 
		text += '</tr></table></td></tr><tr><td colspan=7 class=bline1><img src='+g4_path+'/img/blank.gif width=0 height=0></td>';

		var firstDay = (year + parseInt((year-1)/4) - parseInt((year-1)/100) + parseInt((year-1)/400)) % 7; 
		var daysInMonth = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); 
		if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) daysInMonth[1] += 1; 
		for (var i = 0; i < month-1; i++) firstDay = (firstDay + daysInMonth[i]) % 7;

		text_month=month;
		if(month<10){
			text_month='0'+month;
		}


		for (var i = 0; i < 42; i++) { 
			if (i % 7 == 0) text += '</tr>\n<tr height=18>'; 
			if (i < firstDay || i >= firstDay + daysInMonth[month-1]) { 
				text += '<td style="text-align:center"> </td>'; 
		} else { 
				text_day=i - firstDay + 1;
				if((i - firstDay + 1)<10){
					text_day='0'+text_day;
				}

				text += '<td style="text-align:center;">'; 
				text += "<a style='" + ((i % 7) ? "" : "color:red;")+ ((i % 7==6) ? "color:blue;" : "") + "' href=javascript:put_date('"+obj.name+"','"+year+"-"+text_month+"-"+text_day+"')>"+(i - firstDay + 1) + "</a></td>"; 
			} 
		} 
		obj_div.innerHTML = text + '</tr>\n</table>'; 
	}

	function put_date(obj_name,date_data){
		obj = document.getElementById(obj_name);
		obj.value=date_data;
		hiddenCalendar();
	}

	function hiddenCalendar(){
		selectBoxVisible();
		obj_div = document.getElementById("cal_div");
		obj_style = obj_div.style;
		obj_style.display='none';
	}

	function select_add_cancel(tmp){
		obj=document.getElementById(document.category_add_form.obj_name.value);
		if(tmp==1){
			obj.selectedIndex=0;
		}
		document.category_add_form.reset();
		layer_off('category_add_div');
		selectBoxVisible();
	}

	function file_changed(text,obj_name){
		obj=document.getElementById(obj_name);
		obj.focus();
		obj.value=text;
	}

	function add_selected(obj_name,category_id,multi){
		obj=document.getElementById(obj_name);


		if(obj.length-1==obj.selectedIndex){
			obj_div_style = eval("category_add_div.style");
			obj_div_style.display = 'block';
			div_left=get_left_pos(obj);
			div_top=get_top_pos(obj);
			obj_div_style.left=div_left;
			obj_div_style.top=div_top+23;
			selectBoxHidden('category_add_div');
			f = eval(document.category_add_form);
			f.obj_name.value=obj.name;
			f.category_id.value=category_id;
		}else if( 0 != obj.selectedIndex && multi){
			//alert(obj.options[obj.selectedIndex].value);
			obj_tx=document.getElementById(obj_name + "_tx");
			obj_hdn=document.getElementById(obj_name + "_hdn");
			//alert(obj_hdn.value.indexOf(obj.options[obj.selectedIndex].value));
			
			str_pos=obj_hdn.value.indexOf(obj.options[obj.selectedIndex].value);
			
			if(str_pos < 0){
				obj_hdn.value = obj.options[obj.selectedIndex].value + " " +obj_hdn.value;
				obj_tx.value  = obj.options[obj.selectedIndex].text + " " +obj_tx.value;
			}else{
				str_arr=obj_hdn.value.split(" ");
				obj_hdn.value="";
				obj_tx.value="";
				//alert(obj.options[obj.selectedIndex].value);
				for(i=0;i<str_arr.length;i++){
					if(str_arr[i] > 0 && str_arr[i] != obj.options[obj.selectedIndex].value){
						obj_hdn.value = obj_hdn.value + " " + str_arr[i];
						obj_tx.value  = obj_tx.value + " " + text_find_from_select(obj,str_arr[i]);
					}
				}
			}
		}



	}

	function text_find_from_select(obj,tmp_val){
		for(k=0;k<obj.length-1;k++){
			if(obj.options[k].value==tmp_val){
				return obj.options[k].text;
			}
		}
	}

	function select_add_submit() {
		if(f.category_text.value){
			f=eval("document.category_add_form");
			var url = "category_proc.php";
			var para = "category_id="+encodeURIComponent(f.category_id.value)+"&category_text="+encodeURIComponent(f.category_text.value)+"&obj_name="+encodeURIComponent(f.obj_name.value)+"&mode="+encodeURIComponent(f.mode.value);
			new Ajax.Request(
				url,
			  {
				method:'post',
				parameters: para, 
				onSuccess: function(transport){
				var added_value = transport.responseText;
				if(added_value){
					obj=document.getElementById(f.obj_name.value);
					obj_length=obj.length;
					obj.options[obj_length-1].value=added_value;
					obj.options[obj_length-1].text=f.category_text.value;
					obj.selectedIndex=obj_length-1;
					obj.length++;
					obj.options[obj_length].value='';
					obj.options[obj_length].text='추가하기';
					select_add_cancel(0);
					
				}else{
					alert('오류발생 관리자에게 문의하세요.');
				}
				},
				onFailure: function(){ alert('오류발생 관리자에게 문의하세요.') }
			  });
		}
	}

	function show_memo(obj,table_name,no){
		
		obj_div = document.getElementById("memo_div");
		obj_div_style = obj_div.style;
		obj_div_style.display = 'none';
		div_left=get_left_pos(obj)+24;
		div_top=get_top_pos(obj);
		obj_div_style.left=div_left;
		obj_div_style.top=div_top;

			var url = g4_path + "/memo_load.php";
			var para = "table_name="+encodeURIComponent(table_name)+"&no="+encodeURIComponent(no);
			new Ajax.Request(
				url,
			  {
				method:'post',
				parameters: para, 
				onSuccess: function(transport){
				var ajax_rlt = transport.responseText;
				if(ajax_rlt){
					obj_div_style.display = 'block';
					obj_div.innerHTML = ajax_rlt;
					selectBoxHidden('memo_div');
//					setTimeout("selectBoxHidden('memo_div')",100);
				}else{
					alert('오류발생 관리자에게 문의하세요.');
				}
				},
				onFailure: function(){ alert('오류발생 관리자에게 문의하세요.') }
			  });
	}

	function memo_submit(form_name){
		obj_div = document.getElementById("memo_div");
		f=eval("document."+form_name);
		if(!f.memo_txt.value){
			alert('내용을 입력하세요.');
			return false;
		}
			var url = g4_path + "/memo_load.php";
			var para = "table_name="+encodeURIComponent(f.table_name.value)+"&no="+encodeURIComponent(f.no.value)+"&memo_no="+encodeURIComponent(f.memo_no.value)+"&memo_txt="+encodeURIComponent(f.memo_txt.value);
			new Ajax.Request(
				url,
			  {
				method:'post',
				parameters: para, 
				onSuccess: function(transport){
				var ajax_rlt = transport.responseText;
				if(ajax_rlt){
					obj_div.innerHTML = ajax_rlt;
					selectBoxHidden('memo_div');
				}else{
					alert('오류발생 관리자에게 문의하세요.');
				}
				},
				onFailure: function(){ alert('오류발생 관리자에게 문의하세요.') }
			  });
	}

	function select_val_chg(obj,val){
		for(i=0;i<obj.length;i++){
			if(obj.options[i].value==val){
				obj.selectedIndex=i;
			}
		}
	}

	function url_load(url,obj_name,para){
		obj = document.getElementById(obj_name);
		obj.innerHTML="<table border=0 cellpadding=0 cellspacing=0 width=100% height=100%><tr height=100%><td width=100% class=c bgcolor='#ffffff'><img src='"+g4_path+"/img/loading.gif' border=0></td></tr></table>";
		//alert(obj);
		var para = para;
//"table_name="+encodeURIComponent(f.table_name.value)+"&no="+encodeURIComponent(f.no.value)+"&memo_no="+encodeURIComponent(f.memo_no.value)+"&memo_txt="+encodeURIComponent(f.memo_txt.value);
		new Ajax.Request(
			url,
		  {
			method:'post',
			parameters: para, 
			onSuccess: function(transport){
			var ajax_rlt = transport.responseText;
			if(ajax_rlt){
				obj.innerHTML = ajax_rlt;
			}else{
				alert('오류발생 관리자에게 문의하세요.');
			}
			},
			onFailure: function(){ alert('오류발생 관리자에게 문의하세요.') }
		  });
	}

	function memo_hidden(){
		layer_off('memo_div');
		selectBoxVisible();
	}

	function div_togle(div_name_,nums,no){
		for(ii=1;ii<=nums;ii++){
			sub_obj_style=eval(div_name_+ii+'.style');
			if(no==ii){
				if(sub_obj_style.display=='block'){
					sub_obj_style.display='none';
				}else{
					sub_obj_style.display='block';
				}
			}else{
				sub_obj_style.display='none';
			}
		}
	}
	// 레이어, 가로/세로(false/true)
    function pagePrint(tmp,portrait) { 
		Obj=document.getElementById(tmp);
        //var W = Obj.offsetWidth;        //screen.availWidth; 
        //var H = Obj.offsetHeight;        //screen.availHeight; 
        //var features = "menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,width=" + W + ",height=" + H + ",left=0,top=0"; 
        //var PrintPage = window.open("about:blank",Obj.id,features); 
		var PrintPage = eval(hiddenframe); 
        //PrintPage.document.open(); 
        PrintPage.innerHTML="<html><head><title></title><link rel='stylesheet' href='<?=$g4['path']?>/style.css' type='text/css'>\n </head>\n<body>" + Obj.innerHTML + "\n</body></html>"; 

		factory.printing.header = ""; 
		factory.printing.footer = ""; 
		factory.printing.portrait = portrait;    // true 세로출력 , false 가로출력 
		factory.printing.leftMargin = 10; 
		factory.printing.topMargin = 10; 
		factory.printing.rightMargin = 10; 
		factory.printing.bottomMargin = 10; 
		//factory.printing.printBackground = true;
		factory.printing.Print(false, PrintPage);    // 첫번째 인자 : 대화상자표시여부 , 두번째인자 : 출력될 프레임
		//PrintPage.print();
		//PrintPage.document.print();
		//PrintPage.document.close(); 
        //PrintPage.document.title = document.domain; 
        //PrintPage.printWindow(PrintPage.location.reload()); 
    }

	function stu_statusbar_chg(visa_no,obj,no){
		//alert(visa_no);
		//학생비자이면
		visa_stu="<table border=0 cellpadding=0 cellspacing=0 width=100% class='ed bgw sf'>			<tr height=20>				<td class=c><div id=bar_div_1></div></td>				<td class=c><div id=bar_div_2></div></td>				<td class=c><div id=bar_div_3></div></td>				<td class=c><div id=bar_div_4></div></td>				<td class=c><div id=bar_div_5></div></td>				<td class=c><div id=bar_div_6></div></td>				<td class=c><div id=bar_div_7></div></td>				<td class=c><div id=bar_div_8></div></td>				<td class=c><div id=bar_div_9></div></td>				<td class=c><div id=bar_div_10></div></td>			</tr>			<tr><td colspan='10' class='line2'></td></tr>			<tr height=1><td></td></tr>			<tr height=8>				<td class='r-border ' id=student_status_1><img src='"+g4_path+"/img/blank.gif' height=0 width=0 border=0></td>				<td class='r-border ' id=student_status_2><img src='"+g4_path+"/img/blank.gif' height=0 width=0 border=0></td>				<td class='r-border ' id=student_status_3><img src='"+g4_path+"/img/blank.gif' height=0 width=0 border=0></td>				<td class='r-border ' id=student_status_4><img src='"+g4_path+"/img/blank.gif' height=0 width=0 border=0></td>				<td class='r-border ' id=student_status_5><img src='"+g4_path+"/img/blank.gif' height=0 width=0 border=0></td>				<td class='r-border ' id=student_status_6><img src='"+g4_path+"/img/blank.gif' height=0 width=0 border=0></td>				<td class='r-border ' id=student_status_7><img src='"+g4_path+"/img/blank.gif' height=0 width=0 border=0></td>				<td class='r-border ' id=student_status_8><img src='"+g4_path+"/img/blank.gif' height=0 width=0 border=0></td>				<td class='r-border ' id=student_status_9><img src='"+g4_path+"/img/blank.gif' height=0 width=0 border=0></td>						<td class=' ' id=student_status_10><img src='"+g4_path+"/img/blank.gif' height=0 width=0 border=0></td>			</tr>			<tr>				<td width=10%></td>				<td width=10%></td>				<td width=10%></td>				<td width=10%></td>				<td width=10%></td>				<td width=10%></td>				<td width=10%></td>				<td width=10%></td>				<td width=10%></td>				<td width=10%></td>			</tr>		</table>		<table border=0 cellpadding=0 cellspacing=0 width=100% class='bgw sf'>			<tr height=5><td></td></tr>			<tr class=c>				<td width=10%>첫상담</td>				<td width=10%>학교신청</td>				<td width=10%>OFFER</td>				<td width=10%>학비입금</td>				<td width=10%>학비송금</td>				<td width=10%>COE</td>				<td width=10%>신체검사</td>				<td width=10%>비자신청</td>				<td width=10%>서류접수</td>				<td width=10%>비자발급</td>			</tr>		</table>";
		visa_oth="		<table border=0 cellpadding=0 cellspacing=0 width=100% class='ed bgw sf'>			<tr height=20>				<td class=c><div id=bar_div_1></div></td>				<td class=c><div id=bar_div_2></div></td>				<td class=c><div id=bar_div_3></div></td>				<td class=c><div id=bar_div_4></div></td>				<td class=c><div id=bar_div_5></div></td>				<td class=c><div id=bar_div_6></div></td>			</tr>			<tr><td colspan='10' class='line2'></td></tr>			<tr height=1><td></td></tr>			<tr height=8>				<td class='r-border ' id=student_status_1><img src='"+g4_path+"/img/blank.gif' height=0 width=0 border=0></td>				<td class='r-border ' id=student_status_2><img src='"+g4_path+"/img/blank.gif' height=0 width=0 border=0></td>				<td class='r-border ' id=student_status_3><img src='"+g4_path+"/img/blank.gif' height=0 width=0 border=0></td>				<td class='r-border ' id=student_status_4><img src='"+g4_path+"/img/blank.gif' height=0 width=0 border=0></td>				<td class='r-border ' id=student_status_5><img src='"+g4_path+"/img/blank.gif' height=0 width=0 border=0></td>						<td class=' ' id=student_status_6><img src='"+g4_path+"/img/blank.gif' height=0 width=0 border=0></td>			</tr>			<tr>				<td width=16%></td>				<td width=17%></td>				<td width=17%></td>				<td width=17%></td>				<td width=17%></td>				<td width=16%></td>			</tr>		</table>		<table border=0 cellpadding=0 cellspacing=0 width=100% class='bgw sf'>			<tr height=5><td></td></tr>			<tr class=c>				<td width=16%>첫상담</td>				<td width=17%>학교신청</td>				<td width=17%>OFFER</td>				<td width=17%>학비입금</td>				<td width=17%>학비송금</td>				<td width=16%>COE</td>			</tr>		</table>";
		div=document.getElementById('stu_statusbar_div');
		if(visa_no==17){
			div.innerHTML=visa_stu;
			bar_num=10;
			student_status_call(obj,no,bar_num);
		}else if(visa_no==0){
			div.innerHTML="";
		}else{
			div.innerHTML=visa_oth;
			bar_num=6;
			student_status_call(obj,no,bar_num);
		}
		
	}

	function student_status_call(obj,no,bar_num){
		if(obj=='student_status_bar'){
		}
		txt=document.getElementById(obj).value;
		//alert(txt);
		var tmp_v = txt.split("-");

		for(i=0;i<bar_num;i++){
			tmp_name="student_status_"+(i+1);
			obj = document.getElementById(tmp_name);
			obj_style=eval(obj.style);
			if(tmp_v[i]==1){
				obj_style.backgroundColor='#CD7444';
			}else{
				obj_style.backgroundColor='#FFFFFF';
			}
			if(document.getElementById('bar_'+no+"_"+(i+1)).value=="0000-00-00"){
				document.getElementById('bar_div_'+(i+1)).innerHTML = "";
			}else{
				document.getElementById('bar_div_'+(i+1)).innerHTML = document.getElementById('bar_'+no+"_"+(i+1)).value;
			}
		}
	}
}
