/// <summary>
        /// Update the order of an AJAX re-order operation with the drag and drop table.
        /// Figure out the new order by GUID and then update the Description to store the
        /// order in a 3-digit numeric.
        /// </summary>
        /// <param name="sender">Object causing the event to be triggered.</param>
        /// <param name="e">The event information.</param>
        protected void btnUpdateDocumentOrder_Click(object sender, EventArgs e)
        {
            int count = 1;


            //
            // Walk each item in order.
            //
            foreach (string str in this.hfDocumentOrder.Value.Split(new char[] { '&' }))
            {
                //
                // Header and Footer rows have an empty GUID, so skip them.
                //
                if ((str != string.Empty) && !str.EndsWith("="))
                {
                    string[] strArray3 = str.Split(new char[] { '_' });
                    try
                    {
                        //
                        // Update this item with the new order number.
                        //
                        Guid guid = new Guid(strArray3[strArray3.Length - 1]);
                        PromotionRequestDocument doc = promotion.Documents.FirstOrDefault(d => d.GUID == guid);
                        int ignored = doc.ByteArray.Length; // Needed to save.

                        doc.Description = String.Format("{0:000}", count++);
                        doc.Save(CurrentUser.Identity.Name);
                    }
                    catch
                    {
                    }
                }
            }

            ShowDocuments();
        }
        /// <summary>
        /// The page is being loaded, we need to do some initialization information.
        /// </summary>
        /// <param name="sender">The object causing the event to be triggered.</param>
        /// <param name="e">Information about the event itself.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            //
            // If this is an initial page load, set the initial values.
            //
            if (!IsPostBack)
            {
                tbTitle.Text = promotion.Title;
                if (promotion.PromotionRequestID == -1)
                {
                    promotion.WebStartDate = DateTime.Now;
                    promotion.WebEndDate   = DateTime.Now;
                }
                tbStartDate.Text = promotion.WebStartDate.ToString("MM/dd/yyyy hh:mm tt").ToLower();
                tbEndDate.Text   = promotion.WebEndDate.ToString("MM/dd/yyyy hh:mm tt").ToLower();
                try
                {
                    ddlTopicArea.SelectedValue = promotion.TopicArea.LookupID.ToString();
                }
                catch
                {
                    ddlTopicArea.SelectedValue = "-1";
                }
                cbWeekly.Checked = (promotion.WebSummary == "Weekly");
            }

            //
            // Handle a document image being uploaded.
            //
            pnlWrongSize.Visible = false;
            if (this.ihBlobID.Value != string.Empty)
            {
                PromotionRequestDocument item  = new PromotionRequestDocument(promotion.PromotionRequestID, Convert.ToInt32(this.ihBlobID.Value));
                Arena.Utility.ArenaImage img   = new Arena.Utility.ArenaImage(Convert.ToInt32(this.ihBlobID.Value));
                System.Drawing.Image     image = img.GetImage(0, 0);

                //
                // Check if the image being uploaded fits the required dimensions.
                //
                if ((RequiredWidthSetting == 0 || RequiredWidthSetting == image.Width) &&
                    (RequiredHeightSetting == 0 || RequiredHeightSetting == image.Height))
                {
                    bool flag = false;

                    //
                    // Look for an existing image in the promotion.
                    //
                    for (int i = 0; i < promotion.Documents.Count; i++)
                    {
                        if (promotion.Documents[i].DocumentID == item.DocumentID)
                        {
                            promotion.Documents[i] = item;
                            flag = true;
                            break;
                        }
                    }

                    //
                    // If not found, add this image to the promotion.
                    //
                    if (!flag)
                    {
                        int ignored = item.ByteArray.Length;

                        promotion.Save(CurrentUser.Identity.Name);
                        item.PromotionRequestID = promotion.PromotionRequestID;
                        item.BlobID             = Convert.ToInt32(this.ihBlobID.Value);
                        item.Description        = "999";
                        item.Save(CurrentUser.Identity.Name);
                        promotion.Documents.Add(item);
                    }
                }
                else
                {
                    //
                    // Delete the image from the database.
                    //
                    img.Delete();

                    //
                    // Inform the user it was the wrong size.
                    //
                    ltWrongSize.Text = "";
                    if (RequiredWidthSetting != 0 && RequiredHeightSetting != 0)
                    {
                        ltWrongSize.Text = String.Format("Your image was not uploaded. It must be exactly {0} by {1} pixels in size.", RequiredWidthSetting, RequiredHeightSetting);
                    }
                    else if (RequiredWidthSetting != 0)
                    {
                        ltWrongSize.Text = String.Format("Your image was not uploaded. It must be exactly {0} pixels wide.", RequiredWidthSetting);
                    }
                    else
                    {
                        ltWrongSize.Text = String.Format("Your image was not uploaded. It must be exactly {0} pixels high.", RequiredHeightSetting);
                    }

                    pnlWrongSize.Visible = true;
                }
                this.ihBlobID.Value = string.Empty;
            }

            //
            // Do final initialization.
            //
            RegisterScripts();
            ShowDocuments();
            lbAddItem.OnClientClick = string.Format("openChooseDocumentWindow('{0}', '-1','-1'); return false;", DocumentTypeSetting);
        }