/// <summary>
        /// Load view state
        /// </summary>
        /// <param name="state">The saved view state</param>
        /// <exception cref="ArgumentException">This is thrown if an unexpected shape type is found in the view
        /// state.</exception>
        public void LoadViewState(object state)
        {
            EWSoftware.ImageMaps.Web.Controls.ImageAreaBase a;
            Triplet t;
            int     idx, count, itemIdx;

            if (state == null)
            {
                return;
            }

            t = (Triplet)state;

            // Restore all items?
            if (!(t.First is ArrayList))
            {
                saveAll = true;
                this.Clear();

                count = (int)t.First;
                ImageAreaShape[] shapes = (ImageAreaShape[])t.Second;
                object[]         states = (object[])t.Third;

                for (idx = 0; idx < count; idx++)
                {
                    switch (shapes[idx])
                    {
                    case ImageAreaShape.Rectangle:
                        a = new EWSoftware.ImageMaps.Web.Controls.ImageAreaRectangle();
                        break;

                    case ImageAreaShape.Circle:
                        a = new EWSoftware.ImageMaps.Web.Controls.ImageAreaCircle();
                        break;

                    case ImageAreaShape.Polygon:
                        a = new EWSoftware.ImageMaps.Web.Controls.ImageAreaPolygon();
                        break;

                    default:
                        throw new ArgumentException("Unexpected shape type in view state", "state");
                    }

                    a.TrackViewState();
                    a.LoadViewState(states[idx]);
                    this.Add(a);
                }

                return;
            }

            ArrayList changedIndices = (ArrayList)t.First, changedShapes = (ArrayList)t.Second,
                      changedStates = (ArrayList)t.Third;

            for (idx = 0; idx < changedIndices.Count; idx++)
            {
                itemIdx = (int)changedIndices[idx];

                if (itemIdx < this.Count)
                {
                    ((EWSoftware.ImageMaps.Web.Controls.ImageAreaBase) this[itemIdx]).LoadViewState(changedStates[idx]);
                }
                else
                {
                    switch ((ImageAreaShape)changedShapes[idx])
                    {
                    case ImageAreaShape.Rectangle:
                        a = new EWSoftware.ImageMaps.Web.Controls.ImageAreaRectangle();
                        break;

                    case ImageAreaShape.Circle:
                        a = new EWSoftware.ImageMaps.Web.Controls.ImageAreaCircle();
                        break;

                    case ImageAreaShape.Polygon:
                        a = new EWSoftware.ImageMaps.Web.Controls.ImageAreaPolygon();
                        break;

                    default:
                        throw new ArgumentException("Unexpected shape type in view state", "state");
                    }

                    a.TrackViewState();
                    a.LoadViewState(changedStates[idx]);
                    this.Add(a);
                }
            }
        }
        /// <summary>
        /// Load view state
        /// </summary>
        /// <param name="state">The saved view state</param>
        /// <exception cref="ArgumentException">This is thrown if an unexpected shape type is found in the view
        /// state.</exception>
        public void LoadViewState(object state)
        {
            EWSoftware.ImageMaps.Web.Controls.ImageAreaBase a;
            Triplet t;
            int idx, count, itemIdx;

            if(state == null)
                return;

            t = (Triplet)state;

            // Restore all items?
            if(!(t.First is ArrayList))
            {
                saveAll = true;
                this.Clear();

                count = (int)t.First;
                ImageAreaShape[] shapes = (ImageAreaShape[])t.Second;
                object[] states = (object[])t.Third;

                for(idx = 0; idx < count; idx++)
                {
                    switch(shapes[idx])
                    {
                        case ImageAreaShape.Rectangle:
                            a = new EWSoftware.ImageMaps.Web.Controls.ImageAreaRectangle();
                            break;

                        case ImageAreaShape.Circle:
                            a = new EWSoftware.ImageMaps.Web.Controls.ImageAreaCircle();
                            break;

                        case ImageAreaShape.Polygon:
                            a = new EWSoftware.ImageMaps.Web.Controls.ImageAreaPolygon();
                            break;

                        default:
                            throw new ArgumentException("Unexpected shape type in view state", "state");
                    }

                    a.TrackViewState();
                    a.LoadViewState(states[idx]);
                    this.Add(a);
                }

                return;
            }

            ArrayList changedIndices = (ArrayList)t.First, changedShapes = (ArrayList)t.Second,
                changedStates = (ArrayList)t.Third;

            for(idx = 0; idx < changedIndices.Count; idx++)
            {
                itemIdx = (int)changedIndices[idx];

                if(itemIdx < this.Count)
                {
                    ((EWSoftware.ImageMaps.Web.Controls.ImageAreaBase)this[itemIdx]).LoadViewState(changedStates[idx]);
                }
                else
                {
                    switch((ImageAreaShape)changedShapes[idx])
                    {
                        case ImageAreaShape.Rectangle:
                            a = new EWSoftware.ImageMaps.Web.Controls.ImageAreaRectangle();
                            break;

                        case ImageAreaShape.Circle:
                            a = new EWSoftware.ImageMaps.Web.Controls.ImageAreaCircle();
                            break;

                        case ImageAreaShape.Polygon:
                            a = new EWSoftware.ImageMaps.Web.Controls.ImageAreaPolygon();
                            break;

                        default:
                            throw new ArgumentException("Unexpected shape type in view state", "state");
                    }

                    a.TrackViewState();
                    a.LoadViewState(changedStates[idx]);
                    this.Add(a);
                }
            }
        }