﻿/***************************
* website_title
****************************/
document.title = ":::: 고려사이버대학교 ::::";

var imageWidthMax = 590;
var iframeWidthMax = 590;

var imgHostUrl = "http://www.kdu.edu";
var jsHostUrl = "http://www.kdu.edu"; ;


/***************************
* Quick Menu
****************************/
function scrap() {

    //alert(" call scrap");
    var divId = "main_cont";
    var inElement = document.getElementById(divId);

    var meintext = inElement.innerHTML;


    var extResource =
        "<head>"
        + "<style type=\"text/css\">"
	    + "<!--"
        + "  @import url(" + imgHostUrl + "/public/css/common.css);"
        + "  @import url(" + imgHostUrl + "/public/css/board.css);"
        + "  @import url(" + imgHostUrl + "/public/css/department.css);"
	    + "-->"
    	+ "</style>"
    	+ "<!--[if lte ie 7]><style type=\"text/css\"> @import url(" + imgHostUrl + "/public/css/ie7.css); </style><![endif]-->"
    	+ "<script type=\"text/javascript\" language=\"javascript\" src=\"" + jsHostUrl + "/public/js/common.js\"></script>"
	    + "<script type=\"text/javascript\" src=\"" + jsHostUrl + "/public/js/player.js\"></script>"
	    + "<script type=\"text/javascript\" src=\"" + jsHostUrl + "/public/js/player_event_stat_change.js\" event=\"PlayStateChange(OldState,NewState)\" for=\"MediaPlayer\"></script>"
	    + "<script type=\"text/javascript\" src=\"" + jsHostUrl + "/public/js/player_event_buffering.js\" event=\"Buffering(bStart)\" for=\"MediaPlayer\"></script>"
		+ "<script type=\"text/javascript\" src=\"" + jsHostUrl + "/public/js/player_event_buffering.js\" event=\"Buffering(bStart)\" for=\"MediaPlayer\"></script>"
		+ "<script>section_name='" + section_name + "';depth1 = " + depth1 + "; depth2 = '" + depth2 + "' ;depth3 = '" + depth3 + "' ;enableFontResize = '" + enableFontResize + "';</script>"
	    + "</head>";


    var old = /\/public\/images/g;
    meintext = meintext.replace(old, imgHostUrl + "/public/images");

    old = /\/public\/swf/g;
    meintext = meintext.replace(old, imgHostUrl + "/public/swf");

    old = /flash_img/g;
    meintext = meintext.replace(old, "flash_img_by_scrap");


    old = /<OBJECT/g;
    meintext = meintext.replace(old, "<!--<OBJECT");

    old = /<\/OBJECT>/g;
    meintext = meintext.replace(old, "</OBJECT>-->");


    meintext = extResource
		+ "<div style=\"width:678px\">"
		+ meintext
		+ "</div>";


    var result = false;
    if (window.clipboardData) {
        // the IE-manier
        result = window.clipboardData.setData("Text", meintext);

        // waarschijnlijk niet de beste manier om Moz/NS te detecteren;
        // het is mij echter onbekend vanaf welke versie dit precies werkt:
    } else if (window.netscape) {

        // dit is belangrijk maar staat nergens duidelijk vermeld:
        // you have to sign the code to enable this, or see notes below
        netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');

        // maak een interface naar het clipboard
        var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);
        if (!clip) return;

        // maak een transferable
        var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);
        if (!trans) return;

        // specificeer wat voor soort data we op willen halen; text in dit geval
        trans.addDataFlavor('text/unicode');

        // om de data uit de transferable te halen hebben we 2 nieuwe objecten nodig om het in op te slaan
        var str = new Object();
        var len = new Object();

        var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);

        var copytext = meintext;
        str.data = copytext;
        trans.setTransferData("text/unicode", str, copytext.length * 2);
        var clipid = Components.interfaces.nsIClipboard;

        if (!clip) return;

        clip.setData(trans, null, clipid.kGlobalClipboard);

    }

    if (result) {
        alert("복사되었습니다.");
    }

    return;
}


function fontDefault() {
    fontSetClass("fsize2");
}
function fontPlus() {
    var currentClass = fontGetCurrentClass();
    switch (currentClass) {
        case "fsize1":
            fontSetClass("fsize2");
            break;
        case "fsize2":
            fontSetClass("fsize3");
            break;
        case "fsize3":
            fontSetClass("fsize4");
            break;
        case "fsize4":
            //Nothing                
            break;
        default:
            break;
    }
}
function fontMinus() {
    var currentClass = fontGetCurrentClass();

    switch (currentClass) {
        case "fsize1":
            //Nothing
            break;
        case "fsize2":
            fontSetClass("fsize1");
            break;
        case "fsize3":
            fontSetClass("fsize2");
            break;
        case "fsize4":
            fontSetClass("fsize3");
            break;
        default:
            break;
    }
}
function fontGetCurrentClass() {
    var contentArea = document.getElementById("main_cont");
    if (contentArea) {
        return contentArea.className;
    } else {
        return "";
    }
}
function fontSetClass(newClassName) {
    var contentArea = document.getElementById("main_cont");
    if (contentArea) {
        contentArea.className = newClassName;
    }
}



/******************************************************************************/
/* rollover_image
/******************************************************************************/
function MM_swapImgRestore() { //v3.0
    var i, x, a = document.MM_sr; for (i = 0; a && i < a.length && (x = a[i]) && x.oSrc; i++) x.src = x.oSrc;
}

function MM_preloadImages() { //v3.0
    var d = document; if (d.images) {
        if (!d.MM_p) d.MM_p = new Array();
        var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for (i = 0; i < a.length; i++)
            if (a[i].indexOf("#") != 0) { d.MM_p[j] = new Image; d.MM_p[j++].src = a[i]; } 
    }
}

function MM_findObj(n, d) { //v4.01
    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 < d.forms.length; i++) x = d.forms[i][n];
    for (i = 0; !x && d.layers && i < d.layers.length; i++) x = MM_findObj(n, d.layers[i].document);
    if (!x && d.getElementById) x = d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
    var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr = new Array; for (i = 0; i < (a.length - 2); i += 3)
        if ((x = MM_findObj(a[i])) != null) { document.MM_sr[j++] = x; if (!x.oSrc) x.oSrc = x.src; x.src = a[i + 2]; }
}


/***************************
* layer
****************************/
/* 학부 - 경영학과 - 관련 자격증 */
function dbaopen(elem) {
    var clss = elem.className;
    clss += ' active'
    elem.className = clss;
}
function dbaclose(elem) {
    elem.className = 'course_name';
}


/* 학부 - 예술학과 - 학과개요 */
function dacarchg(chon, chid, num) {
    for (i = 1; i < num + 1; i++) {
        document.getElementById(chid + i).src = chgimg(chid + i, 'off');
        document.getElementById(chid + i + "_cont").style.display = "none";
    }
    document.getElementById(chon).src = chgimg(chon, 'on');
    document.getElementById(chon + "_cont").style.display = "";
}
function chgimg(tid, status) {
    var x = "/public/images/department/dacar_summary_" + tid + "_" + status + ".gif";
    return x;
}


/* 대학생활가이드 */
function guide_process_go(process_name, process_num) {
    if (process_name == "fresh") {
        process_tab = 6;
    } else if (process_name == "exam") {
        process_tab = 7;
    }
    for (i = 1; i <= process_tab; i++) {
        document.getElementById("guide_process0" + i).style.display = "none";
    }
    document.getElementById("guide_process0" + process_num).style.display = "block";
}


/***************************
* select menu
****************************/
/* 진학설명회 및 검색 - 지난 년도 */
function higher_fair_go() {
    var go_url = document.year_form.year_select.options[document.year_form.year_select.selectedIndex].value;
    window.location.href = go_url;
}

/* 학생대표모델 - 지난 기수 */
function model_go() {
    var go_url = document.model_form.model_select.options[document.model_form.model_select.selectedIndex].value;
    window.location.href = go_url;
}

/* 한디페스티발 - 지난 대회 보기 */
function festival_go() {
    var go_url = document.festival_form.festival_select.options[document.festival_form.festival_select.selectedIndex].value;
    window.location.href = go_url;
}

/* 문화학과 - 현장학습과 문화체험 */
function create_options() {
    var optionarray = new Array();
    var optioncount = 6; //페이지숫자에 맞도록 변경

    for (i = 0; i < optioncount; i++) { optionarray[i] = new Array(2); }

    optionarray[0][0] = "/public/html/department/dac_ac/dacac_experience_070630.html";
    optionarray[0][1] = "2007.6.30 대전시립미술관 외";
    optionarray[1][0] = "/public/html/department/dac_ac/dacac_experience_080322.html";
    optionarray[1][1] = "2008.3.22 뮤지컬 “사랑은 비를 타고” 뮤지컬";
    optionarray[2][0] = "/public/html/department/dac_ac/dacac_experience_080419.html";
    optionarray[2][1] = "2008.4.19 활동사진 다큐멘타리 “우리학교”";
    optionarray[3][0] = "/public/html/department/dac_ac/dacac_experience_080701.html";
    optionarray[3][1] = "2008.7.1 전라남도 장성과 담양 문화유산";
    optionarray[4][0] = "/public/html/department/dac_ac/dacac_experience_080806.html";
    optionarray[4][1] = "2008.8.6 연극 “광수생각”";
    optionarray[5][0] = "/public/html/department/dac_ac/dacac_experience_080928.html";
    optionarray[5][1] = "2008.9.28 덕수궁 미술관 “남미 거장전” 외";
    //데이터를 입력

    return optionarray;
}

function create_cont_navi() {
    var opt = create_options();
    var mkup = "";
    mkup += "<div class='cont_navi'>";
    mkup += "<select onChange='change_cont_navi(this)'>";
    for (i = opt.length - 1; i >= 0; i--) {
        if (opt[i][0] == location.pathname) { mkup += "<option value='" + opt[i][0] + "' selected='selected'>" + opt[i][1] + "</option>"; }
        else { mkup += "<option value='" + opt[i][0] + "' >" + opt[i][1] + "</option>"; }
    }
    mkup += "</select>";
    mkup += "</div>";
    document.write(mkup);
}

function change_cont_navi(sel) { location.pathname = sel.options[sel.selectedIndex].value; }


/***************************
* flash
****************************/
function flash_img(fname, fwidth, fheight) {
    var g = "";
    var swf_folder = "";

    if (section_name == "department") {
        swf_folder = "department";
    } else {
        swf_folder = "contimg";
    }

    g += "	<object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 ";
    g += "    codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0 ";
    g += "    width='" + fwidth + "px' height='" + fheight + "px' id=" + fname + "_obj align=middle>";
    g += "		<param name=allowScriptAccess value=middle>";
    g += "		<param name=movie value=/public/swf/" + swf_folder + "/" + fname + ".swf>";
    g += "		<param name=quality value=high>";
    g += "		<param name=wmode value=transparent>";
    g += "		<embed src=/public/swf/" + swf_folder + "/" + fname + ".swf ";
    g += "         quality=high pluginspage=http://www.macromedia.com/go/getflashplayer ";
    g += "		 type=application/x-shockwave-flash wmode=transparent width='" + fwidth + "px' height='" + fheight + "px'></embed>";
    g += "	</object>";

    document.write(g);
}



/***************************
* 전화번호 및 이메일 주소 셀렉트박스
****************************/
function initPhonePre(selectBoxName) {
    var objs = document.getElementsByName(selectBoxName);

    var phone_code = new Array();
    phone_code[0] = "010";
    phone_code[1] = "011";
    phone_code[2] = "016";
    phone_code[3] = "017";
    phone_code[4] = "018";
    phone_code[5] = "019";

    for (var i = 0; i < phone_code.length; i++) {
        var obj_node = document.createElement("option");
        var text = document.createTextNode(phone_code[i]);
        obj_node.setAttribute("value", phone_code[i]);
        var txt = obj_node.appendChild(text);
        objs[0].appendChild(obj_node);
    }

}


function initPhoneAreaPre(selectBoxName) {
    var objs = document.getElementsByName(selectBoxName);

    var phone_code = new Array();

    phone_code[0] = "02";
    phone_code[1] = "031";
    phone_code[2] = "032";
    phone_code[3] = "033";
    phone_code[4] = "041";
    phone_code[5] = "042";
    phone_code[6] = "043";
    phone_code[7] = "051";
    phone_code[8] = "052";
    phone_code[9] = "053";
    phone_code[10] = "054";
    phone_code[11] = "055";
    phone_code[12] = "061";
    phone_code[13] = "062";
    phone_code[14] = "063";
    phone_code[15] = "064";
    phone_code[16] = "070";


    for (var i = 0; i < phone_code.length; i++) {
        var obj_node = document.createElement("option");
        var text = document.createTextNode(phone_code[i]);
        obj_node.setAttribute("value", phone_code[i]);
        var txt = obj_node.appendChild(text);
        objs[0].appendChild(obj_node);
    }

}


function initEmailDomain(selectBoxName) {
    var objs = document.getElementsByName(selectBoxName);


    var email_code = new Array();
    email_code[0] = "직접입력";
    email_code[1] = "naver.com";
    email_code[2] = "yahoo.co.kr";
    email_code[3] = "nate.com";
    email_code[4] = "live.co.kr";
    email_code[5] = "hotmail.com";

    for (var i = 0; i < email_code.length; i++) {
        var obj_node = document.createElement("option");
        var text = document.createTextNode(email_code[i]);
        obj_node.setAttribute("value", email_code[i]);
        var txt = obj_node.appendChild(text);
        objs[0].appendChild(obj_node);
    }
}

function selectedEmailDomain(selectObj, targetEmailTxtName) {

    var emailTxt = document.getElementsByName(targetEmailTxtName);
    emailTxt[0].value = selectObj.value;

}

function selfResize(w, h) {
    self.resizeTo(w, h);
}




/***************************
* popup
****************************/
/* window_open 스크롤이 없을 때 */
function popwin(url, target, intwidth, intheight) {
    window.open(url, target, "width=" + intwidth + ",height=" + intheight + ",resizable=0,scrollbars=0");
}

/* window_open 스크롤이 있을 때 */
function popwin_s(url, target, intwidth, intheight) {
    window.open(url, target, "width=" + intwidth + ",height=" + intheight + ",resizable=0,scrollbars=1");
}

/* window_close */
function closewin() {
    window.close();
}


/* 우편번호 찾기 */
function popzipcode(app_zip1, app_zip2, app_addr1) {
    var url = "/public/html/common/pop_zipcode.html?app_zip1=" + app_zip1 + "&app_zip2=" + app_zip2 + "&app_addr1=" + app_addr1;
    window.open(url, "_zipcode", "width=400, height=425, toolbar=no, resizable=0, scrollbars=0");
}
function profpopzipcode() {
    var url = "/public/html/common/prof_pop_zipcode.html?move_val=lecturer";
    window.open(url, "_zipcode", "width=400, height=425, toolbar=no, resizable=0, scrollbars=0");
}
/* 달력 팝업 */
function popcalendar(app_date) {
    var url = "/public/html/common/pop_calendar.aspx?app_date=" + app_date;
    window.open(url, "_calendar", "width=400, height=320, toolbar=no, resizable=0, scrollbars=0");
}

/* 동영상 */
function popvod01(vod_code) {
    window.open("/public/html/common/pop_vod_view01.html?vod_code=" + vod_code, "_vod_view01", "width=396, height=492, toolbar=no, resizable=0, scrollbars=0");
}
function popvod02(vod_code) {
    window.open("/public/html/common/pop_vod_view02.html?vod_code=" + vod_code, "_vod_view02", "width=476, height=550, toolbar=no, resizable=0, scrollbars=0");
}
function popvod05(vod_code) {
    window.open("/public/html/common/pop_vod_view05.html?vod_code=" + vod_code, "_vod_view05", "width=576, height=546, toolbar=no, resizable=0, scrollbars=0");
}
function popvod06(vod_code) {
    window.open("/public/html/common/pop_vod_view06.html?vod_code=" + vod_code, "_vod_view06", "width=320, height=57, toolbar=no, resizable=0, scrollbars=0");
}
function popvod07(vod_code) {
    window.open("/public/html/common/pop_vod_view07.html?vod_code=" + vod_code, "_vod_view07", "width=576, height=546, toolbar=no, resizable=0, scrollbars=0");
}
function popvod08(vod_code) {
    window.open("/public/html/common/pop_vod_view08.html?vod_code=" + vod_code, "_vod_view08", "width=576, height=546, toolbar=no, resizable=0, scrollbars=0");
}
function popvod09(vod_code) {
    window.open("/public/html/common/pop_vod_view09.html?vod_code=" + vod_code, "_vod_view09", "width=396, height=492, toolbar=no, resizable=0, scrollbars=0");
}
function popvod10(vod_code) {
    window.open("/public/html/common/pop_vod_view10.html?vod_code=" + vod_code, "_vod_view10", "width=576, height=546, toolbar=no, resizable=0, scrollbars=0");
}

/* common - 인증마크 */
function pop_good_site01(folder, name) {
    window.open("/public/html/common/pop_good_site01.html", "pop_good_site01", "width=620, height=560, toolbar=no, resizable=0, scrollbars=1");
}
function pop_good_site02(folder, name) {
    window.open("/public/html/common/pop_good_site02.html", "pop_good_site02", "width=620, height=655, toolbar=no, resizable=0, scrollbars=1");
}
function pop_good_site03(folder, name) {
    window.open("/public/html/common/pop_good_site03.html", "pop_good_site03", "width=620, height=655, toolbar=no, resizable=0, scrollbars=1");
}
function pop_good_site04(folder, name) {
    window.open("/public/html/common/pop_good_site04.html", "pop_good_site04", "width=620, height=690, toolbar=no, resizable=0, scrollbars=1");
}
/* common - 홍보동영상 */
/*weekly*/
function pop_good_all(folder, name) {
    window.open("/public/html/choice/view.aspx?no=95&code=2&type=04", "pop_good_all", "width=720, height=615, toolbar=no, resizable=0, scrollbars=0");
}
/*weekly*/
function pop_good_all_weekly(folder, name) {
    window.open("/public/html/choice/view.aspx?no=98&code=02&type=04", "pop_good_all_weekly", "width=720, height=610, toolbar=no, resizable=0, scrollbars=0");
}
/*flah_quick_menu_weekly*/
function pop_good_all01(folder, name) {
    window.open("/public/CyberTour/index.htm", "pop_good_all01", "width=850, height=600, toolbar=no, resizable=0, scrollbars=no");
}

/* 비전선포식동영상 */
function popvodvs01(folder, name) {
    window.open("/public/html/choice/pop_vod_view01.html", "popvodvs01", "width=720, height=610, toolbar=no, resizable=0, scrollbars=0");
}
function popvodvs02(folder, name) {
    window.open("/public/html/choice/pop_vod_view02.html", "popvodvs02", "width=720, height=610, toolbar=no, resizable=0, scrollbars=0");
}
function popvodvs03(folder, name) {
    window.open("/public/html/choice/pop_vod_view03.html", "popvodvs03", "width=720, height=610, toolbar=no, resizable=0, scrollbars=0");
}
function popvodvs04(folder, name) {
    window.open("/public/html/choice/pop_vod_view04.html", "popvodvs04", "width=720, height=610, toolbar=no, resizable=0, scrollbars=0");
}
function popvodvs05(folder, name) {
    window.open("/public/html/choice/pop_vod_view05.html", "popvodvs06", "width=720, height=610, toolbar=no, resizable=0, scrollbars=0");
}


/*선택한디대 - 학교광고모음*/
function flash_ad(fname, fwidth, fheight) {
    var g = "";
    var swf_folder = "ad";

    g += "	<object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 ";
    g += "    codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0 ";
    g += "    width='" + fwidth + "px' height='" + fheight + "px' id=" + fname + "_obj align=middle>";
    g += "		<param name=allowScriptAccess value=middle>";
    g += "		<param name=movie value=/public/images/choice/" + swf_folder + "/" + fname + ".swf>";
    g += "		<param name=quality value=high>";
    g += "		<param name=wmode value=transparent>";
    g += "		<embed src=/public/images/choice/" + swf_folder + "/" + fname + ".swf ";
    g += "         quality=high pluginspage=http://www.macromedia.com/go/getflashplayer ";
    g += "		 type=application/x-shockwave-flash wmode=transparent width='" + fwidth + "px' height='" + fheight + "px'></embed>";
    g += "	</object>";

    document.write(g);
}

/* 대학소개 - 협정서 이미지 */
function popprotocol(name) {
    window.open("/public/html/intro/coop/pop_protocol.html?name=" + name, "_protocol", "width=510, height=770, toolbar=no, resizable=0, scrollbars=0");
}
function popprotocol_many(name, page) {
    window.open("/public/html/intro/coop/pop_protocol_many.html?name=" + name + "&page=" + page, "_protocol", "width=510, height=795, toolbar=no, resizable=0, scrollbars=0");
}
function popprotocol_many2(name, page) {
    window.open("/public/html/intro/coop/pop_protocol_many2.html?name=" + name + "&page=" + page, "_protocol", "width=510, height=795, toolbar=no, resizable=0, scrollbars=0");
}
/* 학사소개 - 졸업과제 > 상세보기 */
function popgraduation(year, name) {
    var height = "";
    if (year == "2009" && name == "ditmd") {
        height = "370";
    } else if (year == "20012008" && name == "ditmd") {
        height = "430";
    } else if (year == "20012008" && name == "damta") {
        height = "500";
    } else {
        height = "550";
    }
    window.open("/public/html/affairs/pop_graduation_work" + year + "_" + name + ".html", "_graduation", "width=620, height=" + height + ", toolbar=no, resizable=0, scrollbars=1");
}

/* 학부소개 - 관련 자격증 > 상세보기 */
function popcertification(folder, name) {
    window.open("/public/html/department/" + folder + "/pop_cer_" + name + ".html", "_certification", "width=620, height=600, toolbar=no, resizable=0, scrollbars=1");
}
function popcertification02(folder, name, height) {
    window.open("/public/html/department/" + folder + "/pop_cer_" + name + ".html", "_certification", "width=620, height=" + height + ", toolbar=no, resizable=0, scrollbars=0");
}


/* 학부소개 - 교육과정로드맵 */
function poproadmap(name) {
    switch (name) {
        case "msop": height = 620; break;
        case "marketing": height = 480; break;
        case "human": height = 600; break;
        case "finance": height = 600; break;
        case "international": height = 470; break;
        case "ebiz": height = 600; break;
    }
    window.open("/public/html/department/dba_bz" + "/pop_dbabz_roadmap_" + name + ".html", "_roadmap", "width=620, height=" + height + ", toolbar=no, resizable=0, scrollbars=1");
}

/* 학부소개 - 자랑스러운 문화예술인들 */
function popdac(folder, header, name, popwin) {
    var height = "";
    if (name == "kys") {
        height = "420";
    } else if (name == "group_01") {
        height = "520";
    } else if (name == "group_02") {
        height = "440";
    } else if (name == "group_03") {
        height = "600";
    } else if (name == "pji") {
        height = "435";
    }

    else {
        height = "650";
    }
    window.open("/public/html/department/" + folder + header + name + ".html", popwin, "width=416, height=" + height + ", toolbar=no, resizable=0, scrollbars=1");
}


/***************************
* Util
****************************/
/**
* ex ::  <input type="text" name="phoneNumber" onKeyPress="numOnlyCheck();" />  
**/
function numOnlyCheck() {
    if (isNaN(String.fromCharCode(event.keyCode)) && (event.keyCode != 8 && event.keyCode != 9 && event.keyCode != 13)) {
        //alert("숫자만 입력하여 주십시요.");
        event.returnValue = false;
    }
}

function imgMaxSizeCheck(parentElementName) {

    var parentObj = document.getElementById(parentElementName);
    var img = parentObj.getElementsByTagName('IMG');
    for (var i = 0; i < img.length; i++) {
        if (img[i].width > imageWidthMax) {
            resize(img[i]);
        }

        if (img[i].style.width > imageWidthMax + "px") {
            resizeByStyle(img[i]);
        }

    }
}


function resize(img) {

    // 원본 이미지 사이즈 저장
    var width = img.width;
    var height = img.height;

    // 가로, 세로 최대 사이즈 설정
    var maxWidth = imageWidthMax;
    var maxHeight = height;         // 원래 사이즈 

    // 가로나 세로의 길이가 최대 사이즈보다 크면 실행  
    if (width > maxWidth || height > maxHeight) {

        // 가로가 세로보다 크면 가로는 최대사이즈로, 세로는 비율 맞춰 리사이즈
        if (width > height) {
            resizeWidth = maxWidth;
            resizeHeight = ((height * resizeWidth) / width);


            // 세로가 가로보다 크면 세로는 최대사이즈로, 가로는 비율 맞춰 리사이즈
        } else {
            resizeHeight = maxHeight;
            resizeWidth = Math.Round((width * resizeHeight) / height);
        }
    }

    // 리사이즈한 크기로 이미지 크기 다시 지정
    img.width = resizeWidth;
    img.height = resizeHeight;
}


function resizeByStyle(img) {

    // 원본 이미지 사이즈 저장
    var width = img.style.width.replace(/px/g, "");
    var height = img.style.height.replace(/px/g, "");

    // 가로, 세로 최대 사이즈 설정
    var maxWidth = imageWidthMax;
    var maxHeight = height;         // 원래 사이즈 

    // 가로나 세로의 길이가 최대 사이즈보다 크면 실행  
    if (width > maxWidth || height > maxHeight) {

        // 가로가 세로보다 크면 가로는 최대사이즈로, 세로는 비율 맞춰 리사이즈
        if (width > height) {
            resizeWidth = maxWidth;
            resizeHeight = ((height * resizeWidth) / width);


            // 세로가 가로보다 크면 세로는 최대사이즈로, 가로는 비율 맞춰 리사이즈
        } else {
            resizeHeight = maxHeight;
            resizeWidth = Math.Round((width * resizeHeight) / height);
        }
    }

    // 리사이즈한 크기로 이미지 크기 다시 지정
    img.style.width = resizeWidth + "px";
    img.style.height = resizeHeight + "px";
}

function iframeMaxSizeCheck() {
    var iframeElement = document.getElementsByTagName("iframe");
    if (iframeElement.length >= 1) {
        for (var i = 0; i < iframeElement.length; i++) {
            if (iframeElement[i].width > iframeWidthMax) {
                iframeElement[i].width = iframeWidthMax;
            }
        }
    }

}


function writeFlash(fname, fwidth, fheight) {
    var g = "";

    g += "    <object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 ";
    g += "    codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0 ";
    g += "    width='" + fwidth + "px' height='" + fheight + "px' id=" + fname + "_obj align=middle>";
    g += "        <param name=allowScriptAccess value=middle>";
    g += "        <param name=movie value=" + fname + ">";
    g += "        <param name=quality value=high>";
    g += "        <param name=wmode value=transparent>";
    g += "        <embed src=" + fname + " ";
    g += "         quality=high pluginspage=http://www.macromedia.com/go/getflashplayer ";
    g += "         type=application/x-shockwave-flash wmode=transparent width='" + fwidth + "px' height='" + fheight + "px'></embed>";
    g += "    </object>";

    document.write(g);
}

function flash_img_by_scrap(fname, fwidth, fheight) {
    var g = "";
    var swf_folder = "";

    if (section_name == "department") {
        swf_folder = "department";
    } else {
        swf_folder = "contimg";
    }

    g += "	<object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 ";
    g += "    codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0 ";
    g += "    width='" + fwidth + "px' height='" + fheight + "px' id=" + fname + "_obj align=middle>";
    g += "		<param name=allowScriptAccess value=middle>";
    g += "		<param name=movie value=" + imgHostUrl + "/public/swf/" + swf_folder + "/" + fname + ".swf>";
    g += "		<param name=quality value=high>";
    g += "		<param name=wmode value=transparent>";
    g += "		<embed src=" + imgHostUrl + "/public/swf/" + swf_folder + "/" + fname + ".swf ";
    g += "         quality=high pluginspage=http://www.macromedia.com/go/getflashplayer ";
    g += "		 type=application/x-shockwave-flash wmode=transparent width='" + fwidth + "px' height='" + fheight + "px'></embed>";
    g += "	</object>";


    document.write(g);
}
