// Validate Request to Edit Announcement Form Data function validate_edit() { if (this.document.edit.id.value == "") { alert("Please enter a value for Announcement ID.") return false; } if (this.document.edit.pw.value == "") { alert("Please enter a value for Password.") return false; } return true } // Validate retreive lost password form data function validate_getpw() { if (this.document.getpw.email.value == "") { alert("Please enter your email address.") return false; } return true } // function to pick a templete when creating a new announcement function pickTemplate() { if (this.document.News.template[0].checked) { this.document.News.EngagementStory.value = "Use the following sample text as a starting point or delete it. Tara Lynn Sample of Robesonia and John Michael Doe of Temple have recently become engaged to marry. Tara Lynn and John met on the beach in Stone Harbor, NJ during the summer of 2005. After becoming a total pest John was able to convince Tara to go out - it took three weeks of texting and calls! Love was soon to follow as we simply hung out all the time with friends, sometimes at clubs, camping trips to the Adirondacks, and John's favorite thing - touch football with his old school buddies. John proposed on the 50 yd line at the beginning of their annual Thanksgiving weekend match. We plan to marry in the summer of 2008 and reside here in Berks County initially. Our plans may involve a destination wedding in Aruba (please Daddy). "; this.document.News.EngagementStoryType.value = "informal"; } if (this.document.News.template[1].checked) { this.document.News.EngagementStory.value = "Use the following sample text as a starting point or delete it. Mr. and Mrs. Donald Sample of Robesonia, Pa are happy to announce the engagement of their daughter Tara Lynn to John Doe of Temple, Pa. \r\nThe Samples' are formerly of Bel Air, Md where Tara Lynn attended local schools up to the 8th grade, and, after moving to Pa, graduated from Conrad Weiser High School in Robesonia, Pa. Tara is currently employed at the Berkshire Mall in Wyomissing. She is the granddaughter of Ben and Ethel Nicolas of Pittsburgh, and the late Clayton and Ella Sample of Butler, Pa., and great granddaughter of the late Chris Sample of San Diego, Ca. John is the son of Harold Doe of West Chester and Maria Smith of Philadelphia. He attended Alvernia College in Reading, where he is presently employed as a Product Coordinator at Cartech. Tara Lynn and John are planning a July 2008 wedding in Aruba."; this.document.News.EngagementStoryType.value = "formal"; } } // Upload New Announcement Form Validator function validate_new() { if (this.document.News.BrideFirstName.value == "") { alert("Please enter the Bride\'s First Name.") return false; } if (this.document.News.BrideLastName.value == "") { alert("Please enter the Bride\'s Last Name.") return false; } if (this.document.News.BrideAddressLine1.value == "") { alert("Please enter the first line of the Bride\'s street address.") return false; } if (this.document.News.BrideCity.value == "") { alert("Please enter a city name for the Bride\'s street address.") return false; } if (this.document.News.BrideZip.value == "") { alert("Please enter a Zipcode for the Bride\'s street address.") return false; } if (this.document.News.BrideEmail.value == "") { alert("Please enter the Bride\'s email address.") return false; } if (this.document.News.BridePhone.value == "") { alert("Please enter the Bride\'s telephone number.") return false; } if (this.document.News.BridePhoneType.value != "cell" && this.document.News.BridePhoneType.value != "work" && this.document.News.BridePhoneType.value != "home") { alert("Please tell us whether the Bride\'s telephone number\n rings at work, home, or on a cell phone.") return false; } if (this.document.News.GroomFirstName.value == "") { alert("Please enter the Groom\'s First Name.") return false; } if (this.document.News.GroomLastName.value == "") { alert("Please enter the Groom\'s Last Name.") return false; } if (this.document.News.GroomAddressLine1.value == "") { alert("Please enter the first line of the Groom\'s street address.") return false; } if (this.document.News.GroomCity.value == "") { alert("Please enter a city name for the Groom\'s street address.") return false; } if (this.document.News.GroomZip.value == "") { alert("Please enter a Zipcode for the Groom\'s street address.") return false; } if (this.document.News.GroomEmail.value == "") { alert("Please enter the Groom\'s email address.") return false; } if (this.document.News.GroomPhone.value == "") { alert("Please enter the Groom\'s telephone number.") return false; } if (this.document.News.GroomPhoneType.value != "cell" && this.document.News.GroomPhoneType.value != "work" && this.document.News.GroomPhoneType.value != "home") { alert("Please tell us whether the Groom\'s telephone number\n rings at work, home, or on a cell phone.") return false; } if (this.document.News.EngagementStory.value == "") { alert("Please tell us your engagement story.") return false; } if (this.document.News.WeddingPlans.value == "") { alert("Please tell us your wedding plans, or simply enter \"none at this time\".") return false; } if (this.document.News.Password.value == "") { alert("Please enter a password.") return false; } if (this.document.News.template[0].checked) { this.document.News.EngagementStoryType.value = "informal"; } if (this.document.News.template[1].checked) { this.document.News.EngagementStoryType.value = "formal"; } return true } // Upload New Picture Form Validator function validate_new_pic() { if (this.document.NewPic.PhotoFileName.value == "") { alert("Please enter a file to upload.") return false; } return true } // Begin Functions to Define Date Pickers var listUtil = new Object; listUtil.add = function (oListbox, sName, sValue) { var oOption = document.createElement("option"); oOption.appendChild(document.createTextNode(sName)); if (arguments.length == 3) { oOption.setAttribute("value", sValue); } oListbox.appendChild(oOption); } var EventUtil = new Object; EventUtil.addEventHandler = function (oTarget, sEventType, fnHandler) { if (oTarget.addEventListener) { // For DOM-Compliant Browsers oTarget.addEventListener(sEventType, fnHandler, false); } else if (oTarget.attachEvent) { // For MS IE oTarget.attachEvent("on" + sEventType, fnHandler); } else { // For Others oTarget["on" + sEventType] = fnHandler; } }; function updateDays(oContainer) { var parent = oContainer.target.parentNode.id; var oYear = this.document.getElementById(parent+"YearSelect"); var oMonth = this.document.getElementById(parent+"MonthSelect"); var oDay = this.document.getElementById(parent+"DaySelect"); var m = parseInt(oMonth.selectedIndex) + 1; var len = oDay.options.length; for (var i=len-1; i >= 28; i--) { oDay.remove(i); } if (m==1 || m==3 || m==5 || m==7 || m==8 || m==10 || m==12) { listUtil.add(oDay, "29", "29"); listUtil.add(oDay, "30", "30"); listUtil.add(oDay, "31", "31"); } if (m==4 || m==6 || m==9 || m==11) { listUtil.add(oDay, "29", "29"); listUtil.add(oDay, "30", "30"); } if(m==2) { var year = parseInt(oYear.options[oYear.selectedIndex].value); var leap = year % 4; var century = year % 100; var leapcentury = year % 400; if (leap == 0 && century != 0) { listUtil.add(oDay, "29", "29"); } if (leap == 0 && century == 0 && leapcentury == 0) { listUtil.add(oDay, "29", "29"); } } } function newDate(oContainer){ if (typeof oContainer == 'undefined') { // For MS IE var parent = window.event.srcElement.id; } else if (typeof oContainer == 'object') { // For DOM-Compliant Browsers var parent = oContainer.target.parentNode.id; } String.prototype.trimDiv = function () { var reDiv = /(.*)Div.*$/; return this.replace(reDiv, "$1"); }; var sField = parent.trimDiv(); var oYear = this.document.getElementById(sField+"Div"+"YearSelect"); var oMonth = this.document.getElementById(sField+"Div"+"MonthSelect"); var oDay = this.document.getElementById(sField+"Div"+"DaySelect"); var oField = this.document.getElementById(sField); oField.value = oYear.options[oYear.selectedIndex].value + "-" + oMonth.options[oMonth.selectedIndex].value + "-" + oDay.options[oDay.selectedIndex].value; return true } function loadPicker(sContainer, sDate){ String.prototype.trimYear = function () { var reDate = /(.*)-(.*)-(.*)$/; return this.replace(reDate, "$1"); }; // Turn the Year string we got into a number var sYear = sDate.trimYear(); // If the Year is 0000 then our work is done if (sYear == "0000") { return } var nYear = (sYear - 1); nYear = nYear + 1; // Get the current year as a number var nY = 2010; // Calculate the IndexYear. This gets funky because the list starts with the previous year. var nIndexYear = nYear - nY + 1; if (nIndexYear < 0) {nIndexYear=0;} String.prototype.trimMonth = function () { var reDate = /(.*)-0{0,1}(.*)-0{0,1}(.*)$/; return this.replace(reDate, "$2"); }; var sMonth = sDate.trimMonth(); var nIndexMonth = sMonth - 1; if (nIndexMonth < 0) {nIndexMonth=0;} String.prototype.trimDay = function () { var reDate = /(.*)-0{0,1}(.*)-0{0,1}(.*)$/; return this.replace(reDate, "$3"); }; var sDay = sDate.trimDay(); var nIndexDay = sDay - 1; if (nIndexDay < 0) {nIndexDay=0;} var mid = sContainer + "MonthSelect"; monthSelect = document.createElement("select"); monthSelect.name = mid; monthSelect.id = mid; monthSelect.size = "1"; monthSelect.style.width = "45px"; monthSelect.onchange = new Function("sContainer", "newDate(sContainer);"); monthSelect.onclick = new Function("sContainer", "updateDays(sContainer);"); this.document.getElementById(sContainer).appendChild(monthSelect); var oMonth = this.document.getElementById(mid); listUtil.add(oMonth, "01", "01"); listUtil.add(oMonth, "02", "02"); listUtil.add(oMonth, "03", "03"); listUtil.add(oMonth, "04", "04"); listUtil.add(oMonth, "05", "05"); listUtil.add(oMonth, "06", "06"); listUtil.add(oMonth, "07", "07"); listUtil.add(oMonth, "08", "08"); listUtil.add(oMonth, "09", "09"); listUtil.add(oMonth, "10", "10"); listUtil.add(oMonth, "11", "11"); listUtil.add(oMonth, "12", "12"); var did = sContainer + "DaySelect"; daySelect = document.createElement("select"); daySelect.name = did; daySelect.id = did; daySelect.size = "1"; daySelect.style.width = "45px"; daySelect.onchange = new Function("sContainer", "newDate(sContainer);"); daySelect.onclick = new Function("sContainer", "updateDays(sContainer);"); this.document.getElementById(sContainer).appendChild(daySelect); var oDay = this.document.getElementById(did); listUtil.add(oDay, "01", "01"); listUtil.add(oDay, "02", "02"); listUtil.add(oDay, "03", "03"); listUtil.add(oDay, "04", "04"); listUtil.add(oDay, "05", "05"); listUtil.add(oDay, "06", "06"); listUtil.add(oDay, "07", "07"); listUtil.add(oDay, "08", "08"); listUtil.add(oDay, "09", "09"); listUtil.add(oDay, "10", "10"); listUtil.add(oDay, "11", "11"); listUtil.add(oDay, "12", "12"); listUtil.add(oDay, "13", "13"); listUtil.add(oDay, "14", "14"); listUtil.add(oDay, "15", "15"); listUtil.add(oDay, "16", "16"); listUtil.add(oDay, "17", "17"); listUtil.add(oDay, "18", "18"); listUtil.add(oDay, "19", "19"); listUtil.add(oDay, "20", "20"); listUtil.add(oDay, "21", "21"); listUtil.add(oDay, "22", "22"); listUtil.add(oDay, "23", "23"); listUtil.add(oDay, "24", "24"); listUtil.add(oDay, "25", "25"); listUtil.add(oDay, "26", "26"); listUtil.add(oDay, "27", "27"); listUtil.add(oDay, "28", "28"); var m = nIndexMonth; if (m==1 || m==3 || m==5 || m==7 || m==8 || m==10 || m==12) { listUtil.add(oDay, "29", "29"); listUtil.add(oDay, "30", "30"); listUtil.add(oDay, "31", "31"); } if (m==4 || m==6 || m==9 || m==11) { listUtil.add(oDay, "29", "29"); listUtil.add(oDay, "30", "30"); } if(m==2) { var year = parseInt(oYear.options[oYear.selectedIndex].value); var leap = year % 4; var century = year % 100; var leapcentury = year % 400; if (leap == 0 && century != 0) { listUtil.add(oDay, "29", "29"); } if (leap == 0 && century == 0 && leapcentury == 0) { listUtil.add(oDay, "29", "29"); } } var yid = sContainer + "YearSelect"; yearSelect = document.createElement("select"); yearSelect.name = sContainer + "YearSelect"; yearSelect.id = sContainer + "YearSelect"; yearSelect.size = "1"; yearSelect.style.width = "60px"; yearSelect.onchange = new Function("sContainer", "newDate(sContainer);"); yearSelect.onclick = new Function("sContainer", "updateDays(sContainer);"); this.document.getElementById(sContainer).appendChild(yearSelect); var oYear = this.document.getElementById(yid); var Year = 2009; listUtil.add(oYear, Year, Year); listUtil.add(oYear, Year+1, Year+1); listUtil.add(oYear, Year+2, Year+2); listUtil.add(oYear, Year+3, Year+3); oMonth.selectedIndex = nIndexMonth; oDay.selectedIndex = nIndexDay; oYear.selectedIndex = nIndexYear; String.prototype.trimDiv = function () { var reDiv = /(.*)Div.*$/; return this.replace(reDiv, "$1"); }; var sField = sContainer.trimDiv(); var oField= this.document.getElementById(sField); oField.value = oYear.options[oYear.selectedIndex].value + "-" + oMonth.options[oMonth.selectedIndex].value + "-" + oDay.options[oDay.selectedIndex].value; }