function createImageAndLink(src, messages, index) {
// Create image element
var img = document.createElement("img");
img.src = src;
img.width = 240;
img.height = 240;
// Create link element
var link = document.createElement("div");
link.className = "link link-" + index;
link.appendChild(img);
// Append the link to the container
var container = document.getElementById("imageContainer");
container.appendChild(link);
// Add click event to display or hide text
link.addEventListener("click", function () {
displayText(messages, link);
});
}
// Create images with links and text boxes
createImageAndLink("images/act1.png", ["This is my open letter: Has a machine ever helped you be human? If you took a picture of your guts and posted it online, what would people say? Do you think anybody would hold them?"], 1);
createImageAndLink("images/act2.png", ["They wouldn't. I got rid of my smartphone and television seven years ago and became a complete luddite. I kept my Linux Desktop PC to access the ar15.com forum, to sell and buy rifles. Nobody else comes this far into the woods. Machines are no vessel for love and I am much too old to believe in angels. My roots run deep in the forest soil, deeper than cables can. There is no emotional support to be found online, sorry to say.","lud7"], 2);
createImageAndLink("images/act3.png", [
"My line is always open to all of you at any time",
"IM me and I will call you to lend you an ear and a shoulder. Together, we can overcome a lot of difficulties and hard times.",
"We have done it before and we can continue to do it. Do not despair and lose hope.",
"We have had attempts in the past. Thank God, both were dealt with successfully. I am sure tc69 would get involved again to avert a tragedy like he did before.",
"I'm IM-ing you my contact info. If someone's in my area that needs help, let me know."