private void BindCountryFirst()
    {
        DataTable     dt           = new DataTable();
        List <string> vList        = new List <string>();
        DataTable     dtCategories = new DataTable();
        DataFunctions obj          = new DataFunctions();

        dt = obj.PropertiesByCase(vList, countryid, "Country");
        DataView dv = dt.DefaultView;

        dv.Sort              = "category asc";
        dt                   = dv.ToTable();
        dtCategories         = obj.FindNumCategorieswithImage(dt);
        dtlStates.DataSource = dtCategories;
        dtlStates.DataBind();
    }
    protected void Page_Load(object sender, System.EventArgs e)
    {
        RegionCountriesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), "select distinct Country,Region from Countries inner join Regions on Countries.RegionID=Regions.ID " +
                                                                " inner join StateProvinces on StateProvinces.CountryID=Countries.ID " +
                                                                "where (RegionID=@RegionID)  AND EXISTS (" +
                                                                " SELECT * FROM Properties INNER JOIN Cities ON Properties.CityID = Cities.ID" +
                                                                " WHERE (Properties.IfFinished = 1) AND (Properties.IfApproved = 1)" +
                                                                " AND (Cities.StateProvinceID = StateProvinces.ID) " +
                                                                " AND NOT EXISTS (SELECT * FROM Auctions WHERE PropertyID = Properties.ID)) " +
                                                                "ORDER BY Country", SqlDbType.Int);
        StateProvincesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), "SELECT StateProvinces.* " +
                                                               "FROM StateProvinces " +
                                                               "WHERE (StateProvinces.CountryID = @CountryID) AND EXISTS (" +
                                                               " SELECT * FROM Properties INNER JOIN Cities ON Properties.CityID = Cities.ID" +
                                                               " WHERE (Properties.IfFinished = 1) AND (Properties.IfApproved = 1)" +
                                                               " AND (Cities.StateProvinceID = StateProvinces.ID) " +
                                                               " AND NOT EXISTS (SELECT * FROM Auctions WHERE PropertyID = Properties.ID)) " +
                                                               "ORDER BY StateProvince", SqlDbType.Int);
        // StateCodeInfo.Text = SqlDbType.Int.
        CitiesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), String.Format(STR_SELECTCitiesFROMCitiesWHERECitiesStateProvinceID), SqlDbType.Int);

        const string STR_SELECTPropertiesInfo = "SELECT Properties.Name2 as PropertyName2, Properties.Name, Properties.NumBedrooms, Properties.NumBaths, Properties.NumSleeps, Properties.NumTVs, Properties.NumVCRs, Properties.CityID, Properties.NumCDPlayers, Properties.ID, CASE WHEN EXISTS (SELECT * FROM PropertiesAmenities INNER JOIN Amenities ON PropertiesAmenities.AmenityID = Amenities.ID WHERE (PropertiesAmenities.PropertyID = Properties.ID) AND (Amenities.Amenity = 'Beach Front')) THEN 'Beach Front' ELSE '' END AS BeachFront, CASE WHEN EXISTS (SELECT * FROM PropertiesAmenities INNER JOIN Amenities ON PropertiesAmenities.AmenityID = Amenities.ID WHERE (PropertiesAmenities.PropertyID = Properties.ID) AND (Amenities.Amenity = 'Seaside')) THEN 'Seaside' ELSE '' END AS Seaside, CASE WHEN EXISTS (SELECT * FROM PropertiesAmenities INNER JOIN Amenities ON PropertiesAmenities.AmenityID = Amenities.ID WHERE (PropertiesAmenities.PropertyID = Properties.ID) AND (Amenities.Amenity = 'Lake Front')) THEN 'Lake Front' ELSE '' END AS LakeFront, CASE WHEN EXISTS (SELECT * FROM PropertiesAmenities INNER JOIN Amenities ON PropertiesAmenities.AmenityID = Amenities.ID WHERE (PropertiesAmenities.PropertyID = Properties.ID) AND (Amenities.Amenity = 'River Front')) THEN 'River Front' ELSE '' END AS RiverFront, CASE WHEN EXISTS (SELECT * FROM PropertiesAmenities INNER JOIN Amenities ON PropertiesAmenities.AmenityID = Amenities.ID WHERE (PropertiesAmenities.PropertyID = Properties.ID) AND (Amenities.Amenity = 'Ski In Ski Out')) THEN 'Ski In Ski Out' ELSE '' END AS Ski, Cities.City, StateProvinces.StateProvince, Countries.Country, Regions.Region, MinimumNightlyRentalTypes.Name AS MinimumNightlyRental, PropertyTypes.Name AS Type FROM Properties INNER JOIN Cities ON Properties.CityID = Cities.ID INNER JOIN StateProvinces ON StateProvinces.ID = Cities.StateProvinceID INNER JOIN Countries ON StateProvinces.CountryID = Countries.ID INNER JOIN Regions ON Countries.RegionID = Regions.ID INNER JOIN Users ON Properties.UserID = Users.ID LEFT OUTER JOIN MinimumNightlyRentalTypes ON Properties.MinimumNightlyRentalID = MinimumNightlyRentalTypes.ID LEFT OUTER JOIN PropertyTypes ON Properties.TypeID = PropertyTypes.ID WHERE (Properties.IfFinished = 1) AND (Properties.IfApproved = 1) AND (StateProvinces.CountryID = @CountryID) AND NOT EXISTS (SELECT * FROM Auctions WHERE PropertyID = Properties.ID) ORDER BY StateProvinces.StateProvince, Cities.City, Type, CASE WHEN EXISTS (SELECT * FROM Invoices WHERE (PropertyID = Properties.ID) AND (PaymentAmount >= InvoiceAmount) AND (GETDATE() <= Invoices.RenewalDate)) THEN 1 ELSE 0 END DESC, Properties.ID";

        PropertiesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), String.Format(STR_SELECTPropertiesInfo), SqlDbType.Int);

        AmenitiesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), "SELECT Amenities.ID, Amenity," +
                                                          " PropertiesAmenities.PropertyID " +
                                                          "FROM Amenities INNER JOIN PropertiesAmenities ON Amenities.ID = PropertiesAmenities.AmenityID" +
                                                          " INNER JOIN Properties ON PropertiesAmenities.PropertyID = Properties.ID " +
                                                          " INNER JOIN Cities ON Properties.CityID = Cities.ID INNER JOIN StateProvinces ON StateProvinces.ID = Cities.StateProvinceID " +
                                                          "WHERE (Properties.IfFinished = 1) AND (Properties.IfApproved = 1) AND (StateProvinces.CountryID = @CountryID)" +
                                                          " AND NOT EXISTS (SELECT * FROM Auctions WHERE PropertyID = Properties.ID) AND (Amenities.Amenity NOT IN" +
                                                          " ('Lake Front', 'Beach Front', 'River Front', 'Seaside', 'Ski In Ski Out', 'TV', 'VCR', 'CD Player'))",
                                                          SqlDbType.Int);

        LocationAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), "SELECT StateProvinces.ID AS StateProvinceID," +
                                                         " StateProvinces.StateProvince, Countries.ID AS CountryID, Countries.Country, Regions.ID AS RegionID," +
                                                         " Regions.Region, Countries.titleoverride, stateprovinces.descriptionoverride " +
                                                         "FROM StateProvinces INNER JOIN Countries ON StateProvinces.CountryID = Countries.ID" +
                                                         " INNER JOIN Regions ON Countries.RegionID = Regions.ID WHERE (Countries.ID = @CountryId)",
                                                         SqlDbType.Int);

        PropertyTypesAdapter = CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), "SELECT     PropertyTypes.Name,COUNT(*) as Count, PropertyTypes.ID " +
                                                              " FROM         Cities INNER JOIN " +
                                                              " Properties ON Cities.ID = Properties.CityID  " +
                                                              " INNER JOIN " +
                                                              " PropertyTypes ON Properties.TypeID = PropertyTypes.ID INNER JOIN " +
                                                              " StateProvinces ON Cities.StateProvinceID = StateProvinces.ID INNER JOIN " +
                                                              " Countries ON StateProvinces.CountryID = Countries.ID  WHERE (Countries.ID = @CountryId) " +
                                                              "group by PropertyTypes.Name,PropertyTypes.ID",
                                                              SqlDbType.Int);


        if ((Request.Params["CountryID"] != null) && (Request.Params["CountryID"].Length > 0))
        {
            try
            {
                countryid = Convert.ToInt32(Request.Params["CountryID"]);
            }
            catch (Exception)
            {
            }
        }

        if (countryid == -1)
        {
            Response.Redirect(CommonFunctions.PrepareURL("InternalError.aspx"));
        }

        // Map Display Of Country Page
        SqlConnection con = CommonFunctions.GetConnection();

        CountryMapAdapter = new SqlDataAdapter(STR_SELECTCitiesFROMCitiesWHERECitiesStateProvinceIDNew, con);//CommonFunctions.PrepareAdapter(CommonFunctions.GetConnection(), String.Format(STR_SELECTCitiesFROMCitiesWHERECitiesStateProvinceID), SqlDbType.Int);
        CountryMapAdapter.SelectCommand.Parameters.Add("@CountryID", SqlDbType.Int);
        CountryMapAdapter.SelectCommand.Parameters["@CountryID"].Value = Convert.ToInt32(countryid);

        DataTable dtmap = new DataTable();

        CountryMapAdapter.Fill(dtmap);
        List <Locationss> eList = new List <Locationss>();

        foreach (DataRow dr in dtmap.Rows)
        {
            try
            {
                Locationss e1 = new Locationss();
                e1.title       = dr["City"].ToString();
                e1.lat         = Convert.ToDouble(dr["Latitude"]);
                e1.lng         = Convert.ToDouble(dr["Longitude"]);
                e1.description = dr["City"].ToString();
                string temp = CommonFunctions.GetSiteAddress() + "/" + dr["Country"].ToString().ToLower().Replace(" ", "_") +
                              "/" + dr["StateProvince"].ToString().ToLower().Replace(" ", "_") + "/" + dr["City"].ToString().ToLower().Replace(" ", "_") + "/default.aspx";
                e1.URL = temp;
                eList.Add(e1);
            }
            catch { }
        }
        string ans             = JsonConvert.SerializeObject(eList, Formatting.Indented);
        ClientScriptManager cs = Page.ClientScript;

        cs.RegisterStartupScript(Page.GetType(), "JSON", "initialize(" + ans + ");", true);


        CitiesAdapter.SelectCommand.Parameters["@CountryId"].Value        = countryid;
        LocationAdapter.SelectCommand.Parameters["@CountryId"].Value      = countryid;
        PropertiesAdapter.SelectCommand.Parameters["@CountryId"].Value    = countryid;
        AmenitiesAdapter.SelectCommand.Parameters["@CountryId"].Value     = countryid;
        PropertyTypesAdapter.SelectCommand.Parameters["@CountryId"].Value = countryid;

        Session["CountryID"] = countryid;
        if (LocationAdapter.Fill(MainDataSet, "Location") > 0)
        {
            regionid      = (int)MainDataSet.Tables["Location"].Rows[0]["RegionID"];
            countryid     = (int)MainDataSet.Tables["Location"].Rows[0]["CountryID"];
            region        = (string)MainDataSet.Tables["Location"].Rows[0]["Region"];
            country       = (string)MainDataSet.Tables["Location"].Rows[0]["Country"];
            stateprovince = (string)MainDataSet.Tables["Location"].Rows[0]["StateProvince"];
        }
        else
        {
            Response.Redirect(CommonFunctions.PrepareURL("InternalError.aspx"));
        }

        StateProvincesAdapter.SelectCommand.Parameters["@CountryID"].Value = countryid;
        RegionCountriesAdapter.SelectCommand.Parameters["@RegionId"].Value = regionid;
        CitiesAdapter.Fill(MainDataSet, "Cities");
        PropertiesAdapter.Fill(MainDataSet, "Properties");
        AmenitiesAdapter.Fill(MainDataSet, "Amenities");
        StateProvincesAdapter.Fill(MainDataSet, "StateProvinces");
        PropertyTypesAdapter.Fill(MainDataSet, "PropertyTypes");
        RegionCountriesAdapter.Fill(MainDataSet, "CountriesRegion");
        DBConnection objTemp = new DBConnection();
        DataTable    dtTemp  = new DataTable();

        try
        {
            dtTemp = VADBCommander.CountyNamesWithProperties(Request.Params["StateProvinceID"].ToString());
            DataTable dtCopy = dtTemp.Copy();
            dtCopy.TableName = "dtcopy";
            dtCopy.Namespace = "dtcopy";
            MainDataSet.Tables.Add(dtCopy);
            MainDataSet.Relations.Add("CitiesProperties", MainDataSet.Tables["Cities"].Columns["ID"],
                                      MainDataSet.Tables["Properties"].Columns["CityID"]);
            MainDataSet.Relations.Add("PropertiesAmenities", MainDataSet.Tables["Properties"].Columns["ID"],
                                      MainDataSet.Tables["Amenities"].Columns["PropertyID"]);

            MainDataSet.Relations.Add("CountyCities", MainDataSet.Tables["dtcopy"].Columns["ID"],
                                      MainDataSet.Tables["Cities"].Columns["countyID"]);
            LocationAdapterCountry.SelectCommand.Parameters["@CountryID"].Value = countryid;
        }
        catch (Exception ex) { lblInfo22.Text += ex.Message; }
        finally { objTemp.CloseConnection(); }

        foreach (DataRow datarow in MainDataSet.Tables["Cities"].Rows)
        {
            if (datarow["City"] is string)
            {
                cities += " " + (string)datarow["City"];
            }
        }
        HtmlHead head = Page.Header;

        DataBind();

        /////// common for postback and ! postback
        List <string> vList        = new List <string>();
        DataTable     dt           = new DataTable();
        DataFunctions obj          = new DataFunctions();
        DataTable     dtCategories = new DataTable();
        DBConnection  obj1         = new DBConnection();

        try
        {
            if (!IsPostBack)
            {
                dt = obj.PropertiesByCase(vList, countryid, "Country");
                DataView dv = dt.DefaultView;
                dv.Sort       = "category asc";
                dt            = dv.ToTable();
                test123.Text  = "Country " + countryid.ToString() + " Count " + dt.Rows.Count.ToString();
                Session["dt"] = dt;
                int[] i = new int[4];
                i = FindNumAmenities(dt);

                //dtCategories = obj.FindNumCategories(dt);
                dtCategories = obj.FindNumCategorieswithImage(dt);
                DataView dvMax = dtCategories.DefaultView;
                dvMax.Sort = "count desc";
                DataTable dtMax          = dvMax.ToTable();
                int       vCategoryCount = 0;
                string    firstCategory  = "";
                string    subCategory    = "";
                foreach (DataRow row in dtMax.Rows)
                {
                    int index = dtMax.Rows.IndexOf(row);
                    if (index == 0)
                    {
                        firstCategory = row["category"].ToString();
                        subCategory   = dt.Rows[0]["SubCategory"].ToString();
                    }
                    test123.Text = test123.Text + row["count"].ToString() + ",";
                    string vTemp = row["category"].ToString() + " (" + row["count"].ToString() + ")";
                    vTemp          = vTemp.Replace(" ", "&nbsp;");
                    vCategoryCount = vCategoryCount + Convert.ToInt32(row["count"].ToString());
                }

                if (!IsPostBack)
                {
                    dtlStates.DataSource = dtCategories;
                    dtlStates.DataBind();
                }
                //numbedrooms filter
                dtCategories = obj.FindNumBedrooms(dt);
                int vBedCount = 0;
                foreach (DataRow row in dtCategories.Rows)
                {
                    vBedCount += Convert.ToInt32(row["count"]);
                }

                Page page = (Page)HttpContext.Current.Handler;


                dtlStates.Style.Add("display", "block");
                filerMain.Style.Add("display", "block");
                if (Request.QueryString["category"] != null)
                {
                    firstCategory = Convert.ToString(Request.QueryString["category"]);
                }
                {
                    string dispString  = "";
                    string dispString2 = "";
                    if (subCategory.Contains("_"))
                    {
                        string[] strSplit = subCategory.Split('_');
                        dispString = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1]) + "s";
                    }
                    else
                    {
                        dispString = UppercaseFirst(subCategory) + "s";
                    }
                    if (firstCategory.Contains("_"))
                    {
                        string[] strSplit = firstCategory.Split('_');
                        dispString2 = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1]) + "s";
                    }
                    else
                    {
                        dispString2 = UppercaseFirst(firstCategory) + "s";
                    }
                    altTag      = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals";
                    ltrH11.Text = char.ToUpper(country[0]) + country.Substring(1) + " " + char.ToUpper(firstCategory[0]) + firstCategory.Substring(1) + "s";
                    ltrH12.Text = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals";
                    //ltrH1.Text = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals And " + dispString2;
                    page.Title = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals | Vacations Abroad";
                }
                if (firstCategory == "bandb")
                {
                    firstCategory = "B&B";
                }


                DataTable dtCategory = dt.Clone();
                foreach (DataRow dr in dt.Rows)
                {
                    string vTemp = dr["Category"].ToString();     //+ " (" + dr["count"].ToString() + ")";
                    if (vTemp.ToLower().Replace(" ", "").Trim() == firstCategory.ToLower().Replace("_", " ").Replace(" ", ""))
                    {
                        subCategory = dr["SubCategory"].ToString();
                        dtCategory.ImportRow(dr);
                    }
                }
                DataView dv1 = dtCategory.DefaultView;
                dv1.Sort = "MinNightRate desc";

                dtlStates.Visible = true;

                if (Request.QueryString["category"] != null)
                {
                    string dispString = "";
                    if (firstCategory.Contains("_"))
                    {
                        string[] strSplit = firstCategory.Split('_');
                        dispString = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1]) + "s";
                    }
                    else
                    {
                        dispString = UppercaseFirst(firstCategory) + "s";
                    }
                    ltrH11.Text = char.ToUpper(country[0]) + country.Substring(1) + " " + char.ToUpper(firstCategory[0]) + firstCategory.Substring(1) + "s";
                    ltrH12.Text = char.ToUpper(country[0]) + country.Substring(1) + " " + subCategory + "s";
                    //ltrH1.Text = char.ToUpper(country[0]) + country.Substring(1) + " " + dispString;
                    page.Title  = char.ToUpper(country[0]) + country.Substring(1) + " " + char.ToUpper(firstCategory[0]) + firstCategory.Substring(1) + "s And " + subCategory + "s | Vacations Abroad";
                    altTag      = subCategory + " in " + country;
                    Label3.Text = altTag;
                }
                else
                {
                    string dispString  = "";
                    string dispString2 = "";
                    if (subCategory.Contains("_"))
                    {
                        string[] strSplit = subCategory.Split('_');
                        dispString = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1]) + "s";
                    }
                    else
                    {
                        dispString = UppercaseFirst(subCategory) + "s";
                    }
                    if (firstCategory.Contains("_"))
                    {
                        string[] strSplit = firstCategory.Split('_');
                        dispString2 = UppercaseFirst(strSplit[0]) + " " + UppercaseFirst(strSplit[1]) + "s";
                    }
                    else
                    {
                        dispString2 = UppercaseFirst(firstCategory) + "s";
                    }
                    altTag      = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals";
                    ltrH11.Text = char.ToUpper(country[0]) + country.Substring(1) + " Vacations ";
                    ltrH12.Text = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals";
                    //ltrH1.Text = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals And " + char.ToUpper(country[0]) + country.Substring(1) + " " + dispString2;
                    page.Title = char.ToUpper(country[0]) + country.Substring(1) + " Vacation Rentals And " + " " + dispString + " | Vacations Abroad";
                }
                string tempcountry = CommonFunctions.GetSiteAddress() + "/" + country.ToLower().Replace(" ", "_") +
                                     "/default.aspx";
                lbltText.Text = "<a href=\"" + tempcountry + "\"><span class=\"CountryInternalLink\" style=\"font-weight:normal;font-style:normal\">" + "</span></a></sp>";

                HtmlMeta description = new HtmlMeta();
                description.Name    = "description";
                description.Content = "Book Now " + char.ToUpper(country[0]) + country.Substring(1) + char.ToUpper(firstCategory[0]) + firstCategory.Substring(1) + "s And unique " + subCategory + "s";
                head.Controls.Add(description);
                //}

                ViewState["firstCategory"] = firstCategory;
                // get the Page Text
                DataTable dt1 = new DataTable();
                try
                {
                    dt1 = VADBCommander.GetMainCountryText(countryid.ToString());
                }
                catch (Exception ex) { lblInfo.Text = ex.Message; }

                if (dt1.Rows.Count > 0)
                {
                    if (dt1.Rows[0]["countryText"] != null)
                    {
                        if (!IsPostBack)
                        {
                            lblCountryInfo.Text = dt1.Rows[0]["countryText"].ToString();
                            txtCountryText.Text = dt1.Rows[0]["countryText"].ToString().Replace("<br />", Environment.NewLine);
                        }
                    }
                    if (!string.IsNullOrEmpty(Convert.ToString(dt1.Rows[0]["countryText2"])))
                    {
                        if (!IsPostBack)
                        {
                            lblInfo2.Text          = dt1.Rows[0]["countryText2"].ToString();
                            counrtyregions.Visible = true;
                            txtCountryText2.Text   = dt1.Rows[0]["countryText2"].ToString().Replace("<br />", Environment.NewLine);
                        }
                    }
                }
            }

            string vText = "Vacations-abroad.com is a " + stateprovince + " accommodation directory of " + stateprovince + " rentals by owner and privately owned " + stateprovince + " holiday accommodation. Our short term " + stateprovince + " rentals include luxury " +
                           stateprovince + " holiday homes, " + stateprovince + " vacation homes and " + stateprovince + " vacation home rentals which are perfect for group or family vacation rentals in " + stateprovince + " " + country;
        }
        catch (Exception ex) { lblInfo.Text = ex.Message; }

        DBConnection  obj3          = new DBConnection();
        SqlDataReader reader        = obj3.ExecuteRecordSetArtificial("SELECT Cities.* FROM Cities WHERE (Cities.StateProvinceID = " + stateprovinceid + ") " + "AND EXISTS ( SELECT * FROM Properties WHERE (Properties.IfFinished = 1) AND (Properties.IfApproved = 1) AND " + "(Properties.CityID = Cities.ID)  AND NOT EXISTS (SELECT * FROM Auctions WHERE PropertyID = Properties.ID)) ORDER " + "BY City");
        string        states1       = "";
        string        regionCountry = "";

        foreach (DataRow dr in MainDataSet.Tables["CountriesRegion"].Rows)
        {
            string temp = CommonFunctions.GetSiteAddress() +
                          "/" + dr["Country"].ToString().ToLower().Replace(" ", "_") + "/default.aspx";
            temp = temp.ToLower();
            temp = temp.Replace(' ', '_');
            if (Convert.ToString(MainDataSet.Tables["Location"].Rows[0]["Country"]) == Convert.ToString(dr["Country"]))
            {
                rtLow3.InnerHtml += "<a href=\"" + temp + "\"><span class=\"CountryInternalLink\" style=\"text-decoration:underline;\">" + dr["Country"].ToString().Replace(" ", "&nbsp;") + "</span></a>, ";
            }
            else
            {
                rtLow3.InnerHtml += "<a href=\"" + temp + "\"><span class=\"CountryInternalLink\">" + dr["Country"].ToString().Replace(" ", "&nbsp;") + "</span></a>, ";
            }
            //rtLow3.InnerHtml += "<span class=\"CountryInternalLink\">" + dr["Country"].ToString().Replace(" ", "&nbsp;") + "</span>, ";
            states1      += "<a href=\"" + temp + "\"><span class=\"CountryInternalLink\" style=\"font-weight:normal;font-style:normal\">" + dr["Country"].ToString().Replace(" ", "&nbsp;") + "</span></a>, ";
            regionCountry = dr["Region"].ToString();
        }
        states1 = "";
        foreach (DataRow dr in MainDataSet.Tables["StateProvinces"].Rows)
        {
            string temp = CommonFunctions.GetSiteAddress() + "/" + country.ToLower().Replace(" ", "_") +
                          "/" + dr["StateProvince"].ToString().ToLower().Replace(" ", "_") + "/default.aspx";
            states1 += "<a href=\"" + temp + "\"><span class=\"CountryInternalLink\" style=\"font-weight:normal;font-style:normal\">" + dr["StateProvince"].ToString().Replace(" ", "&nbsp;") + "</span></a>, ";
        }
        rtLow3.InnerHtml = rtLow3.InnerHtml.Remove(rtLow3.InnerHtml.Length - 2, 2);
        rtHd3.InnerHtml  = regionCountry + ":";

        //add counties to right column
        //add counties within state
        string query = "";

        dt = obj1.spGetRightSideCounties(stateprovinceid);
        if (dt.Rows.Count > 0)
        {
            rtCountiesHd.InnerHtml = stateprovince + " Counties";
            foreach (DataRow datarow in dt.Rows)
            {
                if (datarow["county"] is string)
                {
                    string temp = CommonFunctions.GetSiteAddress() + "/" + stateprovince + "/Holiday-Rentals/" +
                                  datarow["county"].ToString() + "-Vacation_Rentals/default.aspx";
                    temp = temp.ToLower();
                    temp = temp.Replace(' ', '_');
                    divCitiesRt.InnerHtml += "<a href=\"" + temp + "\"><span class=\"CountryInternalLink\">" + datarow["county"].ToString().Replace(" ", "&nbsp;") + "</span></a>, ";
                }
            }
            divCitiesRt.InnerHtml = divCitiesRt.InnerHtml.Remove(divCitiesRt.InnerHtml.Length - 2, 2);
        }
        else
        {
            rtCountyOut.Visible = false;
            lblBr.Text          = "";
            lblBr.Visible       = false;
        }

        //add counties within state
        DataTable dtCountries = obj1.spStateProvByCountries(countryid);

        rtLowerHd.InnerHtml = country + " States";
        foreach (DataRow row in dtCountries.Rows)
        {
            if (row["stateprovince"] is string)
            {
                string temp = CommonFunctions.GetSiteAddress() + "/" + country + "/" + row["stateprovince"].ToString() + "/default.aspx";
                temp = temp.ToLower();
                temp = temp.Replace(' ', '_');

                rtLower.InnerHtml += "<a href=\"" + temp + "\">" + row["stateprovince"].ToString().Replace(" ", "&nbsp;") + "</a>, ";
            }
        }
        rtLower.InnerHtml = rtLower.InnerHtml.Remove(rtLower.InnerHtml.Length - 2, 2);
        /////// common for postback and ! postback ////////



        string tempstate = CommonFunctions.GetSiteAddress() + "/" + country.ToLower().Replace(" ", "_") +
                           "/default.aspx";

        Session["tempstate"]   = stateprovince;
        Session["tempcountry"] = country;


        lbltText.Text = lbltText.Text + states1;

        Page.Header.Controls.Add(new LiteralControl("<link href='/css/StyleSheetBig4.css?6=4' rel='stylesheet' type='text/css'></script>"));



        //HtmlMeta description = new HtmlMeta();

        //description.Name = "description";
        //description.Content = Description.Text.Replace("%country%", country).Replace("%stateprovince%", stateprovince).
        //    Replace("%cities%", cities);
        //// Description OVER RIDE area

        //string DescripReplacement = MainDataSet.Tables["Location"].Rows[0]["descriptionoverride"].ToString();
        //if (DescripReplacement.Length > 0)
        //    description.Content = DescripReplacement;
        Page page1 = (Page)HttpContext.Current.Handler;
        //description.Content = page1.Title;
        //head.Controls.Add(description);
        HtmlMeta keywords = new HtmlMeta();

        keywords.Name    = "keywords";
        keywords.Content = Keywords.Text.Replace("%country%", country).Replace("%stateprovince%", stateprovince).
                           Replace("%cities%", cities);
        keywords.Content = page1.Title;
        head.Controls.Add(keywords);
        ((System.Web.UI.WebControls.Image)Master.FindControl("Logo")).AlternateText = page1.Title;
    }