function copyToClipboard(text) { window.prompt("To copy to clipboard, press Ctrl+C then Enter!", text); } function postMessage(theMessage) { var diiv = document.getElementById("messagediv"); diiv.innerHTML = theMessage; diiv.style.visibility = 'visible'; diiv.style.opacity = '1'; diiv.style.display = 'block'; var duration = 5000; var amountOfActions = 10; var count = 10; setInterval(function(){ count --; if (count >= 0) { diiv.style.opacity = count/amountOfActions; } else { diiv.style.visibility = 'hidden'; } }, duration / amountOfActions); } function chomp(raw_text) { return raw_text.replace(/(\n|\r)+$/, ''); } function showProfile(handle) { window.open('viewprofile.asp?handle='+handle,'profile','width=620,height=370'); } function openCal() { window.open('bigcal.asp','profile','width=925,height=650,resizable=1,scrollbars=1'); } function adjustFrame() { if(screen.height <= 768) { document.getElementById('maindiv').style.height = '450px'; document.getElementById('menudiv').style.height = '320px'; } } function populateCombo(combo,values,chosen) { combo.options.length = 0; for (var j=0; jb) return 1; if (ab) return -1; return 0; } function trim(sString) { while (sString.substring(0,1) == ' ') { sString = sString.substring(1, sString.length); } while (sString.substring(sString.length-1, sString.length) == ' ') { sString = sString.substring(0,sString.length-1); } return sString; } function pickItem(fElement,chosen) { var optsArray = fElement.options; for (var i=0; i "9"))) return false; } // All characters are numbers. return true; } function stripCharsInBag(s, bag){ var i; var returnString = ""; // Search through string's characters one by one. // If character is not in bag, append to returnString. for (i = 0; i < s.length; i++){ var c = s.charAt(i); if (bag.indexOf(c) == -1) returnString += c; } return returnString; } function daysInFebruary (year){ // February has 29 days in any year evenly divisible by four, // EXCEPT for centurial years which are not also divisible by 400. return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 ); } function DaysArray(n) { for (var i = 1; i <= n; i++) { this[i] = 31 if (i==4 || i==6 || i==9 || i==11) {this[i] = 30} if (i==2) {this[i] = 29} } return this } function isValidDate(dtStr,warn) { var daysInMonth = DaysArray(12) var pos1=dtStr.indexOf(dtCh) var pos2=dtStr.indexOf(dtCh,pos1+1) var strMonth=dtStr.substring(0,pos1) var strDay=dtStr.substring(pos1+1,pos2) var strYear=dtStr.substring(pos2+1) strYr=strYear if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1) if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1) for (var i = 1; i <= 3; i++) { if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1) } month=parseInt(strMonth) day=parseInt(strDay) year=parseInt(strYr) if (pos1==-1 || pos2==-1){ if(warn) alert("The date format should be : mm/dd/yyyy") return false } if (strMonth.length<1 || month<1 || month>12){ if(warn) alert("Please enter a valid month") return false } if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){ if(warn) alert("Please enter a valid day") return false } if (strYear.length != 4 || year==0 || yearmaxYear){ if(warn) alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear) return false } if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){ if(warn) alert("Please enter a valid date") return false } return true; } /** This is a Javascript implementation of the Java Hashtable object. Contructor(s): Hashtable() Creates a new, empty hashtable Method(s): void clear() Clears this hashtable so that it contains no keys. boolean containsKey(String key) Tests if the specified object is a key in this hashtable. boolean containsValue(Object value) Returns true if this Hashtable maps one or more keys to this value. Object get(String key) Returns the value to which the specified key is mapped in this hashtable. boolean isEmpty() Tests if this hashtable maps no keys to values. Array keys() Returns an array of the keys in this hashtable. void put(String key, Object value) Maps the specified key to the specified value in this hashtable. A NullPointerException is thrown is the key or value is null. Object remove(String key) Removes the key (and its corresponding value) from this hashtable. Returns the value of the key that was removed int size() Returns the number of keys in this hashtable. String toString() Returns a string representation of this Hashtable object in the form of a set of entries, enclosed in braces and separated by the ASCII characters ", " (comma and space). Array values() Returns a array view of the values contained in this Hashtable. */ function Hashtable(){ this.clear = hashtable_clear; this.containsKey = hashtable_containsKey; this.containsValue = hashtable_containsValue; this.get = hashtable_get; this.isEmpty = hashtable_isEmpty; this.keys = hashtable_keys; this.put = hashtable_put; this.remove = hashtable_remove; this.size = hashtable_size; this.toString = hashtable_toString; this.values = hashtable_values; this.hashtable = new Array(); } /*=======Private methods for internal use only========*/ function getByValue(value) { for(var i in this.hashtable) { if(this.hashtable[i] == value) { return i; } } } function hashtable_clear(){ this.hashtable = new Array(); } function hashtable_containsKey(key){ var exists = false; for (var i in this.hashtable) { if (i == key && this.hashtable[i] != null) { exists = true; break; } } return exists; } function hashtable_containsValue(value){ var contains = false; if (value != null) { for (var i in this.hashtable) { if (this.hashtable[i] == value) { contains = true; break; } } } return contains; } function hashtable_get(key){ return this.hashtable[key]; } function hashtable_isEmpty(){ return (this.size == 0) ? true : false; } function hashtable_keys(){ var keys = new Array(); for (var i in this.hashtable) { if (this.hashtable[i] != null) keys.push(i); } return keys; } function hashtable_put(key, value){ if (key == null || value == null) { throw "NullPointerException {" + key + "},{" + value + "}"; }else{ this.hashtable[key] = value; } } function hashtable_remove(key){ var rtn = this.hashtable[key]; this.hashtable[key] = null; return rtn; } function hashtable_size(){ var size = 0; for (var i in this.hashtable) { if (this.hashtable[i] != null) size ++; } return size; } function hashtable_toString(){ var result = ""; for (var i in this.hashtable) { if (this.hashtable[i] != null) result += "{" + i + "},{" + this.hashtable[i] + "}\n"; } return result; } function hashtable_values(){ var values = new Array(); for (var i in this.hashtable) { if (this.hashtable[i] != null) values.push(this.hashtable[i]); } return values; }