/* Coolite Inc. 2004-2006. All rights are reserved. Unauthorized use prohibited. Visit http://www.basicdatepicker.com/ for more info. Version 1.2.2411 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*/if (typeof(window["BDP"]) == "undefined")
{
    window["BDP"] =
    {
    };
}
BasicDatePicker = function(suppressInit)
{
    if(!suppressInit) this.init();
    var today = new Date();
    this.todayDate = today.getDate(), this.todayMonth = today.getMonth(), this.todayYear = today.getFullYear(),this.dateCounts = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31),this.viewingYear, this.viewingMonth, this.selectedYear,this.selectedMonth, this.selectedDay,this.buttonElement, this.valueElement, this.labelElement, this.yearInc, this.params, this.timeout, this.interval, this.isDate, this.popUp,this.popUpShim, this.monthSelectorShim, this.yearSelectorShim, this.monthSelector, this.yearSelector,this.stayOpen = false, this.cancelFocus = false, this.cancelTextBoxClick, this.isIE, this.isIEWin, this.isOpera, this.isSafari, this.isNS6, this.isIEMac;
};
BasicDatePicker.prototype.init = function()
{
    var ua = navigator.userAgent.toLowerCase();
    var isMac = (ua.indexOf("mac") != -1);
    this.isIE = (ua.indexOf("ie") != -1);
    this.isOpera = (ua.indexOf("opera") != -1);
    this.isSafari = (ua.indexOf("safari") != -1);
    this.isNS6 = (ua.indexOf("netscape6/") != -1);
    this.isIEWin = (this.isIE && !isMac && !this.isOpera);
    this.isIEMac = (this.isIE && isMac && !this.isOpera);
};
BasicDatePicker.prototype.ehTextBoxClick = function(buttonElement, valueElement, labelElement, params)
{
    this.stayOpen = true;
    if(this.cancelTextBoxClick)
    {
        this.cancelTextBoxClick = false;
        return false;
    }
    else
    {
        this.showPopUp(buttonElement, valueElement, labelElement, params);
    }
};
BasicDatePicker.prototype.showPopUp = function(buttonElement, valueElement, labelElement, params)
{
    if(this.cancelFocus)
    {
        this.cancelFocus = false;
        return false;
    }
    this.inputFocusValue = valueElement.value;
    if(!params.enabled)
    {
        return false;
    }
    if(this.params != null && (this.params != params))
    {
        this.hidePopUp();
    }
    else if(this.params == params && this.buttonElement == buttonElement && this.valueElement == valueElement)
    {
        this.hidePopUp();
        return false;
    }
    this.buttonElement = buttonElement;
    this.valueElement = valueElement;
    this.labelElement = labelElement;
    this.params = this.loadParams(params);
    if(!this.popUp)
    {
        this.popUp = document.createElement("DIV");
        with(this.popUp)
        {
            id = "basicDatePickerPopUp";
            style.position = "absolute";
            style.visibility = "hidden";
            style.zIndex = "1000";
        }
        this.popUp.onclick = this.ehPopUpClick;
        document.body.appendChild(this.popUp);
    }
    if(!this.wireUpCustomEvent("onClientBeforeCalendarOpen"))
    {
        this.hidePopUp();
        return false; //TEST
    }
    this.parseDate(this.valueElement.value);
    this.buildCalendar();
    var buttonPosition = this.findPosition(this.buttonElement);
    var leftPosition = this.params.xOffset + buttonPosition.x+70;//long_pair

	//自动调整位置
	objHeight = this.popUp.clientHeight + this.buttonElement.clientHeight + 5;
    var topPosition = (buttonPosition.y + objHeight < document.body.clientHeight) ? (this.params.yOffset + buttonPosition.y) : (buttonPosition.y - objHeight - this.params.yOffset);

    this.popUp.style.left = (leftPosition + this.buttonElement.offsetWidth - this.popUp.offsetWidth) + "px";
    this.popUp.style.top = (topPosition + this.buttonElement.offsetHeight) + "px";
    if(parseInt(this.popUp.style.left) < 0)
    {
        this.popUp.style.left = 0;
    }
    if(parseInt(this.popUp.style.top) < 0)
    {
        this.popUp.style.top = 0;
    }
    this.popUpShim = this.showShim(this.popUpShim, this.popUp);
    this.popUp.style.visibility = "visible";
    if(!this.wireUpCustomEvent("onClientAfterCalendarOpen"))
    {
        this.hidePopUp();
        return false; //TEST
    }
    document.onclick = this.ehDocumentClick;
    document.onkeydown = this.ehKeyPress;
};
BasicDatePicker.prototype.showShim = function(v, o)
{
    if(this.isIEWin)
    {
        if(!v)
        {
            v = document.createElement("IFRAME");
            with(v)
            {
                src = "javascript:false;";
                style.position = "absolute";
                style.visibility = "hidden";
                style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)";
            }
            document.body.appendChild(v);
        }
        with(v)
        {
            style.width = o.offsetWidth;
            style.height = o.offsetHeight;
            style.top = o.style.top;
            style.left = o.style.left;
            style.zIndex = o.style.zIndex - 1;
            style.visibility = "visible";
        }
    }
    return v;
};
BasicDatePicker.prototype.hideShim = function(v)
{
    if(this.isIEWin)
    {
        if(v)
        {
            v.style.visibility = "hidden";
        }
    }
};
BasicDatePicker.prototype.hidePopUp = function()
{
    if(!this.wireUpCustomEvent("onClientBeforeCalendarClose"))
    {
        return false; //TEST
    }
    if(this.popUp)
    {
        this.popUp.style.visibility = "hidden";
    }
    this.clearTimers();
    this.hideShim(this.popUpShim);
    this.hideSelectors();
    this.reset();
    document.onclick = null;
    document.onkeydown = null;
};
BasicDatePicker.prototype.hideSelectors = function()
{
    if(this.monthSelector) this.monthSelector.style.visibility = "hidden";
    if(this.yearSelector) this.yearSelector.style.visibility = "hidden";
    this.hideShim(this.monthSelectorShim);
    this.hideShim(this.yearSelectorShim);
};
BasicDatePicker.prototype.clearTimers = function()
{
    if(this.timeout)
    {
        clearTimeout(this.timeout);
    }
    if(this.interval)
    {
        clearInterval(this.interval);
    }
};
BasicDatePicker.prototype.buildStyleAttributes = function(style, cssClass)
{
    var atts = "";
    if(style.length > 0 || cssClass.length > 0)
    {
        if(style.length > 0)
        {
            atts += " style=\"" + style + "\"";
        }
        if(cssClass.length > 0)
        {
            atts += " class=\"" + cssClass + "\"";
        }
    }
    return atts;
};
BasicDatePicker.prototype.buildSingleCalendar = function(year, month, showPrevMonthArrow, showNextMonthArrow)
{
    this.hideSelectors();
    var viewingPrevMonth = month - 1;
    var viewingPrevMonthYear = year;
    if(viewingPrevMonth == -1)
    {
        viewingPrevMonth = 11;
        viewingPrevMonthYear--;
    }
    var viewingNextMonth = month + 1;
    var viewingNextMonthYear = year;
    if(viewingNextMonth == 12)
    {
        viewingNextMonth = 0;
        viewingNextMonthYear++;
    }
    var o = "";
    o += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"" + this.buildStyleAttributes(this.params.popUpStyle, this.params.popUpStyleCssClass) + ">";
    o += "<tr><td>";
    if(this.params.showTitle)
    {
        o += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"" + this.buildStyleAttributes(this.params.titleStyle, this.params.titleStyleCssClass) + ">";
        o += "<tr>";
        var monthAndYear = "<th>";
        var monthName = this.params.culture.monthNames[month];
        if(this.params.monthSelectorEnabled)
        {
            monthAndYear += "<span onclick=\"basicDatePicker.ehMonthSelectorClick(this)\" style=\"cursor:pointer\">" + monthName + "</span>";
        }
        else
        {
            monthAndYear += monthName;
        }
        monthAndYear += " ";
        if(this.params.yearSelectorEnabled)
        {
            monthAndYear += "<span onclick=\"basicDatePicker.ehYearSelectorClick(this)\" style=\"cursor:pointer\">" + year + "</span>";
        }
        else
        {
            monthAndYear += year;
        }
        monthAndYear += "</th>";
        if(this.params.showNextPrevMonth)
        {
            var prevMonth, nextMonth;
            switch(this.params.nextPrevFormat)
            {
                case "ShortMonth": prevMonth = this.params.culture.monthNamesAbbr[viewingPrevMonth];
                nextMonth = this.params.culture.monthNamesAbbr[viewingNextMonth];
                break;
                case "FullMonth": prevMonth = this.params.culture.monthNames[viewingPrevMonth];
                nextMonth = this.params.culture.monthNames[viewingNextMonth];
                break;
                case "Image":prevMonth = "<img src=\"" + this.params.prevMonthImageUrl + "\"";
                var prevMonthWidthHeight = (this.params.nextPrevMonthImageWidth != "") ? "width:" + this.params.nextPrevMonthImageWidth + ";" : "";
                prevMonthWidthHeight += (this.params.nextPrevMonthImageHeight != "") ? "height:" + this.params.nextPrevMonthImageHeight + ";" : "";
                if(prevMonthWidthHeight != "") prevMonth += " style=\"" + prevMonthWidthHeight + "\"";
                prevMonth += " border=\"0\" alt=\"\"/>";
                nextMonth = "<img src=\"" + this.params.nextMonthImageUrl + "\"";
                var nextMonthWidthHeight = (this.params.nextPrevMonthImageWidth != "") ? "width:" + this.params.nextPrevMonthImageWidth + ";" : "";
                nextMonthWidthHeight += (this.params.nextPrevMonthImageHeight != "") ? "height:" + this.params.nextPrevMonthImageHeight + ";" : "";
                if(nextMonthWidthHeight != "") nextMonth += " style=\"" + nextMonthWidthHeight + "\"";
                nextMonth += " border=\"0\" alt=\"\"/>";
                break;
                case "CustomText":default:prevMonth = this.params.prevMonthText;
                nextMonth = this.params.nextMonthText;
                break;
            }
            if(showPrevMonthArrow)
            {
                o += "<td onclick=\"basicDatePicker.viewPrevMonth()\" onmousedown=\"basicDatePicker.clearTimers();basicDatePicker.timeout=setTimeout('basicDatePicker.ehPrevMonthMouseDown()', 400);\" onmouseup=\"basicDatePicker.clearTimers();\" onmouseout=\"basicDatePicker.clearTimers();\"" + this.buildStyleAttributes(this.params.nextPrevStyle, this.params.nextPrevStyleCssClass) + ">";
                o += prevMonth;
                o += "</td>";
            }
            else
            {
                o += "<td></td>";
            }
            o += monthAndYear;
            if(showNextMonthArrow)
            {
                o += "<td onclick=\"basicDatePicker.viewNextMonth()\" onmousedown=\"basicDatePicker.clearTimers();basicDatePicker.timeout=setTimeout('basicDatePicker.ehNextMonthMouseDown()', 400);\" onmouseup=\"basicDatePicker.clearTimers();\" onmouseout=\"basicDatePicker.clearTimers();\"" + this.buildStyleAttributes(this.params.nextPrevStyle, this.params.nextPrevStyleCssClass) + ">";
                o += nextMonth;
                o += "</td>";
            }
            else
            {
                o += "<td></td>";
            }
        }
        else
        {
            o += monthAndYear;
        }
        o += "</tr>";
        o += "</table>";
    }
    if(((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
    {
        this.dateCounts[1] = 29;
    }
    else
    {
        this.dateCounts[1] = 28;
    }
    o += "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"" + this.buildStyleAttributes(this.params.calendarStyle, this.params.calendarStyleCssClass) + ">";
    if(this.params.showDayHeader)
    {
        o += "<thead><tr>";
        if(this.params.showWeekNumbers && this.params.firstDayOfWeek == 0)
        {
            o += "<th" + this.buildStyleAttributes(this.params.dayHeaderStyle, this.params.dayHeaderStyleCssClass) + ">&nbsp;</th>";
        }
        var dayPointer = this.params.firstDayOfWeek;
        for(var i=0; i<7; i++, dayPointer++)
        {
            if(dayPointer == 7)
            {
                dayPointer = 0;
            }
            o += "<th" + this.buildStyleAttributes(this.params.dayHeaderStyle, this.params.dayHeaderStyleCssClass) + ">";
            switch(this.params.dayNameFormat)
            {
                case "Short":o += this.params.culture.dayNamesAbbr[dayPointer];
                break;
                case "Full":o += this.params.culture.dayNames[dayPointer];
                break;
                case "FirstTwoLetters":o += this.params.culture.dayNames[dayPointer].substring(0,2);
                break;
                case "FirstLetter":default:o += this.params.culture.dayNames[dayPointer].substring(0,1);
                break;
            }
            o += "</th>";
        }
        o += "</tr></thead>";
    }
    o += "<tbody><tr>";
    var column = 0;
    var startOfMonth = new Date(year,month,1).getDay();
    startOfMonth = startOfMonth - this.params.firstDayOfWeek;
    if(startOfMonth < 0)
    {
        startOfMonth = 7 + startOfMonth;
    }
    for(var i=0; i<startOfMonth; i++, column++)
    {
        o += this.buildDayCell(viewingPrevMonthYear, viewingPrevMonth, this.dateCounts[viewingPrevMonth] - startOfMonth + i + 1, "prev");
    }
    var row = 0;
    for(var i=1; i<=this.dateCounts[month]; i++, column++)
    {
        o += this.buildDayCell(year, month, i, "current");
        if(column == 6)
        {
            if(i < this.dateCounts[month])
            {
                o += "</tr><tr>";
                row++;
                column = -1;
            }
        }
    }
    if (column > 0)
    {
        for (var i=1; column<7; i++, column++)
        {
            o += this.buildDayCell(viewingNextMonthYear, viewingNextMonth, i, "next");
        }
    }
    if(this.params.forceSixRows)
    {
        for(var y = row; y < 5; y++)
        {
            o += "</tr><tr>";
            for(var x=0; x < 7; x++, i++)
            {
                o += this.buildDayCell(viewingNextMonthYear, viewingNextMonth, i, "next");
            }
        }
    }
    o += "</tr></tbody>";
    o += "</table>";
    o += "</td></tr>";
    o += "</table>";
    return o;
};
BasicDatePicker.prototype.buildCalendar = function()
{
    if(this.viewingMonth == null || this.viewingYear == null)
    {
        (this.params.visibleDate) ? this.viewingMonth = this.params.visibleDate.getMonth() : this.viewingMonth = this.todayMonth;
        (this.params.visibleDate) ? this.viewingYear = this.params.visibleDate.getFullYear() : this.viewingYear = this.todayYear;
    }
    var viewingDate = new Date(this.viewingYear, this.viewingMonth, 1);
    var o = "<table cellpadding=\"0\" cellspacing=\"0\" class=\"bdpWrapper\">";
    for(var y=0; y<this.params.rows; y++)
    {
        o += "<tr>";
        for(var x=0; x<this.params.columns; x++)
        {
            var showPrevMonth = (y == 0 && x == 0);
            var showNextMonth = (y == 0 && x == this.params.columns-1);
            o += "<td>";
            o += this.buildSingleCalendar(viewingDate.getFullYear(), viewingDate.getMonth(), showPrevMonth, showNextMonth);
            o += "</td>";
            viewingDate = viewingDate.addMonths(1);
        }
        o += "</tr>";
    }
    o += "<tr><td colspan=\"" + this.params.columns + "\">";
    var showFooter = (this.params.showTodayButton || this.params.showNoneButton);
    if(showFooter)
    {
        o += "<div" + this.buildStyleAttributes(this.params.footerStyle, this.params.footerStyleCssClass) + ">";
        if(this.params.showTodayButton)
        {
            o += "<input type=\"button\" onClick=\"basicDatePicker.selectDate(basicDatePicker.todayYear,basicDatePicker.todayMonth,basicDatePicker.todayDate,true);\" value=\"" + this.params.todayButtonText + "\"" + this.buildStyleAttributes(this.params.todayButtonStyle, this.params.todayButtonStyleCssClass) + " title=\"\"/>";
        }
        if(this.params.showNoneButton)
        {
            o += "<input type=\"button\" onClick=\"basicDatePicker.clearSelectedDate();\" value=\"" + this.params.noneButtonText + "\"" + this.buildStyleAttributes(this.params.noneButtonStyle, this.params.noneButtonStyleCssClass) + " title=\"\"/>";
        }
        o += "</div>";
    }
    if(this.params.footNoteText != '')
    {
        o += "<div" + this.buildStyleAttributes(this.params.footNoteStyle, this.params.footNoteStyleCssClass) + ">" + this.params.footNoteText + "</div>";
    }
    o += "</td></tr>";
    o += "</table>";
    this.popUp.innerHTML = o;
};
BasicDatePicker.prototype.buildDayCell = function(y, m, d, type)
{
    var curDate = new Date(y, m, d);
    var arrSpecialDates = null;
    var dayOfWeek = curDate.getDay(), dayClassName = "";
    var isWeekDay = (dayOfWeek != 0 && dayOfWeek != 6);
    var styleToUse = null;
    var styleCssClassToUse = null;
    var specialDateSelectable = true;
    var specialDateOnClick = "";
    var specialDateText = "";
    switch(type)
    {
        case "current":var isSelectedDay = (this.selectedYear == y && this.selectedMonth == m && this.selectedDay == d);
        var isTodayDay = (y == this.todayYear && m == this.todayMonth && this.todayDate == d);
        if(isSelectedDay && isTodayDay)
        {
            if(isWeekDay)
            {
                styleToUse = this.params.selectedDayTodayDayStyle;
                styleCssClassToUse = this.params.selectedDayTodayDayStyleCssClass;
            }
            else
            {
                styleToUse = this.params.selectedDayWeekendDayStyle;
                styleCssClassToUse = this.params.selectedDayWeekendDayStyleCssClass;
            }
        }
        else if(isSelectedDay)
        {
            if(isWeekDay)
            {
                styleToUse = this.params.selectedDayStyle;
                styleCssClassToUse = this.params.selectedDayStyleCssClass;
            }
            else
            {
                styleToUse = this.params.selectedDayWeekendDayStyle;
                styleCssClassToUse = this.params.selectedDayWeekendDayStyleCssClass;
            }
        }
        else if(isTodayDay)
        {
            if(isWeekDay)
            {
                styleToUse = this.params.todayDayStyle;
                styleCssClassToUse = this.params.todayDayStyleCssClass;
            }
            else
            {
                styleToUse = this.params.todayDayWeekendDayStyle;
                styleCssClassToUse = this.params.todayDayWeekendDayStyleCssClass;
            }
        }
        else
        {
            if(isWeekDay)
            {
                styleToUse = this.params.dayStyle;
                styleCssClassToUse = this.params.dayStyleCssClass;
            }
            else
            {
                styleToUse = this.params.weekendDayStyle;
                styleCssClassToUse = this.params.weekendDayStyleCssClass;
            }
        }
        break;
        case "prev":case "next":if(isWeekDay)
        {
            styleToUse = this.params.otherMonthDayStyle;
            styleCssClassToUse = this.params.otherMonthDayStyleCssClass;
        }
        else
        {
            styleToUse = this.params.otherMonthDayWeekendDayStyle;
            styleCssClassToUse = this.params.otherMonthDayWeekendDayStyleCssClass;
        }
        break;
    }
    if(this.getSpecialDates() != null)
    {
        arrSpecialDates = this.getSpecialDates().getByDate(curDate);
        for(var i=0; i<arrSpecialDates.length; i++)
        {
            styleToUse += arrSpecialDates[i].style;
            styleCssClassToUse += " " + arrSpecialDates[i].styleCssClass;
            specialDateSelectable = arrSpecialDates[i].selectable;
            if(arrSpecialDates[i].text.length > 0)
            {
                if(i != 0)
                {
                    if(this.isIE || this.isOpera || this.isSafari)
                    {
                        specialDateText += "\n";
                    }
                    else
                    {
                        specialDateText += ", ";
                    }
                }
                specialDateText += arrSpecialDates[i].text;
            }
            if(arrSpecialDates[i].clientSpecialDateClickFunction.length > 0)
            {
                specialDateOnClick += "eval(" + arrSpecialDates[i].clientSpecialDateClickFunction + "(new Date(" + y + "," + m + "," + d + ")));";
            }
        }
        if(arrSpecialDates.length > 0)
        {
            specialDateSelectable = false;
        }
        for(var i=0; i<arrSpecialDates.length; i++)
        {
            if(arrSpecialDates[i].selectable == true)
            {
                specialDateSelectable = true;
                break;
            }
        }
    }
    var o = "";
    if(this.params.showWeekNumbers && dayOfWeek == this.params.firstDayOfWeek && this.params.firstDayOfWeek == 0)
    {
        var when = new Date(y,m,d);
        var newYear = new Date(y,0,1);
        var offset = 7 + 1 - newYear.getDay();
        if (offset == 8) offset = 1;
        var daynum = ((Date.UTC(y,m,d,0,0,0) - Date.UTC(y,0,1,0,0,0)) /1000/60/60/24) + 1;
        var weeknum = Math.floor((daynum-offset+7)/7);
        if (weeknum == this.params.firstDayOfWeek)
        {
            y--;
            var prevNewYear = new Date(y,0,1);
            var prevOffset = 7 + 1 - prevNewYear.getDay();
            if (prevOffset == 2 || prevOffset == 8) weeknum = 53;
            else weeknum = 52;
        }
        o += "<td" + this.buildStyleAttributes(this.params.weekNumberStyle, this.params.weekNumberStyleCssClass) + ">" + weeknum + "</td>";
    }
    o += "<td" + this.buildStyleAttributes(styleToUse, styleCssClassToUse);
    o += " title=\"" + specialDateText + "\"";
    if(this.params.dayStatusBarText.length > 0)
    {
        var statusText = this.params.dayStatusBarText;
        if(statusText.indexOf("{0}") != -1)
        {
            var dateText = this.formatDate(curDate);
            statusText = statusText.replace("{0}", dateText);
        }
        o += " onmouseover=\"window.status = '" + statusText + "';return true;\"";
        o += " onmouseout=\"window.status = '';return true;\"";
    }
    o += ">";
    var onClick = "basicDatePicker.selectDate(" + y + "," + m + "," + d + ", true);" + specialDateOnClick;
    if(type == "current" || type == "prev" && this.params.showDaysInPrevMonth || type == "next" && this.params.showDaysInNextMonth)
    {
        if(specialDateSelectable == true&& ((isWeekDay && this.params.selectableWeekDays || !isWeekDay && this.params.selectableWeekendDays)&& (type == "current" || type == "prev" && this.params.selectablePrevMonthDays || type == "next" && this.params.selectableNextMonthDays)&& (!this.params.maximumDate || this.params.maximumDate >= curDate) && (!this.params.minimumDate || this.params.minimumDate <= curDate)))
        {
            o += "<a href=\"javascript:void(0);" + onClick.replace("{0}",d) + "\" title=\"" + specialDateText + "\">" + d + "</a>";
        }
        else
        {
            o += d;
        }
    }
    else
    {
        o += "&nbsp;";
    }
    o += "</td>";
    if(!this.isNS6 && this.params.onClientDayRender.length > 0 && eval("window." + this.params.onClientDayRender))
    {
        var objectConverterDIV = document.createElement("DIV");
        objectConverterDIV.innerHTML = "<table><tr>" + o + "</tr></table>";
        var newTD = eval(this.params.onClientDayRender + "(this, curDate , objectConverterDIV.firstChild.firstChild.firstChild.firstChild )");
        if(newTD != null && newTD.tagName && newTD.tagName == "TD")
        {
            var objectConverterTR = document.createElement("TR");
            objectConverterTR.appendChild(newTD);
            return objectConverterTR.innerHTML;
        }
    }
    return o;
};
BasicDatePicker.prototype.getStyle = function(el, property)
{
    var value = null;
    var dv = document.defaultView;
    if (el.style[property])
    {
        value = el.style[property];
    }
    else if (el.currentStyle && el.currentStyle[property])
    {
        value = el.currentStyle[property];
    }
    else if ( dv && dv.getComputedStyle )
    {
        var converted = "";
        for(var i = 0, len = property.length;i < len; ++i)
        {
            converted = (property.charAt(i) == property.charAt(i).toUpperCase()) ? converted + '-' + property.charAt(i).toLowerCase() : converted + property.charAt(i);
        }
        if (dv.getComputedStyle(el, "") && dv.getComputedStyle(el, "").getPropertyValue(converted))
        {
            value = dv.getComputedStyle(el, "").getPropertyValue(converted);
        }
    }
    return value;
};
BasicDatePicker.prototype.findPosition = function(el)
{
    if (el.parentNode === null)
    {
        return null;
    }
    var parent = null, box, pos =
    {
        x: 0, y: 0
    };
    if (el.getBoundingClientRect)
    {
        box = el.getBoundingClientRect();
        var scrollTop = Math.max(document.documentElement.scrollTop, document.body.scrollTop);
        var scrollLeft = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft);
        pos.x = box.left + scrollLeft;
        pos.y = box.top + scrollTop;
        return pos;
    }
    else if (document.getBoxObjectFor)
    {
        box = document.getBoxObjectFor(el);
        var borderLeft = parseInt(this.getStyle(el, "borderLeftWidth"));
        var borderTop = parseInt(this.getStyle(el, "borderTopWidth"));
        pos.x = box.x - borderLeft;
        pos.y = box.y - borderTop;
    }
    else
    {
        pos.x = el.offsetLeft;
        pos.y = el.offsetTop;
        parent = el.offsetParent;
        if (parent != el)
        {
            while (parent)
            {
                pos.x += parent.offsetLeft;
                pos.y += parent.offsetTop;
                parent = parent.offsetParent;
            }
        }
        if (this.isOpera || this.isSafari && this.getStyle(el, "position") == "absolute" )
        {
            pos.x -= document.body.offsetLeft;
            pos.y -= document.body.offsetTop;
        }
    }
    parent = (el.parentNode) ? el.parentNode : null;
    while (parent && parent.tagName.toLowerCase() != "body" && parent.tagName.toLowerCase() != "html")
    {
        pos.x -= parent.scrollLeft;
        if(!this.isOpera)
        {
            pos.y -= parent.scrollTop;
        }
        parent = (parent.parentNode) ? parent.parentNode : null;
    }
    return pos;
};
BasicDatePicker.prototype.viewNextMonth = function()
{
    var nextMonth = this.viewingMonth + 1;
    var nextMonthYear = this.viewingYear;
    if (nextMonth > 11)
    {
        nextMonth = 0;
        nextMonthYear++;
    }
    if(!this.wireUpCustomEvent("onClientBeforeVisibleMonthChanged",new Date(nextMonthYear, nextMonth, 1)))
    {
        return false; //TEST
    }
    this.viewingMonth = nextMonth;
    this.viewingYear = nextMonthYear;
    this.buildCalendar();
    if(!this.wireUpCustomEvent("onClientAfterVisibleMonthChanged"))
    {
        return false; //TEST
    }
};
BasicDatePicker.prototype.viewPrevMonth = function()
{
    var prevMonth = this.viewingMonth - 1;
    var prevMonthYear = this.viewingYear;
    if (prevMonth < 0)
    {
        prevMonth = 11;
        prevMonthYear--;
    }
    if(!this.wireUpCustomEvent("onClientBeforeVisibleMonthChanged",new Date(prevMonthYear, prevMonth, 1)))
    {
        return false; //TEST
    }
    this.viewingMonth = prevMonth;
    this.viewingYear = prevMonthYear;
    this.buildCalendar();
    if(!this.wireUpCustomEvent("onClientAfterVisibleMonthChanged"))
    {
        return false; //TEST
    }
};
BasicDatePicker.prototype.wireUpCustomEvent = function(arg1, arg2)
{
    var r, f = this.params[arg1];
    if(f != null && f.length > 0 && window[f])
    {
        r = window[f](this, arg2);
    };
    return (r == false) ? false : true;
};
BasicDatePicker.prototype.clearSelectedDate = function()
{
    this.clear();
    if(this.valueElement.style.display != "none" && !this.valueElement.disabled)
    {
        this.valueElement.focus();
    }
    this.hidePopUp();
};
BasicDatePicker.prototype.selectDate = function(y, m, d, hide)
{
    if((d) == null || (d) == 0) return false; //TEST
    this.selectedYear = y, this.selectedMonth = m, this.selectedDay = d;
    this.viewingYear = y, this.viewingMonth = m;
    var prevFormattedDate = this.valueElement.value;
    var newDate = new Date(this.selectedYear, this.selectedMonth, this.selectedDay,0,0,0);
    if(newDate.getTime() == this.params.nullDate.getTime())
    {
        newDate = null;
    }
    var formattedDate = this.formatDate(newDate);
    if(prevFormattedDate != formattedDate)
    {
        if(!this.wireUpCustomEvent("onClientBeforeSelectionChanged",new Date(this.selectedYear, this.selectedMonth, this.selectedDay)))
        {
            return false; //TEST
        }
        if(this.params.displayType == "Button")
        {
            this.buttonElement.value = formattedDate;
        }
        else if(this.params.displayType == "HyperLink")
        {
            this.buttonElement.innerHTML = formattedDate;
        }
        else if(this.labelElement)
        {
            this.labelElement.innerHTML = formattedDate;
        }
        this.valueElement.value = formattedDate;
        this.clearTimers();
        if(!this.wireUpCustomEvent("onClientAfterSelectionChanged"))
        {
            return false; //TEST
        }
        if(this.params.autoPostBack && hide)
        {
            eval(this.params.postBackFunction);
        }
        if(this.params.displayType == "TextBox" || this.params.displayType.indexOf("TextBox") != -1 && this.params.openCalendarOnTextBoxFocus)
        {
            this.cancelFocus = true;
        }
        if(this.valueElement.style.display != "none" && this.cancelFocus)
        {
            this.valueElement.focus();
        }
    }
    if(hide)
    {
        this.hidePopUp();
    }
};
BasicDatePicker.prototype.padWithZero = function(num)
{
    return (num< 10) ? "0" + num : num;
};
BasicDatePicker.prototype.formatDate = function(date)
{
    if(date)
    {
        var y = date.getFullYear(), m = date.getMonth(), d = date.getDate(), dow = date.getDay();
        var finalDate = this.params.dateFormat;
        finalDate = finalDate.replace("yyyy",y);
        finalDate = finalDate.replace("yy",this.padWithZero(y%100));
        finalDate = finalDate.replace("dddd","{0}");
        finalDate = finalDate.replace("ddd","{1}");
        finalDate = finalDate.replace("dd","{2}");
        finalDate = finalDate.replace("d","{3}");
        finalDate = finalDate.replace("MMMM","{4}");
        finalDate = finalDate.replace("MMM","{5}");
        finalDate = finalDate.replace("MM","{6}");
        finalDate = finalDate.replace("M","{7}");
        finalDate = finalDate.replace("{0}",this.params.culture.dayNames[dow]);
        finalDate = finalDate.replace("{1}",this.params.culture.dayNamesAbbr[dow]);
        finalDate = finalDate.replace("{2}",this.padWithZero(d));
        finalDate = finalDate.replace("{3}",d);
        finalDate = finalDate.replace("{4}",this.params.culture.monthNames[m]);
        finalDate = finalDate.replace("{5}",this.params.culture.monthNamesAbbr[m]);
        finalDate = finalDate.replace("{6}",this.padWithZero(m+1));
        finalDate = finalDate.replace("{7}",m+1);
        return finalDate;
    }
    else
    {
        return null;
    }
};
BasicDatePicker.prototype.parseDate = function(valueString)
{
    this.isDate = false;
    if(valueString && valueString != null && valueString.length > 0 && valueString != this.params.nullDateText)
    {
        var format = this.params.dateFormat;
        var i_value = 0, i_format = 0;
        var c, token;
        var x,y;
        var year = null, month = null, date = null;
        while(i_format < format.length)
        {
            c = format.charAt(i_format);
            token = "";
            while((format.charAt(i_format) == c) && (i_format < format.length))
            {
                token += format.charAt(i_format++);
            }
            switch(token)
            {
                case "d" :case "dd" :date = this.getInt(valueString, i_value, 1, 2);
                if(!date)
                {
                    return null
                };
                i_value += date.length;
                date = parseInt(date, 10);
                break;
                case "ddd" :for(var i=0;
                i<this.params.culture.dayNamesAbbr.length;
                i++)
                {
                    var dayName = this.params.culture.dayNamesAbbr[i];
                    if(valueString.substring(i_value,i_value+dayName.length).toLowerCase() == dayName.toLowerCase())
                    {
                        i_value += dayName.length;
                        break;
                    }
                }
                break;
                case "dddd" :for(var i=0;
                i<this.params.culture.dayNames.length;
                i++)
                {
                    var dayName = this.params.culture.dayNames[i];
                    if(valueString.substring(i_value,i_value+dayName.length).toLowerCase() == dayName.toLowerCase())
                    {
                        i_value += dayName.length;
                        break;
                    }
                }
                break;
                case "M" :case "MM":month = this.getInt(valueString,i_value,1,2);
                if(!month)
                {
                    return null
                };
                i_value += month.length;
                month = parseInt(month, 10)-1;
                break;
                case "MMM" :for(var i=0;
                i<this.params.culture.monthNamesAbbr.length;
                i++)
                {
                    var monthName = this.params.culture.monthNamesAbbr[i];
                    if(valueString.substring(i_value,i_value+monthName.length).toLowerCase() == monthName.toLowerCase())
                    {
                        month = i;
                        i_value += monthName.length;
                        break;
                    }
                }
                break;
                case "MMMM" :for(var i=0;
                i<this.params.culture.monthNames.length;
                i++)
                {
                    var monthName = this.params.culture.monthNames[i];
                    if(valueString.substring(i_value,i_value+monthName.length).toLowerCase() == monthName.toLowerCase())
                    {
                        month = i;
                        i_value += monthName.length;
                        break;
                    }
                }
                break;
                case "yy" :case "yyyy" :if(token == "yyyy")
                {
                    x = 1;
                    y = 4;
                }
                if(token == "yy")
                {
                    x = 1;
                    y = 2;
                }
                var valuePart = valueString.substring(i_value, i_value + y);
                if(valuePart != null && token == "yyyy" && valuePart.length <= 4 && !valuePart.isNumeric() && valuePart.indexOf("/") < 1 && valuePart.indexOf("-") < 1 && valuePart.indexOf(" ") < 1)
                {
                    return false; //TEST
                }
                year = this.getInt(valueString, i_value, x, y);
                if(year != null)
                {
                    i_value += year.length;
                    if (year.length <= 2)
                    {
                        year = this.getFullYear(year);
                    }
                }
                break;
                default :i_value += token.length;
            }
        }
        if(year == null || isNaN(year))
        {
            year = this.todayYear;
        }
        if(date == null || month == null || isNaN(date) || isNaN(month) || date == 0 || month < 0)
        {
            var tempDate = this.tryParseDate(valueString, this.params.dateOrder);
            if(tempDate == null)
            {
                return null;
            }
            else
            {
                this.isDate = true;
                this.selectDate(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate());
                return new Date(tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate());
            }
        }
        else
        {
            if(date > this.dateCounts[month] || month > 11 || new Date(year, month, date) == this.params.nullDate)
            {
                return null;
            }
            this.isDate = true;
            this.selectDate(year, month, date);
            return new Date(year, month, date);
        }
    }
    else
    {
        if(valueString != null)
        {
            this.clear();
            this.isDate = true;
        }
        return null;
    }
};
BasicDatePicker.prototype.getFullYear = function(year)
{
    if (year > this.params.twoDigitYearBreak)
    {
        year = 1900+(year-0);
        return year;
    }
    else
    {
        year = 2000+(year-0);
        return year;
    }
};
BasicDatePicker.prototype.tryParseDate = function(val, dateOrder)
{
    var yearFirstExp = new RegExp("^\\s*((\\d{4})|(\\d{2}))([,.-/ ]|\\. ?)(\\d{1,2})\\4(\\d{1,2})\\s*$");
    m = val.match(yearFirstExp);
    var d1, m1, y1;
    if (m != null && m[2] && (m[2].length == 4 || dateOrder == "ymd"))
    {
        d1 = m[6];
        m1 = m[5];
        y1 = (m[2].length == 4) ? m[2] : this.getFullYear(parseInt(m[3], 10))
    }
    else
    {
        if (dateOrder == "ymd")
        {
            return null;
        }
        var yearLastExp = new RegExp("^\\s*(\\d{1,2})([,.-/ ]|\\. ?)(\\d{1,2})\\2((\\d{4})|(\\d{2}))\\s*$");
        m = val.match(yearLastExp);
        if (m == null)
        {
            return null;
        }
        if (dateOrder == "mdy")
        {
            if(m[1].isNumeric() && m[1] < 12)
            {
                d1 = m[3];
                m1 = m[1];
            }
            else
            {
                return this.tryParseDate(val, "dmy");
            }
        }
        else
        {
            d1 = m[1];
            m1 = m[3];
        }
        y1 = (m[5] && m[5].length == 4) ? m[5] : this.getFullYear(parseInt(m[6], 10))
    }
    m1 -= 1;
    var date = new Date(y1, m1, d1);
    if (y1 < 100)
    {
        date.setFullYear(y1);
    }
    return (date != null) ? date : null;
};
BasicDatePicker.prototype.getInt = function(str,i,minlength,maxlength)
{
    for(var x=maxlength; x>=minlength; x--)
    {
        var valuePart = str.substring(i, i + x);
        if(valuePart.length < minlength)
        {
            return null;
        }
        if(valuePart.isNumeric())
        {
            return valuePart;
        }
    }
    return null;
};
BasicDatePicker.prototype.ehKeyPress = function(e)
{
    if(!e) e = window.event;
    if(e.keyCode == 9) basicDatePicker.hidePopUp();
};
BasicDatePicker.prototype.ehPopUpClick = function(e)
{
    basicDatePicker.stayOpen = true;
};
BasicDatePicker.prototype.ehDocumentClick = function()
{
    (!basicDatePicker.stayOpen) ? basicDatePicker.hidePopUp() : basicDatePicker.stayOpen = false;
};
BasicDatePicker.prototype.ehPrevMonthMouseDown = function()
{
    basicDatePicker.interval = setInterval("basicDatePicker.viewPrevMonth()",200);
};
BasicDatePicker.prototype.ehNextMonthMouseDown = function()
{
    basicDatePicker.interval = setInterval("basicDatePicker.viewNextMonth()",200);
};
BasicDatePicker.prototype.ehUpYearMouseDown = function(baseYear)
{
    basicDatePicker.interval = setInterval("basicDatePicker.buildYearSelectorLinks(" + (baseYear-1) + ", -1)",90);
};
BasicDatePicker.prototype.ehDownYearMouseDown = function(baseYear)
{
    basicDatePicker.interval = setInterval("basicDatePicker.buildYearSelectorLinks(" + (baseYear-1) + ", 1)",90);
};
BasicDatePicker.prototype.ehMonthSelectorClick = function(oSpan)
{
    this.hideSelectors();
    if(!this.monthSelector)
    {
        this.monthSelector = document.createElement("DIV");
        with(this.monthSelector)
        {
            id = "basicDatePickerMonthSelector";
            className = "bdpMonthSelector";
            style.position = "absolute";
            style.zIndex = "1001";
        }
        document.body.appendChild(this.monthSelector);
    }
    this.monthSelector.innerHTML = "";
    var o = "";
    var monthNames = this.params.culture.monthNames;
    for(var i=0; i < monthNames.length; i++)
    {
        var className = (i == this.viewingMonth) ? "bdpMonthSelectorSelectedItem" : "bdpMonthSelectorItem";
        o += "<a href=\"javascript:void(0);\" onclick=\"basicDatePicker.ehMonthSelectorMonthClick(" + i + ");\" class=\"" + className + "\">" + monthNames[i] + "</a>";
    }
    this.monthSelector.innerHTML = o;
    var pos = this.findPosition(oSpan);
    this.monthSelector.style.top = (parseInt(pos.y + oSpan.offsetHeight + this.params.monthSelectorYOffset)) + "px";
    this.monthSelector.style.left = (parseInt(pos.x + this.params.monthSelectorXOffset)) + "px";
    this.monthSelectorShim = this.showShim(this.monthSelectorShim, this.monthSelector);
    this.monthSelector.style.visibility = "visible";
};
BasicDatePicker.prototype.ehMonthSelectorMonthClick = function(newViewingMonth)
{
    if(!this.wireUpCustomEvent("onClientBeforeVisibleMonthChanged",new Date(this.viewingYear, newViewingMonth, 1)))
    {
        return false; //TEST
    }
    this.viewingMonth = newViewingMonth;
    this.buildCalendar();
    this.ehPopUpClick();
    if(!this.wireUpCustomEvent("onClientAfterVisibleMonthChanged"))
    {
        return false; //TEST
    }
};
BasicDatePicker.prototype.ehYearSelectorClick = function(oSpan)
{
    this.hideSelectors();
    if(!this.yearSelector)
    {
        this.yearSelector = document.createElement("DIV");
        with(this.yearSelector)
        {
            id = "basicDatePickerYearSelector";
            className = "bdpYearSelector";
            style.position = "absolute";
            style.zIndex = "1001";
        }
        document.body.appendChild(this.yearSelector);
    }
    this.buildYearSelectorLinks(this.viewingYear);
    var pos = this.findPosition(oSpan);
    this.yearSelector.style.top = (parseInt(pos.y + oSpan.offsetHeight + this.params.monthSelectorYOffset)) + "px";
    this.yearSelector.style.left = (parseInt(pos.x + this.params.monthSelectorXOffset)) + "px";
    this.yearSelectorShim = this.showShim(this.yearSelectorShim, this.yearSelector);
    this.yearSelector.style.visibility = "visible";
};
BasicDatePicker.prototype.ehYearSelectorYearClick = function(newViewingYear)
{
    if(!this.wireUpCustomEvent("onClientBeforeVisibleMonthChanged",new Date(newViewingYear, this.viewingMonth, 1)))
    {
        return false; //TEST
    }
    this.viewingYear = newViewingYear;
    this.buildCalendar();
    this.ehPopUpClick();
    if(!this.wireUpCustomEvent("onClientAfterVisibleMonthChanged"))
    {
        return false; //TEST
    }
};
BasicDatePicker.prototype.buildYearSelectorLinks = function(baseYear, optTimeoutChange)
{
    var p, m, o = "";
    this.yearSelector.innerHTML = "";
    switch(this.params.upDownYearSelectorFormat)
    {
        case "Image":p = "<img src=\"" + this.params.upYearSelectorImageUrl + "\"";
        var pWidthHeight = (this.params.upDownYearSelectorImageWidth != "") ? "width:" + this.params.upDownYearSelectorImageWidth + ";" : "";
        pWidthHeight += (this.params.upDownYearSelectorImageHeight != "") ? "height:" + this.params.upDownYearSelectorImageHeight + ";" : "";
        if(pWidthHeight != "") p += " style=\"" + pWidthHeight + "\"";
        p += " border=\"0\" />";
        m = "<img src=\"" + this.params.downYearSelectorImageUrl + "\"";
        var mWidthHeight = (this.params.upDownYearSelectorImageWidth != "") ? "width:" + this.params.upDownYearSelectorImageWidth + ";" : "";
        mWidthHeight += (this.params.upDownYearSelectorImageHeight != "") ? "height:" + this.params.upDownYearSelectorImageHeight + ";" : "";
        if(mWidthHeight != "") m += " style=\"" + mWidthHeight + "\"";
        m += " border=\"0\" />";
        break;
        case "CustomText":default:p = this.params.downYearSelectorText;
        m = this.params.upYearSelectorText;
        break;
    }
    baseYear = (optTimeoutChange != null) ? (this.yearInc + optTimeoutChange) : parseInt(baseYear);
    o = "<a href=\"javascript:void(0);\" onclick=\"basicDatePicker.buildYearSelectorLinks(" + (baseYear-1) + ");\" onmousedown=\"basicDatePicker.clearTimers();basicDatePicker.timeout = setTimeout('basicDatePicker.ehUpYearMouseDown(" + baseYear + ")', 300);if(basicDatePicker.isOpera || basicDatePicker.isSafari)basicDatePicker.ehPopUpClick();\" onmouseup=\"basicDatePicker.clearTimers();\" onmouseout=\"basicDatePicker.clearTimers();\" class=\"bdpYearSelectorImg\">" + p + "</a>";
    for(var i=(baseYear-4); i <= (baseYear+4); i++)
    {
        var className = (i == this.viewingYear) ? "bdpYearSelectorSelectedItem" : "bdpYearSelectorItem";
        o += "<a href=\"javascript:void(0);\" onclick=\"basicDatePicker.ehYearSelectorYearClick(" + i + ");\" class=\"" + className + "\">" + i + "</a>";
    }
    o += "<a href=\"javascript:void(0);\" onclick=\"basicDatePicker.buildYearSelectorLinks(" + (baseYear+1) + ");\" onmousedown=\"basicDatePicker.clearTimers();basicDatePicker.timeout = setTimeout('basicDatePicker.ehDownYearMouseDown(" + baseYear + ")', 300);if(basicDatePicker.isOpera || basicDatePicker.isSafari)basicDatePicker.ehPopUpClick();\" onmouseup=\"basicDatePicker.clearTimers();\" onmouseout=\"basicDatePicker.clearTimers();\" class=\"bdpYearSelectorImg\">" + m + "</a>";
    var children = this.yearSelector.childNodes;
    if(children)
    {
        for(var i=0;i<children.length;i++)
        {
            this.yearSelector.removeChild(children[i]);
        }
    }
    this.yearSelector.innerHTML = o;
    this.yearInc = baseYear;
};
BasicDatePicker.prototype.ehFocus = function(valueElement)
{
    this.inputFocusValue = valueElement.value;
};
BasicDatePicker.prototype.tokenizeFormat = function(format)
{
    var self = this;
var formatCondition = function(i_format, format, c)
{
    return ((i_format < format.length) && (format.charAt(i_format) == c));
};
return basicDatePicker.tokenize(format, formatCondition);
};
BasicDatePicker.prototype.tokenizeSpeedDate = function(text)
{
    var self = this;
var formatCondition = function(i_format, format, c)
{
    return (((i_format < format.length) && (format.charAt(i_format) == c)) || ((i_format < format.length) && format.charAt(i_format).isNumeric()));
};
return basicDatePicker.tokenize(text, formatCondition);
};
BasicDatePicker.prototype.tokenize = function(format, formatCondition)
{
    if(format != null && format.length > 0)
    {
        var tokens = new Array();
        var i_format = 0,c,token;
        while(i_format < format.length)
        {
            c = format.charAt(i_format);
            token = "";
            while(formatCondition(i_format, format, c))
            {
                token += format.charAt(i_format++);
            };
            tokens[tokens.length] = token;
        };
    };
    return tokens;
};
BasicDatePicker.prototype.selectRange = function(e, start, length)
{
    var s = (!start || start < 1) ? 0 : start;
    var l = (isNaN(length) || length < 0) ? 1 : length;
    if(e.createTextRange)
    {
        var r = e.createTextRange();
        r.moveStart("character",s);
        r.moveEnd("character",s + l - e.value.length);
        r.select();
    }
    else if(e.setSelectionRange)
    {
        e.setSelectionRange(s, s + l);
    }
    e.focus();
};
BasicDatePicker.prototype.getPositionStart = function(e)
{
    if(e.createTextRange)
    {
        var c = document.selection.createRange().duplicate();
        c.moveEnd("character",e.value.length);
        var s = e.value.lastIndexOf(c.text);
        if(c.text.trim().lenth < 1)
        {
            s = e.value.length;
        }
        return s;
    }
    else
    {
        return e.selectionStart;
    }
};
BasicDatePicker.prototype.keyPress = function(event, e, bdpId)
{
    var bdp = (bdpId) ? BasicDatePickerLoadControl(bdpId) : this;
    var c = this.getKeyCode(event);
    var s = this.getPositionStart(e);
    if(c == (8 || 9))
    {
        return false; //TEST
    }
    if((c == 33 || c == 34 || c == 38 || c == 40) && !bdp.getIsNull())
    {
        switch(c)
        {
            case 38 : if(event.ctrlKey) bdp.setSelectedDate(bdp.getSelectedDate().addYears(1));
            else if (event.altKey) bdp.setSelectedDate(bdp.getSelectedDate().addMonths(1));
            else bdp.setSelectedDate(bdp.getSelectedDate().addDays(1));
            this.selectRange(e, s, 1);
            break;
            case 40 : if(event.ctrlKey) bdp.setSelectedDate(bdp.getSelectedDate().addYears(-1));
            else if (event.altKey) bdp.setSelectedDate(bdp.getSelectedDate().addMonths(-1));
            else bdp.setSelectedDate(bdp.getSelectedDate().addDays(-1));
            this.selectRange(e, s, 1);
            break;
        };
    }
};
BasicDatePicker.prototype.getKeyCode = function(e)
{
    return e.keyCode ? e.keyCode : e.which ? e.which : e.charCode;
};
BasicDatePicker.prototype.speedDate = function()
{
    var text = this.phraseChecks(this.valueElement.value.toLowerCase().trim()), date = null;
    var tryDate = this.parseDate(text);
    if(text.length < 1 || this.isDate)
    {
        return false; //TEST
    }
    var firstChar = text.charAt(0);
    var firstTwoChar = text.substring(0,2);
    var t = (text == "t" || firstTwoChar == "t+" || firstTwoChar == "t-");
    var hasOperator = (firstChar == "+" || firstChar == "-" || firstTwoChar.indexOf("+") != -1 || firstTwoChar.indexOf("-") != -1);
    var isNumber = (text.isNumeric() && text <= this.dateCounts[new Date().getMonth()]);
    if(!t && !isNumber && !hasOperator && (this.params.dateFormat.indexOf("-") != -1))
    {
        return false; //TEST
    }
    if((t || hasOperator || isNumber))
    {
        if(this.inputFocusValue && this.inputFocusValue.trim().length > 0)
        {
            date = this.parseDate(this.inputFocusValue);
        }
        var tokens = this.tokenizeSpeedDate(text);
        if(date == null || isNumber)
        {
            date = new Date(this.todayYear, this.todayMonth, this.todayDate,0,0,0)
        };
        if(this.hasTimePicker())
        {
            var time = window[this.params.timePicker].getSelectedTime();
            if(time != null)
            {
                date.setHours(time.getHours()), date.setMinutes(time.getMinutes()), date.setSeconds(time.getSeconds());
            }
        }
        if(isNumber)
        {
            date.setDate(text);
        }
        if(t)
        {
            date.setDate(this.todayDate);
        }
        if(hasOperator)
        {
            var increment = (t) ? parseInt(tokens[1], 10) : parseInt(tokens[0], 10);
            var datePart = (t) ? tokens[2] : tokens[1];
            date = (text == "+" || text == "t+") ? date.addDays(1) : date;
            date = (text == "-" || text == "t-") ? date.addDays(-1) : date;
            if(datePart && increment)
            {
                switch(datePart)
                {
                    case "d" : date = date.addDays(increment);
                    break;
                    case "m" : date = date.addMonths(increment);
                    break;
                    case "y" : date = date.addYears(increment);
                    break;
                };
            }
            else if(increment)
            {
                date = date.addDays(increment);
            };
        };
    };
    if(date != null)
    {
        this.setSelectedDate(date);
        this.inputFocusValue = this.getSelectedDateFormatted();
    }
    else
    {
        this.inputFocusValue = this.valueElement.value;
    }
};
BasicDatePicker.prototype.ehBlur = function(buttonElement, valueElement, params)
{
    this.buttonElement = buttonElement;
    this.valueElement = valueElement;
    this.params = this.loadParams(params);
    if(this.valueElement.value != this.inputFocusValue)
    {
        if(!this.wireUpCustomEvent("onClientBeforeSelectionChanged",this.getSelectedDate()))
        {
            return false; //TEST
        };
        this.speedDate();
        if(!this.wireUpCustomEvent("onClientAfterSelectionChanged"))
        {
            return false; //TEST
        };
        if(this.params.autoPostBack)
        {
            eval(basicDatePicker.params.postBackFunction);
        };
    };
    if(this.params.displayType != "TextBox" && !this.params.openCalendarOnTextBoxFocus)
    {
        this.reset();
    };
};
BasicDatePicker.prototype.reset = function()
{
    this.selectedMonth = null;
    this.selectedDay = null;
    this.selectedYear = null;
    this.viewingMonth = null;
    this.viewingYear = null;
    this.params = null;
};
BasicDatePicker.prototype.loadParams = function(params)
{
    params.culture = eval(params.culture);
    if(params.firstDayOfWeek == 7)
    {
        params.firstDayOfWeek = params.culture.firstDayOfWeek;
    }
    return params;
};
function BasicDatePickerLoadControl(bdpId)
{
    var bdp = new BasicDatePicker(true);
    bdp.params = bdp.loadParams(eval(bdpId + "Params"));
    bdp.valueElement = document.getElementById(bdpId + "_textBox");
    bdp.labelElement = null;
    switch(bdp.params.displayType)
    {
        case "TextBoxAndButton":bdp.buttonElement = document.getElementById(bdpId + "_button");
        break;
        case "TextBoxAndHyperLink":bdp.buttonElement = document.getElementById(bdpId + "_hyperLink");
        break;
        case "TextBoxAndImage":bdp.buttonElement = document.getElementById(bdpId + "_image");
        break;
        case "TextBox":bdp.buttonElement = document.getElementById(bdpId + "_textBox");
        break;
        case "LabelAndButton":bdp.buttonElement = document.getElementById(bdpId + "_button");
        bdp.labelElement = document.getElementById(bdpId + "_label");
        break;
        case "LabelAndHyperLink":bdp.buttonElement = document.getElementById(bdpId + "_hyperLink");
        bdp.labelElement = document.getElementById(bdpId + "_label");
        break;
        case "LabelAndImage":bdp.buttonElement = document.getElementById(bdpId + "_image");
        bdp.labelElement = document.getElementById(bdpId + "_label");
        break;
        case "Label":bdp.buttonElement = document.getElementById(bdpId + "_label");
        bdp.labelElement = document.getElementById(bdpId + "_label");
        break;
        case "Button":bdp.buttonElement = document.getElementById(bdpId + "_button");
        break;
        case "HyperLink":bdp.buttonElement = document.getElementById(bdpId + "_hyperLink");
        break;
        case "Image":bdp.buttonElement = document.getElementById(bdpId + "_image");
        break;
    }
    return bdp;
};
BasicDatePicker.prototype.getControlId = function()
{
    return this.valueElement.parentNode.id;
};
BasicDatePicker.prototype.getMaximumDate = function(bdpId)
{
    var self = (bdpId) ? BasicDatePickerLoadControl(bdpId) : this;
    return self.params.maximumDate;
};
BasicDatePicker.prototype.setMaximumDate = function(date, bdpId)
{
    var self = (bdpId) ? BasicDatePickerLoadControl(bdpId) : this;
    self.params.maximumDate = date;
};
BasicDatePicker.prototype.getMinimumDate = function(bdpId)
{
    var self = (bdpId) ? BasicDatePickerLoadControl(bdpId) : this;
    return self.params.minimumDate;
};
BasicDatePicker.prototype.setMinimumDate = function(date, bdpId)
{
    var self = (bdpId) ? BasicDatePickerLoadControl(bdpId) : this;
    self.params.minimumDate = date;
};
BasicDatePicker.prototype.hasTimePicker = function()
{
    return (this.params.timePicker != null && this.params.timePicker.length > 0);
};
BasicDatePicker.prototype.setSelectedDate = function(date, bdpId)
{
    var self = (bdpId) ? BasicDatePickerLoadControl(bdpId) : this;
    if(!self.getEnabled())
    {
        return false; //TEST
    }
    if(date == null || date.getTime() == self.params.nullDate.getTime())
    {
        self.clear();
    }
    else
    {
        self.selectedYear = date.getFullYear();
        self.selectedMonth = date.getMonth();
        self.selectedDay = date.getDate();
        var formattedDate = self.formatDate(date);
        if(formattedDate == null)
        {
            formattedDate = "";
        }
        if(self.params.displayType == "Button")
        {
            self.buttonElement.value = formattedDate;
        }
        else if(self.params.displayType == "HyperLink")
        {
            self.buttonElement.innerHTML = formattedDate;
        }
        else if(self.labelElement)
        {
            self.labelElement.innerHTML = formattedDate;
        }
        self.valueElement.value = formattedDate;
    }
    if(self.hasTimePicker())
    {
        var time = (date != null) ? new BDP.TimeSpan(null, date.getHours(), date.getMinutes(), date.getSeconds()) : (window[self.params.timePicker].isNull()) ? null : window[self.params.timePicker].getSelectedTime();
        window[self.params.timePicker].setSelectedTime(time);
    }
};
BasicDatePicker.prototype.getSelectedDate = function(bdpId)
{
    var self = (bdpId) ? BasicDatePickerLoadControl(bdpId) : this;
    this.speedDate();
    var date = self.parseDate(self.valueElement.value);
    if(self.hasTimePicker())
    {
        var time = window[self.params.timePicker].getSelectedTime();
        if(time != null)
        {
            if(date == null) date = new Date();
            return date.addHours(time.getHours()).addMinutes(time.getMinutes()).addSeconds(time.getSeconds());
        }
    }
    return date;
};
BasicDatePicker.prototype.getSelectedDateFormatted = function(bdpId)
{
    var self = (bdpId) ? BasicDatePickerLoadControl(bdpId) : this;
    var text = self.valueElement.value.trim();
    return (text == "" || text == self.params.nullDateText) ? "" : text;
};
BasicDatePicker.prototype.getSelectedDateTimeFormatted = function(bdpId)
{
    var self = (bdpId) ? BasicDatePickerLoadControl(bdpId) : this;
    var text = self.valueElement.value.trim();
    var formattedDate = (text == "" || text == self.params.nullDateText) ? "" : text;
    if(self.hasTimePicker())
    {
        formattedDate += " " + window[self.params.timePicker].getSelectedTimeFormatted();
    }
    return formattedDate.trim();
};
BasicDatePicker.prototype.getSpecialDates = function(bdpId)
{
    var self = (bdpId) ? BasicDatePickerLoadControl(bdpId) : this;
    return (window[self.params.specialDates] && window[self.params.specialDates].dates.length > 0) ? window[self.params.specialDates] : null;
};
BasicDatePicker.prototype.getEnabled = function(bdpId)
{
    var self = (bdpId) ? BasicDatePickerLoadControl(bdpId) : this;
    return self.params.enabled;
};
BasicDatePicker.prototype.setEnabled = function(eVal, bdpId)
{
    var self = (bdpId) ? BasicDatePickerLoadControl(bdpId) : this;
    self.valueElement.disabled = !eVal;
    if(self.valueElement.parentElement)
    {
        self.valueElement.parentElement.disabled = !eVal;
    }
    if(self.buttonElement) self.buttonElement.disabled = !eVal;
    self.params.enabled = eVal;
};
BasicDatePicker.prototype.getIsDate = function(bdpId)
{
    var self = (bdpId) ? BasicDatePickerLoadControl(bdpId) : this;
    self.getSelectedDate();
    return self.isDate;
};
BasicDatePicker.prototype.getIsNull = function(bdpId)
{
    var self = (bdpId) ? BasicDatePickerLoadControl(bdpId) : this;
    return (self.getSelectedDate() == null);
};
BasicDatePicker.prototype.clear = function(bdpId)
{
    var self = (bdpId) ? BasicDatePickerLoadControl(bdpId) : this;
    var prevFormattedDate = self.valueElement.value;
    if(prevFormattedDate != self.params.nullDateText)
    {
        if(!self.wireUpCustomEvent("onClientBeforeSelectionChanged",null))
        {
            return false; //TEST
        }
        self.valueElement.value = self.params.nullDateText;
        self.clearDate = false;
        if(self.params.displayType == "Button")
        {
            self.buttonElement.value = self.params.buttonText;
        }
        else if(self.params.displayType == "HyperLink")
        {
            self.buttonElement.innerHTML = self.params.buttonText;
        }
        else if(self.labelElement)
        {
            self.labelElement.innerHTML = self.params.buttonText;
        }
        if(!self.wireUpCustomEvent("onClientAfterSelectionChanged"))
        {
            return false; //TEST
        }
        if(self.params.autoPostBack)
        {
            eval(self.params.postBackFunction);
        }
    }
    if(self.params.displayType == "TextBox" || self.params.displayType.indexOf("TextBox") != -1 && self.params.openCalendarOnTextBoxFocus)
    {
        self.cancelFocus = true;
    }
    if(self.hasTimePicker())
    {
        window[self.params.timePicker].clear();
    }
};
Date.prototype.addYears = function(number)
{
    return new Date(this.getFullYear() + parseInt(number), this.getMonth(), this.getDate(), this.getHours(), this.getMinutes(), this.getSeconds());
};
Date.prototype.addMonths = function(number)
{
    return new Date(this.getFullYear(), this.getMonth() + parseInt(number), this.getDate(), this.getHours(), this.getMinutes(), this.getSeconds());
};
Date.prototype.addDays = function(number)
{
    return (new Date(this.getTime() + (parseInt(number) * 24 * 60 * 60 * 1000)));
};
String.prototype.trim = function()
{
    var text = this.toString();
    while ((text.substring(0,1) == ' ') || (text.substring(0,1) == '\n') || (text.substring(0,1) == '\r'))
    {
        text = text.substring(1,text.length);
    }
    while ((text.substring(text.length-1,text.length) == ' ') || (text.substring(text.length-1,text.length) == '\n') || (text.substring(text.length-1,text.length) == '\r'))
    {
        text = text.substring(0,text.length-1);
    }
    return text;
};
String.prototype.stripAndClean = function()
{
    var temp = "";
    for (i = 0; i < this.length; i++)
    {
        if(this.charAt(i) != " ")
        {
            temp += this.charAt(i);
        }
    }
    return temp.toLowerCase();
};
Object.prototype.isNumeric = function()
{
    var digits="1234567890", self = this;
    for (var i=0; i < this.length; i++)
    {
        if (digits.indexOf(this.charAt(i))==-1)
        {
            return false;
        }
    }
    return true;
};
Object.prototype.isDate = function()
{
    return (this.constructor.toString().match(/Date/i) == "Date");
};
BasicDatePicker.prototype.phraseChecks = function(t)
{
    var r, n = t.stripAndClean(), f = this.params["onClientPreParse"];
    d = new Date();
    if(f != null && f.length > 0 && window[f])
    {
        r = window[f](this, t);
        if(r != null)
        {
            t = (r.isDate()) ? this.formatDate(r) : r;
        }
    };
    if(t.indexOf("today") != -1)
    {
        t = t.replace("today","t");
    };
    if(t == "tomorrow")
    {
        t = "t+1";
    };
    if(t == "yesterday")
    {
        t = "t-1";
    };
    if(n == "nextmonth")
    {
        d = d.addMonths(1);
        d.setDate(1);
        t = this.formatDate(d);
    };
    if(n == "lastmonth")
    {
        d = d.addMonths(-1);
        d.setDate(1);
        t = this.formatDate(d);
    };
    if(t.indexOf("day") != -1)
    {
        t = t.replace("days","d").replace("day","d");
    };
    if(t.indexOf("month") != -1)
    {
        t = t.replace("months","m").replace("month","m");
    };
    if(t.indexOf("year") != -1)
    {
        t = t.replace("years","y").replace("year","y");
    };
    return t;
};
var myoa_calendar_setup =
{
    onClientDayRender:"",
    onClientPreParse:"",
    onClientBeforeCalendarOpen:"",
    onClientBeforeCalendarClose:"",
    onClientAfterCalendarOpen:"",
    onClientBeforeSelectionChanged:"",
    onClientBeforeVisibleMonthChanged:"",
    onClientAfterVisibleMonthChanged:"",
    enabled:true,
    autoPostBack:false,
    selectableWeekDays:true,
    selectableWeekendDays:true,
    selectablePrevMonthDays:true,
    selectableNextMonthDays:true,
    maximumDate:null,
    minimumDate:null,
    twoDigitYearBreak:50,
    openCalendarOnTextBoxFocus:false,
    monthSelectorEnabled:true,
    yearSelectorEnabled:true,
    rows:1,
    columns:1,
    dayStatusBarText:"{0}",
    nullDateText:"",
    xOffset:0,
    yOffset:1,
    nextPrevMonthImageWidth:"5px",
    nextPrevMonthImageHeight:"9px",
    nextMonthText:"&gt;",
    prevMonthText:"&lt;",
    showWeekNumbers:false,
    showDaysInNextMonth:true,
    showDaysInPrevMonth:true,
    showTodayButton:true,
    todayButtonText:"今天",
    showNoneButton:true,
    noneButtonText:"清空",
    footNoteText:"",
    forceSixRows:true,
    firstDayOfWeek:7,
    dayNameFormat:"FirstLetter",
    displayType:"TextBoxAndImage",
    buttonText:"Calendar",
    nextPrevFormat:"Image",
    showDayHeader:true,
    showNextPrevMonth:true,
    showTitle:true,
    downYearSelectorImageFileName:"arrow_down.gif",
    upDownYearSelectorImageWidth:9,
    upDownYearSelectorImageHeight:5,
    upYearSelectorText:"+",
    downYearSelectorText:"-",
    upDownYearSelectorFormat:"Image",
    monthSelectorXOffset:-11,
    monthSelectorYOffset:2,
    yearSelectorXOffset:-11,
    yearSelectorYOffset:2,
    nullDate:new Date(1,0,1,0,0,0),
    visibleDate:null,
    dateOrder:"ymd",
    popUpStyle:"",
    popUpStyleCssClass:"bdpPopUp",
    calendarStyle:"",
    calendarStyleCssClass:"bdpCalendar",
    noneButtonStyle:"",
    noneButtonStyleCssClass:"bdpClearButton",
    todayButtonStyle:"",
    todayButtonStyleCssClass:"bdpTodayButton",
    titleStyle:"",
    titleStyleCssClass:"bdpTitle",
    nextPrevStyle:"",
    nextPrevStyleCssClass:"bdpNextPrev",
    dayHeaderStyle:"",
    dayHeaderStyleCssClass:"bdpDayHeader",
    dayStyle:"",
    dayStyleCssClass:"bdpDay",
    otherMonthDayStyle:"",
    otherMonthDayStyleCssClass:"bdpOtherMonthDay bdpDay",
    weekendDayStyle:"",
    weekendDayStyleCssClass:"bdpWeekendDay bdpDay",
    selectedDayStyle:"",
    selectedDayStyleCssClass:"bdpSelectedDay bdpDay",
    todayDayStyle:"",
    todayDayStyleCssClass:"bdpTodayDay bdpDay",
    footerStyle:"",
    footerStyleCssClass:"bdpFooter",
    footNoteStyle:"",
    footNoteStyleCssClass:"bdpFootNote",
    weekNumberStyle:"",
    weekNumberStyleCssClass:"bdpWeekNumber",
    otherMonthDayWeekendDayStyle:"",
    otherMonthDayWeekendDayStyleCssClass:"bdpOtherMonthDay bdpDay bdpWeekendDay bdpDay bdpDay",
    selectedDayTodayDayStyle:"",
    selectedDayTodayDayStyleCssClass:"bdpTodayDay bdpDay bdpSelectedDay bdpDay bdpDay",
    selectedDayWeekendDayStyle:"",
    selectedDayWeekendDayStyleCssClass:"bdpSelectedDay bdpDay bdpWeekendDay bdpDay bdpDay",
    todayDayWeekendDayStyle:"",
    todayDayWeekendDayStyleCssClass:"bdpTodayDay bdpDay bdpWeekendDay bdpDay bdpDay",
    timePicker:"",
    postBackFunction:"__doPostBack('HomePageExample1$BasicDatePicker1','')",
    dateFormat:"yyyy-MM-dd",
    culture:"BDPCulture_zh_CN",
    nextMonthImageUrl:"templates/images/calendar/arrow_right.gif",
    prevMonthImageUrl:"templates/images/calendar/arrow_left.gif",
    upYearSelectorImageUrl:"templates/images/calendar/arrow_up.gif",
    downYearSelectorImageUrl:"templates/images/calendar/arrow_down.gif",
    specialDates:""
};
var BDPCulture_zh_CN =
{
    monthNames:new Array("Jan","Feb","Mar","Apr","May","June","July","Aug","Sep","Oct","Nov","Dec"),
    monthNamesAbbr:new Array("Jan","Feb","Mar","Apr","May","June","July","Aug","Sep","Oct","Nov","Dec"),
    dayNames:new Array("Sun","Mon","Tue","Wed","Thr","Fri","Sat"),
    dayNamesAbbr:new Array("日","一","二","三","四","五","六"),
    firstDayOfWeek:0
};
basicDatePicker = new BasicDatePicker();

function calendar(obj)
{
    basicDatePicker.stayOpen = true;
    basicDatePicker.showPopUp(obj, obj, null, myoa_calendar_setup);
}

function month_x_2(obj)
{
    basicDatePicker.rows = 2;
    basicDatePicker.columns = 3;
    basicDatePicker.stayOpen = true;
    basicDatePicker.showPopUp(obj, obj, null, mx2);
}
var mx2 =
{
    onClientDayRender:"",
    onClientPreParse:"",
    onClientBeforeCalendarOpen:"",
    onClientBeforeCalendarClose:"",
    onClientAfterCalendarOpen:"",
    onClientBeforeSelectionChanged:"",
    onClientBeforeVisibleMonthChanged:"",
    onClientAfterVisibleMonthChanged:"",
    enabled:true,
    autoPostBack:false,
    selectableWeekDays:true,
    selectableWeekendDays:true,
    selectablePrevMonthDays:true,
    selectableNextMonthDays:true,
    maximumDate:null,
    minimumDate:null,
    twoDigitYearBreak:50,
    openCalendarOnTextBoxFocus:false,
    monthSelectorEnabled:true,
    yearSelectorEnabled:true,
    rows:2,
    columns:2,
    dayStatusBarText:"{0}",
    nullDateText:"",
    xOffset:0,
    yOffset:1,
    nextPrevMonthImageWidth:"5px",
    nextPrevMonthImageHeight:"9px",
    nextMonthText:"&gt;",
    prevMonthText:"&lt;",
    showWeekNumbers:false,
    showDaysInNextMonth:true,
    showDaysInPrevMonth:true,
    showTodayButton:true,
    todayButtonText:"今天",
    showNoneButton:true,
    noneButtonText:"清空",
    footNoteText:"",
    forceSixRows:true,
    firstDayOfWeek:7,
    dayNameFormat:"FirstLetter",
    displayType:"TextBoxAndImage",
    buttonText:"Calendar",
    nextPrevFormat:"Image",
    showDayHeader:true,
    showNextPrevMonth:true,
    showTitle:true,
    downYearSelectorImageFileName:"arrow_down.gif",
    upDownYearSelectorImageWidth:9,
    upDownYearSelectorImageHeight:5,
    upYearSelectorText:"+",
    downYearSelectorText:"-",
    upDownYearSelectorFormat:"Image",
    monthSelectorXOffset:-11,
    monthSelectorYOffset:2,
    yearSelectorXOffset:-11,
    yearSelectorYOffset:2,
    nullDate:new Date(1,0,1,0,0,0),
    visibleDate:null,
    dateOrder:"ymd",
    popUpStyle:"",
    popUpStyleCssClass:"bdpPopUp",
    calendarStyle:"",
    calendarStyleCssClass:"bdpCalendar",
    noneButtonStyle:"",
    noneButtonStyleCssClass:"bdpClearButton",
    todayButtonStyle:"",
    todayButtonStyleCssClass:"bdpTodayButton",
    titleStyle:"",
    titleStyleCssClass:"bdpTitle",
    nextPrevStyle:"",
    nextPrevStyleCssClass:"bdpNextPrev",
    dayHeaderStyle:"",
    dayHeaderStyleCssClass:"bdpDayHeader",
    dayStyle:"",
    dayStyleCssClass:"bdpDay",
    otherMonthDayStyle:"",
    otherMonthDayStyleCssClass:"bdpOtherMonthDay bdpDay",
    weekendDayStyle:"",
    weekendDayStyleCssClass:"bdpWeekendDay bdpDay",
    selectedDayStyle:"",
    selectedDayStyleCssClass:"bdpSelectedDay bdpDay",
    todayDayStyle:"",
    todayDayStyleCssClass:"bdpTodayDay bdpDay",
    footerStyle:"",
    footerStyleCssClass:"bdpFooter",
    footNoteStyle:"",
    footNoteStyleCssClass:"bdpFootNote",
    weekNumberStyle:"",
    weekNumberStyleCssClass:"bdpWeekNumber",
    otherMonthDayWeekendDayStyle:"",
    otherMonthDayWeekendDayStyleCssClass:"bdpOtherMonthDay bdpDay bdpWeekendDay bdpDay bdpDay",
    selectedDayTodayDayStyle:"",
    selectedDayTodayDayStyleCssClass:"bdpTodayDay bdpDay bdpSelectedDay bdpDay bdpDay",
    selectedDayWeekendDayStyle:"",
    selectedDayWeekendDayStyleCssClass:"bdpSelectedDay bdpDay bdpWeekendDay bdpDay bdpDay",
    todayDayWeekendDayStyle:"",
    todayDayWeekendDayStyleCssClass:"bdpTodayDay bdpDay bdpWeekendDay bdpDay bdpDay",
    timePicker:"",
    postBackFunction:"__doPostBack('HomePageExample1$BasicDatePicker1','')",
    dateFormat:"yyyy-MM-dd",
    culture:"BDPCulture_zh_CN",
    nextMonthImageUrl:"inc/arrow_right.gif",
    prevMonthImageUrl:"inc/arrow_left.gif",
    upYearSelectorImageUrl:"inc/arrow_up.gif",
    downYearSelectorImageUrl:"inc/arrow_down.gif",
    specialDates:""
};


function calendar_datetime(obj) //返回日期、时分秒
{
	time_exp = /^(\d|([0-1]\d)|(2[0-3])):(\d|([0-5]\d)):(\d|([0-5]\d))$/;
	var extra_time = '';
	d = new Date();
	if (obj.value.length<18) {
		extra_time = d.getHours() + ":" + d.getMinutes() + ":" + d.getSeconds();
	} else {
		extra_time = obj.value.substr(11, 8);
	}


	if (!time_exp.exec(extra_time)) { extra_time = d.getHours + ":" + d.getMinutes + ":" + d.getSeconds; }

    basicDatePicker.stayOpen = true;
	myoa_calendar_setup.dateFormat = 'yyyy-MM-dd ' + extra_time;
    basicDatePicker.showPopUp(obj, obj, null, myoa_calendar_setup);
}

function calendar_dt2(obj) //返回日期、时分
{
	time_exp = /^(\d|([0-1]\d)|(2[0-3])):(\d|([0-5]\d))$/;
	var extra_time = '';
	d = new Date();
	if (obj.value.length<15) {
		extra_time = d.getHours() + ":" + d.getMinutes();
	} else {
		extra_time = obj.value.substr(11, 5);
	}


	if (!time_exp.exec(extra_time)) { extra_time = d.getHours + ":" + d.getMinutes }

    basicDatePicker.stayOpen = true;
	myoa_calendar_setup.dateFormat = 'yyyy-MM-dd ' + extra_time;
    basicDatePicker.showPopUp(obj, obj, null, myoa_calendar_setup);
}

