function interfaceLoad() {
    Calendar.setup({ 
            date : getdate(currentDate),
            inputField : 'da0_id',
            button : 'da0_butt_id',
            flatCallback: sendDate,
            showsTime : false,
            timeFormat : '24',
            ifFormat : '%Y-%m-%d',
            flat : 'calendar'});
}

function getdate(string) {
    var d = new Date();
    if (string!='') {
        var regexp = /(\d{4})\D+(\d{1,2})\D+(\d{1,2}).*/;
        regexp.exec(string);
        d.setDate(1);d.setMonth(0);d.setFullYear(1900);
        d.setMilliseconds(0);d.setSeconds(0);d.setMinutes(0);d.setHours(0);
        d.setDate(RegExp["$3"]);d.setMonth(RegExp["$2"]-1);d.setFullYear(RegExp["$1"]);
    }
    return d;
}

function sendDate(calendar) {
    var y = calendar.date.getFullYear();
    var m = calendar.date.getMonth()+1;
    var d = calendar.date.getDate();
    m = m>9 ? m : "0"+m;
    d = d>9 ? d : "0"+d;
    document.getElementById('news_date_f').value = y+'-'+m+'-'+d;
    document.getElementById('sdate_form').submit();
}


