| 364 | /* Returns a querystring of BP cookies (cookies beginning with 'bp-') */ |
| 365 | function getAutocompleteCookies() { |
| 366 | var allCookies = document.cookie.split(';'), // get all cookies and split into an array |
| 367 | bpCookies = {}, |
| 368 | cookiePrefix = 'bp-', |
| 369 | i, cookie, delimiter, name, value; |
| 370 | |
| 371 | // loop through cookies |
| 372 | for (i = 0; i < allCookies.length; i++) { |
| 373 | cookie = allCookies[i]; |
| 374 | delimiter = cookie.indexOf('='); |
| 375 | name = jq.trim( unescape( cookie.slice(0, delimiter) ) ); |
| 376 | value = unescape( cookie.slice(delimiter + 1) ); |
| 377 | |
| 378 | // if BP cookie, store it |
| 379 | if ( name.indexOf(cookiePrefix) === 0 ) { |
| 380 | bpCookies[name] = value; |
| 381 | } |
| 382 | } |
| 383 | |
| 384 | // returns BP cookies as querystring |
| 385 | return encodeURIComponent( jq.param(bpCookies) ); |
| 386 | } |