private void SaveItem()
        {
            MapItem m     = sm;
            string  title = SiteMap.RemoveBadChars(rRequest[this.txtText.ClientID].ToString());
            string  url   = rRequest[this.txtUrl.ClientID].ToString();

            if (nItemId != -1)
            {
                sPagePath = rRequest[this.txtPath.ClientID].ToString().Replace("admin/", "admin1/");
                if (nItemId == -2)
                {
                    if (sPagePath != "/")
                    {
                        sPagePath = sPagePath.Trim('/');
                    }
                    if (rRequest[this.cmbType.ClientID].ToString() == "Page" && PageInfo.Exists(sPagePath))
                    {
                        return;
                    }
                    m         = new MapItem();
                    m._parent = sm;
                }
                else
                {
                    m = sm.All[nItemId];
                }
                m.SetType(rRequest[this.cmbType.ClientID].ToString());
                if (m._type == MapItemType.Page)
                {
                    PageInfo pi = new PageInfo(sPagePath);
                    if (m._path != sPagePath && m._path.Length > 0)
                    {
                        if (PageInfo.Exists(sPagePath))
                        {
                            sPagePath = m._path;
                            pi        = new PageInfo(sPagePath);
                        }
                        else
                        {
                            pi = new PageInfo(m._path);
                            PageInfo.Delete(m._path);
                        }
                    }
                    if (rRequest[this.cmbPart.ClientID].ToString() == string.Empty)
                    {
                        rRequest[this.cmbPart.ClientID] = -1;
                    }
                    title = title == string.Empty ? PageInfo.CreateName(sPagePath) : title;
                    PageInfo.SavePage(
                        sPagePath,
                        rRequest[this.txtCodeFile.ClientID].ToString(),
                        rRequest[this.cmbTemplate.ClientID].ToString(),
                        pi.Body,
                        pi.Description,
                        pi.Title.Length == 0 || pi.Title == m.Text ? title : pi.Title,
                        pi.KeyWords,
                        pi.Head,
                        pi.Header,
                        rRequest[this.chkSecure2.ClientID].ToString() == "1",
                        rRequest[this.chkDeleted.ClientID].ToString() == "1",
                        pi.Cache,
                        Convert.ToInt32(rRequest[this.cmbPart.ClientID]),
                        pi.StatusCode,
                        pi.GenerateLastModified,
                        pi.Fields);
                    if (url == string.Empty || url == null)
                    {
                        url = Path.VRoot + sPagePath + Config.Main.Extension;
                    }
                }
                m._hidden = rRequest[this.chkShow.ClientID].ToString() == "0";
                int pid   = int.Parse(rRequest[this.cmbParent.ClientID].ToString().Split('#')[0]);
                int index = int.Parse(rRequest[this.cmbIndex.ClientID].ToString());
                if (pid != m.Parent.ID || index != m.Index)
                {
                    MapItem p = pid == -1 ? sm : sm.All[pid];
                    m.Remove();
                    if (p.Items.Count > index)
                    {
                        p.Items.Insert(index, m);
                    }
                    else
                    {
                        p.Items.Add(m);
                    }
                }
            }
            m._text = title;
            m._url  = url;
            m._path = sPagePath;
            sm.Save();

            sm = new SiteMap();
            Response.Write(sm.GetItemByPath(m._path).ID);
        }