var xwzDatePicker = function(objTextbox){ 
    if(window.__xwzDatePickers == null) window.__xwzDatePickers = new Array(0); 
    this.index = window.__xwzDatePickers.length; 
    window.__xwzDatePickers[this.index] = this; 

    this.oText = objTextbox; 
    this.dtCurrent = null;//ÀÔ·ÂµÈ ³¯Â¥ 
    this.dtDisplay = new Date();//Ãâ·Â¿ë ³¯Â¥ 
    this.objField =null;// µð½ºÇÃ·¹ÀÌ Å×ÀÌºí 
    this.objLabel = null;// ³¯Â¥ Ãâ·ÂµÉ ¼¿ 
    this.objArrow = null;// È­»ìÇ¥ ¼¿ 
    this.imgArrow = null;// È­»ìÇ¥ ÀÌ¹ÌÁö 
    this.isEmpty = false;// ³¯Â¥ ¾øÀ½ À» Ãâ·ÂÇÒÁö ¿©ºÎ 
    this.emptyValue = "";// ³¯Â¥ ¾øÀ½ Ç¥±â °ª 
    this.isVisible = false;// ÆË¾÷Ã¢ º¸ÀÓ ¿©ºÎ 
    this.isActive = false;// È°¼ºÈ­µÇ¾ú´ÂÁö ¿©ºÎ 
    this.Images = {arrow : "", prev : "", next : ""};//µð½ºÇÃ·¹ÀÌ¿¡¼­ È­»ìÇ¥ ÀÌ¹ÌÁö,  ´Þ·Â¿¡¼­ ÀÌÀü, ´ÙÀ½ ÀÌ¹ÌÁö 
    this.Week = new Array(0);// ÁÖ Ç¥±â ÅØ½ºÆ® ¹è¿­ 
    this.Formula = new Array(0);//³¯Â¥ Æ÷¸ä ÇüÅÂ 
    this.WeekColor = ['#CC0000', '', '', '', '', '','#0066CC'];//ÀÏº° »ö»ó 
    this.Styles = {def:new Array(0), hov:new Array(0), act:new Array(0), flt:new Array(0)}// ±âº», ¸¶¿ì½º ¿À¹ö, È°¼ºÈ­ µÇ¾úÀ» ¶§ »ö»ó ¼³Á¤, È°¼ºÈ­, ¿À¹ö µÇ¾úÀ» ¶§ ¿À¸¥ÂÊ È­»ìÇ¥ ÇÊÅÍÈ¿°ú »ö»ó 

    this.objWindow = null;//ÆË¾÷Ã¢ °´Ã¼ 
    this.lblCaption = null;// ´Þ·Â¿¡¼­ ¿ù, ³â Ç¥±â ·¹ÀÌ¾î 
    this.lblEmpty = null;// ´Þ·Â¿¡¼­ ³¯Â¥ ¾øÀ½ Ãâ·Â °´Ã¼ 
    this.cellCalendar = null;//´Þ·ÂÀÇ °¢ ¼¿À» ¹è¿­·Î ÀúÀå 

    this.setLanguage("ko");//±âº» ³¯Â¥ Ãâ·Â Æ÷¸äÀ» ÇÑ±Û 
    //±âº» »ö»ó ¼³Á¤ :BORDER, BACKGROUND, FONT
    this.setStyleColor("default:#d5d5be,#ffffff,#000000;Hover:#d5d5be,#FFFFFF,#740048;Active:#d5d5be,#666666,#500040;filter:#E0D4B2,#FFD456,#E0D4B2,#FFD456"); 

    this.Initializ();//ÃÊ±âÈ­ 
    this.oText.DatePick = this;//´ë»ó ÅØ½ºÆ® ¹Ú½ºÀÇ °´Ã¼ ¼Ó¼ºÀ¸·Î ÇöÀç functionÀ¸·Î ÁöÁ¤ 
    //ÅØ½ºÆ® ¹Ú½ºÀÇ ÇÁ·ÎÆÛÆ¼°¡ º¯°æµÉ ¶§ ºÐ±âÇÔ¼ö 
    this.oText.onpropertychange=function(){if(window.event.type == "propertychange" && this.DatePick !=null) this.DatePick.__setPropertyAttribute(window.event.propertyName);} 
} 
/*========================================================= 
³¯Â¥¾øÀ½ Ãâ·Â¿©ºÎ ¹× ³¯Â¥¾øÀ½ Ç¥½Ã ¹®ÀÚ ¼³Á¤ 
=========================================================*/ 
xwzDatePicker.prototype.letDisplayEmpty = function(bool){this.isEmpty=eval(bool);if(this.lblEmpty!=null) this.lblEmpty.style.display = this.isEmpty ? '' : 'none'; } 
xwzDatePicker.prototype.letEmptyValue = function(str){this.emptyValue=str;} 
/*========================================================= 
ÀÌ¹ÌÁö ¼ÂÆÃ 
=========================================================*/ 
xwzDatePicker.prototype.setArrowImageValue = function(str){this.Images.arrow = str;} 
xwzDatePicker.prototype.setPrevImageValue = function(str){this.Images.prev = str;} 
xwzDatePicker.prototype.setNextImageValue = function(str){this.Images.next = str;} 
xwzDatePicker.prototype.letDisabled = function(bool){ 
    if(bool == true){ 
        this.objLabel.style.color="#666666"; 
        this.objLabel.style.filter="gray()"; 
        this.objArrow.style.filter="gray()"; 
    }else{ 
        this.objLabel.style.color=""; 
        this.objLabel.style.filter=""; 
        this.objArrow.style.filter=""; 
    } 
} 
/*========================================================= 
ÁÖ Ç¥½Ã ´ÜÀ§ 
=========================================================*/ 
xwzDatePicker.prototype.setLanguage = function(str){ 
    var WeekText = {"ch": ['ìí','êÅ','ûý','â©','ÙÊ','ÐÝ','÷Ï'],"ko" : ['ÀÏ','¿ù','È­','¼ö','¸ñ','±Ý','Åä'],"en" : ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']}; 
    var DateText = {"ch": ['êÅ ','ìí','Ò´ '],"ko" : ['¿ù','ÀÏ', '³â'],"en" : ['-', '', '-']}; 
    if(WeekText[str] != null) this.Weeks = WeekText[str];else this.Weeks = WeekText["ko"]; 
    if(DateText[str] != null) this.Formula = DateText[str];else this.Formula = DateText["ko"]; 
} 

/*========================================================= 
¸¶¿ì½º ¿À¹öµîÀÇ ÀÌº¥Æ®¿¡ µû¸¥ »ö»ó ¼³Á¤ ÇÔ¼ö 
=========================================================*/ 
xwzDatePicker.prototype.setStyleColor = function(str){ 
    var Composition = new Array(0), Rule = new Array(0), sSelector = "", Colors = new Array(0); 
    Composition = str.replace(/\s/gi, '').toString().split(";") 
    if(Composition.length == 0) return; 
    for(var i = 0 ; i < Composition.length; i++){ 
        Composition[i] = Composition[i].replace(/\s/gi, '');//¹«È¿¹®ÀÚ Á¦°Å 
        if(Composition[i] == '') continue;sSelector = Composition[i].split(':').shift();Colors = Composition[i].split(':').pop().toString().split(','); 
        if(sSelector.toLowerCase() == 'default'){for(var n = 0; n < Colors.length;n++) this.Styles.def[n] = Colors[n];} 
        else if(sSelector.toLowerCase() == 'hover'){for(var n = 0; n < Colors.length;n++) this.Styles.hov[n] = Colors[n];} 
        else if(sSelector.toLowerCase() == 'active'){for(var n = 0; n < Colors.length;n++) this.Styles.act[n] = Colors[n];} 
        else if(sSelector.toLowerCase() == 'filter'){for(var n = 0; n < Colors.length;n++) this.Styles.flt[n] = Colors[n];} 
    } 
} 

/*========================================================= 
°ª º¯°æ¿¡ µû¸¥ ¼ÂÆÃ 
=========================================================*/ 
xwzDatePicker.prototype.changeValue = function(sValue){ 
    if( (/^([0-9]){4}-([0-9]){2}-([0-9]){2}/).test(sValue) == true){ 
        this.dtCurrent = new Date(sValue.substr(0,4), sValue.substr(5,2)-1, sValue.substr(8,2)); 
        this.dtDisplay=this.dtCurrent; 
        this.setDateValue(this.dtCurrent.getDate()); 
        this.display(); 
    }else{ 
        this.setEmptyValue(); 
    } 
} 
xwzDatePicker.prototype.setEmptyValue = function(){ 
    this.oText.onpropertychange=null; 
    this.oText.value = ""; 
    this.objLabel.innerHTML = this.emptyValue; 
    this.isVisible = true; 
    this.swapVisible(); 
    this.oText.onpropertychange=function(){if(window.event.type == "propertychange" && this.DatePick !=null) this.DatePick.__setPropertyAttribute(window.event.propertyName);} 
} 
/*========================================================= 
¼±ÅÃµÈ ³¯Â¥¿¡ ´ëÇÑ Ãâ·Â 
=========================================================*/ 
xwzDatePicker.prototype.setDateValue = function(day){ 
    this.oText.onpropertychange=new Function("return false"); 
    var year = this.dtDisplay.getFullYear(), month = this.dtDisplay.getMonth(); 
    this.dtCurrent = new Date(year, month, day); 
    this.oText.value = year + '' + this.__fillZero(month+1, 2) + '' + this.__fillZero(day, 2); 
    this.objLabel.innerHTML = year + '/' + this.__fillZero(month+1, 2) + '/' +  this.__fillZero(day, 2);
//    this.objLabel.innerHTML = year + this.Formula[2] + this.__fillZero(month+1, 2) + this.Formula[0] +  this.__fillZero(day, 2) +this.Formula[1] ; 
    this.isVisible = true; 
    this.swapVisible(); 
    this.oText.onpropertychange=function(){if(window.event.type == "propertychange" && this.DatePick !=null) this.DatePick.__setPropertyAttribute(window.event.propertyName);} 
} 
/*========================================================= 
ÇÁ·ÎÆÛÆ¼ ¼³Á¤ -- ¼Ó¼º°ªÀÌ º¯°æµÉ¶§ 
=========================================================*/ 
xwzDatePicker.prototype.__setPropertyAttribute = function(sType){ 
    switch(sType.toString()){ 
        case "isEmpty" : this.letDisplayEmpty(this.oText.getAttribute(sType));break; 
        case "empty" : this.letEmptyValue(this.oText.getAttribute(sType));break; 
        case "value" : this.changeValue(this.oText.getAttribute(sType));break; 
        case "arrowImage" : this.setArrowImageValue(this.oText.getAttribute(sType));break; 
        case "prevImage" : this.setPrevImageValue(this.oText.getAttribute(sType));break; 
        case "nextImage" : this.setNextImageValue(this.oText.getAttribute(sType));break; 
        case "colorStyle" : this.setStyleColor(this.oText.getAttribute(sType));break; 
        case "language" : this.setLanguage(this.oText.getAttribute(sType));break; 
        case "disabled" : this.letDisabled(this.oText.disabled);break; 
        default : break; 
    } 
} 
xwzDatePicker.prototype.__isPopupView = function(){{if(this.objWindow == null) return false;return this.objWindow.isOpen;}} 
xwzDatePicker.prototype.__fillZero = function(num, len){if(num.toString().length >= len) return num;var nMax = len-( num.toString().length );var str = "";for(var i=0; i < nMax; i++) str +="0";return str + (num).toString();} 
/*========================================================= 
¸¶¿ì½º ÀÌº¥Æ®¿¡ µû¸¥ È¿°ú 
=========================================================*/ 
xwzDatePicker.prototype.hoverIn = function(){ 
    if(this.isActive == false && this.oText.disabled == false){ 
/*
        this.objField.style.border=this.Styles.hov[0] + " 1px solid" ; 
        this.objField.style.backgroundColor=this.Styles.hov[1] ; 

        this.objLabel.style.border=this.Styles.hov[1] + " 1px solid"; 
        this.objLabel.style.backgroundColor=this.Styles.hov[1] ; 
        this.objLabel.style.color=this.Styles.hov[2]; 

        this.objArrow.style.border=this.Styles.hov[0] + " 1px solid"; 
        this.objArrow.style.backgroundColor=this.Styles.hov[1] ; 
        this.objArrow.style.color=this.Styles.hov[1]; 
        this.objArrow.style.filter="progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr="+this.Styles.flt[0]+",endColorStr="+this.Styles.flt[1]+");"; 
*/
    } 
} 
xwzDatePicker.prototype.hoverOut = function(){ 
    if(this.isActive == false && this.oText.disabled == false){ 
/*
        this.objField.style.border=this.Styles.def[0] + " 1px solid" ; 
        this.objField.style.backgroundColor=this.Styles.def[1] ; 

        this.objLabel.style.border=this.Styles.def[1] + " 1px solid"; 
        this.objLabel.style.backgroundColor=this.Styles.def[1] ; 
        this.objLabel.style.color=this.Styles.def[2]; 

        this.objArrow.style.border=this.Styles.def[1] + " 1px solid"; 
        this.objArrow.style.backgroundColor=this.Styles.def[1] ; 
        this.objArrow.style.color=this.Styles.def[1]; 
        this.objArrow.style.filter=""; 
*/        
    } 
} 

xwzDatePicker.prototype.deactive = function(){ 
    if(this.oText.disabled == false){ 
/*    	
        this.isActive = false; 
        this.objField.style.border=this.Styles.def[0] + " 1px solid" ; 
        this.objField.style.backgroundColor=this.Styles.def[1] ; 

        this.objLabel.style.border=this.Styles.def[1] + " 1px solid"; 
        this.objLabel.style.backgroundColor=this.Styles.def[1] ; 
        this.objLabel.style.color=this.Styles.def[2]; 

        this.objArrow.style.border=this.Styles.def[1] + " 1px solid"; 
        this.objArrow.style.backgroundColor=this.Styles.def[1] ; 
        this.objArrow.style.color=this.Styles.def[1]; 
        this.objArrow.style.filter=""; 
*/        
    } 
} 
xwzDatePicker.prototype.active = function(){ 
    if(this.oText.disabled == false){ 
        this.isActive = true; 
/*        
        this.objField.style.border=this.Styles.act[0] + " 1px solid" ; 
        this.objField.style.backgroundColor=this.Styles.hov[1] ; 

        this.objLabel.style.border=this.Styles.act[1] + " 1px solid"; 
        this.objLabel.style.backgroundColor=this.Styles.act[1] ; 
        this.objLabel.style.color=this.Styles.act[2]; 

        this.objArrow.style.border=this.Styles.act[0] + " 1px solid"; 
        this.objArrow.style.backgroundColor=this.Styles.act[1] ; 
        this.objArrow.style.color=this.Styles.act[1]; 
        this.objArrow.style.filter="progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr="+this.Styles.flt[2]+",endColorStr="+this.Styles.flt[3]+");"; 
*/        
    } 
} 
/* ================================================ 
ÆË¾÷Ã¢ Ãâ·Â °áÁ¤ 
================================================ */ 
xwzDatePicker.prototype.swapVisible = function(){ 
    if(this.isVisible == false){ 
        if(this.oText.disabled == false && this.objWindow != null){ 
            var nHeight = 164; 
            if(this.isEmpty == true) nHeight =183; 
            var nDiff = window.screen.height - window.event.screenY - nHeight;posY = nDiff < nHeight ?  nHeight *-1 : this.objField.offsetHeight; 
            this.objWindow.show(0, posY, 139, nHeight, this.objField); 
            this.objWindow.document.getElementById('IDS_MONTH_LIST').style.display = "none"; 
            this.active(); 
            this.isVisible = true; 
        } 
    }else{ 
        this.deactive(); 
        if(this.__isPopupView()==true) this.objWindow.hide(); 
        this.isVisible = false; 
        setTimeout("window.__xwzDatePickers[" +this.index + "].display()", 30); 
    } 
} 
/* ================================================ 
ÃÊ±âÈ­ ÇÔ¼ö 
================================================ */ 
xwzDatePicker.prototype.Initializ = function(){ 
    var bwver = new Number(((window.navigator.appVersion.split('; '))[1].split(' '))[1]); 
    if(window.navigator.appName != "Microsoft Internet Explorer" || bwver < 5.5) return; 
    //== ±âº»º¯¼ö´ëÀÔ 
    var sValue=this.oText.getAttribute("value"); 
    
    if(sValue != "" && sValue != null && sValue != "0") 
//    	this.dtCurrent = new Date(sValue.substr(0,4), sValue.substr(5,2)-1, sValue.substr(8,2)); 
    	this.dtCurrent = new Date(sValue.substr(0,4), sValue.substr(4,2)-1, sValue.substr(6,2)); 
    
    if(isNaN(this.dtCurrent) || this.dtCurrent == null){this.oText.value="";this.dtCurrent=new Date();} 
    this.dtDisplay=this.dtCurrent; 
    var attributes = ["isEmpty","empty", "arrowImage", "prevImage","nextImage", "colorStyle", "language"]; 
    for(var i = 0; i < attributes.length; i++){ 
        if(this.oText.getAttribute(attributes[i]) == null || this.oText.getAttribute(attributes[i]) =="" ) continue; 
        this.__setPropertyAttribute(attributes[i]); 
    } 

    var row = null; 
    //=== Å×ÀÌºí »ý¼º 
    this.objField = document.createElement("TABLE"); 
    this.objField.setAttribute('cellPadding', 0); 
    this.objField.setAttribute('cellSpacing', 1); 

    this.objField.style.display='inline' ; 

    this.objField.style.margin="0 0 0 0"; 
    this.objField.style.padding="0 0 0 0"; 
    this.objField.style.border=this.Styles.def[0] + " 1px solid" ; 
    this.objField.style.verticalAlign='text-bottom'; 
    this.objField.style.backgroundColor=this.Styles.def[1]; 

    this.objField.onmouseover=new Function("window.__xwzDatePickers[" +this.index + "].hoverIn()"); 
    this.objField.onmouseout=new Function("window.__xwzDatePickers[" + this.index+ "].hoverOut()"); 

    //=== Row »ý¼º 
    var tBody = document.createElement("TBODY"); 
    this.objField.appendChild(tBody); 

    row = document.createElement("TR"); 
    row.style.cssText = ""; 
    row.onmousedown=new Function("e", "if((window.event.button||e.which)==1) window.__xwzDatePickers[" +this.index + "].swapVisible()"); 
    //=== µð½ºÇÃ·¹ÀÌ cell »ý¼º 
    this.objLabel = document.createElement("TD"); 
    this.objLabel.onselectstart=new Function("return false"); 

    if(this.oText.value == ""){ 
        this.objLabel.setAttribute("innerText", this.emptyValue); 
    }else{ 
//        this.objLabel.innerHTML = this.dtDisplay.getFullYear() + this.Formula[2] + this.__fillZero(this.dtDisplay.getMonth()+1, 2) + this.Formula[0] +  this.__fillZero(this.dtDisplay.getDate(), 2) + this.Formula[1]; 

//ÀÌ¹üÁÖ¼öÁ¤ - 2007-05-06
//        this.objLabel.innerHTML = this.oText.value.substring(0,4) + this.Formula[2] + this.oText.value.substring(4,6) + this.Formula[0] +  this.oText.value.substring(6,8) + this.Formula[1]; 
        this.objLabel.innerHTML = this.oText.value.substring(0,4) + "/" + this.oText.value.substring(4,6) + "/" +  this.oText.value.substring(6,8); 
    } 
    this.objLabel.style.cssText = ""; 
    this.objLabel.style.width=65;
    this.objLabel.style.height=15; 
    this.objLabel.style.font="normal normal normal 11px µ¸¿ò"; 
    this.objLabel.style.cursor="default"; 
    this.objLabel.style.textAlign="center"; 

    this.objLabel.style.margin="0 0 0 0"; 
    this.objLabel.style.padding="0 0 0 0"; 
    this.objLabel.style.border=this.Styles.def[1] + " 0px solid"; 
    this.objLabel.style.backgroundColor=this.Styles.def[1] ; 
    this.objLabel.style.color=this.Styles.def[2]; 
    row.appendChild(this.objLabel); 

    //=== È­»ìÇ¥ »ý¼º 
    this.imgArrow=document.createElement("IMG"); 
    this.imgArrow.src = this.Images.arrow; 
    this.imgArrow.valign = "middle"; 
    this.imgArrow.style.cssText = ""; 

    this.objArrow= document.createElement("TD"); 
    this.objArrow.onselectstart=new Function("return false"); 
    this.objArrow.style.margin="0 0 0 0"; 
    this.objArrow.style.padding="0 0 0 0"; 
    this.objArrow.style.border=this.Styles.def[1] + " 0px solid"; 
    this.objArrow.style.backgroundColor=this.Styles.def[1] ; 
    this.objArrow.style.color=this.Styles.def[1]; 
    this.objArrow.appendChild(this.imgArrow); 
    row.appendChild(this.objArrow); 
    tBody.appendChild(row); 

    this.objLabel.onfocus=new Function("window.__xwzDatePickers[" +this.index + "].active();"); 
    this.objArrow.onfocus=new Function("window.__xwzDatePickers[" +this.index + "].active()"); 
    //this.objLabel.setAttribute('tabIndex', 0); 

    this.objLabel.onblur=new Function("window.__xwzDatePickers[" +this.index + "].deactive()"); 
    this.objArrow.onblur=new Function("window.__xwzDatePickers[" +this.index + "].deactive()"); 

    this.oText.insertAdjacentElement("afterEnd", this.objField); 
    if(this.oText.disabled == true) this.__setPropertyAttribute('disabled'); 

    this.oText.style.width='0px'; 
    this.oText.style.visibility='hidden'; 
    this.createWindow(); 
    this.InitializCalendar(); 
    this.display(); 
    window.document.attachEvent("onmousedown", new Function("window.__xwzDatePickers[" +this.index + "].hideCalendar()")); 
} 
/* ================================================ 
¹®¼­ °´Ã¼¿¡¼­ÀÇ ¸¶¿ì½º ´Ù¿î ÀÌº¥Æ® ¹ß»ý½Ã ºñÈ°¼ºÈ­ 
================================================ */ 
xwzDatePicker.prototype.hideCalendar = function(){ 
    if(window.event.srcElement ==this.objArrow ||window.event.srcElement ==this.objLabel || window.event.srcElement ==this.imgArrow) return; 
    if(this.isVisible == true) this.swapVisible(); 
} 

/* ================================================ 
ÆË¾÷Ã¢ »ý¼ºÇÔ¼ö 
================================================ */ 
xwzDatePicker.prototype.createWindow= function(){ 
    var Doc     = null, Body = null, StyleSheet = null; 
    this.objWindow = window.createPopup(); 
    Doc        = this.objWindow.document; 
    Body        = this.objWindow.document.body; 
    /*»ý¼ºµÈ Window °´Ã¼¿¡ °¢ ½ºÅ¸ÀÏÀ» Àû¿ë ½ÃÅ´*/ 
    Body.style.cssText = "margin:1px;padding:0px;border:#A0A0A0 1px solid;cursor:default;background-color:#FCFCFC;overflow:hidden"; 

    StyleSheet = Doc.createStyleSheet(); 
    StyleSheet.addRule("BODY", "font-size:8pt;color:#666666;font-family:sans-serif,serif"); 
    StyleSheet.addRule("TD", "font-size:8pt;color:#666666;font-family:sans-serif,serif"); 
    StyleSheet.addRule("SPAN", "font-size:8pt;font-family:sans-serif,serif"); 
    StyleSheet.addRule("DIV", "font-size:8pt;color:#666666;font-family:sans-serif,serif"); 
    StyleSheet.addRule(".cssTitle",            "color:#0000FF;font-size:13px;font-family:Verdana;"); 
    StyleSheet.addRule(".cssTitleOver",    "color:#0066CC;font-size:13px;font-family:Verdana;"); 

    StyleSheet.addRule(".cssEmpty",            "padding-top:1px;cursor:pointer;height:19;text-align:center;border:#FCFCFC 1px solid;FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#FFFFFF', EndColorStr='#FFFFFF')"); 
    StyleSheet.addRule(".cssEmptyOver", "padding-top:1px;cursor:pointer;height:19;text-align:center;border:#E77B0F 1px solid;FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#FFF2DD', EndColorStr='#F6A53D')"); 
    StyleSheet.addRule(".cssEmptyOver SPAN",  "color:#2F2F2F;FILTER: progid:DXImageTransform.Microsoft.dropShadow( Color=#FFF2DD,offX=1,offY=1,positive=true);width:100%"); 

    StyleSheet.addRule(".cssSel",            "padding-top:1px;cursor:default;color:#000000;border:#E77B0F 1px solid;FILTER: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr='#FFF2DD', EndColorStr='#F6A53D')progid:DXImageTransform.Microsoft.dropShadow( Color=#999999,offX=1,offY=1,positive=true);"); 
    StyleSheet.addRule(".cssDef",            "cursor:pointer;border:#FCFCFC 1px solid;"); 
    StyleSheet.addRule(".cssDefOver",    "cursor:pointer;border:#7A98AF 1px solid;"); 

    StyleSheet.addRule(".cssDef SPAN",        "width:100%;border:#FFFFFF 1px solid;background-color:transparent;"); 
    StyleSheet.addRule(".cssDefOver SPAN","width:100%;border:#FFFFFF 1px solid;border-bottom-color:#D7D1C5;border-right-color:#D7D1C5;background-color:#C9F7FA"); 
    /*³â / ¿ù ¼±ÅÃ¶õ*/ 
    StyleSheet.addRule(".cssRect TD.cssItem",        "cursor:pointer;color:#666666;border:#F6F6F6  1px solid;background-color:transparent;"); 
    StyleSheet.addRule(".cssRect TD.cssHover",    "cursor:pointer;color:#333333;border:#F6A53D  1px solid;background-color:#FFF2DD;"); 
    StyleSheet.addRule(".cssRect TD.cssDisable",    "cursor:pointer;color:#666666;border:#CECECE  1px solid;background-color:#FAFAFA;"); 

    StyleSheet.addRule(".cssRect TD.cssItem SPAN",    "font-size:10px;font-familye:Tahoma;width:100%;border-top:#F6F6F6 1px solid;border-left:#F6F6F6 1px solid;border-bottom:#F6F6F6 1px solid;border-right:#F6F6F6 1px solid;cursor:pointer;padding:1px 3px 1px 3px"); 
    StyleSheet.addRule(".cssRect TD.cssHover SPAN",    "font-size:10px;font-familye:Tahoma;width:100%;border-top:#FFFFFF 1px solid;border-left:#FFFFFF 1px solid;border-bottom:#FFF2DD 1px solid;border-right:#FFF2DD 1px solid;cursor:pointer;padding:1px 3px 1px 3px"); 
    StyleSheet.addRule(".cssRect TD.cssDisable SPAN","font-size:10px;font-familye:Tahoma;width:100%;border-top:#F6F6F6 1px solid;border-left:#F6F6F6 1px solid;border-bottom:#FFFFFF 1px solid;border-right:#FFFFFF 1px solid;cursor:pointer;padding:1px 3px 1px 3px"); 

    StyleSheet.addRule(".cssTab TD.cssItem",    "cursor:pointer;color:#666666;letter-spacing: -1;height: 19px;border:#F6F6F6 1px solid;background-color:transparent") 
    StyleSheet.addRule(".cssTab TD.cssHover","cursor:pointer;color:#333333;letter-spacing: -1;height: 19px;border:#88ACCB 1px solid;background-color:#E8FBFF;border:#70D9FF 1px solid"); 
    StyleSheet.addRule(".cssTab TD.cssItem SPAN",     "width:100%;height:17px;border-top:#F6F6F6 1px solid;border-left:#F6F6F6 1px solid;border-bottom:#F6F6F6 1px solid;border-right:#F6F6F6 1px solid;padding: 2 0 0 2;cursor:pointer;") 
    StyleSheet.addRule(".cssTab TD.cssHover SPAN","width:100%;height:17px;border-top:#FFFFFF 1px solid;border-left:#FFFFFF 1px solid;border-bottom:#E8FBFF 1px solid;border-right:#E8FBFF 1px solid;padding: 2 0 0 2;cursor:pointer;") 

} 
/* ================================================ 
´Þ·Â ÃÊ±âÈ­ ÇÔ¼ö 
================================================ */ 
xwzDatePicker.prototype.InitializCalendar = function(){ 
    var Doc        = this.objWindow.document; 
    var table =null,tbody=null,  row = null, cell =null, img = null; 

    table = Doc.createElement("TABLE"); 
    table.setAttribute('cellPadding', 1); 
    table.setAttribute('cellSpacing', 0); 
    table.setAttribute('align', 'center'); 
    table.setAttribute('width', '100%'); 

    tbody=Doc.createElement("TBODY"); 
    table.appendChild(tbody); 
    row = Doc.createElement('TR'); 
    tbody.appendChild(row); 
    //-- Prev 
    img = Doc.createElement('img'); 
    img.src=this.Images.prev; 
    cell = Doc.createElement('TD'); 
    cell.setAttribute('height', 21); 
    cell.setAttribute('width', 17); 
    cell.setAttribute('align', 'center'); 
    cell.setAttribute('bgColor', '#E3EDF6'); 
    cell.style.cursor='pointer'; 

    cell.onclick=new Function("window.__xwzDatePickers[" +this.index + "].setCurrentDateSibling(0, -1)"); 
    cell.appendChild(img); 
    row.appendChild(cell); 
    img = null; cell=null; 

    //-- Title 
    this.lblCaption = Doc.createElement('TD'); 
    this.lblCaption.setAttribute('height', 21); 
    this.lblCaption.setAttribute('align', 'center'); 
    this.lblCaption.setAttribute('bgColor', '#E3EDF6'); 
    this.lblCaption.style.cursor='default'; 

    var div = Doc.createElement("div");//¿ù 
    div.style.cssText="display:inline;width:40;text-align:right;cursor:pointer;"; 
    div.innerHTML = "<span class=\"cssTitle\"> </span>¿ù,"; 
    div.onclick=new Function("var table =window.__xwzDatePickers[" +this.index + "].objWindow.document.getElementById('IDS_MONTH_LIST');table.style.display = table.style.display == 'none' ? '' : 'none';window.__xwzDatePickers[" +this.index + "].objWindow.document.getElementById('IDS_YEAR_LIST').style.display='none';"); 
    this.lblCaption.appendChild(div); 

    div = Doc.createElement("div");//³â 
    div.style.cssText="display:inline;width:44px;cursor:pointer"; 
    div.innerHTML = " "; 
    div.onclick=new Function("__xwzDatePickers[" +this.index + "].yearList(__xwzDatePickers[" +this.index + "].dtDisplay.getFullYear())"); 
    this.lblCaption.appendChild(div); 
    row.appendChild(this.lblCaption); 

    //-- Next 
    img = Doc.createElement('img'); 
    img.src=this.Images.next; 
    cell = Doc.createElement('TD'); 
    cell.setAttribute('height', 21); 
    cell.setAttribute('width', 17); 
    cell.setAttribute('align', 'center'); 
    cell.setAttribute('bgColor', '#E3EDF6'); 
    cell.style.cursor='pointer'; 
    cell.onclick=new Function("window.__xwzDatePickers[" +this.index + "].setCurrentDateSibling(0, 1)"); 
    cell.appendChild(img); 
    row.appendChild(cell); 

    Doc.body.insertAdjacentElement("beforeEnd",table); 
    img = null; cell=null, row = null, table=null, tbody=null; 

    //====[¿ù ¼±ÅÃ¶õ]====// 
    table = Doc.createElement("TABLE"); 
    table.setAttribute('cellPadding', 0); 
    table.setAttribute('cellSpacing', 2); 
    table.align="center"; 
    table.style.backgroundColor="#F6F6F6"; 
    table.style.border="#CACACA 1px solid"; 
    table.className="cssTab"; 
    table.setAttribute('id', 'IDS_MONTH_LIST'); 
    table.style.position="absolute"; 
    table.style.left="42"; 

    tbody=Doc.createElement("TBODY"); 
    table.appendChild(tbody); 
    for(var i = 1 ;  i <= 6; i++){ 
        row = Doc.createElement('TR'); 
        tbody.appendChild(row); 
        cell = Doc.createElement("TD"); 
        cell.className="cssItem"; 
        cell.align="center" 
        cell.innerHTML = "<span>" + i + this.Formula[0].replace(/([\s\-]+)/, '') + "</span>"; 
        cell.onmouseover=new Function("this.className='cssHover' "); 
        cell.onmouseout=new Function("this.className='cssItem' "); 
        cell.onclick=new Function("window.__xwzDatePickers[" +this.index + "].setCurrentDate(__xwzDatePickers[" +this.index + "].dtDisplay.getFullYear(), "+ i+")"); 
        row.appendChild(cell); 

        cell = Doc.createElement("TD"); 
        cell.className="cssItem"; 
        cell.align="center" 
        cell.innerHTML = "<span>" + (6+i) + this.Formula[0].replace(/([\s\-]+)/, '') + "</span>"; 
        cell.onmouseover=new Function("this.className='cssHover' "); 
        cell.onmouseout=new Function("this.className='cssItem' "); 
        cell.onclick=new Function("window.__xwzDatePickers[" +this.index + "].setCurrentDate(__xwzDatePickers[" +this.index + "].dtDisplay.getFullYear(), "+ (6+i)+")"); 
        row.appendChild(cell); 
    } 
    Doc.body.insertAdjacentElement("beforeEnd",table); 
    img = null; cell=null, row = null, table=null, tbody=null; 
    //====[³âµµ ¼±ÅÃ¶õ]====// 
    table = Doc.createElement("TABLE"); 
    table.setAttribute('cellPadding', 0); 
    table.setAttribute('cellSpacing', 2); 
    table.align="center"; 
    table.style.backgroundColor="#F6F6F6"; 
    table.style.border="#CACACA 1px solid"; 
    table.className="cssRect"; 
    table.setAttribute('id', 'IDS_YEAR_LIST'); 
    table.style.position="absolute"; 
    table.style.left="66"; 

    tbody=Doc.createElement("TBODY"); 
    table.appendChild(tbody); 
    Doc.body.insertAdjacentElement("beforeEnd",table); 
    img = null; cell=null, row = null, table=null, tbody=null; 
    //====[¿äÀÏÇ¥½Ã]====// 
    table = Doc.createElement("TABLE"); 
    table.setAttribute('cellPadding', 1); 
    table.setAttribute('cellSpacing', 0); 
    table.setAttribute('align', 'center'); 
    table.setAttribute('width', '100%'); 
    table.style.cssText = 'border-top:#999999 1px solid;border-bottom:#808080 1px solid'; 
    tbody = Doc.createElement("TBODY"); 
    table.appendChild(tbody); 

    row = Doc.createElement("TR"); 
    for(var i = 0 ; i < this.Weeks.length; i++){ 
        cell = Doc.createElement("TD"); 
        cell.setAttribute('height', 19); 
        cell.setAttribute('align', 'center'); 
        cell.setAttribute('bgColor', '#F2F2F2'); 
        if(this.WeekColor[i] != null || this.WeekColor[i] !='') cell.style.color=this.WeekColor[i]; 
        cell.innerHTML = this.Weeks[i]; 
        row.appendChild(cell); 
    } 
    tbody.appendChild(row); 
    Doc.body.insertAdjacentElement("beforeEnd",table); 
    img = null; cell=null, row = null, table=null, tbody=null; 


    //====[±â°£¾øÀ½ Ç¥½Ã]====// 
    this.lblEmpty = Doc.createElement("div"); 
    this.lblEmpty.className="cssEmpty"; 
    this.lblEmpty.style.width="100%" 
    if(this.isEmpty==false) this.lblEmpty.style.display="none"; 
    this.lblEmpty.onmouseover=function(){this.className='cssEmptyOver';} 
    this.lblEmpty.onmouseout=function(){this.className='cssEmpty';} 
    this.lblEmpty.onclick=new Function("window.__xwzDatePickers[" +this.index + "].setEmptyValue();this.className='cssEmpty';"); 
    this.lblEmpty.innerHTML = "<span>"+this.emptyValue+"</span>"; 
    Doc.body.insertAdjacentElement("beforeEnd",this.lblEmpty); 

    table = Doc.createElement("TABLE"); 
    tbody=Doc.createElement("TBODY"); 
    table.setAttribute('cellPadding', 0); 
    table.setAttribute('cellSpacing', 1); 
    table.setAttribute('align', 'center'); 
    table.setAttribute('width', '100%'); 
    table.appendChild(tbody); 

    var nWeek = 0; 
    var cells = new Array(0); 
    for(var i = 0; i < 42; i++){ 
        if(i%7 ==0){ 
            row = Doc.createElement("TR"); 
            tbody.appendChild(row); 
        } 
        nWeek = (i%7) ; 

        cell = Doc.createElement("TD"); 
        cell.setAttribute('align', 'right'); 
        cell.setAttribute('height', '17'); 
        cell.setAttribute('width', '17'); 
        if(this.WeekColor[nWeek] != null || this.WeekColor[nWeek] !='') cell.style.color=this.WeekColor[nWeek]; 
        cell.innerText = i; 
        row.appendChild(cell); 
        cells[i] = cell; 
    } 
    this.cellCalendar = cells; 
    Doc.body.insertAdjacentElement("beforeEnd",table); 

} 
/* ================================================ 
³âµµ ¸ñ·Ï Ãâ·ÂÇÔ¼ö 
================================================ */ 
xwzDatePicker.prototype.yearList=function(nYear,isChange) 
{ 
    var Doc        = this.objWindow.document; 
    var table =null,tbody=null,  row = null, cell =null, img = null; 
    table =Doc.getElementById('IDS_YEAR_LIST'); 

    tbody=table.tBodies[0]; 
    if( table.style.display == 'none' || isChange==true) 
    { 
        for(var i=tbody.rows.length-1;i>=0;i--) 
        { 
            tbody.removeChild(tbody.rows[i]); 
        } 
        //-- ÀÌÀü ³âµµ ¼±ÅÃ 
        row = Doc.createElement('TR'); 
        tbody.appendChild(row); 
        cell = Doc.createElement("TD"); 
        cell.className="cssItem"; 
        cell.align="center"; 
        cell.style.fontSize="8px"; 
        cell.setAttribute('height', 10); 
        cell.innerHTML = "¡ã"; 
        cell.onmouseover=new Function("this.className='cssHover' "); 
        cell.onmouseout=new Function("this.className='cssItem' "); 
        cell.onclick=new Function("__xwzDatePickers[" +this.index + "].yearList("+(nYear-3)+", true)"); 
        row.appendChild(cell); 

        for(var i = 2 ;  i >0; i--){ 
            row = Doc.createElement('TR'); 
            tbody.appendChild(row); 
            cell = Doc.createElement("TD"); 
            cell.className="cssItem"; 
            cell.align="center"; 
            cell.innerHTML = "<span>"+(nYear-i)+"</span>"; 
            cell.onmouseover=new Function("this.className='cssHover' "); 
            cell.onmouseout=new Function("this.className='cssItem' "); 
            cell.onclick=new Function("__xwzDatePickers[" +this.index + "].setCurrentDate("+(nYear-i)+", " +( this.dtDisplay.getMonth()+1) +")"); 
            row.appendChild(cell); 
        } 
        row = Doc.createElement('TR'); 
        tbody.appendChild(row); 
        cell = Doc.createElement("TD"); 
        cell.align="center"; 
        if(nYear == this.dtDisplay.getFullYear()) 
        { 
            cell.className="cssDisable"; 
            cell.innerHTML = "<span>"+nYear+"</span>"; 
            cell.onclick=new Function("__xwzDatePickers[" +this.index + "].objWindow.document.getElementById('IDS_YEAR_LIST').style.display =  'none' "); 
        } 
        else 
        { 
            cell.className="cssItem"; 
            cell.innerHTML = "<span>"+nYear+"</span>"; 
            cell.onmouseover=new Function("this.className='cssHover' "); 
            cell.onmouseout=new Function("this.className='cssItem' "); 
            cell.onclick=new Function("__xwzDatePickers[" +this.index + "].setCurrentDate("+(nYear)+", " +( this.dtDisplay.getMonth()+1) +")"); 
        } 
        row.appendChild(cell); 

        for(var i = 1 ;  i <=2; i++){ 
            row = Doc.createElement('TR'); 
            tbody.appendChild(row); 
            cell = Doc.createElement("TD"); 
            cell.align="center"; 
            cell.className="cssItem"; 
            cell.innerHTML = "<span>"+(nYear+i)+"</span>"; 
            cell.onmouseover=new Function("this.className='cssHover' "); 
            cell.onmouseout=new Function("this.className='cssItem' "); 
            cell.onclick=new Function("__xwzDatePickers[" +this.index + "].setCurrentDate("+(nYear+i)+", " +( this.dtDisplay.getMonth()+1) +")"); 
            row.appendChild(cell); 
        } 
        //-- ´ÙÀ½ ³âµµ ¼±ÅÃ 
        row = Doc.createElement('TR'); 
        tbody.appendChild(row); 
        cell = Doc.createElement("TD"); 
        cell.className="cssItem"; 
        cell.align="center"; 
        cell.style.fontSize="8px"; 
        cell.setAttribute('height', 10); 
        cell.innerHTML = "¡å"; 
        cell.onmouseover=new Function("this.className='cssHover' "); 
        cell.onmouseout=new Function("this.className='cssItem' "); 
        cell.onclick=new Function("__xwzDatePickers[" +this.index + "].yearList("+(nYear+3)+", true)"); 
        row.appendChild(cell); 
        Doc.getElementById('IDS_MONTH_LIST').style.display='none'; 
        table.style.display = ''; 
    } 
    else 
    { 
        table.style.display = 'none'; 
    } 
} 
/* ================================================ 
¼³Á¤µÈ ³¯Â¥ º¯°æ ÇÔ¼ö 
================================================ */ 
xwzDatePicker.prototype.setCurrentDate =function(nYear, nMonth){    this.dtDisplay=new Date(nYear , nMonth-1, 1 );this.display();} 
xwzDatePicker.prototype.setCurrentDateSibling =function(nYear, nMonth){    this.dtDisplay=new Date(this.dtDisplay.getFullYear() + nYear , this.dtDisplay.getMonth() + nMonth, 1 );this.display();} 
/* ================================================ 
³¯Â¥ Ãâ·Â ÇÔ¼ö 
================================================ */ 
xwzDatePicker.prototype.display =function(){ 
    var dpYear = this.dtDisplay.getFullYear(), dpMonth = this.dtDisplay.getMonth(), dpDay = 0; 
    var curYear = this.dtCurrent.getFullYear(), curMonth = this.dtCurrent.getMonth(), curDay = this.dtCurrent.getDate(); 
    var cells = this.cellCalendar; 
    var dtTemp = null, nMin = 0, nMax = 0; 

    dtTemp = new Date(dpYear, dpMonth, 1); 
    nMin = dtTemp.getDay(); 
    dtTemp = new Date(dpYear, dpMonth+1, 0); 
    nMax = nMin + dtTemp.getDate()-1; 

    this.objWindow.document.getElementById('IDS_MONTH_LIST').style.display ='none'; 
    this.objWindow.document.getElementById('IDS_YEAR_LIST').style.display ='none'; 

    this.lblCaption.childNodes[0].innerHTML="<span class=\"cssTitle\">"+ (dpMonth+1)+"</span>"+this.Formula[0].replace(/\s/, '')+","; 
    this.lblCaption.childNodes[1].innerHTML=dpYear ; 
    for(var i=0; i < 42; i++){ 
        cells[i].onclick=new Function("return false"); 
        cells[i].onmouseover=new Function("return false"); 
        cells[i].onmouseout=new Function("return false"); 
        if(i>=nMin && i<=nMax){ 
            dpDay = i - nMin+1; 
            cells[i].innerHTML = "<span>"+dpDay+"</span>"; 
            if(dpYear==curYear && dpMonth==curMonth && dpDay==curDay && this.oText.value !=""){ 
                cells[i].className='cssSel'; 
            }else{ 
                cells[i].className='cssDef'; 
                cells[i].onclick=new Function("with(window.__xwzDatePickers[" +this.index + "]){setDateValue("+dpDay+");}"); 
                cells[i].onmouseover=function(){this.className=this.className + "Over";    } 
                cells[i].onmouseout=function(){this.className=this.className.replace("Over", "");} 
            } 
        }else{ 
            cells[i].className=''; 
            cells[i].innerHTML = "<span> </span>"; 
        } 
    } 
} 