var MSG_NEED_NUMBER = 1 var MSG_NEED_VALUE = 2 var MSG_NEED_YEAR = 4 var MSG_NEED_2_DECIMAL = 5 var MSG_MAX_100 = 6 var MSG_SUM_100 = 7 var MSG_NEED_DATE = 8 var MSG_WARN_NO_VALUE = 9 var ie=document.all var dom=document.getElementById var ns4=document.layers var bBlankItems = false var nFirstBlankItem var bRadioInit = false var aryRadioButton = new Array(); var nControlCount var bReloading=false; function BodyOnLoad() { bRadioInit=true; nControlCount=0; //clear the new array //each position in the array corresponds to a question for(i=0; i<50; ++i) { aryRadioButton[i] = null; } } function RadioUnClick(rdoObject,iQuestionNumber) { //If the value of the radiobutton is the same value, then the user clicked a radio button //that is already selected. Therefore we need to unselected it. if(bRadioInit==false) BodyOnLoad(); // alert(iQuestionNumber + rdoObject.name + " " + rdoObject.type) if(iQuestionNumber > nControlCount) nControlCount=iQuestionNumber; if ((rdoObject.value)==(aryRadioButton[iQuestionNumber])) { rdoObject.checked = false; aryRadioButton[iQuestionNumber] = null; } else { //keep track of the new value aryRadioButton[iQuestionNumber] = rdoObject.value; } } function RadioOnFocus(rdoObject,iQuestionNumber) { //If the value of the radiobutton is the same value, then the user clicked a radio button //that is already selected. Therefore we need to unselected it. if(bRadioInit==false) BodyOnLoad(); if(iQuestionNumber > nControlCount) nControlCount=iQuestionNumber; if(rdoObject.checked == true) aryRadioButton[iQuestionNumber] = rdoObject.value; } if(top.sidebar != null) { if(top.sidebar.SelectCurrentPage != null) { top.sidebar.SelectCurrentPage() } } function TrackCount(fieldObj,countFieldName,maxChars) { var countField = eval("fieldObj.form."+countFieldName); var diff = maxChars - fieldObj.value.length; // Need to check & enforce limit here also in case user pastes data if (diff < 0) { fieldObj.value = fieldObj.value.substring(0,maxChars); diff = maxChars - fieldObj.value.length; } //countField.value = diff; } function LimitText(fieldObj,maxChars) { var result = true; if (fieldObj.value.length >= maxChars) result = false; if (window.event) window.event.returnValue = result; return result; } function JumpToPage(nPage) { if(top.survey.ValidationCheck != null) { if(ValidationCheck()) { document.UserForm.action="/surveyb/survey.asp?Action=" + nPage document.UserForm.submit() } } else { document.UserForm.action="/surveyb/survey.asp?&Action=" + nPage document.UserForm.submit() } } function JumpToPhysPage(nPage) { if(top.survey.ValidationCheck != null) { if(ValidationCheck()) { document.UserForm.action="/surveyb/survey.asp?IsPhysPage=1&Action=" + nPage document.UserForm.submit() } } else { document.UserForm.action="/surveyb/survey.asp?IsPhysPage=1&Action=" + nPage document.UserForm.submit() } } function LogoffSurvey() { if(ValidationCheck()) { document.UserForm.action="/survey.asp?Action=Exit" document.UserForm.submit() } } function ReloadPage(ctl) { if(ctl != 0) { if(bReloading==false) { bReloading=true; document.UserForm.action=document.UserForm.action + "&Action=reload&ScrollPos=" + GetScrollPos() document.UserForm.submit() } } } function GetScrollPos() { var y = window.scrollY if(y >=0) return y; else { if(ie!=null) { y=document.body.scrollTop; if(y>0) return y; } } return 0; } function Required(item) { var bItemChecked = false; if(item.value != null) { SetBkColor(item,"white") if(item.length == null) // a data-entry type field { if (item.value == "") { item.focus() SetBkColor(item,"red") alert(GetMessage(MSG_NEED_VALUE)) item.focus() return false; } } else // A combo-box. a value of Zero indicates no value { if (item.value == "0") { item.focus() SetBkColor(item,"red") alert(GetMessage(MSG_NEED_VALUE)) item.focus() return false; } } } else // Multiple radio buttons { for (var i=0;i 100.0),GetMessage(MSG_MAX_100)) } function GetInt(item) { if (item=="") return 0; else return parseInt(item); } function GetFloat(item) { if (item=="") return parseFloat("0.0"); else return parseFloat(item); } function GetRadioButton(item) { var bItemChecked = false; for (var i=0;i "9" || str.length == null) { return false } } return true } //----------------------------------------------------------------------------- // Custom Script Helper Functions //----------------------------------------------------------------------------- function GetQInt(strItemName) { var strValue = GetQValue(strItemName); if (strValue=="") return 0; else return parseInt(strValue); } function SetQValue(strItemName,strValue) { var item = GetQItem(strItemName) if(item) item.value = strValue; } function GetQValue(strItemName) { var item = GetQItem(strItemName) if (item) return item.value; else return ""; } function GetQRadio(strItemName) { var item = GetQItem(strItemName) for (var i=0;i