반응형
<script type=text/javascript>
var UserAgent = navigator.userAgent;
var AppVersion = (((navigator.appVersion.split('; '))[1].split(' '))[1]);

// default NSelect style
var SL_ActiveIDX = null;
var SL_Focused = null;
var SL_FocusedIDX = null;
var SL_Table = " cellspacing=0 cellpadding=0 border=0";
var SL_Text = "text-indent:2px;padding-top:3px;";
var SL_IPrefix = "http://sstatic.naver.com/search/images5/";
var SL_AImage = "arrow.gif";
var SL_BImage = "blank.gif";
var SL_SBLen = 10;
var SL_SBWidth = 18;
var SL_ScrollBar = ""
    +"scrollbar-face-color:#ffffff;"
    +"scrollbar-shadow-color:999999;"
    +"scrollbar-highlight-color:#E8E8E8;"
    +"scrollbar-3dlight-color:999999;"
    +"scrollbar-darkshadow-color:#EEEEEE;"
    +"scrollbar-track-color:#999999;"
    +"scrollbar-arrow-color:#E8E8E8;";

var SL_BGColor = "#FEFFCB";
var SL_BGColor_M = "#225688";
var SL_Border = "1px solid #AFB086";
var SL_FontSize = "10pt";
var SL_FontColor = "#000000";
var SL_Height = "18px";

SList = new Array();
document.write( "<div id=NSDiv style='position:absolute;top:-100px;z-index:3;'></div>" );

// set SL Style
function setEnv( pSrc, pBG, pBM, pBD, pAI )
{
    var oEnv = new Object();
    var oSrc = createObject( pSrc );

    if( oSrc.style.width ) {
    oEnv.Width = oSrc.style.width;
    } else {
    document.all.NSDiv.innerHTML = ""
        +"<table style='top:2px;'><tr><td height=1>"+pSrc+"</td></tr></table>";
    oEnv.Width = document.all.NSDiv.scrollWidth;
    }
    if( oSrc.style.height ) oEnv.Height = oSrc.style.height; else oEnv.Height = SL_Height;
    if( oSrc.style.fontSize ) oEnv.FontSize = oSrc.style.fontSize; else oEnv.FontSize = SL_FontSize;
    if( oSrc.style.color ) oEnv.FontColor = oSrc.style.color; else oEnv.FontColor = SL_FontColor;

    if( pBG ) oEnv.BGColor = pBG;    else oEnv.BGColor = SL_BGColor;
    if( pBM ) oEnv.BGColor_M = pBM;    else oEnv.BGColor_M = SL_BGColor_M;
    if( pBD ) oEnv.Border = pBD;    else oEnv.Border = SL_Border;
    if( pAI ) oEnv.AImage = pAI;    else oEnv.AImage = SL_AImage;

    return oEnv;
}

// parameter NSelect
function NSelect( HTMLSrc, KIN, BG, BM, BD, AI )
{
    if ( UserAgent.indexOf( "MSIE" ) < 0 || AppVersion < 5 ) {
    document.write( HTMLSrc );
    return;
    } else {
    var SE = setEnv( HTMLSrc, BG, BM, BD, AI );
    var SListObj = new setNSelect( HTMLSrc, KIN, SE );
    SListObj.append();

    return SListObj;
    }
}

function appendSList()
{
    document.write("<div id=TempDiv></div>\n");
    document.all.TempDiv.appendChild( this.Table );
    document.all.TempDiv.removeNode();

    return;
}

function MouseScrollHandler() {
    var f_titleObj = SList[SL_FocusedIDX].Title;
    var f_itemObj = SList[SL_FocusedIDX].Items;
    var idx_length = f_itemObj.options.length;
    var idx_selected = f_itemObj.options.selectedIndex ;

    CancelEventHandler( window.event );

    if( window.event.wheelDelta > 0 ) {
    idx_selected = Math.max( 0, --idx_selected );
    } else {
    idx_selected = Math.min( idx_length - 1, ++idx_selected );
    }

    if( f_itemObj.options.selectedIndex != idx_selected ) {
    f_itemObj.options.selectedIndex = idx_selected;
    SList[SL_FocusedIDX].ChangeTitle();
    if( f_itemObj.onchange ) f_itemObj.onchange();
    }

    return;
}

function ActiveIDXHandler() {
    if( SL_ActiveIDX == null ) {
    for( i = 0; i < SList.length; i++ ) {
        SList[i].List.style.display = "none";
        if( i == SL_Focused ) TitleHighlightHandler( i, 1 );
        else TitleHighlightHandler( i, 0 );
    }

    if( SL_Focused == null )
        document.detachEvent( 'onclick', ActiveIDXHandler );
    }
    if( SL_Focused == null ) document.detachEvent( 'onmousewheel', MouseScrollHandler );
    else document.attachEvent( 'onmousewheel', MouseScrollHandler );

    SL_ActiveIDX = null;
    SL_Focused = null;

    return;
}

function TitleClickHandler()
{
    SL_ActiveIDX = this.entry;

    for( i = 0; i < SList.length; i++ ) {
    if( i == SL_ActiveIDX ) {
        if( SList[i].List.style.display == "block" ) {
        SList[i].List.style.display = "none";
        TitleHighlightHandler( i, 1 );
        SL_Focused = i;
        SL_FocusedIDX = i;
        } else SList[i].List.style.display = "block";
    } else {
        SList[i].List.style.display = "none";
        TitleHighlightHandler( i, 0 );
    }
    }

    document.detachEvent( 'onclick', ActiveIDXHandler );
    document.attachEvent( 'onclick', ActiveIDXHandler );

    return;
}

function TitleMouseOverHandler()
{
    this.Title.children(0).cells(2).children(0).style.filter = "";
    if( !this.kin ) this.Title.style.border = "1 solid #999999";

    return;
}

function TitleMouseOutHandler()
{
    this.Title.children(0).cells(2).children(0).style.filter = "alpha( opacity=80 );";
    if( !this.kin ) this.Title.style.border = "1 solid #C3CACD";

    return;
}

function TitleHighlightHandler( entry, t )
{
    if( t ) {
    if( this.kin )
        SList[entry].Title.children(0).cells(0).style.background = SList[entry].env.BGColor;
    else
        SList[entry].Title.children(0).cells(0).style.background = SList[entry].env.BGColor_M;
    } else {
    SList[entry].Title.children(0).cells(0).style.background = SList[entry].env.BGColor;
    }

    return;
}

function ListMouseDownHandler( f )
{
    var tObj = this.Title.children(0);
    var length = this.Items.length;

    for( i = 0; i < length; i++ ) {
    this.Items.options[i].selected = false;
    if ( i == f.idx ) {
        this.Items.options[i].selected = true;
        this.ChangeTitle();
    }
    }
    if( this.Items.onchange ) this.Items.onchange();
    if ( this.kin && ( length - 1 ) == f.idx )
    location.href = this.Items.options[f.idx].value;

    this.List.style.display = "none";

    SL_Focused = this.entry;
    SL_FocusedIDX = this.entry;

    return;
}

function ListMouseOverHandler( f )
{
    if( this.kin ) f.style.color = "#FFFFFF";
    f.style.background = this.env.BGColor_M;
    return;
}

function ListMouseOutHandler( f )
{
    f.style.color = this.env.FontColor;
    f.style.background = this.env.BGColor;
    return;
}

function CancelEventHandler( e )
{
    e.cancelBubble = true;
    e.returnValue = false;

    return;
}

function ModifyDivHandler() {
    var width = parseInt( this.Title.style.width );

    this.Items.style.width = null;
    document.all.NSDiv.innerHTML = ""
    +"<table style='top:2px;'><tr><td height=1>"+this.Items.outerHTML+"</td></tr></table>";
    var scrollWidth = parseInt( document.all.NSDiv.scrollWidth );

    if( scrollWidth > width ) {
    this.Title.style.width = scrollWidth;
    this.List.style.width = scrollWidth;
    }

    return;
}

function ChangeTitleHandler() {
    var newTitle = this.Items.options[this.Items.options.selectedIndex].innerHTML ;
    this.Title.children(0).cells(0).innerHTML = "<nobr>"+newTitle+"</nobr>";

    return;
}

function ChangeListHandler() {
    var length = this.Items.length;
    var item = "";

    var listHeight = parseInt( this.env.Height ) * Math.min( SL_SBLen, length ) + 2;
    var overflowY = ( length > SL_SBLen ) ? "scroll" : "hidden";

    this.List.innerHTML = "";
    for( i = 0; i < this.Items.options.length; i++ ) {
    item = ""
        +"<DIV idx="+i+" style='height:"+this.env.Height+";"+SL_Text+"'"
        +"  onMouseDown='SList["+this.entry+"].ListMouseDown( this );'"
        +"  onMouseOver='SList["+this.entry+"].ListMouseOver( this );'"
        +"  onMouseOut='SList["+this.entry+"].ListMouseOut( this );'>"
        +"    <nobr>"+this.Items.options[i].innerText+"</nobr>"
        +"</DIV>";
    oItem = createObject( item );
    this.List.appendChild( oItem );
    }

    this.List.style.height = listHeight;
    this.List.style.overflowY = overflowY;

    return;
}

function AddOptionHandler( sText, sValue, iIndex ) {
    var oOption = document.createElement("OPTION");
    this.Items.options.add(oOption, iIndex);

    oOption.innerText = sText;
    oOption.value = sValue;

    return;
}

function setNSelect( pSrc, pKIN, pSE )
{
    this.entry = SList.length;
    this.lower = null;
    this.src = pSrc;
    this.env = pSE;
    this.kin = pKIN;

    // NSelect Object
    this.Items;
    this.Title;
    this.List;
    this.Table;

    // Create NSelect Element
    this.ItemObj = createObject;
    this.ListObj  = createList;
    this.TitleObj = createTitle;
    this.TableObj = createSList;

    // NSelect EventHandler
    this.TitleClick = TitleClickHandler;
    this.TitleMouseOver = TitleMouseOverHandler;
    this.TitleMouseOut = TitleMouseOutHandler;
    this.ListMouseDown = ListMouseDownHandler;
    this.ListMouseOver = ListMouseOverHandler;
    this.ListMouseOut = ListMouseOutHandler;
    this.CancelEvent = CancelEventHandler;

    // NSelect Function
    this.ModifyDiv = ModifyDivHandler;
    this.ChangeTitle = ChangeTitleHandler;
    this.ChangeList = ChangeListHandler;
    this.AddOption = AddOptionHandler;

    this.append = appendSList;
    this.Table = this.TableObj();

    SList[this.entry] = this;

    return;
}

function createObject( pSrc )
{      
    oObj = new Object();
    oObj.Div = document.createElement("DIV");
    oObj.Div.insertAdjacentHTML("afterBegin", pSrc);

    return oObj.Div.children(0);
}

function createTitle()
{
    var length = this.Items.length;

    for ( i = 0; i < length; i++ ) {
    if (this.Items.options[i].selected) {
        SIName = this.Items.options[i].innerText;
        SIValue = this.Items.options[i].value;
    }
    }

    this.Title = createObject(""
    +"<DIV id=title style='width:"+this.env.Width+";overflow-X:hidden;position:relative;left:0px;top:0px;"
    +"border:"+this.env.Border+";cursor:default;background:"+this.env.BGColor+";'"
    +"    onClick='SList["+this.entry+"].TitleClick( window.event );'"
    +"    onMouseOver='SList["+this.entry+"].TitleMouseOver( window.event );'"
    +"    onMouseOut='SList["+this.entry+"].TitleMouseOut( window.event );'"
    +">"
        +"<table height="+this.env.Height+" "+SL_Table+" style='table-layout:fixed;text-overflow:hidden;'>"
    +"<tr>"
        +"    <td style='width:100%;font-size:"+this.env.FontSize+";color:"+this.env.FontColor+";"+SL_Text+"'><nobr>"+SIName+"</nobr></td>"
        +"    <td style='display:none;'></td>"
        +"    <td align=center valign=center width="+SL_SBWidth+"><img src='"+SL_IPrefix+this.env.AImage+"' border=0 style='Filter:Alpha( Opacity=80 )'></td>"
    +"</tr>"
    +"</table>"
    +"</DIV>");

    oTitle_Sub = createObject(""
    +"<img style='position:absolute;top:1px;left:0;width:"+this.env.Width+";height:"+this.env.Height+";'"
    +"    ondragstart='SList["+this.entry+"].CancelEvent( window.event );'"
    +" src='"+SL_IPrefix+SL_BImage+"'>");

    this.Title.childNodes(0).cells(1).appendChild( this.Items );
    this.Title.childNodes(0).cells(2).appendChild( oTitle_Sub );

    return;
}

function createList()
{
    var ListDiv = ""
    +"<DIV id=list style='position:absolute;z-index:2;display:none;background:"+this.env.BGColor+";"
    +"border:"+this.env.Border+";font-size:"+this.env.FontSize+";color:"+this.env.FontColor+";cursor:default;"
    +"width:"+this.env.Width+";overflow-X:hidden;"+SL_ScrollBar+"'></DIV>";

    this.List = createObject( ListDiv );
    this.ChangeList();

    return;
}

function createSList()
{
    this.Items = this.ItemObj( this.src );

    this.TitleObj();
    this.ListObj();

    var table = createObject(""
        +"<table cellspacing=0 cellpadding=1 border=0>"
        +"<tr><td></td></tr>"
        +"</table>");

    table.cells(0).appendChild( this.Title );
    table.cells(0).appendChild( this.List );

    return table;
}


</script>
<script>
var yearSelect;
var monthSelect;

var todayDate;

if (typeof(headerfooter_time_year) != "undefined")
{
    /* 오늘의 날짜를 서버 날짜로 설정 */
    todayDate = new Date(
                    headerfooter_time_year, headerfooter_time_month - 1,
                    headerfooter_time_day, headerfooter_time_hour,
                    headerfooter_time_minute, headerfooter_time_second);
}
else
    todayDate = new Date();

function memorialDay(name, month, day, solarLunar, holiday, type)
{
    this.name = name;
    this.month = month;
    this.day = day;
    this.solarLunar = solarLunar;
    this.holiday = holiday;    /* true : 빨간날 false : 안빨간날 */
    this.type = type;    /* true : real time setting */
    this.techneer = true;
}

var memorialDays = Array (
    new memorialDay("신정", 1, 1, 1, true),
    new memorialDay("", 12, 0, 2, true, true),    /* 실시간으로 정해짐 */
    new memorialDay("설날", 1, 1, 2, true),
    new memorialDay("", 1, 2, 2, true),
    new memorialDay("삼일절", 3, 1, 1, true),
    new memorialDay("식목일", 4, 5, 1, true),
    new memorialDay("석가탄신일", 4, 8, 2, true),
    new memorialDay("어린이날", 5, 5, 1, true),
    new memorialDay("현충일", 6, 6, 1, true),
    new memorialDay("제헌절", 7, 17, 1, true),
    new memorialDay("광복절", 8, 15, 1, true),
    new memorialDay("", 8, 14, 2, true),
    new memorialDay("추석", 8, 15, 2, true),
    new memorialDay("", 8, 16, 2, true),
    new memorialDay("개천절", 10, 3, 1, true),
    new memorialDay("성탄절", 12, 25, 1, true),

    new memorialDay("정월대보름", 1, 15, 2, false),
    new memorialDay("단오", 5, 5, 2, false),
    new memorialDay("국군의날", 10, 1, 1, false),
    new memorialDay("한글날", 10, 9, 1, false),
    new memorialDay("625전쟁일", 6, 25, 1, false),
    new memorialDay("삼짇날", 3, 3, 2, false),
    new memorialDay("물의날", 3, 22, 1, false),
    new memorialDay("만우절", 4, 1, 1, false),
    new memorialDay("장애인의날", 4, 20, 1, false),
    new memorialDay("과학의날", 4, 21, 1 , false),
    new memorialDay("충무공탄신일", 4, 28, 1, false),
    new memorialDay("근로자의날·법의날", 5, 1, 1, false),
    new memorialDay("어버이날", 5, 8, 1, false),
    new memorialDay("스승의날", 5, 15, 1, false),
    new memorialDay("발명의날", 5, 19, 1, false),
    new memorialDay("바다의날", 5, 31, 1, false),
    new memorialDay("환경의날", 6, 5, 1, false),
    new memorialDay("유두", 6, 15, 2, false),
    new memorialDay("칠월칠석", 7, 7, 2, false),
    new memorialDay("중양절", 9, 9, 2, false),
    new memorialDay("철도의날", 9, 18, 1, false),
    new memorialDay("소방의날", 11, 9, 1, false)
);
   

function myDate(year, month, day, leapMonth)
{
    this.year = year;
    this.month = month;
    this.day = day;
    this.leapMonth = leapMonth;
}

// 음력 데이터 (평달 - 작은달 :1,  큰달:2 )
// (윤달이 있는 달 - 평달이 작고 윤달도 작으면 :3 , 평달이 작고 윤달이 크면 : 4)
// (윤달이 있는 달 - 평달이 크고 윤달이 작으면 :5,  평달과 윤달이 모두 크면 : 6)
var lunarMonthTable = [
[2, 1, 2, 1, 2, 1, 2, 2, 1, 2, 1, 2],
[1, 2, 1, 1, 2, 1, 2, 5, 2, 2, 1, 2],
[1, 2, 1, 1, 2, 1, 2, 1, 2, 2, 2, 1],   /* 1901 */
[2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 2, 2],
[1, 2, 1, 2, 3, 2, 1, 1, 2, 2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5, 2, 1, 2, 1, 2, 1, 1],
[2, 1, 2, 2, 1, 2, 2, 1, 2, 1, 2, 1],
[2, 1, 1, 2, 1, 2, 2, 1, 2, 2, 1, 2],   /* 2041 */
[1, 5, 1, 2, 1, 2, 1, 2, 2, 2, 1, 2],
[1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 2, 2]];

/* 양력 <-> 음력 변환 함수
* type : 1 - 양력 -> 음력
*        2 - 음력 -> 양력
* leapmonth : 0 - 평달
*             1 - 윤달 (type = 2 일때만 유효)
*/
function lunarCalc(year, month, day, type, leapmonth)
{
    var solYear, solMonth, solDay;
    var lunYear, lunMonth, lunDay;
    var lunLeapMonth, lunMonthDay;    
    var i, lunIndex;

    var solMonthDay = [31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];

    /* range check */
    if (year < 1900 || year > 2040)
    {
        alert('1900년부터 2040년까지만 지원합니다');
        return;
    }

    /* 속도 개선을 위해 기준 일자를 여러개로 한다 */
    if (year >= 2000)
    {
        /* 기준일자 양력 2000년 1월 1일 (음력 1999년 11월 25일) */
        solYear = 2000;
        solMonth = 1;
        solDay = 1;
        lunYear = 1999;
        lunMonth = 11;
        lunDay = 25;
        lunLeapMonth = 0;

        solMonthDay[1] = 29;    /* 2000 년 2월 28일 */
        lunMonthDay = 30;    /* 1999년 11월 */
    }
    else if (year >= 1970)
    {
        /* 기준일자 양력 1970년 1월 1일 (음력 1969년 11월 24일) */
        solYear = 1970;
        solMonth = 1;
        solDay = 1;
        lunYear = 1969;
        lunMonth = 11;
        lunDay = 24;
        lunLeapMonth = 0;

        solMonthDay[1] = 28;    /* 1970 년 2월 28일 */
        lunMonthDay = 30;    /* 1969년 11월 */
    }
    else if (year >= 1940)
    {
        /* 기준일자 양력 1940년 1월 1일 (음력 1939년 11월 22일) */
        solYear = 1940;
        solMonth = 1;
        solDay = 1;
        lunYear = 1939;
        lunMonth = 11;
        lunDay = 22;
        lunLeapMonth = 0;

        solMonthDay[1] = 29;    /* 1940 년 2월 28일 */
        lunMonthDay = 29;    /* 1939년 11월 */
    }
    else
    {
        /* 기준일자 양력 1900년 1월 1일 (음력 1899년 12월 1일) */
        solYear = 1900;
        solMonth = 1;
        solDay = 1;
        lunYear = 1899;
        lunMonth = 12;
        lunDay = 1;
        lunLeapMonth = 0;

        solMonthDay[1] = 28;    /* 1900 년 2월 28일 */
        lunMonthDay = 30;    /* 1899년 12월 */
    }

    lunIndex = lunYear - 1899;

    while (true)
    {
//        document.write(solYear + "-" + solMonth + "-" + solDay + "<->");
//        document.write(lunYear + "-" + lunMonth + "-" + lunDay + " " + lunLeapMonth + " " + lunMonthDay + "<br>");

        if (type == 1 &&
            year == solYear &&
            month == solMonth &&
            day == solDay)
        {
            return new myDate(lunYear, lunMonth, lunDay, lunLeapMonth);
        }   
        else if (type == 2 &&
                year == lunYear &&
                month == lunMonth &&
                day == lunDay &&
                leapmonth == lunLeapMonth)
        {
            return new myDate(solYear, solMonth, solDay, 0);
        }

        /* add a day of solar calendar */
        if (solMonth == 12 && solDay == 31)
        {
            solYear++;
            solMonth = 1;
            solDay = 1;

            /* set monthDay of Feb */
            if (solYear % 400 == 0)
                solMonthDay[1] = 29;
            else if (solYear % 100 == 0)
                solMonthDay[1] = 28;
            else if (solYear % 4 == 0)
                solMonthDay[1] = 29;
            else
                solMonthDay[1] = 28;

        }
        else if (solMonthDay[solMonth - 1] == solDay)
        {
            solMonth++;
            solDay = 1;    
        }
        else
            solDay++;


        /* add a day of lunar calendar */
        if (lunMonth == 12 &&
            ((lunarMonthTable[lunIndex][lunMonth - 1] == 1 && lunDay == 29) ||
            (lunarMonthTable[lunIndex][lunMonth - 1] == 2 && lunDay == 30)))
        {
            lunYear++;
            lunMonth = 1;
            lunDay = 1;

            lunIndex = lunYear - 1899;

            if (lunarMonthTable[lunIndex][lunMonth - 1] == 1)
                lunMonthDay = 29;
            else if (lunarMonthTable[lunIndex][lunMonth - 1] == 2)
                lunMonthDay = 30;
        }
        else if (lunDay == lunMonthDay)
        {
            if (lunarMonthTable[lunIndex][lunMonth - 1] >= 3
                && lunLeapMonth == 0)
            {
                lunDay = 1;
                lunLeapMonth = 1;
            }
            else
            {
                lunMonth++;
                lunDay = 1;
                lunLeapMonth = 0;
            }

            if (lunarMonthTable[lunIndex][lunMonth - 1] == 1)
                lunMonthDay = 29;
            else if (lunarMonthTable[lunIndex][lunMonth - 1] == 2)
                lunMonthDay = 30;
            else if (lunarMonthTable[lunIndex][lunMonth - 1] == 3)
                lunMonthDay = 29;
            else if (lunarMonthTable[lunIndex][lunMonth - 1] == 4 &&
                    lunLeapMonth == 0)
                lunMonthDay = 29;
            else if (lunarMonthTable[lunIndex][lunMonth - 1] == 4 &&
                    lunLeapMonth == 1)
                lunMonthDay = 30;
            else if (lunarMonthTable[lunIndex][lunMonth - 1] == 5 &&
                    lunLeapMonth == 0)
                lunMonthDay = 30;
            else if (lunarMonthTable[lunIndex][lunMonth - 1] == 5 &&
                    lunLeapMonth == 1)
                    lunMonthDay = 29;
            else if (lunarMonthTable[lunIndex][lunMonth - 1] == 6)
                lunMonthDay = 30;
        }
        else
            lunDay++;
    }
}

function getWeekday(year, month, day)
{
    var weekday = Array("일", "월", "화", "수", "목", "금", "토");
    var date = new Date(year, month - 1, day);

    if (date)
        return weekday[date.getDay()];
}

function getPassDay(year, month, day)
{
    var date = new Date(year, month - 1, day);

    var interval = Math.floor((todayDate - date) / (1000 * 60 * 60 * 24) + 1);

    return interval;
}

function getDDay(year, month, day)
{
    var date = new Date(year, month - 1, day);

    var interval = Math.floor((date - todayDate) / (1000 * 60 * 60 * 24) + 1);

    return interval;
}

function getDateSpecificInterval(year, month, day, interval)
{
    var date = new Date(year, month - 1, parseInt(day) + parseInt(interval) - 1);

    return date;
}

function dayCalcDisplay(type)
{
    var startYear = parseInt(document.getElementById("startYear").value);
    var startMonth = parseInt(document.getElementById("startMonth").value);
    var startDay = parseInt(document.getElementById("startDay").value);

    if (!startYear || startYear == 0 ||
        !startMonth || startMonth == 0 ||
        !startDay || startDay == 0)
    {
        alert('기준일을 입력해주세요');
        return;
    }

    var startDate = new Date(startYear, startMonth - 1, startDay);
    var today = new Date(todayDate.getFullYear(),
                        todayDate.getMonth(), todayDate.getDate());

    switch (type)
    {
    /* 오늘은 몇일째 */
    case 1:
        if (today < startDate)
        {
            alert("기준일을 오늘보다 이전 날짜로 설정하세요");
            return;
        }

        var interval = getPassDay(startYear, startMonth, startDay);
        document.getElementById("day1").value = interval;
        break;
    /* x 일 되는 날은 */
    case 2:
        if (today < startDate)
        {
            alert("기준일을 오늘 이전 날짜로 설정하세요");
            return;
        }

        var day2 = document.getElementById("day2").value;

        if (day2 <= 0)
        {
            alert("0 보다 큰 수를 입력하세요");
            return;
        }

        var date = getDateSpecificInterval(startYear, startMonth, startDay, day2);

        document.getElementById("resultYear").value = date.getFullYear();
        document.getElementById("resultMonth").value = date.getMonth() + 1;
        document.getElementById("resultDay").value = date.getDate();

        break;
    /* D-Day */
    case 3:
        var targetYear = parseInt(document.getElementById("targetYear").value);
        var targetMonth = parseInt(document.getElementById("targetMonth").value);
        var targetDay = parseInt(document.getElementById("targetDay").value);
        var interval = getDDay(targetYear, targetMonth, targetDay);

        if (!targetYear || targetYear == 0 ||
            !targetMonth || targetMonth == 0 ||
            !targetDay || targetDay == 0)
        {
            alert('날짜를 입력해주세요');
            return;
        }

        var targetDate = new Date(targetYear, targetMonth - 1, targetDay);

        if (today > targetDate)
        {
            alert("기준일을 오늘 이후 날짜로 설정하세요");
            return;
        }

        document.getElementById("day3").value = interval;

        break;

    /* 요일 계산 */
    case 4:
        var year = parseInt(document.getElementById("weekdayYear").value);
        var month = parseInt(document.getElementById("weekdayMonth").value);
        var day = parseInt(document.getElementById("weekdayDay").value);
        var weekday = document.getElementById("weekday");

        if (!year || year == "0" ||
            !month || month == "0" ||
            !day || day == "0")
        {
            alert('날짜를 입력해 주세요');
            return;
        }
       
        if (year < 100)
        {
            alert('년도를 100년 이후로 입력해 주세요');
            return;
        }

        weekday.value = getWeekday(year, month, day) + "요일";

        break;

    /* 양력/음력 변환 */
    case 5:
        if (document.getElementById('solarLunar').value == 'solar')
        {
            var leapMonth = document.getElementById('leapMonth').checked;
            var date = lunarCalc(startYear, startMonth, startDay, 2, leapMonth);
        }
        else
        {
            var date = lunarCalc(startYear, startMonth, startDay, 1);
        }

        if (date)
        {
            document.getElementById('solarLunarYear').value = date.year;
            document.getElementById('solarLunarMonth').value =
                (date.leapMonth ? "윤" : "") + date.month;
            document.getElementById('solarLunarDay').value = date.day;
        }
        else
        {
            document.getElementById('solarLunarYear').value = "";
            document.getElementById('solarLunarMonth').value = "";
            document.getElementById('solarLunarDay').value = "";
        }

        break;
    }
}

function memorialDayCheck(solarDate, lunarDate)
{
    var i;
    var memorial;


    for (i = 0; i < memorialDays.length; i++)
    {
        if (memorialDays[i].month == solarDate.month &&
            memorialDays[i].day == solarDate.day &&
            memorialDays[i].solarLunar == 1)
            return memorialDays[i];

        if (memorialDays[i].month == lunarDate.month &&
            memorialDays[i].day == lunarDate.day &&
            memorialDays[i].solarLunar == 2 &&
            !memorialDays[i].leapMonth)
            return memorialDays[i];
    }

    return null;
}

function setStartDate(year, month, day)
{
    document.getElementById('startYear').value = year;
    document.getElementById('startMonth').value = month;
    document.getElementById('startDay').value = day;
}

function setCalendar(year, month)
{
    var i;
    var oYearSelect = document.getElementById('yearSelect');
    var oMonthSelect = document.getElementById('monthSelect');

    if (!year)
    {
        year = oYearSelect.value;
        month = oMonthSelect.value;
    }
    else
    {
        for (i = 0; i < oYearSelect.length; i++)
            if (oYearSelect[i].value == year)
            {
                oYearSelect.selectedIndex = i;
                break;
            }
   
        for (i = 0; i < oMonthSelect.length; i++)
            if (oMonthSelect[i].value == month)
            {
                oMonthSelect.selectedIndex = i;
                break;
            }
    }

    var monthDay = Array(31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

    /* set monthDay of Feb */
    if (year % 400 == 0)
        monthDay[1] = 29;
    else if (year % 100 == 0)
        monthDay[1] = 28;
    else if (year % 4 == 0)
        monthDay[1] = 29;
    else
        monthDay[1] = 28;


    /* set the day before 설날 */
    if (lunarMonthTable[year - 1 - 1899][11] == 1)
        memorialDays[1].day = 29;
    else if (lunarMonthTable[year - 1 - 1899][11] == 2)
        memorialDays[1].day = 30;


    var date = new Date(year, month - 1, 1);
    var startWeekday = date.getDay();

    /* clean all day cell */
    for (i = 0; i < 42; i++)
    {
        document.getElementById('dayCell' + i).innerHTML = "";
        document.getElementById('memoCell' + i).innerHTML = "";
    }

    /* fill day cell */        
    for (i = 0; i < monthDay[month - 1]; i ++)
    {
        var index = startWeekday + i;
        var dayHTML;
        var memoHTML;

        var solarDate = new myDate(year, month, i + 1);
        var lunarDate = lunarCalc(year, month, i + 1, 1);

        /* memorial day */
        var memorial = memorialDayCheck(solarDate, lunarDate);

        /* 쉬지않는 기념일 */
        var memorialDay = false;
        if (memorial && memorial.holiday == false)
            memorialDay = true;

        /* day print */
        dayHTML = "<span onClick=\"setStartDate(" +
                    year + ", " + month + ", " + ( i + 1 ) + ")\">" +
                    "<font id=ln2 color='COLOR' title='TITLE'>" +
                    "HIGHLIGHT_START" + ( i + 1 ) + "HIGHLIGHT_END" +
                    "</font></span>";

        /* decoration */
        if ((memorial && memorial.holiday) || index % 7 == 0)
            dayHTML = dayHTML.replace("COLOR", "#DD7403");
        else if (index % 7 == 6)
            dayHTML = dayHTML.replace("COLOR", "#3C8096");

        if (memorial)
            dayHTML = dayHTML.replace("TITLE", memorial.name);

        if (todayDate.getFullYear() == year &&
            todayDate.getMonth() + 1 == month &&
            todayDate.getDate() == i + 1)
        {
            dayHTML = dayHTML.replace("HIGHLIGHT_START", "<b>");
            dayHTML = dayHTML.replace("HIGHLIGHT_END", "</b>");
        }

        dayHTML = dayHTML.replace("TITLE", "");    
        dayHTML = dayHTML.replace("COLOR", "");
        dayHTML = dayHTML.replace("HIGHLIGHT_START", "");
        dayHTML = dayHTML.replace("HIGHLIGHT_END", "");


        document.getElementById('dayCell' + index).innerHTML = dayHTML;


        /* lunar calnedar print */
        if (lunarDate.day == 1 || lunarDate.day == 15)
        {
            memoHTML = "<img src=http://www.blueb.co.kr/SRC/javascript/image2/" + (lunarDate.month < 10 ? "0" + lunarDate.month : lunarDate.month) + (lunarDate.day < 10 ? "0" + lunarDate.day: lunarDate.day) + ".gif border=0>";

        }
        else
            memoHTML = "<table border=0 cellpadding=0 cellspacing=0><tr height=17><td></td><tr></table>";

        document.getElementById('memoCell' + index).innerHTML = memoHTML;


    }
}

function lunarMonthCheck()
{
    if (document.getElementById('solarLunar').value == "solar")
        document.getElementById('leapMonth').disabled = false;
    else
        document.getElementById('leapMonth').disabled = true;
}

var ayear = todayDate.getFullYear(), amonth = todayDate.getMonth() + 1;

function initCalendar()
{
    document.write("<table border=0 cellpadding=0 cellspacing=0 width=100%><tr><td><font id=ln6><font color=#cf4900>달력</font> : 날짜와 요일을 확인할 수 있고, 특정일을 입력하면 해당일의 요일을 알려 줍니다.</font></td></tr><tr><td></td><td height=5 nowrap></td></tr></table>");
    document.write("");
    document.write("<table width=100% border=0 cellpadding=0 cellspacing=0>");
    document.write("<tr>");
    document.write("    ");
    document.write("    <td nowrap valign=top>");
    document.write("    <!--------달력 들어갈곳----->");
    document.write("    <table border=0 cellpadding=0 cellspacing=0 width=220>");
    document.write("    <tr>");
    document.write("        <td>");
    document.write("        <table border=0 cellpadding=0 cellspacing=0 width=100%>");
    document.write("        <tr>");
    document.write("            <td rowspan=2 width=1 nowrap bgcolor=C3CACD></td>");
    document.write("            <td width=100% bgcolor=C3CACD></td>");
    document.write("            <td rowspan=2 width=1 nowrap bgcolor=A6ACAE></td>");
    document.write("            <td rowspan=2 width=2 height=2 nowrap bgcolor=ffffff></td>");
    document.write("        </tr>");
    document.write("        <tr>");
    document.write("            <td height=1 bgcolor=F1F6F8></td>");
    document.write("        </tr>");
    document.write("        <tr>");
    document.write("            <td width=1 nowrap bgcolor=C3CACD></td>");
    document.write("            <td width=100% bgcolor=F1F6F8 height=32 align=center>");
    document.write("            <!-----날짜 넣는 곳--->");
    document.write("            <table width=95% border=0 cellpadding=0 cellspacing=0>");
    document.write("            <tr>");
    document.write("                <td nowrap>");
    document.write("                <!--------년도---------->");
    document.write("                <table border=0 cellpadding=0 cellspacing=0>");
    document.write("                <tr>");
    document.write("                    <td>");

    var selectStr;
    var i, j;

    selectStr = "<select id=yearSelect style='width:80;font-size:9pt;' onChange='setCalendar()'>\n";

    for (i = 1900; i <= 2030; i++)
        selectStr += "<option value='" + i + "'>" + i + " 년</option>";

    selectStr += "</select>";

    document.write(selectStr);

    document.write("                    </td>");
    document.write("                </tr>");
    document.write("                </table>");
    document.write("                <!--------년도---------->            ");

    document.write("                </td>");
    document.write("                <td width=10 nowrap></td>");
    document.write("                <td nowrap>");
    document.write("                <!--------월---------->");
    document.write("                <table border=0 cellpadding=0 cellspacing=0>");
    document.write("                <tr>");
    document.write("                    <td>");


    selectStr = "<select id=monthSelect style='width:60;font-size:9pt' id=monthSelect onChange='setCalendar()'>\n";

    for (i = 1; i <= 12; i++)
        selectStr += "<option value='" + i + "'>" + i + " 월</option>";

    selectStr += "</select>";

    document.write(selectStr);

    document.write("                    </td>");
    document.write("                </tr>");
    document.write("                </table>");
    document.write("                <!--------월---------->        ");
    document.write("                </td>");
    document.write("                <td width=100%></td>");
    document.write("            </tr>");
    document.write("            </table>");
    document.write("            <!-----날짜 넣는 곳--->");
    document.write("            </td>");
    document.write("            <td width=1 nowrap bgcolor=A6ACAE></td>");
    document.write("            <td width=2 nowrap bgcolor=E0E4E6></td>");
    document.write("        </tr>");
    document.write("        <tr>");
    document.write("            <td width=1 nowrap bgcolor=C3CACD></td>");
    document.write("            <td width=100% height=1 background=http://www.blueb.co.kr/SRC/javascript/image2/date_line01.gif border=0></td>");
    document.write("            <td width=1 nowrap bgcolor=A6ACAE></td>");
    document.write("            <td width=2 nowrap bgcolor=E0E4E6></td>");
    document.write("        </tr>");
    document.write("        <tr>");
    document.write("            <td width=1 nowrap bgcolor=C3CACD></td>");
    document.write("            <td width=100% bgcolor=ffffff align=center>");
    document.write("            <!----달력 넣는곳------>");
    document.write("            <table border=0 cellpadding=0 cellspacing=0 width=100%>");

    document.write("            <tr>");
    document.write("                <td width=15% align=center><font id=ln6 color=DD7403>일</font></td>");
    document.write("                <td width=14% align=center><font id=ln6>월</font></td>");
    document.write("                <td width=14% align=center><font id=ln6>화</font></td>");
    document.write("                <td width=14% align=center><font id=ln6>수</font></td>");
    document.write("                <td width=14% align=center><font id=ln6>목</font></td>");
    document.write("                <td width=14% align=center><font id=ln6>금</font></td>");
    document.write("                <td width=15% align=center><font id=ln6 color=3C8096>토</font></td>");
    document.write("            </tr>");
    document.write("            <tr><td colspan=7 height=7 nowrap></td></tr>");


    for (i = 0; i < 6; i++)
    {
        document.write("<tr>");

        for (j = 0; j < 7; j++)
            document.write("<td align=center id='dayCell" + ( i * 7 + j )+ "'></td>");
        document.write("</tr>");

        document.write("<tr nowrap>");

        for (j = 0; j < 7; j++)
            document.write("<td align=center valign=top id='memoCell" + ( i * 7 + j ) + "'></td>");

        document.write("</tr>");
    }

    /////////////////////////////////////////////////////////////////////////// by Choi, Sungjoon

    if (typeof(rege_0_1) != "undefined" && 1900 <= rege_0_1 && rege_0_1 <= 2030)
    {
        ayear = rege_0_1;
        amonth = 1;
    }

    if (typeof(rege_0_2) != "undefined" && 1 <= rege_0_2 && rege_0_2 <= 12)
        amonth = rege_0_2;

    ///////////////////////////////////////////////////////////////////////////

    document.write("            <tr><td colspan=7 height=7 nowrap></td></tr>");
    document.write("            </table>        ");
    document.write("            <!----달력 넣는곳------>");
    document.write("            </td>");
    document.write("            <td width=1 nowrap bgcolor=A6ACAE></td>");
    document.write("            <td width=2 nowrap bgcolor=E0E4E6></td>");
    document.write("        </tr>");
    document.write("        </table>");
    document.write("        </td>");
    document.write("    </tr>");
    document.write("    <tr>");
    document.write("        <td>");
    document.write("        <table border=0 cellpadding=0 cellspacing=0 width=100%>");
    document.write("        <tr>");
    document.write("            <td colspan=2 width=100% height=1 bgcolor=A6ACAE></td>");
    document.write("            <td width=2 nowrap bgcolor=E0E4E6></td>");
    document.write("        </tr>");
    document.write("        <tr>");
    document.write("            <td width=2 height=2 nowrap></td>");
    document.write("            <td width=100% bgcolor=E0E4E6></td>");
    document.write("            <td width=2 nowrap bgcolor=E0E4E6></td>");
    document.write("        </tr>");
    document.write("        </table>    ");
    document.write("        </td>");
    document.write("    </tr>");
    document.write("    </table>");
    document.write("    <!--------달력 들어갈곳----->    ");
    document.write("    </td>");
    document.write("    <td width=20 nowrap></td>");

    document.write("    <td width=100% valign=top>");
    document.write("    <!--------날짜 계산하는 곳 ----->");
    document.write("    <table border=0 cellpadding=0 cellspacing=0 width=420>");
    document.write("    <tr>");
    document.write("        <td bgcolor=D8E4C5>");
    document.write("        <table border=0 cellpadding=3 cellspacing=1 width=100%>");
    document.write("        <tr>");
    document.write("            <td bgcolor=F5F9EF>");
    document.write("            <font id=ln6>");
    document.write("            &nbsp;<font color=275361><b>기준일</b></font>&nbsp; &nbsp;");
    document.write("            <input type=text size=7 maxlength=4 style='height:21; border:1 solid C3CACD; padding:3 0 0 2;' id=startYear value='" + todayDate.getFullYear() + "'> 년 &nbsp;");
    document.write("            <input type=text size=3 maxlength=2 style='height:21; border:1 solid C3CACD; padding:3 0 0 2;' id=startMonth value='" + ( todayDate.getMonth() + 1 ) + "'> 월 &nbsp;");
    document.write("            <input type=text size=3 maxlength=2 style='height:21; border:1 solid C3CACD; padding:3 0 0 2;' id=startDay value='" + todayDate.getDate() + "'> 일");
    document.write("            </font>");
    document.write("            &nbsp;<input type=checkbox id=leapMonth disabled><font id=ln6>윤달</font>");
    document.write("            </td>");
    document.write("        </tr>");
    document.write("        </table>");
    document.write("        </td>");
    document.write("    </tr>");
    document.write("    </table>");
    document.write("    <font size=1><br></font>");
    document.write("");
    document.write("    <table border=0 cellpadding=0 cellspacing=0 width=420><tr><td height=1 background=http://www.blueb.co.kr/SRC/javascript/image2/date_line01.gif border=0></td></tr></table>");
    document.write("    ");
    document.write("    <!----양력/음력 계산기----->");
    document.write("    <table border=0 cellpadding=0 cellspacing=0 width=420><tr><td height=7 nowrap></td></tr><tr><td nowrap><font id=ln6><font color=#cf4900>음력/양력 변환</font> : 기준일의 날짜를 음력 혹은 양력으로 변환해 줍니다.</font></td></tr><tr><td height=2 nowrap></td></tr></table>");
    document.write("        ");
    document.write("    <table border=0 cellpadding=0 cellspacing=0 width=420>");
    document.write("    <tr>");
    document.write("        <td>");
    document.write("        <table border=0 cellpadding=0 cellspacing=0>");
    document.write("        <tr>");
    document.write("            <td valign=top>");
    document.write("            <!--------양력/음력--------->");
    document.write("            <table border=0 cellpadding=0 cellspacing=0>");
    document.write("            <tr>");
    document.write("                <td>");
   
    selectStr = "<select style='width:50;font-size:9pt' id='solarLunar' onChange='lunarMonthCheck()'>\n";
    selectStr += "<option value='solar'>양력</option>";
    selectStr += "<option value='lunar' selected>음력</option>";

    NSelect(selectStr, 0, '#FFFFFF', '#EDEFF0', '1 solid #C3CACD', 'arrow_etcsrch.gif');


    document.write("                </td>");
    document.write("            </tr>");
    document.write("            </table>");
    document.write("            <!--------양력/음력--------->");
    document.write("            </td>");
    document.write("            <td valign=bottom><font id=ln6>으로</font></td>");
    document.write("            <td width=10 nowrap></td>");
    document.write("            <td>");
    document.write("            <font id=ln6>");
    document.write("            <a href=javascript:void(0) onClick='dayCalcDisplay(5)'><img src=http://www.blueb.co.kr/SRC/javascript/image2/met_but01.gif border=0 align=absmiddle></a>");
    document.write("            <a href=javascript:void(0) onClick='dayCalcDisplay(5)'><img src=http://www.blueb.co.kr/SRC/javascript/image2/date_arrow.gif border=0 align=absmiddle></a>");
    document.write("            <input type=text size=5 style='height:21; border:1 solid C3CACD; padding:3 0 0 2;' id=solarLunarYear readonly> 년&nbsp;");
    document.write("            <input type=text size=2 style='height:21; border:1 solid C3CACD; padding:3 0 0 2;' id=solarLunarMonth readonly> 월&nbsp;");
    document.write("            <input type=text size=2 style='height:21; border:1 solid C3CACD; padding:3 0 0 2;' id=solarLunarDay readonly> 일");
    document.write("            </font>");
    document.write("            </td>");
    document.write("        </tr>");
    document.write("        </table>");
    document.write("        </td>");
    document.write("    </tr>");
    document.write("    <tr><td height=7 nowrap></td></tr>");
    document.write("    </table>");
    document.write("    <!----양력/음력 계산기----->");
    document.write("    ");
    document.write("    <table border=0 cellpadding=0 cellspacing=0 width=420><tr><td height=1 background=http://www.blueb.co.kr/SRC/javascript/image2/date_line01.gif border=0></td></tr></table>    ");
    document.write("    ");
    document.write("    <!----특정일 계산 ----->");
    document.write("    <table border=0 cellpadding=0 cellspacing=0 width=420><tr><td height=7 nowrap></td></tr><tr><td><font id=ln6><font color=#cf4900>특정일 계산기</font> : 기준일로부터 오늘까지의 날짜를 계산합니다.</font></td></tr><tr><td height=2 nowrap></td></tr></table>");
    document.write("    ");
    document.write("    <table border=0 cellpadding=0 cellspacing=0 width=97%>");
    document.write("    <tr><td colspan=2 height=3 nowrap></td></tr>");
    document.write("    <tr>");
    document.write("        <td nowrap valign=top><font id=ln6>오늘은 몇일째?</font></td>");
    document.write("        <td width=100%>");
    document.write("        <font id=ln6>");
    document.write("        <a href=javascript:void(0) onClick='dayCalcDisplay(1)'><img src=http://www.blueb.co.kr/SRC/javascript/image2/date_but02.gif border=0 align=absmiddle></a>");
    document.write("        <a href=javascript:void(0) onClick='dayCalcDisplay(1)'><img src=http://www.blueb.co.kr/SRC/javascript/image2/date_arrow.gif border=0 align=absmiddle></a>");
    document.write("        <input type=text size=6 style='height:21; border:1 solid C3CACD; padding:3 0 0 2;' id=day1 readonly> 일째");
    document.write("        </font>");
    document.write("        </td>");
    document.write("    </tr>");
    document.write("    <tr><td colspan=2 height=5 nowrap></td></tr>");
    document.write("    <tr>");
    document.write("        <td nowrap valign=top>");
    document.write("        <font id=ln6>");
    document.write("        <input type=text size=3 style='height:21; border:1 solid C3CACD; padding:3 0 0 2;' id=day2> 일 되는 날은?&nbsp; &nbsp;");
    document.write("        </font>");
    document.write("        </td>");
    document.write("        <td nowrap>");
    document.write("        <font id=ln6>");
    document.write("        <a href=javascript:void(0) onClick='dayCalcDisplay(2)'><img src=http://www.blueb.co.kr/SRC/javascript/image2/date_but02.gif border=0 align=absmiddle></a>");
    document.write("        <a href=javascript:void(0) onClick='dayCalcDisplay(2)'><img src=http://www.blueb.co.kr/SRC/javascript/image2/date_arrow.gif border=0 align=absmiddle></a>");
    document.write("        <input type=text size=5 style='height:21; border:1 solid C3CACD; padding:3 0 0 2;' id=resultYear readonly> 년&nbsp;");
    document.write("        <input type=text size=2 style='height:21; border:1 solid C3CACD; padding:3 0 0 2;' id=resultMonth readonly> 월&nbsp;");
    document.write("        <input type=text size=2 style='height:21; border:1 solid C3CACD; padding:3 0 0 2;' id=resultDay readonly> 일");
    document.write("        </font>");
    document.write("        </td>");
    document.write("    </tr>    ");
    document.write("    <tr><td colspan=2 height=7 nowrap></td></tr>");
    document.write("    </table>");
    document.write("    ");
    document.write("    <!----특정일 계산 ----->");
    document.write("");
    document.write("    <table border=0 cellpadding=0 cellspacing=0 width=420><tr><td height=1 background=http://www.blueb.co.kr/SRC/javascript/image2/date_line01.gif border=0></td></tr></table>    ");
    document.write("    ");
    document.write("    <!----요일 계산기----->");
    document.write("    <table border=0 cellpadding=0 cellspacing=0 width=420><tr><td height=7 nowrap></td></tr><tr><td><font id=ln6><font color=#cf4900>요일 계산기</font> : 특정일의 요일을 알려 줍니다.</font></td></tr><tr><td height=2 nowrap></td></tr></table>");
    document.write("");
    document.write("    <table border=0 cellpadding=0 cellspacing=0 width=420>");
    document.write("    <tr>");
    document.write("        <td>");
    document.write("        <font id=ln6>");
    document.write("        <input type=text size=5 maxlength=4 style='height:21; border:1 solid C3CACD; padding:3 0 0 2;' id=weekdayYear> 년&nbsp;");
    document.write("        <input type=text size=2 maxlength=2 style='height:21; border:1 solid C3CACD; padding:3 0 0 2;' id=weekdayMonth> 월&nbsp;");
    document.write("        <input type=text size=2 maxlength=2 style='height:21; border:1 solid C3CACD; padding:3 0 0 2;' id=weekdayDay> 일 의 요일은?&nbsp;");
    document.write("        <a href=javascript:void(0) onClick='dayCalcDisplay(4)'><img src=http://www.blueb.co.kr/SRC/javascript/image2/date_but01.gif border=0 align=absmiddle></a>");
    document.write("        <a href=javascript:void(0) onClick='dayCalcDisplay(4)'><img src=http://www.blueb.co.kr/SRC/javascript/image2/date_arrow.gif border=0 align=absmiddle></a>");
    document.write("        <input type=text size=6 style='height:21; border:1 solid C3CACD; padding:3 0 0 2;' id=weekday readonly>");
    document.write("        </font></td>");
    document.write("    </tr>");
    document.write("    <tr><td height=7 nowrap></td></tr>");
    document.write("    </table>");
    document.write("    <!----요일 계산기----->");
    document.write("");
    document.write("    <table border=0 cellpadding=0 cellspacing=0 width=420><tr><td height=1 background=http://www.blueb.co.kr/SRC/javascript/image2/date_line01.gif border=0></td></tr></table>");
    document.write("");
    document.write("    <!----D-Day 계산기----->");
    document.write("    <table border=0 cellpadding=0 cellspacing=0 width=420><tr><td height=7 nowrap></td></tr><tr><td><font id=ln6><font color=#cf4900>D-Day 계산기</font> : 오늘부터 특정일까지 남은 날짜를 계산합니다.</font></td></tr><tr><td height=2 nowrap></td></tr></table>");
    document.write("    ");
    document.write("    <table border=0 cellpadding=0 cellspacing=0 width=420>");
    document.write("    <tr>");
    document.write("        <td nowrap>");
    document.write("        <font id=ln6>");
    document.write("        <input type=text size=5 maxlength=4 style='height:21; border:1 solid C3CACD; padding:3 0 0 2;' id=targetYear> 년&nbsp;");
    document.write("        <input type=text size=2 maxlength=2 style='height:21; border:1 solid C3CACD; padding:3 0 0 2;' id=targetMonth> 월&nbsp;");
    document.write("        <input type=text size=2 maxlength=2 style='height:21; border:1 solid C3CACD; padding:3 0 0 2;' id=targetDay> 일 까지 남은 날은?&nbsp;");
    document.write("        <a href=javascript:void(0) onClick='dayCalcDisplay(3)'><img src=http://www.blueb.co.kr/SRC/javascript/image2/date_but02.gif border=0 align=absmiddle></a>");
    document.write("        <a href=javascript:void(0) onClick='dayCalcDisplay(3)'><img src=http://www.blueb.co.kr/SRC/javascript/image2/date_arrow.gif border=0 align=absmiddle></a>");
    document.write("        <input type=text size=6 style='height:21; border:1 solid C3CACD; padding:3 0 0 2;' id=day3 readonly> 일");
    document.write("        </font>");
    document.write("        </td>");
    document.write("    </tr>");
    document.write("    <tr><td height=7 nowrap></td></tr>");
    document.write("    </table>    ");
    document.write("    <!----D-Day 계산기----->");
    document.write("    ");
    document.write("    <!--------날짜 계산하는 곳 ----->");
    document.write("    </td>");
    document.write("</tr>");
    document.write("</table>");
}

initCalendar();
setCalendar(ayear, amonth);
</script>
Posted by 1010