function getStage(menuObj) { if (menuObj.selectedIndex>0) { location.href=pathToAppRoot+"content/" +menuObj.options[menuObj.selectedIndex].value } } function emailPage(pageurl){ location.href=pathToAppRoot+"email/email.jsp?pageurl=<%=etp_pageurl%>&uuid=<%=etp_uuid%>"; } function glossary(term) { openWin(pathToAppRoot+"etc/glossaryPopup.jsp?m="+mode+"&term="+escape(term)+"<%=aQueryString%>","glossary", 324, 399, false); } function getResource(resourceUrl) { if (resourceUrl.length>0) { location.href=resourceUrl; } } function stayInformedLink() { location.href='<%=MORE_INFO_URL%>' + '&campaign=<%=session.getAttribute("ctCampaign")%>&network=<%=session.getAttribute("ctNetwork")%>&creative=<%=session.getAttribute("ctCreative")%>&placement=<%=session.getAttribute("ctPlacement")%>&publication=<%=session.getAttribute("ctPublication")%>&source=<%=session.getAttribute("ctSource")%>'; } function isValidSearchForm(formObj) { if (formObj.elements["query"].value.length==0 || formObj.elements["query"].value=="Search") { formObj.elements["query"].focus(); alert("Please enter a search keyword or keywords before performing a search."); formObj.elements["query"].focus(); return false; } return true; } function isEmpty(s) { return ((s == null) || (s.length == 0)) } // Returns true if string s is empty or // whitespace characters only. function isWhitespace (s) { // Is s empty? return (isEmpty(s) || reWhitespace.test(s)); } // Notify user that required field theField is empty. // String s describes expected contents of theField.value. // Put focus in theField and return false. function warnEmpty (theField, s) { theField.focus(); alert(mPrefix + s + mSuffix); return false; } // Notify user that contents of field theField are invalid. // String s describes expected contents of theField.value. // Put select theField, pu focus in it, and return false. function warnInvalid (theField, s) { theField.focus(); theField.select(); alert(s); return false; } function warnMustFill (theField, s) { theField.focus(); alert(s); return false; } function checkString (theField, s, emptyOK) { // Next line is needed on NN3 to avoid "undefined is not a number" error // in equality comparison below. if (checkString.arguments.length == 2) emptyOK = defaultEmptyOK; if ((emptyOK == true) && (isEmpty(theField.value))) return true; if (isWhitespace(theField.value)) return warnEmpty (theField, s); else return true; } function isEmail (s) { if (isEmpty(s)) if (isEmail.arguments.length == 1) return defaultEmptyOK; else return (isEmail.arguments[1] == true); else { return reEmail.test(s) } } function isAlphanumeric (s) { var i; if (isEmpty(s)) if (isAlphanumeric.arguments.length == 1) return defaultEmptyOK; else return (isAlphanumeric.arguments[1] == true); else { return reAlphanumeric.test(s) } } function isInteger (s) { var i; if (isEmpty(s)) if (isInteger.arguments.length == 1) return defaultEmptyOK; else return (isInteger.arguments[1] == true); return reInteger.test(s) } // isAlphabetic (STRING s [, BOOLEAN emptyOK]) // // Returns true if string s is English letters // (A .. Z, a .. z, 0 .. 9) only. // function isAlphabetic (s) { var i; if (isEmpty(s)) if (isAlphabetic.arguments.length == 1) return defaultEmptyOK; else return (isAlphabetic.arguments[1] == true); else { return reAlphabetic.test(s) } } function validateEmail(emailAddress) { var match = /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*$/.test(emailAddress); return match; } // checkEmail (TEXTFIELD theField [, BOOLEAN emptyOK==false]) // // Check that string theField.value is a valid Email. // function checkEmail (theField, message, emptyOK) { if (checkEmail.arguments.length == 2) emptyOK = defaultEmptyOK; if ((emptyOK == true) && (isEmpty(theField.value))) return true; else if (!isEmail(theField.value, false)) return warnInvalid (theField, message); else if(!validateEmail(theField.value)) alert(message); else return true; } // check alphanumeric (TEXTFIELD theField [, BOOLEAN emptyOK==false]) // // Check that string theField.value is a valid alphanumeric string. // function checkAlphanumeric (theField, message, emptyOK) { if (checkAlphanumeric.arguments.length == 2) emptyOK = defaultEmptyOK; if ((emptyOK == true) && (isEmpty(theField.value))) return true; else if (!isAlphanumeric(theField.value)) return warnInvalid (theField, message); else return true; } // checkAlphabetic (TEXTFIELD theField [, BOOLEAN emptyOK==false]) // // Check that string theField.value is a valid alphabetic string. // function checkAlphabetic (theField, message, emptyOK) { if (checkAlphabetic.arguments.length == 2) emptyOK = defaultEmptyOK; if ((emptyOK == true) && (isEmpty(theField.value))) return true; else if (!isAlphabetic(theField.value)) return warnInvalid (theField, message); else return true; } // checkNumber (TEXTFIELD theField [, BOOLEAN emptyOK==false]) // // Check that string theField.value is a valid number string. // function checkNumber (theField, message, emptyOK) { if (checkNumber.arguments.length == 2) emptyOK = defaultEmptyOK; if ((emptyOK == true) && (isEmpty(theField.value))) return true; else if (!isInteger(theField.value)) return warnInvalid (theField, message); else return true; } // Check that option theField.value is filled by user // function checkRequiredSelect(theField, message) { if (theField.options[theField.options.selectedIndex].value == "$$$$$") return warnMustFill(theField, message); else return true; } function checkRequiredRadio(theField, message) { if (!theField.checked) return warnMustFill(theField, message); else return true; } // check form element values before submitting // if all fields look good return true so that the form can be submitted function CheckForm(theForm, fes) { // first check that all "required" fields are filled for (i = 0; i < theForm.elements.length; i++) { if (typeof(fes[theForm.elements[i].name]) == "undefined") { continue; } if (fes[theForm.elements[i].name].required == 1) { if (fes[theForm.elements[i].name].type == "text") { if (!checkString(theForm.elements[i], fes[theForm.elements[i].name].desc, false)) return false; } else if (fes[theForm.elements[i].name].type == "select") { if (!checkRequiredSelect(theForm.elements[i], iSelectPrefix + fes[theForm.elements[i].name].desc+iSelectSuffix)) return false; } else if (fes[theForm.elements[i].name].type == "radio") { var radiochecked = theForm.elements[i].checked; var radioname = theForm.elements[i].name; var j = i+1; while (j < theForm.elements.length) { if (theForm.elements[j].type == "radio" && theForm.elements[j].name == radioname) { if (!radiochecked) radiochecked = theForm.elements[j].checked; j++; } else break; // reached end of radio button sequence } if (!radiochecked) return warnMustFill(theForm.elements[i], iRadioPrefix + fes[theForm.elements[i].name].desc+iRadioSuffix); i = j - 1; } } } // now check the contents of all fields that require tests for (i = 0; i < theForm.elements.length; i++) { if (typeof(fes[theForm.elements[i].name]) == "undefined") { continue; } if (fes[theForm.elements[i].name].ctype == "Alphabetic") { if (!checkAlphabetic(theForm.elements[i], iPrefix + fes[theForm.elements[i].name].desc + iAlphabeticSuffix, (fes[theForm.elements[i].name].required == 1) ? false : true)) return false; } else if (fes[theForm.elements[i].name].ctype == "Alphanumeric") { if (!checkAlphanumeric(theForm.elements[i], iPrefix + fes[theForm.elements[i].name].desc + iAlphanumericSuffix, (fes[theForm.elements[i].name].required == 1) ? false : true)) return false; } else if (fes[theForm.elements[i].name].ctype == "Number") { if (!checkNumber(theForm.elements[i], iPrefix + fes[theForm.elements[i].name].desc + iNumberSuffix, (fes[theForm.elements[i].name].required == 1) ? false : true)) return false; } else if (fes[theForm.elements[i].name].ctype == "e-Mail") { if (!checkEmail(theForm.elements[i], iPrefix + fes[theForm.elements[i].name].desc + iEmailSuffix, (fes[theForm.elements[i].name].required == 1) ? false : true)) return false; } else if (fes[theForm.elements[i].name].ctype == "None") { } } //theForm.submitTime.value=new Date();; return true; } function formelement(req, typ, contentt, flddesc) { this.required = req; // is this a required item? this.ctype = contentt; // is content numeric, alphabetic etc. // applies only to text item fields // possible values are "Alphabetic", "Number", // "Alphanumeric", "Email", "None" this.type = typ; // what is the type of this item // "text", "select", "radio" this.desc = flddesc; // descriptive string for item return this; } function textCounter(field, countfield, maxlimit) { if (field.value.length > maxlimit) // if too long...trim it! field.value = field.value.substring(0, maxlimit); // otherwise, update 'characters left' counter else countfield.value = maxlimit - field.value.length; } function textChecker(field, countfield, maxlimit) { if (field.value.length != maxlimit) // if too short...extend it! { field.value = field.value.substring(0, maxlimit); alert("Invalid Phone Number Please Re-enter a standard 10 Digit Number WITHOUT DASHES"); } // otherwise, update 'characters left' counter else countfield.value = maxlimit - field.value.length; } function sendEmailPopUpETP(pageurl){ var winFeatures = ""; winFeatures += "height=365,width=550,top=10,left=10,scrollbars,resizable"; window.open('/utils/emailthispage/emailthispage.jsp?pageurl=<%=etp_pageurl%>&uuid=<%=etp_uuid%>', "EmailThisPage", winFeatures); }