function AddDaysToDate(DateString, Days) {
    DateObject = new Date(DateString);
    return (new Date(DateObject.getTime() + Days * 24 * 60 * 60 * 1000));
}
function FormatDate(DateString) {
    DateObject = new Date(DateString);
    return ((DateObject.getMonth() + 1) + "/" + DateObject.getDate() + "/" + DateObject.getFullYear());
}
function disableback() {
    window.history.forward(1);
}
function ValidateCreditCard(cardnumber) {
    //Validate a Credit Card Checksum

    var index, iid;
    var char;
    var checksum = 0;
    var cardnumberex = new String();

    // remove non-digit characters
    for (index = 0; index < cardnumber.length; index++) {
        char = cardnumber.charAt(index);
        if (char >= '0' && char <= '9')
            cardnumberex += char;
    }

    // invalidate the number if it's too long
    if (cardnumberex.length > 19)
        return false;

    // calculate the sum of odd digits, counting from the end
    for (index = cardnumberex.length - 1; index >= 0; index -= 2) {
        checksum += parseInt(cardnumberex.charAt(index));
    }

    //
    // Calculate the sum of even digits multiplied by 2
    // (e.g. 7 * 2 = 14 -> 1 + 4 = 5 or 3 * 2 = 6 -> 0 + 6 = 6)
    //
    for (index = cardnumberex.length - 2; index >= 0; index -= 2) {
        num = parseInt(cardnumberex.charAt(index)) * 2;
        checksum += (Math.floor(num / 10) + num % 10);
    }

    // the result is valid if the remainder is zero
    return (checksum % 10 == 0);
}
function Find(elemID) {
    // Find a control on the page
    return (document.getElementById) ? document.getElementById(elemID) : ((document.all) ? document.all[elemID] : null);
}
function IsNumeric(sText) {
    var ValidChars = "0123456789. ";
    for (i = 0; i < sText.length; i++) {
        if (ValidChars.indexOf(sText.charAt(i)) == -1) {
            return false;
        }
    }
    return true;
}
function PopUpWindow(url, width, height) {
    var winRef = window.open(url, 'popupWindow', 'width=' + width.toString() + ',height=' + height.toString() + ',scrollbars=1,resizable=1');
}