﻿
String.prototype.trim = function() {
    return this.replace(/^\s+|\s+$/g, "");
}
String.prototype.ltrim = function() {
    return this.replace(/^\s+/, "");
}
String.prototype.rtrim = function() {
    return this.replace(/\s+$/, "");
}

var popupCallBack;

function GetDateValue(d) {
    if (d != null) {

        return d.getFullYear() + '/' + (d.getMonth() + 1) + '/' + d.getDate();
    }

    return '';
}
function openPopup(url, element, width, height, callBack, headerText) {
    //popup.SetContentHtml("Loading...");
    //popup.SetContentUrl('/common/loading.htm');
    popup.SetContentUrl(url);
    //    var s = popup.GetWindowContentIFrame().contentWindow.document.title;
    //    popup.SetHeaderText(s);
    if (popup.IsVisible())
        popup.UpdatePosition();
    if (width && height) {
        popup.SetSize(width, height);
    }
    if (callBack) {
        popupCallBack = callBack;
    }
    if (headerText) {
        popup.SetHeaderText(headerText);
    }
    popup.ShowAtElement(element);

    return void (0);

}
function $Get(elementId) {
    return document.getElementById(elementId);
}
function CloseAndReload() {
    parent.popup.Hide();
    if (parent.gridUser != null)
        parent.gridUser.PerformCallback();
   
}
function ShowLoadingAt(element) {
    loading.ShowInElement(element);
}
function HideLoading() {
    loading.Hide();
}