1 2function toggleonly(name,number,show) 3{ 4//alert(name+" "+number) 5 el = document.all[name+"_"+number] 6 //alert(name+"_"+number+": "+getdisplay(el)); 7 if (getdisplay(el) == "" && !show) 8 changedisplay(el,"none"); 9 else 10 changedisplay(el,""); 11} 12Array.prototype.hasvalue = function (value) { 13 var i; 14 for (i=0; i < this.length; i++) { 15 if (this[i] == value) { 16 return true; 17 } 18 } 19 return false; 20}; 21Array.prototype.haskey = function (value) { 22 for (i in this) { 23 if (i === value) { 24 return true; 25 } 26 } 27 return false; 28}; 29Array.prototype.remove = function (value) { 30 for (i=0; i < this.length; i++) { 31 if (this[i] === value) { 32 this.splice(i,1) 33 } 34 } 35}; 36 37Array.prototype.unsplit = function (delim) { 38 var str=''; 39 for (i=0; i < this.length; i++) 40 { 41 if (i!=0) 42 str+=',' 43 str+=this[i] 44 } 45 return str; 46}; 47function toggle(name) //this will toggle the display even if it is an array of IDs 48{ 49 //alert(name) 50 el = document.getElementById(name) 51 if(typeof(el) == "object" && el != null) 52 { 53 var hidenow = (getdisplay(el) == "" || getdisplay(el) == "inline") 54 //alert(hidenow) 55 if (hidenow) 56 changedisplay(el,"none"); 57 else 58 { 59 if(name == "tktapprovaldiv") 60 changedisplay(el,"inline"); 61 else 62 changedisplay(el,""); 63 } 64 65 el = document.getElementById(name+"_off") 66 67 if(typeof(el) == "object" && el != null) 68 { 69 if(hidenow) 70 changedisplay(el,""); 71 else 72 changedisplay(el,"none"); 73 } 74 } 75} 76 77/*** 78 * 79 */ 80 81/*** 82 * 83 */ 84function getdisplay(el) 85{ 86 if(typeof(el.length)=="undefined") 87 return el.style.display; 88 else 89 for(j=0;j<el.length;j++) 90 return el[j].style.display; 91} 92 93function outputMoney(number) 94{ 95 return outputDollars(Math.floor(number-0) + '') + outputCents(number - 0); 96} 97 98function outputDollars(number) 99{ 100 if (number.length <= 3) 101 return (number == '' ? '0' : number); 102 else 103 { 104 var mod = number.length%3; 105 var output = (mod == 0 ? '' : (number.substring(0,mod))); 106 for (i=0 ; i < Math.floor(number.length/3) ; i++) 107 { 108 if ((mod ==0) && (i ==0)) 109 output+= number.substring(mod+3*i,mod+3*i+3); 110 else 111 output+= ',' + number.substring(mod+3*i,mod+3*i+3); 112 } 113 return (output); 114 } 115} 116 117function outputCents(amount) 118{ 119 amount = Math.round( ( (amount) - Math.floor(amount) ) *100); 120 return (amount < 10 ? '.0' + amount : '.' + amount); 121} 122/* The showonly function is used to toggle the display between 2 or more objects on the document. 123 Example params: 'search','0','1,0,3' 124 The object name (on the document) must have "_x" (x = a digit) after the name(i.e. search_1). 125 The name passed to showonly would be "search". The number param is extension of the object name to display (i.e. search_0) 126 The nums param is the list of extensions of the objects to close. 127*/ 128function showonly(name,number,nums) 129{ 130 //alert(name) 131 ls = nums.split(",") 132 for(i=0;i<ls.length;i++) 133 { 134 nm=name+"_"+ls[i]; 135 el = document.all(name+"_"+ls[i]) 136 //alert(nm +": off") 137 //alert(el.id) 138 changedisplay(el,"none"); 139 } 140 nm=name+"_"+number 141 //alert(nm +": on") 142 el = document.all(name+"_"+number) 143 changedisplay(el,""); 144} 145 146function changedisplay(el,disp) 147{ 148 o=el 149 if(typeof(el)=="string") 150 el=document.getElementById(el) 151 if(el==null) 152 { 153 alert("el: is null("+o+")") 154 return; 155 } 156 if(typeof(el.length)=="undefined") 157 { 158 el.style.display=disp; 159 } 160 else 161 for(j=0;j<el.length;j++) 162 { 163 el[j].style.display=disp; 164 } 165} 166/** 167 * DHTML date validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/) 168 */ 169// Declaring valid date character, minimum year and maximum year 170var dtCh= "/"; 171var minYear=1900; 172var maxYear=2100; 173 174function isInteger(s){ 175 var i; 176 for (i = 0; i < s.length; i++){ 177 // Check that current character is number. 178 var c = s.charAt(i); 179 if (((c < "0") || (c > "9"))) return false; 180 } 181 // All characters are numbers. 182 return true; 183} 184 185function stripCharsInBag(s, bag){ 186 var i; 187 var returnString = ""; 188 // Search through string's characters one by one. 189 // If character is not in bag, append to returnString. 190 for (i = 0; i < s.length; i++){ 191 var c = s.charAt(i); 192 if (bag.indexOf(c) == -1) returnString += c; 193 } 194 return returnString; 195} 196 197function daysInFebruary (year){ 198 // February has 29 days in any year evenly divisible by four, 199 // EXCEPT for centurial years which are not also divisible by 400. 200 return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 ); 201} 202function DaysArray(n) { 203 for (var i = 1; i <= n; i++) { 204 this[i] = 31 205 if (i==4 || i==6 || i==9 || i==11) {this[i] = 30} 206 if (i==2) {this[i] = 29} 207 } 208 return this 209} 210 211function isDate(dtStr){ 212 var daysInMonth = DaysArray(12) 213 var pos1=dtStr.indexOf(dtCh) 214 var pos2=dtStr.indexOf(dtCh,pos1+1) 215 var strMonth=dtStr.substring(0,pos1) 216 var strDay=dtStr.substring(pos1+1,pos2) 217 var strYear=dtStr.substring(pos2+1) 218 strYr=strYear 219 if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1) 220 if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1) 221 for (var i = 1; i <= 3; i++) { 222 if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1) 223 } 224 month=parseInt(strMonth) 225 day=parseInt(strDay) 226 year=parseInt(strYr) 227 228 /* ADDED 8/13/07 TP 229 * ALLOW THE DATE TO BE AN EMPTY STRING 230 */ 231 if(dtStr=='' || !dtStr) return true; 232 233 if (pos1==-1 || pos2==-1){ 234 alert("The date format should be : mm/dd/yyyy") 235 return false 236 } 237 if (strMonth.length<1 || month<1 || month>12){ 238 alert("Please enter a valid month") 239 return false 240 } 241 if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){ 242 alert("Please enter a valid day") 243 return false 244 } 245 if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){ 246 alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear) 247 return false 248 } 249 if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){ 250 alert("Please enter a valid date") 251 return false 252 } 253return true 254} 255 256function chkdate(dt){ 257// var dt=document.frmSample.txtDate 258 if (isDate(dt)==false){ 259// dt.focus() 260 return false 261 } 262 263 /* 264 * This is kind of a hack - the ticket adjustment request form 265 * needs to track if any fields have changed. 266 */ 267 top.modified = true; 268 return true 269 } 270/* end of date validation 271*/ 272function is_validwebsite_format(url) 273{ 274 275 url = url.toLowerCase(); 276 var RegExp = /^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/; 277 if(RegExp.test(url)){ 278 return true; 279 }else{ 280 return false; 281 } 282} 283function website_results(url) 284{ 285 if(url=="") 286 return ""; 287 if(!is_validwebsite_format(url))
288 return "invalid format ("+url+")"; 289 var ret = geturl(url,'status'); 290 291 if(ret=="404") 292 return "Invalid Website: "+url+" is not viewable "; 293 return "" 294} 295 296
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.