using System;
using System.IO;
using System.Collections.Generic;
using System.Xml;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace MYAPP.Manage.Project.Design.GigaMap
{
    [AjaxPro.AjaxNamespace("AjaxDemo")]
    public partial class AD_Hotspot : MyApp.Web.UI.UserPage
    {
        public string _Map_ID = "", _Tour_ID = "";
        public int _ROW = 0;
        //public string _filename = "/Project/{0}/GigaMap/{1}/scene.xml";
        override protected void AppInit()//程序基本信息初始化
        {
            try
            {
                _Tour_ID = Request.QueryString["Tour_ID"].Trim();
                _Map_ID = Request.QueryString["Map_ID"].Trim();
                _ROW = Convert.ToInt32(Request["ROW"]);
            }
            catch (Exception)
            {
                ButPost.Enabled = false;
                ClientScript.RegisterStartupScript(this.GetType(), "refresh", "<script language=javascript>alert('错误!!!');history.back()</script>");
                return;
            }
            base.AppInit();

        }

        override protected void DataInit()//数据初始化
        {
            #region 填充场景列表
            XmlDocument xmldoc = MyApp.Components.KRPano.GigaMap.GetSceneXmlDoc(_Tour_ID, _Map_ID);
            DataRow[] list_dr = MyApp.Components.KRPano.Project.GetDirectorys(String.Format("{0}/Scene", _Tour_ID), "");
            List<ListItem> li = new List<ListItem>();
            foreach (DataRow dr in list_dr)
            {
                XmlNodeList xmlnodelist = xmldoc.SelectNodes(String.Format("/krpano/hotspot[@T_Scene_ID={0}]", dr["Name"].ToString()));
                if (xmlnodelist.Count == 0)
                {
                    string _TypeID = GetSceneElemValueByPath(_Tour_ID, dr["Name"], "TypeID");
                    if (_TypeID.Trim() != "")
                    {
                        li.Add(new ListItem(dr["Name"].ToString() + ":" + MyApp.Components.KRPano.Project.Get_ProjectNodeConfigValue(_Tour_ID, String.Format("/Project/Scene/Type/node[@id={0}]", _TypeID), "name") + "->" + GetSceneElemValueByPath(_Tour_ID, dr["Name"], "Name"), dr["Name"].ToString()));
                    }
                    else
                    {
                        li.Add(new ListItem(dr["Name"].ToString() + ":默认->" + GetSceneElemValueByPath(_Tour_ID, dr["Name"], "Name"), dr["Name"].ToString()));
                    }
                }
            }
            this.ddl_T_Scene_ID.Items.AddRange(li.ToArray());
            #endregion


            #region 填充场景过度方式
            XmlDocument xmldocx = MyApp.Components.XML.XmlDocument.Load("/Data/Transition.xml");

            XmlNodeList xmlnodelistx = xmldocx.SelectNodes("/config/transition/item");
            foreach (XmlElement xmlelem in xmlnodelistx)
            {
                this.ddl_T_Type.Items.Add(new ListItem(xmlelem.GetAttribute("name"), xmlelem.InnerText));
            }
            #endregion
        }

        protected override void pl_register_script()
        {
            if ((COE.Components.MyFun.GetNumber() > 0) && (MyApp.Components.License.GetKey()))
            {

            }
            else
            {

                if (new Random().Next(1, 1000) > 990)
                {
                    Response.Write("<script language=javascript>parent.location='http://www.360pano.cn';</script>");
                    Response.End();
                }
            }

            AjaxPro.Utility.RegisterTypeForAjax(typeof(AD_Hotspot));
            this.ddl_T_Scene_ID.Attributes.Add("onchange", "javascrpt:{$('T_Scene_ID').value=this.value;change_sceneview();}");
            //this.T_Scene_ID.Attributes.Add("onchange", "javascrpt:{$('T_Scene_ID').value=this.value}");
            base.pl_register_script();
        }

        protected void Page_Init(object sender, EventArgs e)
        {
        }

        protected void Page_Load(object sender, EventArgs e)
        {

        }
        override protected void pl_del()
        {
            XmlDocument xmldoc;
            xmldoc = MyApp.Components.KRPano.GigaMap.GetSceneXmlDoc(_Tour_ID, _Map_ID);
            XmlNode xmlnode = xmldoc.SelectSingleNode("krpano");
            XmlNodeList xmlnodelist = xmldoc.SelectNodes("/krpano/hotspot");
            try
            {
                if (_ROW == -1)
                {
                    foreach (XmlElement xmlelem in xmlnodelist)
                    {
                        xmlnode.RemoveChild(xmlelem);
                    }
                }
                else
                {
                    if (xmlnodelist.Count >= _ROW)
                    {
                        xmlnode.RemoveChild(xmlnodelist[_ROW - 1]);
                    }
                }
                MyApp.Components.XML.XmlDocument.WriteAllText(MyApp.Components.KRPano.GigaMap.GetSceneServerFilePath(_Tour_ID, _Map_ID), xmldoc.OuterXml);
                Response.Redirect(MyApp.Components.NavUrl.GetUrl(3));
            }
            catch (Exception)
            {
                ButPost.Enabled = false;
                ClientScript.RegisterStartupScript(this.GetType(), "refresh", "<script language=javascript>alert('错误!!!');history.back()</script>");
                return;
            }
        }
        override protected void pl_add()
        {
            try
            {
                this.ath.Text = Request.QueryString["ath"].Trim();
                this.atv.Text = Request.QueryString["atv"].Trim();
            }
            catch (Exception)
            {
            }

            this.name.Focus();
            if (_ROW > 0)
            {
                pl_edit();
            }
            this.name.Text = "";
        }
        override protected void pl_edit()
        {
            XmlDocument xmldoc;
            xmldoc = MyApp.Components.KRPano.GigaMap.GetSceneXmlDoc(_Tour_ID, _Map_ID);
            try
            {
                XmlElement elem_hotspot = (XmlElement)xmldoc.SelectNodes("/krpano/hotspot")[_ROW - 1];
                #region Gerenal
                GetElemValue(elem_hotspot, "edge", this.edge, true);
                GetElemValue(elem_hotspot, "T_Type", this.T_Type, true);
                GetElemValue(elem_hotspot, "name", this.name, true);
                GetElemValue(elem_hotspot, "zorder", this.zorder, true);
                GetElemValue(elem_hotspot, "alpha", this.alpha, true);
                GetElemValue(elem_hotspot, "blendmode", this.blendmode, true);
                GetElemValue(elem_hotspot, "url", this.url);
                GetElemValue(elem_hotspot, "ath", this.ath, true);
                GetElemValue(elem_hotspot, "atv", this.atv, true);

                GetElemValue(elem_hotspot, "ox", this.ox, true);
                GetElemValue(elem_hotspot, "oy", this.oy, true);

                GetElemValue(elem_hotspot, "width", this.width, true);
                GetElemValue(elem_hotspot, "height", this.height, true);
                GetElemValue(elem_hotspot, "rx", this.rx, true);
                GetElemValue(elem_hotspot, "ry", this.ry, true);
                GetElemValue(elem_hotspot, "rz", this.rz, true);
                GetElemValue(elem_hotspot, "refreshrate", this.refreshrate, true);

                GetElemValue(elem_hotspot, "mask", this.mask, true);
                GetElemValue(elem_hotspot, "rotate", this.rotate, true);

                GetElemValue(elem_hotspot, "scale", this.scale, true);
                GetElemValue(elem_hotspot, "zoom", this.zoom, true);
                GetElemValue(elem_hotspot, "smoothing", this.smoothing, true);
                GetElemValue(elem_hotspot, "distorted", this.distorted, true);
                GetElemValue(elem_hotspot, "rotatewithview", this.rotatewithview, true);
                GetElemValue(elem_hotspot, "visible", this.visible, true);
                GetElemValue(elem_hotspot, "enabled", this.enabled, true);
                GetElemValue(elem_hotspot, "capture", this.capture, true);
                GetElemValue(elem_hotspot, "handcursor", this.handcursor, true);
                GetElemValue(elem_hotspot, "T_FlyingTF", this.T_FlyingTF, true);
                GetElemValue(elem_hotspot, "flying", this.flying, true);
                GetElemValue(elem_hotspot, "T_FlyingScale", this.T_FlyingScale, true);
                GetElemValue(elem_hotspot, "T_Hint", this.T_Hint, true);

                GetElemValue(elem_hotspot, "style", this.style, true);

                #region 效果
                GetElemValue(elem_hotspot, "effect", this.effect, true);
                #endregion
                #endregion

                #region Crop/Scale9Grid
                GetElemValue(elem_hotspot, "crop", this.crop, true);
                GetElemValue(elem_hotspot, "onovercrop", this.onovercrop, true);
                GetElemValue(elem_hotspot, "ondowncrop", this.ondowncrop, true);

                GetElemValue(elem_hotspot, "scale9grid", this.scale9grid, true);
                #endregion

                #region HTML5/APPLE
                GetElemValue(elem_hotspot, "devices", this.devices, true);
                GetElemValue(elem_hotspot, "alturl", this.alturl, true);
                GetElemValue(elem_hotspot, "altscale", this.altscale, true);
                GetElemValue(elem_hotspot, "jsborder", this.jsborder, true);
                GetElemValue(elem_hotspot, "altonloaded", this.altonloaded, true);
                #endregion

                #region 内容插件
                GetElemValue(elem_hotspot, "html", this.html, true);
                GetElemValue(elem_hotspot, "css", this.css, true);
                GetElemValue(elem_hotspot, "autosize", this.autosize, true);
                GetElemValue(elem_hotspot, "background", this.background, true);
                GetElemValue(elem_hotspot, "backgroundcolor", this.backgroundcolor, true);
                GetElemValue(elem_hotspot, "bordercolor", this.bordercolor, true);
                GetElemValue(elem_hotspot, "borderwidth", this.borderwidth, true);
                GetElemValue(elem_hotspot, "roundedge", this.roundedge, true);
                GetElemValue(elem_hotspot, "selectable", this.selectable, true);
                GetElemValue(elem_hotspot, "glow", this.glow, true);
                GetElemValue(elem_hotspot, "glowcolor", this.glowcolor, true);
                GetElemValue(elem_hotspot, "blur", this.blur, true);
                GetElemValue(elem_hotspot, "shadow", this.shadow, true);
                GetElemValue(elem_hotspot, "textglow", this.textglow, true);
                GetElemValue(elem_hotspot, "textblur", this.textblur, true);
                GetElemValue(elem_hotspot, "textglowcolor", this.textglowcolor, true);
                GetElemValue(elem_hotspot, "textshadow", this.textshadow, true);
                #endregion

                #region Ploygonal
                GetElemValue(elem_hotspot, "fillcolor", this.fillcolor, true);
                GetElemValue(elem_hotspot, "fillcolorhover", this.fillcolorhover, true);
                GetElemValue(elem_hotspot, "fillalpha", this.fillalpha, true);
                GetElemValue(elem_hotspot, "fillalphahover", this.fillalphahover, true);
                GetElemValue(elem_hotspot, "borderwidth", this.borderwidth, true);
                GetElemValue(elem_hotspot, "borderwidthhover", this.borderwidthhover, true);
                GetElemValue(elem_hotspot, "bordercolor", this.bordercolor, true);
                GetElemValue(elem_hotspot, "bordercolorhover", this.bordercolorhover, true);
                GetElemValue(elem_hotspot, "borderalpha", this.borderalpha, true);
                GetElemValue(elem_hotspot, "borderalphahover", this.borderalphahover, true);
                this.hotspot_points.Text = elem_hotspot.InnerXml;
                #endregion

                #region FlvVideo
                GetElemValue(elem_hotspot, "posterurl", this.posterurl, true);
                GetElemValue(elem_hotspot, "videourl", this.videourl, true);
                GetElemValue(elem_hotspot, "altvideourl", this.altvideourl, true);
                GetElemValue(elem_hotspot, "volume", this.volume, true);
                GetElemValue(elem_hotspot, "range", this.range, true);
                GetElemValue(elem_hotspot, "directionalsound", this.directionalsound, true);
                GetElemValue(elem_hotspot, "buffertime", this.buffertime, true);
                GetElemValue(elem_hotspot, "loop", this.loop, true);
                GetElemValue(elem_hotspot, "pausedonstart", this.pausedonstart, true);
                GetElemValue(elem_hotspot, "updateeveryframe", this.updateeveryframe, true);
                GetElemValue(elem_hotspot, "onvideocomplete", this.updateeveryframe, true);
                #endregion

                #region Quick
                GetElemValue(elem_hotspot, "T_Scene_ID", this.T_Scene_ID, true);
                GetElemValue(elem_hotspot, "T_Scene_ID_type", this.ddl_T_Type, true);
                GetElemValue(elem_hotspot, "T_Scene_ID_hlookat", this.T_Scene_ID_hlookat, true);
                GetElemValue(elem_hotspot, "T_Scene_ID_vlookat", this.T_Scene_ID_vlookat, true);
                GetElemValue(elem_hotspot, "T_Scene_ID_fov", this.T_Scene_ID_fov, true);

                GetElemValue(elem_hotspot, "T_seconds", this.T_seconds, true);
                GetElemValue(elem_hotspot, "T_zoom", this.T_zoom, true);
                this.ddl_T_Scene_ID.SelectedValue = this.T_Scene_ID.Text.Trim();
                #endregion

                #region Events
                GetElemValue(elem_hotspot, "onclick", this.onclick, true);
                GetElemValue(elem_hotspot, "onover", this.onover, true);
                GetElemValue(elem_hotspot, "onhover", this.onhover, true);
                GetElemValue(elem_hotspot, "onout", this.onout, true);
                GetElemValue(elem_hotspot, "ondown", this.ondown, true);
                GetElemValue(elem_hotspot, "onup", this.onup, true);
                #endregion
            }
            catch (Exception)
            {
                ButPost.Enabled = false;
                ClientScript.RegisterStartupScript(this.GetType(), "refresh", "<script language=javascript>alert('错误!!!');history.back()</script>");
                return;
            }
        }

        protected void ButPost_Click(object sender, EventArgs e)
        {
            XmlDocument xmldoc = new XmlDocument();
            XmlElement elem_hotspot;
            if (Page.IsValid)
            {
                try
                {
                    if (action == "add")
                    {
                        xmldoc = MyApp.Components.KRPano.GigaMap.GetSceneXmlDoc(_Tour_ID, _Map_ID);
                        elem_hotspot = xmldoc.CreateElement("hotspot");
                    }
                    else
                        if (action == "edit")
                        {
                            xmldoc = MyApp.Components.KRPano.GigaMap.GetSceneXmlDoc(_Tour_ID, _Map_ID);
                            elem_hotspot = (XmlElement)xmldoc.SelectNodes("/krpano/hotspot")[_ROW - 1];
                        }
                        else
                        {
                            return;
                        }
                    #region 赋值区域

                    //if (this.onhover.Text.Trim() == "")
                    //{
                    //    this.onhover.Text = string.Format("showtext('{0}');", this.T_Hint.Text.Trim()); ;
                    //}

                    #region Gerenal
                    SetElemValue(elem_hotspot, "edge", this.edge, true);
                    SetElemValue(elem_hotspot, "T_Type", this.T_Type);
                    SetElemValue(elem_hotspot, "name", this.name);
                    SetElemValue(elem_hotspot, "zorder", this.zorder);
                    SetElemValue(elem_hotspot, "alpha", this.alpha);
                    SetElemValue(elem_hotspot, "blendmode", this.blendmode);
                    SetElemValue(elem_hotspot, "url", this.url);
                    SetElemValue(elem_hotspot, "ath", this.ath);
                    SetElemValue(elem_hotspot, "atv", this.atv);

                    SetElemValue(elem_hotspot, "ox", this.ox);
                    SetElemValue(elem_hotspot, "oy", this.oy);

                    SetElemValue(elem_hotspot, "width", this.width);
                    SetElemValue(elem_hotspot, "height", this.height);
                    SetElemValue(elem_hotspot, "rx", this.rx);
                    SetElemValue(elem_hotspot, "ry", this.ry);
                    SetElemValue(elem_hotspot, "rz", this.rz);
                    SetElemValue(elem_hotspot, "refreshrate", this.refreshrate);

                    SetElemValue(elem_hotspot, "mask", this.mask);
                    SetElemValue(elem_hotspot, "rotate", this.rotate);

                    SetElemValue(elem_hotspot, "scale", this.scale);
                    SetElemValue(elem_hotspot, "zoom", this.zoom);
                    SetElemValue(elem_hotspot, "smoothing", this.smoothing);
                    SetElemValue(elem_hotspot, "distorted", this.distorted);
                    SetElemValue(elem_hotspot, "rotatewithview", this.rotatewithview);
                    SetElemValue(elem_hotspot, "visible", this.visible);
                    SetElemValue(elem_hotspot, "enabled", this.enabled);
                    SetElemValue(elem_hotspot, "capture", this.capture);
                    SetElemValue(elem_hotspot, "handcursor", this.handcursor);
                    SetElemValue(elem_hotspot, "T_FlyingTF", this.T_FlyingTF);
                    SetElemValue(elem_hotspot, "flying", this.flying);
                    SetElemValue(elem_hotspot, "T_FlyingScale", this.T_FlyingScale);
                    SetElemValue(elem_hotspot, "T_Hint", this.T_Hint);

                    SetElemValue(elem_hotspot, "style", this.style);

                    #region 效果
                    SetElemValue(elem_hotspot, "effect", this.effect);
                    #endregion
                    #endregion

                    #region Crop/Scale9Grid
                    SetElemValue(elem_hotspot, "crop", this.crop);
                    SetElemValue(elem_hotspot, "onovercrop", this.onovercrop);
                    SetElemValue(elem_hotspot, "ondowncrop", this.ondowncrop);

                    SetElemValue(elem_hotspot, "scale9grid", this.scale9grid);
                    #endregion

                    #region HTML5/APPLE
                    SetElemValue(elem_hotspot, "devices", this.devices);
                    if (this.alturl.Text.Trim() == "")
                    {
                        this.alturl.Text = this.url.Text;
                    }
                    SetElemValue(elem_hotspot, "alturl", this.alturl);
                    //SetElemValue(elem_hotspot, "altscale", this.altscale);
                    SetElemValue(elem_hotspot, "altscale", this.scale);
                    SetElemValue(elem_hotspot, "jsborder", this.jsborder);
                    SetElemValue(elem_hotspot, "altonloaded", this.altonloaded);
                    #endregion

                    #region 内容插件
                    this.html.Text = this.html.Text.Replace("<strong>", "<b>").Replace("</strong>", "</b>");
                    SetElemValue(elem_hotspot, "html", this.html);
                    SetElemValue(elem_hotspot, "css", this.css);
                    SetElemValue(elem_hotspot, "autosize", this.autosize);
                    SetElemValue(elem_hotspot, "background", this.background);
                    SetElemValue(elem_hotspot, "backgroundcolor", this.backgroundcolor);
                    SetElemValue(elem_hotspot, "bordercolor", this.bordercolor);
                    SetElemValue(elem_hotspot, "borderwidth", this.borderwidth);
                    SetElemValue(elem_hotspot, "roundedge", this.roundedge);
                    SetElemValue(elem_hotspot, "selectable", this.selectable);
                    SetElemValue(elem_hotspot, "glow", this.glow);
                    SetElemValue(elem_hotspot, "glowcolor", this.glowcolor);
                    SetElemValue(elem_hotspot, "blur", this.blur);
                    SetElemValue(elem_hotspot, "shadow", this.shadow);
                    SetElemValue(elem_hotspot, "textglow", this.textglow);
                    SetElemValue(elem_hotspot, "textblur", this.textblur);
                    SetElemValue(elem_hotspot, "textglowcolor", this.textglowcolor);
                    SetElemValue(elem_hotspot, "textshadow", this.textshadow);
                    #endregion

                    #region Ploygonal
                    SetElemValue(elem_hotspot, "fillcolor", this.fillcolor);
                    SetElemValue(elem_hotspot, "fillcolorhover", this.fillcolorhover);
                    SetElemValue(elem_hotspot, "fillalpha", this.fillalpha);
                    SetElemValue(elem_hotspot, "fillalphahover", this.fillalphahover);
                    SetElemValue(elem_hotspot, "borderwidth", this.borderwidth);
                    SetElemValue(elem_hotspot, "borderwidthhover", this.borderwidthhover);
                    SetElemValue(elem_hotspot, "bordercolor", this.bordercolor);
                    SetElemValue(elem_hotspot, "bordercolorhover", this.bordercolorhover);
                    SetElemValue(elem_hotspot, "borderalpha", this.borderalpha);
                    SetElemValue(elem_hotspot, "borderalphahover", this.borderalphahover);
                    elem_hotspot.InnerXml = this.hotspot_points.Text;

                    if (this.T_Type.SelectedValue.Trim() == "Ploygonal")//如果是区域热点需要把点热点相关设置清除
                    {
                        SetElemValue(elem_hotspot, "url", "");
                    }
                    #endregion

                    #region FlvVideo
                    SetElemValue(elem_hotspot, "posterurl", this.posterurl, true);
                    SetElemValue(elem_hotspot, "videourl", this.videourl, true);
                    SetElemValue(elem_hotspot, "altvideourl", this.altvideourl, true);
                    SetElemValue(elem_hotspot, "volume", this.volume);
                    SetElemValue(elem_hotspot, "range", this.range);
                    SetElemValue(elem_hotspot, "directionalsound", this.directionalsound);
                    SetElemValue(elem_hotspot, "buffertime", this.buffertime);
                    SetElemValue(elem_hotspot, "loop", this.loop);
                    SetElemValue(elem_hotspot, "pausedonstart", this.pausedonstart);
                    SetElemValue(elem_hotspot, "updateeveryframe", this.updateeveryframe);
                    SetElemValue(elem_hotspot, "onvideocomplete", this.updateeveryframe);
                    #endregion

                    #region Quick
                    SetElemValue(elem_hotspot, "T_Scene_ID", this.T_Scene_ID);
                    SetElemValue(elem_hotspot, "T_Scene_ID_type", this.ddl_T_Type);
                    SetElemValue(elem_hotspot, "T_Scene_ID_hlookat", this.T_Scene_ID_hlookat);
                    SetElemValue(elem_hotspot, "T_Scene_ID_vlookat", this.T_Scene_ID_vlookat);
                    SetElemValue(elem_hotspot, "T_Scene_ID_fov", this.T_Scene_ID_fov);

                    SetElemValue(elem_hotspot, "T_seconds", this.T_seconds);
                    SetElemValue(elem_hotspot, "T_zoom", this.T_zoom);
                    #endregion

                    #region Events
                    SetElemValue(elem_hotspot, "onclick", this.onclick);
                    SetElemValue(elem_hotspot, "onover", this.onover);
                    SetElemValue(elem_hotspot, "onhover", this.onhover);
                    SetElemValue(elem_hotspot, "onout", this.onout);
                    SetElemValue(elem_hotspot, "ondown", this.ondown);
                    SetElemValue(elem_hotspot, "onup", this.onup);
                    #endregion

                    SetElemValue(elem_hotspot, "T_AutoTF", "False");

                    #endregion
                    if (action == "add")
                    {
                        try
                        {
                            xmldoc.SelectSingleNode("/krpano").AppendChild(elem_hotspot);
                            MyApp.Components.XML.XmlDocument.WriteAllText(MyApp.Components.KRPano.GigaMap.GetSceneServerFilePath(_Tour_ID, _Map_ID), xmldoc.OuterXml);
                            Response.Redirect(MyApp.Components.NavUrl.GetUrl(3));
                        }
                        catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "refresh", "<script language=javascript>alert('" + ex.ToString() + "!!!);history.back()</script>"); }
                    }
                    if (action == "edit")
                    {
                        try
                        {
                            MyApp.Components.XML.XmlDocument.WriteAllText(MyApp.Components.KRPano.GigaMap.GetSceneServerFilePath(_Tour_ID, _Map_ID), xmldoc.OuterXml);
                            Response.Redirect(MyApp.Components.NavUrl.GetUrl(3));
                        }
                        catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "refresh", "<script language=javascript>alert('" + ex.ToString() + "!!!);history.back()</script>"); }
                    }


                }
                catch (Exception ex)
                {
                    ButPost.Enabled = false;
                    ClientScript.RegisterStartupScript(this.GetType(), "refresh", "<script language=javascript>alert('" + ex.ToString() + "!!!);history.back()</script>");
                    return;
                }
            }
        }

        [AjaxPro.AjaxMethod]
        public string GetSceneElemValueByPath(object _Tour_ID, object scene_id, string attribute)
        {
            string _File_Dir = Server.MapPath(String.Format("/Project/{0}/scene/{1}/scene.xml", _Tour_ID, scene_id.ToString()));
            StreamReader sr = System.IO.File.OpenText(_File_Dir);
            XmlDocument xmldoc = new XmlDocument();
            xmldoc.LoadXml(sr.ReadToEnd());
            sr.Close();
            XmlNode xmlnode = xmldoc.ChildNodes[0];
            XmlElement xmlelem = (XmlElement)xmlnode;
            if (xmlelem.GetAttribute(attribute).Trim() != "")
            {
                return xmlelem.GetAttribute(attribute).Trim();
            }
            else
            {
                return "　";
            }
        }

        [AjaxPro.AjaxMethod]
        public string GetElemValueByPath(object _Tour_ID, object map_id, string attribute)
        {
            string _File_Dir = Server.MapPath(String.Format("/Project/{0}/GigaMap/{1}/scene.xml", _Tour_ID, map_id.ToString()));
            StreamReader sr = System.IO.File.OpenText(_File_Dir);
            XmlDocument xmldoc = new XmlDocument();
            xmldoc.LoadXml(sr.ReadToEnd());
            sr.Close();
            XmlNode xmlnode = xmldoc.ChildNodes[0];
            XmlElement xmlelem = (XmlElement)xmlnode;
            if (xmlelem.GetAttribute(attribute).Trim() != "")
            {
                return xmlelem.GetAttribute(attribute).Trim();
            }
            else
            {
                return "　";
            }
        }
    }
}
