﻿// title
document.title = " ::::디지털 명문사학 ＊ 한디대::::";

// 절대경로 
var pub = "/HTML";

// focus
function allblur() {
    if (event.srcElement.tagName == "A" || event.srcElement.tagName == "IMG" || event.srcElement.tagName == "INPUT") document.body.focus();
}
//document.onfocusin = allblur; 

// openwindow
function openwindow(theURL, winName, features) {
    window.open(theURL, winName, features);
}

function MM_openBrWindow(theURL, winName, features) {
    window.open(theURL, winName, features);
}

// swapImg
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]; }
}

function Pop_Login() {  //login
    X = 400; Y = 250;
    l = (screen.width) ? (screen.width - X) / 2 : 0;
    t = (screen.height) ? (screen.height - Y) / 2 : 0;
    NewWindow = window.open('' + pub + '/commonN/pop_login.html', 'regist', 'width=' + X + ',height=' + Y + ',top=' + t + ',left=' + l + ',scrollbars=yes,toolbar=no,location=no,directories=no,status=no,resizable=no,menubar=no');
}

// openwindow 스크롤이 없을 때
function OpenWindow(url, intWidth, intHeight) {
    l = (screen.width) ? (screen.width - intWidth) / 2 : 0;
    t = (screen.height) ? (screen.height - intHeight) / 2 : 0;
    window.open(url, "_blank", "width=" + intWidth + ",height=" + intHeight + ",top=" + t + ",left=" + l + ",resizable=0,scrollbars=0");
}

// openwindow 스크롤이 있을 때
function OpenWindow_s(url, intWidth, intHeight) {
    l = (screen.width) ? (screen.width - intWidth) / 2 : 0;
    t = (screen.height) ? (screen.height - intHeight) / 2 : 0;
    window.open(url, "_blank", "width=" + intWidth + ",height=" + intHeight + ",top=" + t + ",left=" + l + ",resizable=0,scrollbars=1");
}

// openwindow 
function OpenWindow_cp(url) {
    window.open(url, "_blank", "width=537,height=540,resizable=0,scrollbars=1");
}

//Popup 		
function popup(Fn, Name, X, Y, Scroll) {
    l = (screen.width) ? (screen.width - X) / 2 : 0;
    t = (screen.height) ? (screen.height - Y) / 2 : 0;

    NewWindow = window.open(Fn, Name, 'width=' + X + ',height=' + Y + ',top=' + t + ',left=' + l + ',scrollbars=' + Scroll + ',toolbar=no,location=no,directories=no,status=no,resizable=no,menubar=no');
}

// openwindow 영업장 안내 지도
function map_img(imageSrc) {
    var win = window.open("", "win", "width=380,height=310");
    with (win.document) {
        open("text/html", "replace");
        write("<HTML><HEAD><TITLE>:: e-Station ::</TITLE></HEAD><BODY><img src=\'" + imageSrc + "\' ></BODY></HTML> ");
        close();
    }
}

// 한디대소개>협력네트워크>협정서
function agree(url) {
    window.open(url, 'win', 'resizable=no,scrollbars=no,top=1,left=1,width=530,height=800');
}

// 학과안내>전공소개>시범강의  //지식체험>강의체험>시범강의
function lecture(url) {
    window.open(url, 'win', 'resizable=1,scrollbars=1,top=1,left=1,width=800,height=600');
}

// 학과안내>전공소개>동영상 보기
function movie(url) {
    window.open(url, 'win', 'resizable=no,scrollbars=no,top=1,left=1,width=364,height=420');
}

// openwindow A/S 센타 안내 지도
function map_center(url) {
    window.open(url, 'win', 'resizable=no,scrollbars=yes,top=1,left=1,width=570,height=500');
}

// openwindow 플래시로 보는 부가서비스
function open_add_flash() {
    var sw = screen.width - 10;
    var sh = screen.height;
    newWindow = window.open("http://www.e-station.com/estation_front/estation_experience/ex_station.htm", "flash", 'scrollbars=yes, width=' + sw + ',height=' + sh + ',top=0,left=0');
}


var isDOM = (document.getElementById ? true : false);
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);

function getRef(id) {
    if (isDOM) return document.getElementById(id);
    if (isIE4) return document.all[id];
    if (isNS4) return document.layers[id];
}
// 우측  킉링크 스크롤되는 함수
var isNS = navigator.appName == "Netscape";

function moveRightEdge() {
    var yMenuFrom, yMenuTo, yOffset, timeoutNextCheck;
    if (isNS4) {
        yMenuFrom = Top_Layer.top;
        yMenuTo = windows.pageYOffset + 600;   // 위쪽 위치
    }
    else if (isDOM) {
        yMenuFrom = parseInt(Top_Layer.style.top, 10);
        yMenuTo = (isNS ? window.pageYOffset : document.body.scrollTop) + 480; // 위쪽 위치
    }

    timeoutNextCheck = 500;

    if (yMenuFrom != yMenuTo) {
        yOffset = Math.ceil(Math.abs(yMenuTo - yMenuFrom) / 20);
        if (yMenuTo < yMenuFrom)
            yOffset = -yOffset;
        if (isNS4)
            Top_Layer.top += yOffset;
        else if (isDOM)
            Top_Layer.style.top = parseInt(Top_Layer.style.top, 10) + yOffset;
        timeoutNextCheck = 10;
    }
    setTimeout("moveRightEdge()", timeoutNextCheck);
}

function moveRightEdge1() {
    var yMenuFrom, yMenuTo, yOffset, timeoutNextCheck;
    if (isNS4) {
        yMenuFrom = quick_Layer.top;
        yMenuTo = windows.pageYOffset + 600;   // 위쪽 위치
    }
    else if (isDOM) {
        yMenuFrom = parseInt(quick_Layer.style.top, 10);
        yMenuTo = (isNS ? window.pageYOffset : document.body.scrollTop) + 200; // 위쪽 위치
    }

    timeoutNextCheck = 500;

    if (yMenuFrom != yMenuTo) {
        yOffset = Math.ceil(Math.abs(yMenuTo - yMenuFrom) / 20);
        if (yMenuTo < yMenuFrom)
            yOffset = -yOffset;
        if (isNS4)
            quick_Layer.top += yOffset;
        else if (isDOM)
            quick_Layer.style.top = parseInt(quick_Layer.style.top, 10) + yOffset;
        timeoutNextCheck = 10;
    }
    setTimeout("moveRightEdge1()", timeoutNextCheck);
}





/* depth4*/
// image roll
function menuOver() {
    this.src = this.src.replace(".gif", "_on.gif");
}
function menuOut() {
    this.src = this.src.replace("_on.gif", ".gif");
}

var depth4currentSeq = -1;
function initTabMenu(menuEl) {
    for (i = 0; i < menuEl.length; i++) {

        if (i != depth4currentSeq) {
            menuEl[i].onmouseover = menuOver;
            menuEl[i].onmouseout = menuOut;
        } else {
            menuEl[i].src = menuEl[i].src.replace(".gif", "_on.gif")
        }
    }
}

/* css first-child */
function cssFirstChild(el, clsname) {
    if (el[0]) {
        if (el[0].className) {
            el[0].className = el[0].className + " " + clsname;
        } else {
            el[0].className = clsname;
        }
    }
}

function css3Background(element, backgroundString) {
    if (!element) {
        return false;
    }
    // getStyle script form http://www.quirksmode.org/dom/getstyles.html
    if (window.getComputedStyle) {
        padding = window.getComputedStyle(element, null).getPropertyValue("padding-top");
        padding += " " + window.getComputedStyle(element, null).getPropertyValue("padding-right");
        padding += " " + window.getComputedStyle(element, null).getPropertyValue("padding-bottom");
        padding += " " + window.getComputedStyle(element, null).getPropertyValue("padding-left");
    } else if (element.currentStyle) {
        padding = eval('element.currentStyle.' + "paddingTop");
        padding += " " + eval('element.currentStyle.' + "paddingRight");
        padding += " " + eval('element.currentStyle.' + "paddingBottom");
        padding += " " + eval('element.currentStyle.' + "paddingLeft");
    }

    // save content
    originalHTML = element.innerHTML;
    element.innerHTML = "";

    // create div element and layering
    backgroundEach = backgroundString.split(",");
    for (i = 0; i < backgroundEach.length; i++) {
        backgroundProperty = backgroundEach[i].replace("background:", "");

        el = document.createElement("div");
        if (i == 0) {
            element.style.padding = "0";
        }
        el.style.background = backgroundProperty;
        element.appendChild(el);
        element = el;
    }

    element.style.padding = padding;
    element.innerHTML = originalHTML;
    return true;
}

function getAllChildren(e) {
    // Returns all children of element. Workaround required for IE5/Windows. Ugh.
    return e.all ? e.all : e.getElementsByTagName('*');
}

document.getElementsBySelector = function(selector) {
    // Attempt to fail gracefully in lesser browsers
    if (!document.getElementsByTagName) {
        return new Array();
    }
    // Split selector in to tokens
    var tokens = selector.split(' ');
    var currentContext = new Array(document);
    for (var i = 0; i < tokens.length; i++) {
        token = tokens[i].replace(/^\s+/, '').replace(/\s+$/, ''); ;
        if (token.indexOf('#') > -1) {
            // Token is an ID selector
            var bits = token.split('#');
            var tagName = bits[0];
            var id = bits[1];
            var element = document.getElementById(id);
            if (tagName && element.nodeName.toLowerCase() != tagName) {
                // tag with that ID not found, return false
                return new Array();
            }
            // Set currentContext to contain just this element
            currentContext = new Array(element);
            continue; // Skip to next token
        }
        if (token.indexOf('.') > -1) {
            // Token contains a class selector
            var bits = token.split('.');
            var tagName = bits[0];
            var className = bits[1];
            if (!tagName) {
                tagName = '*';
            }
            // Get elements matching tag, filter them for class selector
            var found = new Array;
            var foundCount = 0;
            for (var h = 0; h < currentContext.length; h++) {
                var elements;
                if (tagName == '*') {
                    elements = getAllChildren(currentContext[h]);
                } else {
                    elements = currentContext[h].getElementsByTagName(tagName);
                }
                for (var j = 0; j < elements.length; j++) {
                    found[foundCount++] = elements[j];
                }
            }
            currentContext = new Array;
            var currentContextIndex = 0;
            for (var k = 0; k < found.length; k++) {
                if (found[k].className && found[k].className.match(new RegExp('\\b' + className + '\\b'))) {
                    currentContext[currentContextIndex++] = found[k];
                }
            }
            continue; // Skip to next token
        }
        // Code to deal with attribute selectors
        if (token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)) {
            var tagName = RegExp.$1;
            var attrName = RegExp.$2;
            var attrOperator = RegExp.$3;
            var attrValue = RegExp.$4;
            if (!tagName) {
                tagName = '*';
            }
            // Grab all of the tagName elements within current context
            var found = new Array;
            var foundCount = 0;
            for (var h = 0; h < currentContext.length; h++) {
                var elements;
                if (tagName == '*') {
                    elements = getAllChildren(currentContext[h]);
                } else {
                    elements = currentContext[h].getElementsByTagName(tagName);
                }
                for (var j = 0; j < elements.length; j++) {
                    found[foundCount++] = elements[j];
                }
            }
            currentContext = new Array;
            var currentContextIndex = 0;
            var checkFunction; // This function will be used to filter the elements
            switch (attrOperator) {
                case '=': // Equality
                    checkFunction = function(e) { return (e.getAttribute(attrName) == attrValue); };
                    break;
                case '~': // Match one of space seperated words 
                    checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('\\b' + attrValue + '\\b'))); };
                    break;
                case '|': // Match start with value followed by optional hyphen
                    checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('^' + attrValue + '-?'))); };
                    break;
                case '^': // Match starts with value
                    checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) == 0); };
                    break;
                case '$': // Match ends with value - fails with "Warning" in Opera 7
                    checkFunction = function(e) { return (e.getAttribute(attrName).lastIndexOf(attrValue) == e.getAttribute(attrName).length - attrValue.length); };
                    break;
                case '*': // Match ends with value
                    checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) > -1); };
                    break;
                default:
                    // Just test for existence of attribute
                    checkFunction = function(e) { return e.getAttribute(attrName); };
            }
            currentContext = new Array;
            var currentContextIndex = 0;
            for (var k = 0; k < found.length; k++) {
                if (checkFunction(found[k])) {
                    currentContext[currentContextIndex++] = found[k];
                }
            }
            // alert('Attribute Selector: '+tagName+' '+attrName+' '+attrOperator+' '+attrValue);
            continue; // Skip to next token
        }
        // If we get here, token is JUST an element (not a class or ID selector)
        tagName = token;
        var found = new Array;
        var foundCount = 0;
        for (var h = 0; h < currentContext.length; h++) {
            var elements = currentContext[h].getElementsByTagName(tagName);
            for (var j = 0; j < elements.length; j++) {
                found[foundCount++] = elements[j];
            }
        }
        currentContext = found;
    }
    return currentContext;
}


//qna 열리고 닫힘
var old = '';
function critNumber(name) {
    submenu = eval("SelectCrit_" + name + ".style");
    if (old != submenu) {
        if (old != '') {
            old.display = 'none';
        }
        submenu.display = 'block';
        old = submenu;
    }
    else {
        submenu.display = 'none';
        old = '';
    }
}



function view_obj(kind, width, Height, path, mode1) {

    f_obj_kind = kind;
    f_obj_path = path;
    f_obj_width = width;
    f_obj_height = Height;

    if (mode1 != 'normal') {
        var mode_str = '<param name="wmode" value="transparent" />';
    }
    else {
        var mode_str = "";
    }


    if (f_obj_kind == 'flash') {

        var write_obj = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' + f_obj_width + '" height="' + f_obj_height + '">\n';
        write_obj = write_obj + '<param name="movie" value="' + f_obj_path + '">\n';
        write_obj = write_obj + '<param name="quality" value="high">\n';
        write_obj = write_obj + mode_str;
        write_obj = write_obj + '<embed src="' + f_obj_path + '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + f_obj_width + '" height="' + f_obj_height + '"></embed>\n';
        write_obj = write_obj + '</object>\n';
    }
    else if (f_obj_kind == 'wmplayer') {

        if (mode1 == '') {
            var write_obj = '<object classid=CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95 id=WMPlay width=' + f_obj_width + ' height=' + f_obj_height + '>';
            write_obj = write_obj + '<PARAM NAME="FileName" VALUE="' + path + '">';
            write_obj = write_obj + '<PARAM NAME="AllowScan" VALUE="1">';
            write_obj = write_obj + '<PARAM NAME="AutoSize" VALUE="0">';
            write_obj = write_obj + '<PARAM NAME="AutoStart" VALUE="1">';
            write_obj = write_obj + '<PARAM NAME="AnimationAtStart" VALUE="1">';
            write_obj = write_obj + '<PARAM NAME="DisplayMode" VALUE="4">';
            write_obj = write_obj + '<PARAM NAME="EnableContextMenu" VALUE="true">';
            write_obj = write_obj + '<PARAM NAME="ShowControls" VALUE="1">';
            write_obj = write_obj + '<PARAM NAME="ShowAudioControls" VALUE="1">';
            write_obj = write_obj + '<PARAM NAME="ShowDisplay" VALUE="0">';
            write_obj = write_obj + '<PARAM NAME="ShowGotoBar" VALUE="0">';
            write_obj = write_obj + '<PARAM NAME="ShowPositionControls" VALUE="0"> ';
            write_obj = write_obj + '<PARAM NAME="ShowStatusBar" VALUE="0">';
            write_obj = write_obj + '<PARAM NAME="ShowCaptioning" VALUE="0"> ';
            write_obj = write_obj + '<PARAM NAME="ShowTracker" VALUE="1">';
            write_obj = write_obj + '<param name="ShowDisplay" value="false">';
            write_obj = write_obj + '<EMBED type="application/x-mplayer2" "WIDTH: ' + f_obj_width + 'px; HEIGHT: ' + f_obj_height + 'px" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" id="NSPlay" Name="NSPlay" DisplaySize="4" AutoSize="1"  ShowControls="0" ShowDisplay="0" ShowStatusBar="1"  width=' + f_obj_width + '   Height=' + f_obj_height + '  src="' + path + '" autostart="1">';
            write_obj = write_obj + '</EMBED>';
            write_obj = write_obj + '</object>';
        }
        else {
            var write_obj = '<object classid=CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6 id=WMPlay width=' + f_obj_width + ' height=' + f_obj_height + '>';
            write_obj = write_obj + '<PARAM NAME="URL" VALUE="' + path + '">';
            write_obj = write_obj + '<PARAM NAME="AllowScan" VALUE="1">';
            write_obj = write_obj + '<PARAM NAME="AutoSize" VALUE="0">';
            write_obj = write_obj + '<PARAM NAME="AutoStart" VALUE="1">';
            write_obj = write_obj + '<PARAM NAME="AnimationAtStart" VALUE="1">';
            write_obj = write_obj + '<PARAM NAME="DisplayMode" VALUE="4">';
            write_obj = write_obj + '<PARAM NAME="EnableContextMenu" VALUE="true">';
            write_obj = write_obj + '<PARAM NAME="ShowControls" VALUE="1">';
            write_obj = write_obj + '<PARAM NAME="ShowAudioControls" VALUE="1">';
            write_obj = write_obj + '<PARAM NAME="ShowDisplay" VALUE="0">';
            write_obj = write_obj + '<PARAM NAME="ShowGotoBar" VALUE="0">';
            write_obj = write_obj + '<PARAM NAME="ShowPositionControls" VALUE="0"> ';
            write_obj = write_obj + '<PARAM NAME="ShowStatusBar" VALUE="0">';
            write_obj = write_obj + '<PARAM NAME="ShowCaptioning" VALUE="0"> ';
            write_obj = write_obj + '<PARAM NAME="ShowTracker" VALUE="1">';
            write_obj = write_obj + '<param name="ShowDisplay" value="false">';
            write_obj = write_obj + '<EMBED type="application/x-mplayer2" "WIDTH: ' + f_obj_width + 'px; HEIGHT: ' + f_obj_height + 'px" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" id="NSPlay" Name="NSPlay" DisplaySize="4" AutoSize="1"  ShowControls="0" ShowDisplay="0" ShowStatusBar="1"  width=' + f_obj_width + '   Height=' + f_obj_height + '  src="' + path + '" autostart="1">';
            write_obj = write_obj + '</EMBED>';
            write_obj = write_obj + '</object>';
        }



    }
    else if (f_obj_kind == 'free') {
        write_obj = width;

    }
    document.write(write_obj);


}
// mEmbed(파일경로, 가로, 세로)
function mEmbed(url, w, h) {

    // 플래시 코드 정의
    var flashStr =
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='" + w + "' height='" + h + "' id='flashfile' align='middle'>" +
	"<param name='movie' value='" + url + "' />" +
	"<param name='wmode' value='transparent' />" +
	"<param name='menu' value='false' />" +
	"<param name='quality' value='high' />" +
	"<embed src='" + url + "' wmode='transparent' menu='false' quality='high' width='" + w + "' height='" + h + "' name='flashfile' align='middle' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />" +
	"</object>";

    // 플래시 코드 출력
    document.write(flashStr);

}

function mEmbed01(url, w, h, fl_vars) {

    // 플래시 코드 정의
    var flashStr =
	"<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0' width='" + w + "' height='" + h + "' id='flashfile' align='middle'>" +
	"<param name='movie' value='" + url + "' />" +
	"<param name='wmode' value='transparent' />" +
	"<param name='menu' value='false' />" +
	"<param name='quality' value='high' />" +
	"<param name=flashvars value='menunum=" + fl_vars + "' />" +
	"<embed src='" + url + "' wmode='transparent' menu='false' quality='high' width='" + w + "' height='" + h + "' name='flashfile' align='middle' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />" +
	"</object>";

    // 플래시 코드 출력
    document.write(flashStr);

}

