path: (linkParts[3]).substring(1), qsArray: [], query: '', scheme: (linkParts[0]).substring(0, linkParts[0].length-1), source: href }; return uri; } if (!uri.host) uri = splitLink(href); return uri;};searchshield.parseQuery = function (qs){ var qsArray = []; qs.replace(/(?:^|&)([^&=]*)=?([^&]*)/g, function ($0, $1, $2) { if ($1) qsArray[$1] = $2; } ); return qsArray;};// general functionssearchshield.arrayKeys = function (array){ var keys = new Array(); for(k in array) keys.push(k); return keys;};searchshield.inArray = function (key, array, caseSensitive, exactMatch){ if (! array instanceof Array) return false; if (caseSensitive !== true) caseSensitive = false; if (exactMatch !== false) exactMatch = true; if (key instanceof String) { for (var i=0; i < array.length; i++) { var k = caseSensitive ? key.valueOf() : key.valueOf().toLowerCase(); var a = caseSensitive ? array[i] : array[i].toLowerCase(); if(exactMatch && k === a) return true; else if (!exactMatch && (-1 !== k.indexOf(a))) return true; } } else if (key instanceof Array) { for (var i=0; i < array.length; i++) for (var j=0; j < key.length; j++) { var k = caseSensitive ? key[j] : key[j].toLowerCase(); var a = caseSensitive ? array[i] : array[i].toLowerCase(); if (exactMatch && k === a) return true; else if (!exactMatch && (-1 !== k.indexOf(a))) return true; } } return false;};searchshield.getClickHandlerParams = function(clickHandler){ var re = /((?:'[^']*')|[\w]*)(?:,|\))/ig; var chParams = []; clickHandler.replace(re, function($0, $1, $2){ if ($1) chParams.push($1); } ); return chParams;};// general use functions - end// Search constructorsearchshield.Search = function(){ this.doc = null; this.engine = null; this.engines = null; this.links = null; this.uri = null; this.searchHash = null; this.checkUrl = null; this.useLocalImgs = null; this.clockUrl = null; // create engine list (actually key/value object will be used) this.engineList = {};};searchshield.Search.prototype.getSearchNames = function(){ // order is important var names = [ 'Google', 'AVGGoogle', 'AltaVista', 'AVGYahoo', 'Yahoo', 'Bing', 'MSN', // MSN redirects to BING 'Baidu', 'Earthlink', 'AOL', 'Ask', 'Yandex', 'Seznam', 'Webhledani', 'eBay',///temp 'Digg', 'Slashdot', 'Twitter', 'GMail', 'Facebook', 'MySpace' ]; return names;};searchshield.Search.prototype.detectEngine = function(href){ if (!href) return; var aEng = searchshield.Search.prototype.getSearchNames(); var aEngLen = aEng.length; for (var i=0; i < aEngLen; i++) { if (searchshield[aEng[i] + 'SearchEngine'].prototype.validSearch(href)) return aEng[i]; } return;};searchshield.Search.prototype.addEngine = function(engine){ if (!this.engines) this.engines = new Array(); this.engines.push(engine);};searchshield.Search.prototype.addLink = function(inElement, inHref){ if (!this.links) this.links = new Array(); var hrefHash; try { hrefHash = searchshield.avgCallFunc(this.doc, 'GetHash', inHref); } catch (e){} var newNode = { element: inElement, href: inHref, hash: hrefHash, search: this.searchHash }; this.links.push(newNode); return newNode;}// process the search result page after all search engines have been addedsearchshield.Search.prototype.process = function(doc){ // only process when searchshield is enabled if (!searchshield.enabled(doc)) return; this.doc = doc; this.href = this.doc.location.href; this.uri = searchshield.parseLink(this.href); try { this.searchHash = searchshield.avgCallFunc(this.doc, 'GetHash', this.href); // get any previously active engine this.engine = this.engineList[this.searchHash.toString()]; } catch (e) {} /* Process Steps: 1. Add all supported search engines 2. Identify the active search engine 3. Get all document links and add AVG images */ // STEP 1 - Add all supported search engines if (!this.engines) { var aEng = xplSearch.getSearchNames(); var aEngLen = aEng.length; for (var i=0; i < aEngLen; i++) { xplSearch.addEngine(new searchshield[aEng[i]+'SearchEngine'](this)); } } // search the engines if we didn't find one if (!this.engine) { // STEP 2 - Identify the active search engine var engLen = this.engines.length; for