document.addEventListener("DOMContentLoaded", function() {
// Get the current URL path and split it to find the address
const urlPath = window.location.pathname;
const addressPart = urlPath.split("listing.")[1]?.split(".")[0];
// Format the address and populate it into the subject field if the address part is available
if (addressPart) {
const formattedAddress = addressPart.replace(/-/g, ' '); // Replace hyphens with spaces
document.getElementById("subject-field").value = `I would like more information about or to schedule a viewing for ${formattedAddress}`;
}
});