
function Prototypes()
{
    // -----> BEGIN ITEM RESIZE

    this.ResizeItem = function(container, cw, ch, dw, dh, pos)
    {
        var defaultW = dw;
        var defaultH = dh;
        var currW = 0;
        var currH = 0;

        if (defaultW <= cw && defaultH <= ch)
        {
            currW = defaultW;
            currH = defaultH;
        }
        else
        {
            currH = ch;
            currW = (defaultW*ch)/defaultH;

            if (currW > cw)
            {
                currW = cw;
                currH = (defaultH*cw)/defaultW;
            }
        }

        $(container).children().width(currW);
        $(container).children().height(currH);

        if (pos.toLowerCase() == 'top'){this.TopItem(container, ch);}
        if (pos.toLowerCase() == 'bottom'){this.BottomItem(container, ch);}
        if (pos.toLowerCase() == 'left'){this.LeftItem(container, cw);}
        if (pos.toLowerCase() == 'right'){this.RightItem(container, cw);}
        if (pos.toLowerCase() == 'horizontal-center'){this.HCenterItem(container, cw);}
        if (pos.toLowerCase() == 'vertical-center'){this.VCenterItem(container, ch);}
        if (pos.toLowerCase() == 'center'){this.CenterItem(container, cw, ch);}
        if (pos.toLowerCase() == 'top-left'){this.TLItem(container, cw, ch);}
        if (pos.toLowerCase() == 'top-center'){this.TCItem(container, cw, ch);}
        if (pos.toLowerCase() == 'top-right'){this.TRItem(container, cw, ch);}
        if (pos.toLowerCase() == 'middle-left'){this.MLItem(container, cw, ch);}
        if (pos.toLowerCase() == 'middle-right'){this.MRItem(container, cw, ch);}
        if (pos.toLowerCase() == 'bottom-left'){this.BLItem(container, cw, ch);}
        if (pos.toLowerCase() == 'bottom-center'){this.BCItem(container, cw, ch);}
        if (pos.toLowerCase() == 'bottom-right'){this.BRItem(container, cw, ch);}
    }

    this.ResizeItem2 = function(container, cw, ch, dw, dh, pos)
    {
        var defaultW = dw;
        var defaultH = dh;
        var currW = 0;
        var currH = 0;

        currH = ch;
        currW = (defaultW*ch)/defaultH;

        if (currW < cw)
        {
            currW = cw;
            currH = (defaultH*cw)/defaultW;
        }

        $(container).children().width(currW);
        $(container).children().height(currH);

        if (pos.toLowerCase() == 'top'){this.TopItem(container, ch);}
        if (pos.toLowerCase() == 'bottom'){this.BottomItem(container, ch);}
        if (pos.toLowerCase() == 'left'){this.LeftItem(container, cw);}
        if (pos.toLowerCase() == 'right'){this.RightItem(container, cw);}
        if (pos.toLowerCase() == 'horizontal-center'){this.HCenterItem(container, cw);}
        if (pos.toLowerCase() == 'vertical-center'){this.VCenterItem(container, ch);}
        if (pos.toLowerCase() == 'center'){this.CenterItem(container, cw, ch);}
        if (pos.toLowerCase() == 'top-left'){this.TLItem(container, cw, ch);}
        if (pos.toLowerCase() == 'top-center'){this.TCItem(container, cw, ch);}
        if (pos.toLowerCase() == 'top-right'){this.TRItem(container, cw, ch);}
        if (pos.toLowerCase() == 'middle-left'){this.MLItem(container, cw, ch);}
        if (pos.toLowerCase() == 'middle-right'){this.MRItem(container, cw, ch);}
        if (pos.toLowerCase() == 'bottom-left'){this.BLItem(container, cw, ch);}
        if (pos.toLowerCase() == 'bottom-center'){this.BCItem(container, cw, ch);}
        if (pos.toLowerCase() == 'bottom-right'){this.BRItem(container, cw, ch);}
    }

    // -----> END ITEM RESIZE

// -----> BEGIN ITEM POSITIONS

    // -----> TOP
    this.TopItem = function(container, ch)
    {
        $(container).height(ch);
        $(container).children().css({'margin-top':0});
    }

    // -----> BOTTOM
    this.BottomItem = function(container, ch)
    {
        $(container).height(ch);
        $(container).children().css({'margin-top':ch-$(container).children().height()});
    }

    // -----> LEFT
    this.LeftItem = function(container, cw)
    {
        $(container).width(cw);
        $(container).children().css({'margin-left':0});
    }

    // -----> RIGHT
    this.RightItem = function(container, cw)
    {
        $(container).width(cw);
        $(container).children().css({'margin-left':cw-$(container).children().width()});
    }

    // -----> HORIZONTAL CENTER
    this.HCenterItem = function(container, cw)
    {
        $(container).width(cw);
        $(container).children().css({'margin-left':(cw-$(container).children().width())/2});
    }

    // -----> VERTICAL CENTER
    this.VCenterItem = function(container, ch)
    {
        $(container).height(ch);
        $(container).children().css({'margin-top':(ch-$(container).children().height())/2});
    }

    // -----> CENTER
    this.CenterItem = function(container, cw, ch)
    {
        this.HCenterItem(container, cw);
        this.VCenterItem(container, ch);
    }

    // -----> TOP-LEFT
    this.TLItem = function(container, cw, ch)
    {
        this.TopItem(container, ch);
        this.LeftItem(container, cw);
    }

    // -----> TOP-CENTER
    this.TCItem = function(container, cw, ch)
    {
        this.TopItem(container, ch);
        this.HCenterItem(container, cw);
    }

    // -----> TOP-RIGHT
    this.TRItem = function(container, cw, ch)
    {
        this.TopItem(container, ch);
        this.RightItem(container, cw);
    }

    // -----> MIDDLE-LEFT
    this.MLItem = function(container, cw, ch)
    {
        this.VCenterItem(container, ch);
        this.LeftItem(container, cw);
    }

    // -----> MIDDLE-RIGHT
    this.MRItem = function(container, cw, ch)
    {
        this.VCenterItem(container, ch);
        this.RightItem(container, cw);
    }

    // -----> BOTTOM-LEFT
    this.BLItem = function(container, cw, ch)
    {
        this.BottomItem(container, ch);
        this.LeftItem(container, cw);
    }

    // -----> BOTTOM-CENTER
    this.BCItem = function(container, cw, ch)
    {
        this.BottomItem(container, ch);
        this.HCenterItem(container, cw);
    }

    // -----> BOTTOM-RIGHT
    this.BRItem = function(container, cw, ch)
    {
        this.BottomItem(container, ch);
        this.RightItem(container, cw);
    }

// -----> END ITEM POSITIONS

// -----> BEGIN SPECIFIED ITEM POSITIONS

    // -----> TOP
    this.OnTopItem = function(container, children, ch)
    {
        $(container).height(ch);
        $(children).css({'margin-top':0});
    }

    // -----> BOTTOM
    this.OnBottomItem = function(container, children, ch)
    {
        $(container).height(ch);
        $(children).css({'margin-top':ch-$(children).height()});
    }

    // -----> LEFT
    this.OnLeftItem = function(container, children, cw)
    {
        $(container).width(cw);
        $(children).css({'margin-left':0});
    }

    // -----> RIGHT
    this.OnRightItem = function(container, children, cw)
    {
        $(container).width(cw);
        $(children).css({'margin-left':cw-$(children).width()});
    }

    // -----> HORIZONTAL CENTER
    this.OnHCenterItem = function(container, children, cw)
    {
        $(container).width(cw);
        $(children).css({'margin-left':(cw-$(children).width())/2});
    }

    // -----> VERTICAL CENTER
    this.OnVCenterItem = function(container, children, ch)
    {
        $(container).height(ch);
        $(children).css({'margin-top':(ch-$(children).height())/2});
    }

    // -----> CENTER
    this.OnCenterItem = function(container, children, cw, ch)
    {
        this.OnHCenterItem(container, children, cw);
        this.OnVCenterItem(container, children, ch);
    }

    // -----> TOP-LEFT
    this.OnTLItem = function(container, children, cw, ch)
    {
        this.OnTopItem(container, children, ch);
        this.OnLeftItem(container, children, cw);
    }

    // -----> TOP-CENTER
    this.OnTCItem = function(container, children, cw, ch)
    {
        this.OnTopItem(container, children, ch);
        this.OnHCenterItem(container, children, cw);
    }

    // -----> TOP-RIGHT
    this.OnTRItem = function(container, children, cw, ch)
    {
        this.OnTopItem(container, children, ch);
        this.OnRightItem(container, children, cw);
    }

    // -----> MIDDLE-LEFT
    this.OnMLItem = function(container, children, cw, ch)
    {
        this.OnVCenterItem(container, children, ch);
        this.OnLeftItem(container, children, cw);
    }

    // -----> MIDDLE-RIGHT
    this.OnMRItem = function(container, children, cw, ch)
    {
        this.OnVCenterItem(container, children, ch);
        this.OnRightItem(container, children, cw);
    }

    // -----> BOTTOM-LEFT
    this.OnBLItem = function(container, children, cw, ch)
    {
        this.OnBottomItem(container, children, ch);
        this.OnLeftItem(container, children, cw);
    }

    // -----> BOTTOM-CENTER
    this.OnBCItem = function(container, children, cw, ch)
    {
        this.OnBottomItem(container, children, ch);
        this.OnHCenterItem(container, children, cw);
    }

    // -----> BOTTOM-RIGHT
    this.OnBRItem = function(container, children, cw, ch)
    {
        this.OnBottomItem(container, children, ch);
        this.OnRightItem(container, children, cw);
    }

// -----> END SPECIFIED ITEM POSITIONS

// -----> BEGIN RANDOMIZE

    this.randomize = function(theArray)
    {
        theArray.sort(function(){return 0.5-Math.random()});
        return theArray;
    }

// -----> END RANDOMIZE
}
