/// <summary>
        /// Updates the data file offsets from the HTML document within the supplied range 
        /// </summary>
        /// <param name="start">beginning offset to save</param>
        /// <param name="count">last offset to update </param>
        public void SaveOffsetEditor(int start, int count)
        {
            UpdateDocument(new Action(delegate()
            {
                for (int i = start; i <= count; i++)
                { 
                    if (_GuiHost.Document.GetElementById(String.Format("offsetname{0}", i)) != null
                        || _GuiHost.Document.GetElementById(String.Format("offsetlabel{0}", i)) != null)
                    {
                        var offset = InterpreterDataFile.Offsets.FirstOrDefault(x => x.Index == i);
                        if (offset == null)
                        {
                            offset = new OffsetData { Index = i };
                            InterpreterDataFile.Offsets.Add(offset);
                        }
                        double offsetvalue = 0.0;
                        int indexvalue = 0;

                        if (_GuiHost.Document.GetElementById(String.Format("offsetname{0}", i)) != null)
                        {
                            offset.Name = _GuiHost.GetAttribute(String.Format("offsetname{0}", i), Attribs.Value);
                        }
                        else if (_GuiHost.Document.GetElementById(String.Format("offsetlabel{0}", i)) != null)
                        {
                            offset.Name = _GuiHost.GetElementText(String.Format("offsetname{0}", i));
                        }


                        if (_GuiHost.Document.GetElementById(String.Format("offsetid{0}", i)) != null)
                        {
                            if (Int32.TryParse(_GuiHost.GetAttribute(String.Format("offsetid{0}", i), Attribs.Value), out indexvalue))
                            {
                                offset.Index = indexvalue;
                            }
                        }
                        else
                        {
                            offset.Index = i;
                        }

                        if (_GuiHost.Document.GetElementById(String.Format("offsetX{0}", i)) != null)
                        {
                            if (Double.TryParse(_GuiHost.GetAttribute(String.Format("offsetX{0}", i), Attribs.Value), out offsetvalue))
                            {
                                offset.X = offsetvalue;
                            }
                        }
                        if (_GuiHost.Document.GetElementById(String.Format("offsetY{0}", i)) != null)
                        {
                            if (Double.TryParse(_GuiHost.GetAttribute(String.Format("offsetY{0}", i), Attribs.Value), out offsetvalue))
                            {
                                offset.Y = offsetvalue;
                            }
                        }
                        if (_GuiHost.Document.GetElementById(String.Format("offsetZ{0}", i)) != null)
                        {
                            if (Double.TryParse(_GuiHost.GetAttribute(String.Format("offsetZ{0}", i), Attribs.Value), out offsetvalue))
                            {
                                offset.Z = offsetvalue;
                            }
                        }
                        if (_GuiHost.Document.GetElementById(String.Format("offsetA{0}", i)) != null)
                        {
                            if (Double.TryParse(_GuiHost.GetAttribute(String.Format("offsetA{0}", i), Attribs.Value), out offsetvalue))
                            {
                                offset.A = offsetvalue;
                            }
                        }
                        if (_GuiHost.Document.GetElementById(String.Format("offsetB{0}", i)) != null)
                        {
                            if (Double.TryParse(_GuiHost.GetAttribute(String.Format("offsetB{0}", i), Attribs.Value), out offsetvalue))
                            {
                                offset.B = offsetvalue;
                            }
                        }
                        if (_GuiHost.Document.GetElementById(String.Format("offsetC{0}", i)) != null)
                        {
                            if (Double.TryParse(_GuiHost.GetAttribute(String.Format("offsetC{0}", i), Attribs.Value), out offsetvalue))
                            {
                                offset.C = offsetvalue;
                            }
                        } 
                    }
                }
            }));
        }
 /// <summary>
 /// Transfers offset data from the data file to the HTML within the supplied range of elements
 /// </summary>
 /// <param name="start">beginning offset to load</param>
 /// <param name="count">last offset to load </param>
 public void LoadOffsetEditor(int start, int count)
 {
     bool needssave = false;
     UpdateDocument(new Action(delegate()
     {
         for (int i = start; i <= count; i++)
         {
             var element = _GuiHost.Document.GetElementById(String.Format("offsetname{0}", i));
             if (element != null)
             {
                 var offset = InterpreterDataFile.Offsets.FirstOrDefault(x => x.Index == i);
                 if (offset == null)
                 {
                     offset = new OffsetData { Index = i };
                     InterpreterDataFile.Offsets.Add(offset);
                     needssave = true;
                 }
                 _GuiHost.SetAttribute(String.Format("offsetname{0}", i), Attribs.Value, offset.Name);
                 _GuiHost.SetAttribute(String.Format("offsetid{0}", i), Attribs.Value, offset.Index);
                 _GuiHost.SetAttribute(String.Format("offsetX{0}", i), Attribs.Value, offset.X);
                 _GuiHost.SetAttribute(String.Format("offsetY{0}", i), Attribs.Value, offset.Y);
                 _GuiHost.SetAttribute(String.Format("offsetZ{0}", i), Attribs.Value, offset.Z);
                 _GuiHost.SetAttribute(String.Format("offsetA{0}", i), Attribs.Value, offset.A);
                 _GuiHost.SetAttribute(String.Format("offsetB{0}", i), Attribs.Value, offset.B);
                 _GuiHost.SetAttribute(String.Format("offsetC{0}", i), Attribs.Value, offset.C);
             }
             else
             {
                 element = _GuiHost.Document.GetElementById(String.Format("offsetlabel{0}", i));
                 if (element != null)
                 {
                     var offset = InterpreterDataFile.Offsets.FirstOrDefault(x => x.Index == i);
                     if (offset == null)
                     {
                         offset = new OffsetData { Index = i };
                         InterpreterDataFile.Offsets.Add(offset);
                         needssave = true;
                     }
                     _GuiHost.SetAttribute(String.Format("offsetX{0}", i), Attribs.Value, offset.X);
                     _GuiHost.SetAttribute(String.Format("offsetY{0}", i), Attribs.Value, offset.Y);
                     _GuiHost.SetAttribute(String.Format("offsetZ{0}", i), Attribs.Value, offset.Z);
                     _GuiHost.SetAttribute(String.Format("offsetA{0}", i), Attribs.Value, offset.A);
                     _GuiHost.SetAttribute(String.Format("offsetB{0}", i), Attribs.Value, offset.B);
                     _GuiHost.SetAttribute(String.Format("offsetC{0}", i), Attribs.Value, offset.C);
                 }
             }
         }
     }));
     if (needssave)
     {
         SaveInterpreterData();
     }
 }