function pbs_compare_url_to_list(suburl, url_list) { for(var i=0; i 1) { probe = Math.ceil((high + low) / 2); if(url_list[probe][0] <= suburl) low = probe; else high = probe; } if(low >= 0 && suburl.indexOf(url_list[low][0]) == 0) return url_list[low]; else return null; } function pbs_set_cookieval(cookname, val, expirationdate) { // cookname will be used unescaped. // val will be escaped automatically. // expirationdate is optional. // Set expirationdate to the past to delete a cookie. var cookieval = cookname + "=" + escape(val) + "; path=/"; if (expirationdate) { var date = new Date(expirationdate); cookieval = cookieval + "; expires=" + date.toGMTString(); } document.cookie = cookieval; } function pbs_get_cookieval(cookname) { // Caution! If your cookiename is a substring of another cookiename, // you might not get your cookie back. var search = cookname + "="; if (document.cookie.length > 0) { var offset = document.cookie.indexOf(search); if (offset != -1) { offset += search.length; var end = document.cookie.indexOf(";", offset); if (end == -1) end = document.cookie.length; return unescape(document.cookie.substring(offset, end)); } } return null; }