public static BrowserScriptPocketQueriesPQSetting FromPQPage(Framework.Interfaces.ICore core, Framework.Interfaces.IPlugin plugin, WebBrowser wb)
        {
            BrowserScriptPocketQueriesPQSetting result = new BrowserScriptPocketQueriesPQSetting();
            try
            {
                result.ID = Guid.NewGuid().ToString("N");
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_tbName");
                result.Name = wb.Document.GetElementById("ctl00_ContentBody_tbName").GetAttribute("value");
                result.GenerateOnDays = new List<int>();
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_cbDays_");
                for (int i = 0; i < 7; i++)
                {
                    if (checkBoxChecked(wb, string.Format("ctl00_ContentBody_cbDays_{0}", i)))
                    {
                        result.GenerateOnDays.Add(i);
                    }
                }
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_rbRunOption_");
                for (int i = 0; i < 3; i++)
                {
                    if (checkBoxChecked(wb, string.Format("ctl00_ContentBody_rbRunOption_{0}", i)))
                    {
                        result.ExecutionScheme = i;
                        break;
                    }
                }
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_tbResults");
                result.MaximumCaches = wb.Document.GetElementById("ctl00_ContentBody_tbResults").GetAttribute("value");
                result.GeocacheTypes = new List<int>();
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_rbTypeAny");
                if (!radioButtonChecked(wb, "ctl00_ContentBody_rbTypeAny"))
                {
                    core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_cbTaxonomy_");
                    for (int i = 0; i < 11; i++)
                    {
                        if (checkBoxChecked(wb, string.Format("ctl00_ContentBody_cbTaxonomy_{0}", i)))
                        {
                            result.GeocacheTypes.Add(i);
                        }
                    }
                }
                result.GeocacheContainer = new List<int>();
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_rbContainerAny");
                if (!radioButtonChecked(wb, "ctl00_ContentBody_rbContainerAny"))
                {
                    core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_cbContainers_");
                    for (int i = 0; i < 7; i++)
                    {
                        if (checkBoxChecked(wb, string.Format("ctl00_ContentBody_cbContainers_{0}", i)))
                        {
                            result.GeocacheContainer.Add(i);
                        }
                    }
                }
                result.WhichOptions = new List<int>();
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_cbOptions_");
                for (int i = 0; i < 14; i++)
                {
                    if (checkBoxChecked(wb, string.Format("ctl00_ContentBody_cbOptions_{0}", i)))
                    {
                        result.WhichOptions.Add(i);
                    }
                }
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_cbDifficulty");
                if (checkBoxChecked(wb, "ctl00_ContentBody_cbDifficulty"))
                {
                    core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_ddDifficulty");
                    result.DifficultyCondition = wb.Document.GetElementById("ctl00_ContentBody_ddDifficulty").GetAttribute("value");
                }
                else
                {
                    result.DifficultyCondition = "";
                }
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_ddDifficultyScore");
                result.DifficultyValue = wb.Document.GetElementById("ctl00_ContentBody_ddDifficultyScore").GetAttribute("value");
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_cbTerrain");
                if (checkBoxChecked(wb, "ctl00_ContentBody_cbTerrain"))
                {
                    core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_ddTerrain");
                    result.TerrainCondition = wb.Document.GetElementById("ctl00_ContentBody_ddTerrain").GetAttribute("value");
                }
                else
                {
                    result.TerrainCondition = "";
                }
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_ddTerrainScore");
                result.TerrainValue = wb.Document.GetElementById("ctl00_ContentBody_ddTerrainScore").GetAttribute("value");
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_rbNone");
                if (radioButtonChecked(wb, "ctl00_ContentBody_rbNone"))
                {
                    core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_rbNone");
                    result.WithinSelection = "ctl00_ContentBody_rbNone";
                }
                else if (radioButtonChecked(wb, "ctl00_ContentBody_rbCountries"))
                {
                    core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_rbCountries");
                    result.WithinSelection = "ctl00_ContentBody_rbCountries";
                }
                else if (radioButtonChecked(wb, "ctl00_ContentBody_rbStates"))
                {
                    core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_rbStates");
                    result.WithinSelection = "ctl00_ContentBody_rbStates";
                }
                else
                {
                    result.WithinSelection = "";
                }
                result.Countries = new List<string>();
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_lbCountries");
                HtmlElement listel = wb.Document.GetElementById("ctl00_ContentBody_lbCountries");
                foreach (HtmlElement el in listel.Children)
                {
                    if (el.GetAttribute("selected") != null &&
                        (el.GetAttribute("selected").ToLower() == "selected" ||
                        el.GetAttribute("selected").ToLower() == "true"))
                    {
                        result.Countries.Add(el.GetAttribute("value"));
                    }
                }
                result.States = new List<string>();
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_lbStates");
                listel = wb.Document.GetElementById("ctl00_ContentBody_lbStates");
                foreach (HtmlElement el in listel.Children)
                {
                    if (el.GetAttribute("selected") != null &&
                        (el.GetAttribute("selected").ToLower() == "selected" ||
                        el.GetAttribute("selected").ToLower() == "true"))
                    {
                        result.States.Add(el.GetAttribute("value"));
                    }
                }
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_rbOriginNone");
                if (radioButtonChecked(wb, "ctl00_ContentBody_rbOriginNone"))
                {
                    core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_rbOriginNone");
                    result.FromPointSelection = "ctl00_ContentBody_rbOriginNone";
                }
                else if (radioButtonChecked(wb, "ctl00_ContentBody_rbOriginHome"))
                {
                    core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_rbOriginHome");
                    result.FromPointSelection = "ctl00_ContentBody_rbOriginHome";
                }
                else if (radioButtonChecked(wb, "ctl00_ContentBody_rbOriginGC"))
                {
                    core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_rbOriginGC");
                    result.FromPointSelection = "ctl00_ContentBody_rbOriginGC";
                }
                else if (radioButtonChecked(wb, "ctl00_ContentBody_rbPostalCode"))
                {
                    core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_rbPostalCode");
                    result.FromPointSelection = "ctl00_ContentBody_rbPostalCode";
                }
                else if (radioButtonChecked(wb, "ctl00_ContentBody_rbOriginWpt"))
                {
                    core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_rbOriginWpt");
                    result.FromPointSelection = "ctl00_ContentBody_rbOriginWpt";
                }
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_tbGC");
                result.FromPointGCCode = wb.Document.GetElementById("ctl00_ContentBody_tbGC").GetAttribute("value");
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_tbPostalCode");
                result.FromPointPostalCode = wb.Document.GetElementById("ctl00_ContentBody_tbPostalCode").GetAttribute("value");
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00$ContentBody$LatLong");
                result.LatLonFormatValue = GetElementByName(wb.Document.Body, "ctl00$ContentBody$LatLong").GetAttribute("value");
                result.NorthSouthValues = new List<string>();
                result.EastWestValues = new List<string>();
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_LatLong:_selectNorthSouth");
                result.NorthSouthValues.Add(wb.Document.GetElementById("ctl00_ContentBody_LatLong:_selectNorthSouth").GetAttribute("value"));
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_LatLong:_selectEastWest");
                result.EastWestValues.Add(wb.Document.GetElementById("ctl00_ContentBody_LatLong:_selectEastWest").GetAttribute("value"));
                if (result.LatLonFormatValue == "0")
                {
                    core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_LatLong__inputLatDegs");
                    result.NorthSouthValues.Add(wb.Document.GetElementById("ctl00_ContentBody_LatLong__inputLatDegs").GetAttribute("value"));
                    core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_LatLong__inputLongDegs");
                    result.EastWestValues.Add(wb.Document.GetElementById("ctl00_ContentBody_LatLong__inputLongDegs").GetAttribute("value"));                   
                }
                else if (result.LatLonFormatValue == "1")
                {
                    core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_LatLong__inputLatDegs");
                    result.NorthSouthValues.Add(wb.Document.GetElementById("ctl00_ContentBody_LatLong__inputLatDegs").GetAttribute("value"));
                    core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_LatLong__inputLatMins");
                    result.NorthSouthValues.Add(wb.Document.GetElementById("ctl00_ContentBody_LatLong__inputLatMins").GetAttribute("value"));

                    core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_LatLong__inputLongDegs");
                    result.EastWestValues.Add(wb.Document.GetElementById("ctl00_ContentBody_LatLong__inputLongDegs").GetAttribute("value"));
                    core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_LatLong__inputLongMins");
                    result.EastWestValues.Add(wb.Document.GetElementById("ctl00_ContentBody_LatLong__inputLongMins").GetAttribute("value"));
                }
                else if (result.LatLonFormatValue == "2")
                {
                    core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_LatLong__inputLatDegs");
                    result.NorthSouthValues.Add(wb.Document.GetElementById("ctl00_ContentBody_LatLong__inputLatDegs").GetAttribute("value"));
                    core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_LatLong__inputLatMins");
                    result.NorthSouthValues.Add(wb.Document.GetElementById("ctl00_ContentBody_LatLong__inputLatMins").GetAttribute("value"));
                    core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_LatLong__inputLatSecs");
                    result.NorthSouthValues.Add(wb.Document.GetElementById("ctl00_ContentBody_LatLong__inputLatSecs").GetAttribute("value"));

                    core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_LatLong__inputLongDegs");
                    result.EastWestValues.Add(wb.Document.GetElementById("ctl00_ContentBody_LatLong__inputLongDegs").GetAttribute("value"));
                    core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_LatLong__inputLongMins");
                    result.EastWestValues.Add(wb.Document.GetElementById("ctl00_ContentBody_LatLong__inputLongMins").GetAttribute("value"));
                    core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_LatLong__inputLongSecs");
                    result.EastWestValues.Add(wb.Document.GetElementById("ctl00_ContentBody_LatLong__inputLongSecs").GetAttribute("value"));
                }
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_tbRadius");
                result.WithinRadius = wb.Document.GetElementById("ctl00_ContentBody_tbRadius").GetAttribute("value");
                if (radioButtonChecked(wb, "ctl00_ContentBody_rbUnitType_0"))
                {
                    result.WithinRadiusUnitType = "ctl00_ContentBody_rbUnitType_0";
                }
                else
                {
                    result.WithinRadiusUnitType = "ctl00_ContentBody_rbUnitType_1";
                }

                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_rbPlacedNone");
                if (radioButtonChecked(wb, "ctl00_ContentBody_rbPlacedNone"))
                {
                    result.PlacedDuring = "ctl00_ContentBody_rbPlacedNone";
                }
                else if (radioButtonChecked(wb, "ctl00_ContentBody_rbPlacedLast"))
                {
                    result.PlacedDuring = "ctl00_ContentBody_rbPlacedLast";
                }
                else if (radioButtonChecked(wb, "ctl00_ContentBody_rbPlacedBetween"))
                {
                    result.PlacedDuring = "ctl00_ContentBody_rbPlacedBetween";
                }
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_ddLastPlaced");
                result.PlacedDuringFixedInterval = wb.Document.GetElementById("ctl00_ContentBody_ddLastPlaced").GetAttribute("value");
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_DateTimeBegin_Year");
                result.PlacedDuringFromDate = new DateTime(
                    int.Parse(wb.Document.GetElementById("ctl00_ContentBody_DateTimeBegin_Year").GetAttribute("value")),
                    int.Parse(wb.Document.GetElementById("ctl00_ContentBody_DateTimeBegin_Month").GetAttribute("value")),
                    int.Parse(wb.Document.GetElementById("ctl00_ContentBody_DateTimeBegin_Day").GetAttribute("value"))
                    );
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_DateTimeEnd_Year");
                result.PlacedDuringToDate = new DateTime(
                    int.Parse(wb.Document.GetElementById("ctl00_ContentBody_DateTimeEnd_Year").GetAttribute("value")),
                    int.Parse(wb.Document.GetElementById("ctl00_ContentBody_DateTimeEnd_Month").GetAttribute("value")),
                    int.Parse(wb.Document.GetElementById("ctl00_ContentBody_DateTimeEnd_Day").GetAttribute("value"))
                    );
                result.IncludeAttributes = new List<AttributeState>();
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_ctlAttrInclude_dtlAttributeIcons_ctl{0}_hidInput");
                for (int i = 0; i < 70; i++)
                {
                    HtmlElement el = wb.Document.GetElementById(string.Format("ctl00_ContentBody_ctlAttrInclude_dtlAttributeIcons_ctl{0}_hidInput", i.ToString("00")));
                    if (el != null)
                    {
                        AttributeState ats = new AttributeState();
                        ats.ID = el.GetAttribute("AttID");
                        ats.Value = el.GetAttribute("value");
                        result.IncludeAttributes.Add(ats);
                    }
                }
                result.ExcludeAttributes = new List<AttributeState>();
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_ctlAttrExclude_dtlAttributeIcons_ctl{0}_hidInput");
                for (int i = 0; i < 70; i++)
                {
                    HtmlElement el = wb.Document.GetElementById(string.Format("ctl00_ContentBody_ctlAttrExclude_dtlAttributeIcons_ctl{0}_hidInput", i.ToString("00")));
                    if (el != null)
                    {
                        AttributeState ats = new AttributeState();
                        ats.ID = el.GetAttribute("AttID");
                        ats.Value = el.GetAttribute("value");
                        result.ExcludeAttributes.Add(ats);
                    }
                }
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_ddlAltEmails");
                try
                {
                    result.EMail = wb.Document.GetElementById("ctl00_ContentBody_ddlAltEmails").GetAttribute("value");
                }
                catch
                {
                    result.EMail = "";
                }
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_cbZip");
                result.CompressFile = checkBoxChecked(wb, "ctl00_ContentBody_cbZip");
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_ddFormats");
                result.FileFormat = wb.Document.GetElementById("ctl00_ContentBody_ddFormats").GetAttribute("value");
                core.DebugLog(Framework.Data.DebugLogLevel.Info, plugin, null, "ctl00_ContentBody_cbIncludePQNameInFileName");
                result.PQNameInFileName = checkBoxChecked(wb, "ctl00_ContentBody_cbIncludePQNameInFileName");
            }
            catch
            {
                result = null;
            }
            return result;
        }