function stripLTBlanks (stringIn) { workString = stringIn; while (workString.charAt(0) == " ") { workString = workString.substr(1); } while (workString.charAt(workString.length-1) == " ") { workString = workString.substr(0, workString.length-1); } return workString; } function showimagewindow(picname, indexed) { if (indexed == "Yes") { selectedPic = document.getElementById(picname)[document.getElementById(picname).selectedIndex].value; } else { selectedPic = document.getElementById(picname).value; } if (selectedPic != "Select Photo") { selectedPic = selectedPic.replace(/ /g,"%20"); windowToOpen = "currentimagewindow.php?photo=http://handmadeprettythings.com/images/"+selectedPic; showWindow (windowToOpen,"currentimagewindow","height=600, width=600, scrollbars=no"); } } function showthumbnailwindow() { showWindow ("thumbnailwindow.php","thumbnailwindow","height=600, width=850, scrollbars=yes"); } function showWindow(windowName, windowTitle, windowAttributes) { windowHandle = window.open (windowName,windowTitle,windowAttributes); windowHandle.focus(); } function validateName() { personsName = stripLTBlanks (document.getElementById("personsname").value.replace(/Enter Your Full Name Here/g, "")); if (personsName == "") { alert("Please enter your full name!"); document.getElementById("personsname").focus(); return false; } if (personsName.indexOf(" ") < 0) { alert("Please enter your full name!"); document.getElementById("personsname").focus(); return false; } return true; } function validateEmail() { emailAddress = document.getElementById("emailaddress").value.replace(/Enter Your Email Address Here/g, ""); if (emailAddress == "") { alert("Please enter your email address!"); document.getElementById("emailaddress").focus(); return false; } if (emailAddress.indexOf("@") < 2) { alert("Please enter a valid email address!"); document.getElementById("emailaddress").focus(); return false; } if (emailAddress.indexOf(".") < 3) { alert("Please enter a valid email address!"); document.getElementById("emailaddress").focus(); return false; } if (emailAddress.indexOf("@mail.com") >= 0) { alert("Please enter a valid email address!"); document.getElementById("emailaddress").focus(); return false; } return true; } function setRating(valueToSet) { rating = valueToSet; document.getElementById("radiochecked").value = valueToSet; } function validateRating() { rating = document.getElementById("radiochecked").value; if (rating == "0" || rating == "") { alert("Please remember to rate this site!"); document.getElementById("rating").focus(); return false; } return true; } function validateFindUs() { findus = document.getElementById("findus").value; if (findus == "") { alert("Please remember to select where you found this site!"); document.getElementById("findus").focus(); return false; } return true; } function validateComments() { comments = document.getElementById("comments").value; if (comments.indexOf("href=") >= 0) { alert("Please remember there is no spamming allowed!\r\nPlease do not enter a website or email address!"); document.getElementById("findus").focus(); return false; } if (comments.indexOf("http") >= 0) { alert("Please remember there is no spamming allowed!\r\nPlease do not enter a website or email address!"); document.getElementById("findus").focus(); return false; } if (comments.indexOf("@") >= 0) { alert("Please remember there is no spamming allowed!\r\nPlease do not enter a website or email address!"); document.getElementById("findus").focus(); return false; } return true; } function validateGuestbook() { setRandom(); if (!validateName() || !validateEmail() || !validateRating() || !validateFindUs() || !validateComments()) { return false; } alert("Thank you for your information, Press OK to continue"); return true; } function validateEmailOnly() { if (!validateEmail()) { return false; } alert("Thank you for your email, Press OK to continue"); return true; } function setRandom() { randnumber = document.getElementById("randomseed").value; document.getElementById("randomresult").value = randnumber; } function storeUserCartInformation(cartMethod, ipAddress) { }