void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            string innerHtml = webBrowser1.Document.Body.InnerHtml;

            string body = webBrowser1.Document.Body.InnerHtml;

            grdLister.Rows.Clear();
            try
            {
                string htmlText = webBrowser1.Document.Body.InnerHtml.ToStr().ToLower();

                htmlText = htmlText.Replace("\"", "").Trim();

                int Spoint = htmlText.ToLower().IndexOf("<div class=time yui3-u>");
                int dpoint = htmlText.ToLower().IndexOf("<span class=metric>");



                if (Spoint == -1)
                {
                    return;
                }



                // Fails saying google is unexpected token!
                //   var input = XElement.Parse(test);


                //foreach (KeyValuePair<string, string> item in input)
                //    Console.WriteLine("Key: {0,15} Value: {1}", item.Key, item.Value);



                int iteration = 0;

                while (Spoint != -1)
                {
                    iteration++;



                    string          s   = htmlText.Substring(Spoint, dpoint - Spoint);
                    GridViewRowInfo row = null;


                    if (s.Contains("<span class=units>mi</span>"))
                    {
                        IsYahooFaresLoaded = true;
                        string tempStr = s.Substring(s.IndexOf("<span class=imperial>"), s.IndexOf("<span class=units>mi</span>") - s.IndexOf("<span class=imperial>"));
                        tempStr = tempStr.Replace("<span class=imperial>", "").Trim().Replace("<span class=imperial>", "").Trim();
                        decimal miles = tempStr.ToDecimal();


                        tempStr = s.Substring(s.IndexOf("<div class=time yui3-u>"), s.IndexOf("<div class=distance yui3-u>") - s.IndexOf("<div class=ime yui3-u>"));
                        tempStr = tempStr.Replace("<div class=time yui3-u>", "").Trim().Replace("<span class=units>", "").Trim().Replace("</span></div>", "").Trim();
                        string minuts = tempStr.ToStr();

                        htmlText = htmlText.Remove(0, Spoint + s.Length);
                        // int min = rows[i].LastIndexOf(", ");

                        if (htmlText.StartsWith("<span class=metric>"))
                        {
                            htmlText = htmlText.Remove(0, "<span class=metric>".Length).Trim();
                        }

                        // int com = rows[i].IndexOf(",");
                        // //min = min - com;

                        // string miles = rows[i].Substring(0, com).Trim();
                        // string minuts = rows[i].Substring(min, rows[i].Length - min);
                        // minuts = minuts.Replace(",", "").Trim();
                        row = grdLister.Rows.AddNew();
                        row.Cells["miles"].Value   = miles;
                        row.Cells["Miniuts"].Value = minuts;


                        int?companyID = 0;
                        var objFare   = new TaxiDataContext().stp_CalculateGeneralFares(VehicleId, companyID, miles, this.PickupTime);
                        if (objFare != null)
                        {
                            var f = objFare.FirstOrDefault();

                            if ((f.Result == "Success" || f.Result.ToStr().IsNumeric()))
                            {
                                decimal fareVal = f.totalFares.ToDecimal();

                                decimal dd;
                                if (AppVars.objPolicyConfiguration.RoundMileageFares.ToBool())
                                {
                                    fareVal = Math.Ceiling(fareVal);
                                }


                                if (AppVars.objPolicyConfiguration.RoundMileageFares.ToBool() == false)
                                {
                                    dd = fareVal.ToDecimal();
                                }
                                else
                                {
                                    string ff = string.Format("{0:#}", fareVal);
                                    if (ff == string.Empty)
                                    {
                                        ff = "0";
                                    }

                                    dd = ff.ToDecimal();
                                }

                                // Add Airport Pickup Charges If Pickup Point is From Airport...
                                if (this.FromLocTypeId == Enums.LOCATION_TYPES.AIRPORT)
                                {
                                    dd += AppVars.objPolicyConfiguration.AirportPickupCharges.ToDecimal();
                                }



                                row.Cells["Fares"].Value = dd;
                            }
                        }
                    }
                    else
                    {
                        htmlText = htmlText.Replace(s, "");
                    }

                    Spoint = htmlText.IndexOf("<div class=time yui3-u>");
                    dpoint = htmlText.IndexOf("<span class=metric>");


                    while (dpoint - Spoint < 0)
                    {
                        Spoint = htmlText.IndexOf("<div class=time yui3-u>");
                        dpoint = htmlText.IndexOf("<span class=metric>");



                        if (dpoint - Spoint < 0)
                        {
                            int len = "<span class=metric>".Length;

                            htmlText = htmlText.Remove(0, dpoint + len);
                        }


                        Spoint = htmlText.IndexOf("<div class=time yui3-u>");
                        dpoint = htmlText.IndexOf("<span class=metric>");
                    }


                    if (iteration == 10)
                    {
                        break;
                    }
                }


                if (grdLister.Rows.Count > 0)
                {
                    grdLister.CurrentRow = grdLister.Rows[0];
                }

                //int a = 0;
                //if (rows.Count() > 0)
                //{

                //    GridViewRowInfo row = null;
                //    for (int i = 0; i < rows.Count(); i++)
                //    {

                //        if (rows[i].Contains("mi,"))
                //        {

                //            int mi = rows[i].IndexOf("mi,");
                //            int min = rows[i].LastIndexOf(", ");



                //            int com = rows[i].IndexOf(",");
                //            //min = min - com;

                //            string miles = rows[i].Substring(0, com).Trim();
                //            string minuts = rows[i].Substring(min, rows[i].Length - min);
                //            minuts =  minuts.Replace(",", "").Trim();
                //            row = grdLister.Rows.AddNew();
                //            row.Cells["miles"].Value = miles;
                //            row.Cells["Miniuts"].Value = minuts;


                //            int? companyID = 0;
                //            ISingleResult<ClsFares> objFare = General.SP_CalculateFares(VehicleId.ToIntorNull(), companyID.ToIntorNull(), miles.Replace("mi", String.Empty).ToStr(),this.PickupTime);
                //            if (objFare != null)
                //            {
                //                ClsFares f = objFare.FirstOrDefault();

                //                if ((f.Result == "Success" || f.Result.ToStr().IsNumeric()))
                //                {
                //                    decimal fareVal = f.totalFares;

                //                    decimal dd;
                //                    if (AppVars.objPolicyConfiguration.RoundMileageFares.ToBool())
                //                    {

                //                        fareVal = Math.Ceiling(fareVal);
                //                    }


                //                    if (AppVars.objPolicyConfiguration.RoundMileageFares.ToBool() == false)
                //                    {
                //                        dd = fareVal.ToDecimal();
                //                    }
                //                    else
                //                    {
                //                        string ff = string.Format("{0:#}", fareVal);
                //                        if (ff == string.Empty)
                //                            ff = "0";

                //                        dd = ff.ToDecimal();
                //                    }

                //                    // Add Airport Pickup Charges If Pickup Point is From Airport...
                //                    if (this.FromLocTypeId == Enums.LOCATION_TYPES.AIRPORT )
                //                        dd += AppVars.objPolicyConfiguration.AirportPickupCharges.ToDecimal();



                //                    row.Cells["Fares"].Value = dd;



                //                }
                //            }

                //        }



                //    }
                //    if (grdLister.Rows.Count > 0)
                //    {
                //        grdLister.CurrentRow=grdLister.Rows[0];
                //    }
                //}
                //     lblLoading.Visible = false;
            }
            catch (Exception ex)
            {
            }
        }
        public void ReLoadYahooMapFares()
        {
            string innerHtml = string.Empty;

            innerHtml = webBrowser1.Document.Body.InnerHtml.ToStr();

            string body = string.Empty;

            body = webBrowser1.Document.Body.InnerHtml;

            grdLister.Rows.Clear();

            try
            {
                string htmlText = webBrowser1.Document.Body.InnerHtml.ToStr().ToLower();
                htmlText = htmlText.Replace("\"", "").Trim();

                string html2  = webBrowser1.Document.Body.OuterHtml.ToStr().ToLower();
                int    Spoint = htmlText.ToLower().IndexOf("<div class=time yui3-u>");
                int    dpoint = htmlText.ToLower().IndexOf("<span class=metric>");
                if (Spoint == -1)
                {
                    return;
                }

                int iteration = 0;

                while (Spoint != -1)
                {
                    iteration++;
                    string          s   = htmlText.Substring(Spoint, dpoint - Spoint);
                    GridViewRowInfo row = null;
                    if (s.Contains("<span class=units>mi</span>"))
                    {
                        IsYahooFaresLoaded = true;
                        string tempStr = s.Substring(s.IndexOf("<span class=imperial>"), s.IndexOf("<span class=units>mi</span>") - s.IndexOf("<span class=imperial>"));
                        tempStr = tempStr.Replace("<span class=imperial>", "").Trim().Replace("<span class=imperial>", "").Trim();
                        decimal miles = tempStr.ToDecimal();
                        tempStr = s.Substring(s.IndexOf("<div class=time yui3-u>"), s.IndexOf("<div class=distance yui3-u>") - s.IndexOf("<div class=ime yui3-u>"));
                        tempStr = tempStr.Replace("<div class=time yui3-u>", "").Trim().Replace("<span class=units>", "").Trim().Replace("</span></div>", "").Trim();
                        string minuts = tempStr.ToStr();

                        htmlText = htmlText.Remove(0, Spoint + s.Length);
                        // int min = rows[i].LastIndexOf(", ");

                        if (htmlText.StartsWith("<span class=metric>"))
                        {
                            htmlText = htmlText.Remove(0, "<span class=metric>".Length).Trim();
                        }

                        // int com = rows[i].IndexOf(",");
                        // //min = min - com;

                        // string miles = rows[i].Substring(0, com).Trim();
                        // string minuts = rows[i].Substring(min, rows[i].Length - min);
                        // minuts = minuts.Replace(",", "").Trim();
                        row = grdLister.Rows.AddNew();
                        row.Cells["miles"].Value   = miles;
                        row.Cells["Miniuts"].Value = minuts;


                        int?companyID = 0;
                        var objFare   = new TaxiDataContext().stp_CalculateGeneralFares(VehicleId, companyID, miles, this.PickupTime);

                        if (objFare != null)
                        {
                            var f = objFare.FirstOrDefault();

                            if ((f.Result == "Success" || f.Result.ToStr().IsNumeric()))
                            {
                                decimal fareVal = f.totalFares.ToDecimal();

                                decimal dd;
                                if (AppVars.objPolicyConfiguration.RoundMileageFares.ToBool())
                                {
                                    fareVal = Math.Ceiling(fareVal);
                                }


                                if (AppVars.objPolicyConfiguration.RoundMileageFares.ToBool() == false)
                                {
                                    dd = fareVal.ToDecimal();
                                }
                                else
                                {
                                    string ff = string.Format("{0:#}", fareVal);
                                    if (ff == string.Empty)
                                    {
                                        ff = "0";
                                    }

                                    dd = ff.ToDecimal();
                                }

                                // Add Airport Pickup Charges If Pickup Point is From Airport...
                                if (this.FromLocTypeId == Enums.LOCATION_TYPES.AIRPORT)
                                {
                                    dd += AppVars.objPolicyConfiguration.AirportPickupCharges.ToDecimal();
                                }
                                row.Cells["Fares"].Value = dd;
                            }
                        }
                    }
                    else
                    {
                        htmlText = htmlText.Replace(s, "");
                    }

                    Spoint = htmlText.IndexOf("<div class=time yui3-u>");
                    dpoint = htmlText.IndexOf("<span class=metric>");


                    while (dpoint - Spoint < 0)
                    {
                        Spoint = htmlText.IndexOf("<div class=time yui3-u>");
                        dpoint = htmlText.IndexOf("<span class=metric>");



                        if (dpoint - Spoint < 0)
                        {
                            int len = "<span class=metric>".Length;

                            htmlText = htmlText.Remove(0, dpoint + len);
                        }


                        Spoint = htmlText.IndexOf("<div class=time yui3-u>");
                        dpoint = htmlText.IndexOf("<span class=metric>");
                    }

                    if (iteration == 10)
                    {
                        break;
                    }
                }
                if (grdLister.Rows.Count > 0)
                {
                    grdLister.CurrentRow = grdLister.Rows[0];
                }
            }
            catch (Exception ex)
            {
            }
        }