Date.prototype.cutTime = function() {
    var new_date = new Date(this.getFullYear(), this.getMonth(), this.getDate());
    this.setTime(new_date.getTime());
    return this;
}
Date.parseAWADString = function(date) {
    var arrDate = date.split('.');
    ResultDate = new Date(arrDate[2], arrDate[1] - 1, arrDate[0]);
    return ResultDate;
}
Date.prototype.toAWADString = function() {
    var tempDate = this.getDate();
    var tempMonth = this.getMonth() + 1;
    
    if (tempDate < 10)
        tempDate = '0' + tempDate;
    if (tempMonth < 10)
        tempMonth = '0' + tempMonth;
    return tempDate + "." + tempMonth + "." + this.getFullYear();
}


function getPosition(oNode) {
    var iLeft = 0;
    iLeft += $(oNode).offset().left - oNode.scrollLeft;
    var iTop = 0;
    iTop += $(oNode).offset().top - oNode.scrollTop;
    return new Array(iTop, iLeft);

}


/* Cookies */
function CreateCookie(name, value, days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
    }
    document.cookie = name + "=" + escape(value) + ((days) ? "; expires=" + date.toGMTString() : "") + "; path=/";
    
}
function ReadCookie(name) {
    var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for (var i = 0; i < ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') {
            c = c.substring(1, c.length);
        }
        if (c.indexOf(nameEQ) == 0) {
            return c.substring(nameEQ.length, c.length);
        }
    }
    return null;
}
function EraseCookie(name) {
    this.CreateCookie(name, "", -1);
}
/* //Cookies */
    
    
function collapseCallendar() {
    $('#CalendarHeader').toggle();
    $('#CalendarBody').toggle();
    //
    var text = $('#calendar a.expandCollapse').html();
    if (text == '<em></em>' + MO_collapse){
        text = '<em></em>' + MO_expande;
    }
    else
    {
        text = '<em></em>' + MO_collapse;
    }
        
    $('#calendar a.expandCollapse').html(text);
    DirectionBalloon.hide();
}
    
