﻿jQuery.fn.showWaiting = function () {
    this.each(function () {
        if (this.ajaxWaiting && this.headEl) {
            this.ajaxWaiting.height(this.headEl.height()).fadeTo("fast", 0.6);
        }
    })
}
jQuery.fn.hideWaiting = function () {
    this.each(function () {
        if (this.ajaxWaiting && this.headEl) {
            this.ajaxWaiting.hide();
        }
    })
}
Date.prototype.addHours = function (h) {
    this.setTime(this.getTime() + (h * 60 * 60 * 1000));
    return this;
}
Date.prototype.FormatDate = function () {
    return this.getFullYear() + "/" + (this.getMonth() + 1).toString().lpad("0", 2) + "/" + this.getDate().toString().lpad("0", 2);
}
Date.prototype.FormatTime = function () {
    return this.getHours().toString().lpad("0", 2) + ":" + this.getMinutes().toString().lpad("0", 2);
}
Date.prototype.Format = function () {
    return this.FormatDate() + " " + this.FormatTime();
}
//pads left
String.prototype.lpad = function (padString, length) {
    var str = this;
    while (str.length < length)
        str = padString + str;
    return str;
}

//pads right
String.prototype.rpad = function (padString, length) {
    var str = this;
    while (str.length < length)
        str = str + padString;
    return str;
}    

