/*  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

                        UDC.c_stack.js
    
                             -~|~-

    Copyright (c) Samuel Trygger. All Rights Reserved. You may use
    this code if and only if this entire copyright notice appears
    unchanged.

    Contact samuel@trygger.nu for all other uses.

                             -~|~-

    Description : A simple Javascript stack implementation. Check
                  the example code to see how it works
    Requires    : Nothing in particular. It is self contained.
    Tested with : Microsoft Internet Explorer 6.0.2600.0000     Win2000
                  Netscape Communicator 4.79                    Win2000
                  Netscape 6.2                                  Win2000
    Author      : Samuel Trygger
    Contact     : samuel@trygger.nu
    Home Page   : http://samuel.trygger.nu/devzone/javascript/

                             -~|~-

    -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-  */

var _CONST_Stack_HLPR_VERSION = '1.2';

function _Stack_HLPR_Peek() {
    var retVal = null;
    if (this.length) retVal = this[this.length - 1];
    return retVal;
}
c_stack.prototype.peek = _Stack_HLPR_Peek;

function _Stack_HLPR_Pop() {
    var retVal = null;
    if (this.length) {
        retVal = this[this.length - 1];
        this.length--;
    }
    return retVal;
}
c_stack.prototype.pop = _Stack_HLPR_Pop;

function _Stack_HLPR_Push(value) {
    this[this.length] = value;
    this.length++;
}
c_stack.prototype.push = _Stack_HLPR_Push;

function _Stack_HLPR_Clear() {
    this.length = 0;
}
c_stack.prototype.clear = _Stack_HLPR_Clear;

function c_stack() {
    this.length = 0;
    this.VERSION = _CONST_Stack_HLPR_VERSION;
    
    return this;
}
