//Global varibale assignment let photoIndex = { caroselPick: 0, cpp: 0, vb: 0, vbL: 0, html: 0, js: 0, php: 0 }; //Functions function changeStyle(elmID, attribute , displayValue) { let elm = document.getElementById(elmID); elm.style[attribute] = displayValue; } function whichPhoto(incriment, numCycles, identifier) { //incriment is the how many indexes to move "up" or "down" //numCycles should be the total number of indexes starting with 1 //identifier is the id of the element witout the ending index let dirrection = incriment; let cycle = false; //This stops the photo index from increasing or deceasing beyond usable values if (photoIndex[identifier] == 0 && dirrection == -1) { dirrection = 0; } if (photoIndex[identifier] == (numCycles - 1) && dirrection == 1) { dirrection = 0; } //This is to cylce throught the index's if (dirrection == 0 && incriment == 1) { photoIndex[identifier] = 0; cycle = true; } else if (dirrection == 0 && incriment == -1) { photoIndex[identifier] = numCycles - 1; cycle = true; } //This changes the index if (dirrection != 0 || cycle == true) { if(!cycle){ photoIndex[identifier] += dirrection; } let comparison = identifier + photoIndex[identifier]; for (let i = 0; i < (numCycles); i++ ) { if (!comparison){continue;} if (comparison == document.getElementById(identifier + i).id) { changeStyle(identifier + i, 'display', 'flex') changeStyle(identifier + i, 'flex', 1); continue; } else { changeStyle(identifier + i, 'display', 'none') changeStyle(identifier + i, 'flex', 0) } } } } function downloadableSelector(identifier, btnName){ let elm = document.getElementById('btn' + btnName + 'Downlaodables'); if(photoIndex[identifier] == 0 ){ if(identifier == "cpp"){elm.setAttribute('href', '../downloadables/cpp/calculator.zip');} if(identifier == "vb"){elm.setAttribute('href', '../downloadables/vb/bookStore.exe');} if(identifier == "html"){elm.setAttribute('href', '../downloadables/html/navigationMenuHTML.txt');} if(identifier == "php"){elm,setAttribute('href', '../downloadables/php/CPT238Prject3Folder.zip')} } if(photoIndex[identifier] == 1 ){ if(identifier == "cpp"){elm.setAttribute('href', '../downloadables/cpp/removeWhite.zip');} if(identifier == "vb"){elm.setAttribute('href', '../downloadables/vb/bookStoreAudio.exe');} if(identifier == "html"){elm.setAttribute('href', '../downloadables/html/navigationMenuHTML.txt');} if(identifier == "php"){elm,setAttribute('href', '../downloadables/php/CPT238Prject3Folder.zip')} } if (photoIndex[identifier] == 2 ) { if(identifier == "cpp"){elm.setAttribute('href', '../downloadables/cpp/plantList.zip');} if(identifier == "vb"){elm.setAttribute('href', '../downloadables/vb/shipping.exe');} if(identifier == "html"){elm.setAttribute('href', '../downloadables/html/contactHTML.txt');} if(identifier == "php"){elm,setAttribute('href', '../downloadables/php/CPT238Prject3Folder.zip')} } if (photoIndex[identifier] == 3 ){ if(identifier == "html"){elm.setAttribute('href', '../downloadables/html/contactHTML.txt');} } if (photoIndex[identifier] == 4 ){ if(identifier == "html"){elm.setAttribute('href', '../downloadables/html/CPT238Prject3Folder.zip');} } } function changeTheProjectLabel(elmID, photoIndexIdentifier) { let label = document.getElementById(elmID); if (photoIndex[photoIndexIdentifier] == 0){ if (photoIndexIdentifier == "vb") {label.innerHTML = "Book Store";} else if (photoIndexIdentifier == "cpp"){label.innerHTML = "Calculator";} else if (photoIndexIdentifier == "html"){label.innerHTML = "HTML for Navigation";} } else if (photoIndex[photoIndexIdentifier] == 1) { if (photoIndexIdentifier == "vb") {label.innerHTML = "Book Store w/ Audio Books";} else if (photoIndexIdentifier == "cpp"){label.innerHTML = "Remove The White Spaces";} else if (photoIndexIdentifier == "html"){label.innerHTML = "CSS for Navigation";} } else if (photoIndex[photoIndexIdentifier] == 2){ if (photoIndexIdentifier == "vb") {label.innerHTML = "Shipping Cost Calc";} else if (photoIndexIdentifier == "cpp"){label.innerHTML = "PLant Collection";} else if (photoIndexIdentifier == "html"){label.innerHTML = "HTML for Contact Form";} } else if (photoIndex[photoIndexIdentifier] == 3){ if (photoIndexIdentifier == "html"){label.innerHTML = "CSS for Contact Form";} } else if (photoIndex[photoIndexIdentifier] == 4){ if (photoIndexIdentifier == "html"){label.innerHTML = "";} } }