function get(eid) {return document.getElementById(eid);} ; function getCookie(key) { var c = document.cookie; // convenience reference if ( 0 == c.length ) return null; // if none, return null - exit immediately // implicit else - test for cookie value for key var c_start = c.indexOf(key + "="); if (-1 == c_start) return null; // if no value for key, return null - exit immediately // implicit else - get value from cookie string c = c.substring(c_start + (key + "=").length); var c_end = c.indexOf( ";" ); // find end of value for key if ( -1 == c_end ) c_end = c.length; // if no trailing semi-colon, this is last value, reset end // chop trailing parts, if any and return unescaped value return unescape( c.substring( 0, c_end ) ); } ; function setCookie( key, value, expiredays) { // if not given, set default number of days until expiration to one year in the future if ('undefined' == typeof expiredays) expiredays = 365.25; // get a new Date instance var expires = new Date(); // convert requested (or default) number of days to milliseconds expires.setTime( expires.getTime() + 1000*24*60*60 * expiredays ); // add new key/value pair to cookies for page document.cookie = key + '=' + escape(value) + ((null == expiredays)?'':(';expires=' + expires.toGMTString())); } ; function removeBlock(bOpen, bClose, s) { // remove all subtext between between {bOpen} and {bClose} from // {s}, if both {bOpen} and {bClose} are found and {bOpen} occurs // before {bClose} - otherwise, return {s} unchanged if (-1 != s.indexOf(bOpen) && // {bOpen} found -1 != s.indexOf(bClose) && // {bClose} found s.indexOf(bOpen) < s.indexOf(bClose)) { // {bOpen} before {bClose} s = s.substring(0, s.indexOf(bOpen)) + s.substring(s.indexOf(bClose) + bClose.length); } return s; } ; function removeAllBlocks(bOpen, bClose, s) { // for all paired instances of {bOpen} and {bClose} found in {s}, // remove all subtext between between {bOpen} and {bClose} from // {s}, if both {bOpen} and {bClose} are found and {bOpen} occurs // before {bClose} - otherwise, return {s} unchanged while (-1 != s.indexOf(bOpen) && // {bOpen} found -1 != s.indexOf(bClose) && // {bClose} found s.indexOf(bOpen) < s.indexOf(bClose)) { // {bOpen} before {bClose} s = removeBlock(bOpen, bClose, s); } return s; } ; function doMailto(aRef) { var aId = aRef.id; // get id of calling anchor element var oldHref = aRef.href; // get original href - simply a text message var pathIdx = oldHref.lastIndexOf('/'); // check href for full http path if (-1 != pathIdx) oldHref = oldHref.substring(pathIdx + 1); // if included, chop it oldHref = unescape(oldHref); // replace URL escaped characters with regular text // get anchor content, i.e., obfuscated e-mail address, and de-obfuscate it var href = removeAllBlocks('', aRef.innerHTML.toLowerCase()); aRef.href = 'mailto:' + href; // assign de-obfuscated href and let browser invoke mail-client setTimeout("get('" + aId + "').href='" + oldHref + "'", 500); // reassign old version after brief delay } ;