function CheckLength(length) { if (window.event.srcElement.value.length >= length) { alert('The maximum number of characters for a short abstract is' + length); return false; } } function SelectDate(FormName, FieldName) { var sMonth, sDay, sYear; var sMonthField, sDayField, sYearField; sMonth = getValue(eval('document.' + FormName + '.' + FieldName + 'Month')); sDay = getValue(eval('document.' + FormName + '.' + FieldName + 'Day')); sYear = getValue(eval('document.' + FormName + '.' + FieldName + 'Year')); sMonthField = 'document.' + FormName + '.' + FieldName + 'Month'; sDayField = 'document.' + FormName + '.' + FieldName + 'Day'; sYearField = 'document.' + FormName + '.' + FieldName + 'Year'; PickDate(sMonth, sDay, sYear, sMonthField, sDayField, sYearField); } function PutDate(iMonth, iDay, iYear, sMonthCtrlName, sDayCtrlName, sYearCtrlName) { var sMonth, sDay, sYear; var iStart sMonth = 'opener.' + sMonthCtrlName; sDay = 'opener.' + sDayCtrlName; sYear = 'opener.' + sYearCtrlName; iStart = eval(sYear + '[1].value'); if (typeof(opener.document) != 'object') { window.close(); return; } if (opener.document == null) { window.close(); return; } // SET THE VALUE OF THE FIELD THAT WAS PASSED TO THE CALENDAR if (typeof(eval(sMonth)) == "object") eval(sMonth + '.selectedIndex = ' + iMonth); if (typeof(eval(sDay)) == "object") eval(sDay + '.value = ' + iDay); if (typeof(eval(sYear)) == "object") eval(sYear + '.selectedIndex = ' + (iYear - iStart + 1)); // GIVE FOCUS BACK TO THE DATE FIELD if (typeof(eval(sMonth)) == "object") eval(sMonth + '.focus()'); window.close(); } function PickDate(iMonth, iDay, iYear, sMonthCtrlName, sDayCtrlName, sYearCtrlName) { var sURL; sURL = '/includes/selectdate.asp?MONTH=' + iMonth + '&DAY=' + iDay + '&YEAR=' + iYear + '&M_NAME=' + sMonthCtrlName + '&D_NAME=' + sDayCtrlName + '&Y_NAME=' + sYearCtrlName; var newwin = window.open(sURL, 'selectdate', 'TOP=150,LEFT=300,WIDTH=170,HEIGHT=220,RESIZABLE=yes,SCROLLBARS=no,STATUS=0'); if (newwin != null) { if (newwin.opener == null) newwin.opener = self; } } function getIndex(arrayName, value) { for (var i=0; i < arrayName.length; i++) if(value == arrayName[i]) return i; return -1; } function getValue(Field) { fieldType = Field.type; if (fieldType == "text") { return getTextValue(Field); } else if (fieldType == "hidden") { return getTextValue(Field); } else if (fieldType == "select-one") { return getListValue(Field); } else if (fieldType == "textarea") { return getTextValue(Field); } else if (fieldType == "file") { return getTextValue(Field); } else if (fieldType == "password") { return getTextValue(Field); } else if (fieldType == "checkbox") { return getCheckboxValue(Field); } else if (isNaN(fieldType)) { return getRadioValue(Field); } else { return getTextValue(Field); } } function isFieldEmpty(Field) { fieldType = Field.type; if (fieldType == "text") { return isEmptyText(Field); } else if (fieldType == "hidden") { return isEmptyText(Field); } else if (fieldType == "file") { return isEmptyText(Field); } else if (fieldType == "select-one") { return isEmptyList(Field); } else if (fieldType == "textarea") { return isEmptyText(Field); } else if (fieldType == "password") { return isEmptyText(Field); } else if (fieldType == "checkbox") { return isEmptyCheckbox(Field) } else if (isNaN(fieldType)) { return isEmptyRadio(Field) } else { return isEmptyText(Field); } } function isCurrency(Field) { strValue = Field.value; regexp = /^(([0-9]{1,3}(\,[0-9]{3})*)|([0-9]{0,3}))(\.[0-9]{2})?$/ if (isEmpty(strValue)) { return false; } return regexp.test(strValue); } function isFloat(Field) { strValue = Field.value; regexp = /^(\+|\-)?([0-9]+)(((\.|\,)?([0-9]+))?)$/ if (isEmpty(strValue)) { return false; } return regexp.test(strValue); } function isInteger(Field) { strValue = getValue(Field); regexp = /^(\+|\-)?([0-9]+)$/ if (isEmpty(strValue)) { return false; } return regexp.test(strValue); } function isMemberUserName(Field) { strValue = getValue(Field); regexp = /^[^*]([^$@\\ ]+)$/ if (isEmpty(strValue)) { return false; } return regexp.test(strValue); } function isUserName(Field) { strValue = getValue(Field); regexp = /^([^$@\\ ]+)$/ if (isEmpty(strValue)) { return false; } return regexp.test(strValue); } function getCCNumber(sInput) { var sResult=''; // make sure input is a string sInput+=''; for (iLoop=0; iLoop= '0' && sInput.substring(iLoop, iLoop+1) <= '9') sResult += sInput.substring(iLoop, iLoop+1); } return sResult; } function isCreditCardNumber(Field) { var iChkSum=0; var ccnum = getCCNumber(getValue(Field)); // check for correct card number length if (ccnum.length<13) return false; // make an array and fill it with the individual digits of the cc number ccnumchk=new Array; for (iLoop=0; iLoop < ccnum.length; iLoop++) { ccnumchk[ccnum.length-1-iLoop] = ccnum.substring(iLoop, iLoop+1); } // perform the weird mathematical method (some base 10 stuff) to // convert the number to a two digit number // for those of you who aren't as familiar with the js operators // i'll comment some of the math lines...well, really just one var skemp=0; for (iLoop=0; iLoop < ccnum.length; iLoop++) { // if splits is an even number... if (iLoop %2 != 0) { ccnumchk[iLoop]=ccnumchk[iLoop]*2; if (ccnumchk[iLoop] >= 10) ccnumchk[iLoop]=ccnumchk[iLoop]-9; } // switch ccnumchk[splits] to a number ccnumchk[iLoop]++; ccnumchk[iLoop]--; iChkSum = iChkSum + ccnumchk[iLoop].valueOf(); } if (iChkSum%10 != 0) { return false; } // The result isn't base 10 return true; } function isEmail(Field) { strValue = getValue(Field); regexp = /^([^$@\\ ]+)@((([^$@\\ \.]+)\.)+)([A-Za-z0-9]+)$/ if (isEmpty(strValue)) { return false; } return regexp.test(strValue); } function isURL(Field) { strValue = getValue(Field); regexp = /^http(s?):\/\/([^$@\\ ]+)$/i if (isEmpty(strValue)) { return false; } return regexp.test(strValue); } function isEmailList(Field) { strValue = getValue(Field); // delete all spaces near comma rexp = /, /gi; strValue = strValue.replace(rexp, ','); rexp = / ,/gi; strValue = strValue.replace(rexp, ','); strArray = strValue.split(","); regexp = /^([^$@\\ ]+)@((([^$@\\ \.]+)\.)+)([A-Za-z0-9]+)$/ for (i=0; i < strArray.length; i++) { if (isEmpty(strArray[i])) return false; if (!regexp.test(strArray[i])) return false; } // set new field value (with removed spaces between comma and addresses) Field.value = strValue; return true; } function isEmptyCheckbox(Field) { return !Field.checked; } function isEmptyRadio(Field) { found = false; if(isNaN(Field.length)) { return !Field.checked; } for(i=0; i< Field.length; i++) { if ( Field[i].checked ) { found = true; break; } } return !found; } function getListValue(Field) { return Field[Field.selectedIndex].value; } function getTextValue(Field) { return Field.value; } function getCheckboxValue(Field) { if (Field.checked) return Field.value; return ''; } function getRadioValue(Field) { found = false; if(isNaN(Field.length)) { return Field.value; } for(i=0; i< Field.length; i++) { if ( Field[i].checked ) { return Field[i].value; break; } } return !found; } function isZip(Field) { strValue = getValue(Field); if (isEmpty(strValue)) { return false; } if (strValue.indexOf('-') >=0 ) { regexp = /^\d{5}-\d{4}$/ } else { regexp = /^\d{5}$/ } return regexp.test(strValue); } function isPhone(Field) { strValue = getValue(Field); regexp = /^\d{3}-\d{3}-\d{4}$/ if (isEmpty(strValue)) { return false; } return regexp.test(strValue); } function isFax(Field) { strValue = getValue(Field); regexp = /^\d{3}-\d{3}-\d{4}$/ if (isEmpty(strValue)) { return false; } return regexp.test(strValue); } function isEmptyList(Field) { return isEmpty(Field[Field.selectedIndex].value); } function isEmptyText(Field) { return isEmpty(Field.value) } function isEmpty(s) { if (s == null || trim(s) == '') { return true; } else { return false; } } function convertYear(y) { var borderYEAR = 40; yearvalue = parseInt(y,10); if (isNaN(yearvalue)) return y; if (yearvalue - borderYEAR <= 0) { yearvalue = yearvalue + 2000 } else if (yearvalue - 100 < 0) { yearvalue = yearvalue + 1900 } return yearvalue; } function CheckTime(hh,mm,ampm) { if (isNaN(parseInt(hh,10))) return false; if (isNaN(parseInt(mm,10))) return false; if (isEmpty(ampm)) return false; hh = parseInt(hh,10); mm = parseInt(mm,10); if (ampm == 'PM' && hh > 12) return false; return true; } function CheckDate(m,d,y) { Months = "31/!/28/!/31/!/30/!/31/!/30/!/31/!/31/!/30/!/31/!/30/!/31"; MonthArray = Months.split("/!/"); if (isNaN(parseInt(m,10))) return false; if (isNaN(parseInt(d,10))) return false; if (isNaN(parseInt(y,10))) return false; d = parseInt(d,10); y = parseInt(y,10); m = parseInt(m,10); y = convertYear(y); if (y <= 1900 ) return false; if (m < 1 || m > 12 ) return false; if ( isLeapYear(y)) MonthArray[1] = eval(eval(MonthArray[1]) + 1); if (d<1 || MonthArray[m-1] < d ) return false; return true; } function isLeapYear(Year) { if(Math.round(Year/4) == Year/4){ if(Math.round(Year/100) == Year/100){ if(Math.round(Year/400) == Year/400) return true; else return false; }else return true; } return false; } function trim(str) { while (str.substring(0,1) == " ") { str = str.substring(1,str.length); } while (str.substring(str.length-1,str.length) == " ") { str = str.substring(0,str.length-1); } return str; } function removeCurrency( strValue ) { var objRegExp = /\(/; var strMinus = ''; //check if negative if(objRegExp.test(strValue)){ strMinus = '-'; } objRegExp = /\)|\(|[,]/g; strValue = strValue.replace(objRegExp,''); if(strValue.indexOf('$') >= 0){ strValue = strValue.substring(1, strValue.length); } return strMinus + strValue; } function addCurrency( strValue ) { var objRegExp = /-?[0-9]+\.[0-9]{2}$/; if( objRegExp.test(strValue)) { objRegExp.compile('^-'); strValue = addCommas(strValue); if (objRegExp.test(strValue)){ strValue = '(' + strValue.replace(objRegExp,'') + ')'; } return strValue; } else return strValue; } function addCommas( strValue ) { var objRegExp = new RegExp('(-?[0-9]+)([0-9]{3})'); //check for match to search criteria while(objRegExp.test(strValue)) { //replace original string with first group match, //a comma, then second group match strValue = strValue.replace(objRegExp, '$1,$2'); } return strValue; } function roundNumber(NumToRound,NumRightDecimal) { var num = Math.round(NumToRound*Math.pow(10,NumRightDecimal))/Math.pow(10,NumRightDecimal); var string = "" + num; var number = string.length - string.indexOf('.'); if (string.indexOf('.') == -1) return string + '.00'; if (number == 1) return string + '00'; if (number == 2) return string + '0'; return string; } function XmlHTTP() { var obj = null; try { obj = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try { obj = new ActiveXObject("Microsoft.XMLHTTP"); } catch(oc){ obj = null; } } if(!obj&&typeof XMLHttpRequest!= "undefined") { obj = new XMLHttpRequest(); } return obj; } var popup function popupImage(image, height, width) { var src, tWidth, tHeight var s; s = image.split("/") src = "/includes/popupImage.asp?src="+ s[0] tWidth = parseInt(width) + 20; tHeight = parseInt(height) + 70; for(i=1; i