1 2//Return true if the supplied value is an integer. 3function IsInteger(Value) { 4 //Test if parseInt returns a number. See the doc about NaN for why the code is written this way. 5 if ((Value == "") || (isNaN(parseInt(Value)))) 6 {return false;} 7 else 8 {return true;} 9} 10 11//Return true if the supplied value is a number. 12function IsNumber(Value) { 13 //Test if parseFloat returns a number. See the doc about NaN for why the code is written this way. 14 if ((Value == "") || (isNaN(parseFloat(Value)))) 15 {return false;} 16 else 17 {return true;} 18} 19 20//Return true if the supplied value is a number. 21function IsNumberOrBlank(Value) { 22 //Test if parseFloat returns a number. See the doc about NaN for why the code is written this way. 23 if ((Value != "") && (isNaN(Value))) { 24 return false; 25 } else { 26 return true; 27 } 28} 29 30//Return the index of the specified form element. 31function GetFormIndex(ElementName) { 32 var i; 33 for(i=0;i<document.PdcSurvey.elements.length;i++) { 34 if (document.PdcSurvey.elements[i].name == ElementName) { 35 return i; 36 } 37 } 38 return -1; 39} 40 41//Return the index of the selected option from the array. 42function PdcSelectedOption(optionArray) { 43 for(var x=0;x<optionArray.length;x++) { 44 //The option could a radio button which is check or a selected list item. If either of those 45 //cases is true return the index. 46 if (((optionArray[x].type == "radio") && optionArray[x].checked) || optionArray[x].selected) 47 return x; 48 } 49 return -1; 50} 51 52//Return true if all topics in the table have unique choice selections. 53function PdcValidateRankings() { 54 var index; 55 var choiceValues = new Array(); 56 57 for (var x=0;x<arguments.length;x++){ 58 //Get the selected index 59 index = PdcSelectedOption(document.PdcSurvey[arguments[x]]); 60 61 //If there is a selected index test if it has already been set. 62 if (index != -1) { 63 if (choiceValues[index] == 1) { 64 return false; 65 } else { 66 choiceValues[index] = 1; 67 } 68 } 69 } 70 return true; 71} 72 73 74function PdcGetElement(elementName) { 75 // Check if the browser supports GetElementById, otherwise loop thru all of the form elements. 76 if (document.getElementById) { 77 return document.getElementById(elementName); 78 } else { 79 for(var i=0;i<document.PdcSurvey.elements.length;i++) { 80 if (document.PdcSurvey.elements[i].id == elementName) 81 return document.PdcSurvey.elements[i]; 82 } 83 } 84 return null; 85} 86 87function PdcSelectedCount() { 88 //Answer the number of selected buttons 89 var Selected=0; 90 91 for (var x = 0; x < arguments.length; x++) { 92 try { 93 if (PdcGetElement(arguments[x]).checked) { 94 Selected += 1; 95 } else if (PdcGetElement(arguments[x]).selected) { 96 Selected += 1; 97 } 98 } catch (e) { 99 try { 100 if (PdcGetElement(arguments[x]).selected) { Selected += 1; } 101 } catch (e2) { } 102 } 103 } 104 return Selected; 105} 106 107 108function PdcClearCheckboxes() { 109 for (var x=0;x<arguments.length;x++){ 110 PdcGetElement(arguments[x]).checked = false; 111 } 112} 113 114function PdcZeroNotAnswered() { 115 for (var x=0;x<arguments.length;x++){ 116 if (PdcGetElement(arguments[x]).value == '') { 117 PdcGetElement(arguments[x]).value = '0'; 118 } 119 } 120} 121 122 123function PdcTextResponseCount() { 124 //Answer the number of Responses 125 var Responses = 0; 126 127 for (var x = 0; x < arguments.length; x++) { 128 try { 129 if (PdcGetElement(arguments[x]).value != '') { 130 Responses += 1; 131 } 132 } catch (e) { 133 try { 134 if (PdcGetElement(arguments[x]).value != '') { Responses += 1; } 135 } catch (e2) { } 136 } 137 } 138 return Responses; 139} 140 141function PdcJumpToQuestion(QuestionId, Message) { 142 //Jump to the question and notify the user. 143 window.location = QuestionId; 144 alert(Message); 145} 146 147function PdcAnyButtonSelected() { 148 //Takes an array of buttons and returns true if any of them are selected. 149 for (var x=0;x<arguments.length;x++){ 150 try { 151 if (PdcGetElement(arguments[x]).checked) { 152 return true; 153 } else if (PdcGetElement(arguments[x]).selected) { 154 return true; 155 } 156 } catch (e) { 157 try { 158 if (PdcGetElement(arguments[x]).selected) { return true; } 159 } catch (e2) { } 160 } 161 } 162 return false; 163} 164 165function PdcAnyAnswered() { 166 //Takes an array of text fields and answers true if any have values. 167 for (var x=0;x<arguments.length;x++){ 168 if (PdcGetElement(arguments[x]).value != '') {return true;} 169 } 170 return false; 171} 172 173function PdcAnyNotAnswered() { 174 //Takes an array of text fields and answers true if any have blank values. 175 for (var x=0;x<arguments.length;x++){ 176 if (PdcGetElement(arguments[x]).value == '') {return true;} 177 } 178 return false; 179} 180 181 182function PdcFieldTotal() { 183 //Takes an array of text fields and answers the total. 184 var Total = 0; 185 var TextValue; 186 187 //Loop thru the arguments, for each text field get the value and if numeric add to the total. 188 for (var x=0;x<arguments.length;x++){ 189 TextValue = PdcGetElement(arguments[x]).value 190 if (IsNumber(TextValue)) Total += parseFloat(TextValue) 191 } 192 return Total; 193} 194 195function PdcSelectedButtons() { 196 //Answer a serial string of selected buttons 197 var Selected=''; 198 for (var x=0;x<arguments.length;x++){ 199 if (PdcGetElement(arguments[x]).checked) { 200 Selected += arguments[x] + '|'; 201 } else if (PdcGetElement(arguments[x]).selected) { 202 Selected += arguments[x] + '|'; 203 } 204 205 try { 206 if (PdcGetElement(arguments[x]).checked) { 207 Selected += arguments[x] + '|'; 208 } else if (PdcGetElement(arguments[x]).selected) { 209 Selected += arguments[x] + '|'; 210 } 211 } catch (e) { 212 try { 213 if (PdcGetElement(arguments[x]).selected) { Selected += arguments[x] + '|'; } 214 } catch (e2) { } 215 } 216 } 217 if (Selected != '') {Selected = Selected.substring(0, Selected.length-1)} 218 return Selected; 219} 220// This is very important as it notifies the CDN fallback that this script has fully loaded. 221window['CDN_LoadedRideSharkSurvey'] = true;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.