						
  var expDays= 365;
  var CookieInfoStr='';

  var expdate = new Date();
  var olddate = new Date();
  expdate.setTime (expdate.getTime() + (expDays*24*60*60*1000));
  olddate.setTime (expdate.getTime());

// if js is disabled we want app elements to be visible
// so they are visible by default in the CSS

document.write("<" + "style type='text/css'>.exp{display:none;}<" + "/" + "style>");

window.onload = function()
{
  dsds_onload();
}
function dsds_onload()
{
  var ln=1, // lnk number
      lo=1; // lnk object

  for (; lo; ++ln) {
    lo = document.getElementById('lnk' + ln);
    if (lo) {
      lo.appId = '-' + ln;
      lo.onclick = dsds_onclick;
    }
  }
  window.currentAppId = null; // global
}
// assumes app elements have display:none initially
function dsds_onclick()
{
  var e;
  if (currentAppId && currentAppId != this.appId) {
    e = document.getElementById(currentAppId);
    e.style.display = 'none';
  }
  e = document.getElementById(this.appId);
  if (e.style.display == 'block') {
    e.style.display = 'none';
    currentAppId = null;
  }
  else {
    e.style.display = 'block';
    currentAppId = this.appId;
  }
  return false;
}
function StoreResultsLink(){
    document.write ('<a href="javascript:addCookieArray(\'' + document.title + '\',\'' + location.href + '\');"><img id="floatimg" src="http://www.4ei.com/ars.gif" border="0" align="absmiddle" hspace="2"></a>');
}
function StoreResultsLinkaa(){
    document.write ('<a href="javascript:addCookieArrayaa(\'' + document.title + '\',\'' + location.href + '\');"><img id="floatimgaa" src="http://www.4ei.com/ars.gif" border="0" align="absmiddle" hspace="2"></a>');
}
function StoreLink1(){
    var title = str.replace(/'/g, '');
    var link = strl;
    document.write ('<a href="javascript:addCookieArraya(\'' + title + '\',\'' + link + '\');"><img id="floatimga" src="http://www.4ei.com/ars3.gif" border="0" align="absmiddle" hspace="2"></a>');
}
function StoreLink2(){
    var title = str.replace(/'/g, '');
    var link = strl;
    document.write ('<a href="javascript:addCookieArrayb(\'' + title + '\',\'' + link + '\');"><img id="floatimgb" src="http://www.4ei.com/ars3.gif" border="0" align="absmiddle" hspace="2"></a>');
}
function StoreLink3(){
    var title = str.replace(/'/g, '');
    var link = strl;
    document.write ('<a href="javascript:addCookieArrayc(\'' + title + '\',\'' + link + '\');"><img id="floatimgc" src="http://www.4ei.com/ars3.gif" border="0" align="absmiddle" hspace="2"></a>');
}
function StoreLink4(){
    var title = str.replace(/'/g, '');
    var link = strl;
    document.write ('<a href="javascript:addCookieArrayd(\'' + title + '\',\'' + link + '\');"><img id="floatimgd" src="http://www.4ei.com/ars3.gif" border="0" align="absmiddle" hspace="2"></a>');
}
function StoreLink5(){
    var title = str.replace(/'/g, '');
    var link = strl;
    document.write ('<a href="javascript:addCookieArraye(\'' + title + '\',\'' + link + '\');"><img id="floatimge" src="http://www.4ei.com/ars3.gif" border="0" align="absmiddle" hspace="2"></a>');
}
function StoreLink6(){
    var title = str.replace(/'/g, '');
    var link = strl;
    document.write ('<a href="javascript:addCookieArrayf(\'' + title + '\',\'' + link + '\');"><img id="floatimgf" src="http://www.4ei.com/ars3.gif" border="0" align="absmiddle" hspace="2"></a>');
}
function StoreLink7(){
    var title = str.replace(/'/g, '');
    var link = strl;
    document.write ('<a href="javascript:addCookieArrayg(\'' + title + '\',\'' + link + '\');"><img id="floatimgg" src="http://www.4ei.com/ars3.gif" border="0" align="absmiddle" hspace="2"></a>');
}
function StoreLink8(){
    var title = str.replace(/'/g, '');
    var link = strl;
    document.write ('<a href="javascript:addCookieArrayh(\'' + title + '\',\'' + link + '\');"><img id="floatimgh" src="http://www.4ei.com/ars3.gif" border="0" align="absmiddle" hspace="2"></a>');
}
function StoreLink9(){
    var title = str.replace(/'/g, '');
    var link = strl;
    document.write ('<a href="javascript:addCookieArrayi(\'' + title + '\',\'' + link + '\');"><img id="floatimgi" src="http://www.4ei.com/ars3.gif" border="0" align="absmiddle" hspace="2"></a>');
}
function StoreLink10(){
    var title = str.replace(/'/g, '');
    var link = strl;
    document.write ('<a href="javascript:addCookieArrayj(\'' + title + '\',\'' + link + '\');"><img id="floatimgj" src="http://www.4ei.com/ars3.gif" border="0" align="absmiddle" hspace="2"></a>');
}
function StoreLink11(){
    var title = str.replace(/'/g, '');
    var link = strl;
    document.write ('<a href="javascript:addCookieArrayk(\'' + title + '\',\'' + link + '\');"><img id="floatimgk" src="http://www.4ei.com/ars3.gif" border="0" align="absmiddle" hspace="2"></a>');
}
function StoreLink12(){
    var title = str.replace(/'/g, '');
    var link = strl;
    document.write ('<a href="javascript:addCookieArrayl(\'' + title + '\',\'' + link + '\');"><img id="floatimgl" src="http://www.4ei.com/ars3.gif" border="0" align="absmiddle" hspace="2"></a>');
}
function StoreLink13(){
    var title = str.replace(/'/g, '');
    var link = strl;
    document.write ('<a href="javascript:addCookieArraym(\'' + title + '\',\'' + link + '\');"><img id="floatimgm" src="http://www.4ei.com/ars3.gif" border="0" align="absmiddle" hspace="2"></a>');
}
function StoreLink14(){
    var title = str.replace(/'/g, '');
    var link = strl;
    document.write ('<a href="javascript:addCookieArrayn(\'' + title + '\',\'' + link + '\');"><img id="floatimgn" src="http://www.4ei.com/ars3.gif" border="0" align="absmiddle" hspace="2"></a>');
}
function StoreLink15(){
    var title = str.replace(/'/g, '');
    var link = strl;
    document.write ('<a href="javascript:addCookieArrayo(\'' + title + '\',\'' + link + '\');"><img id="floatimgo" src="http://www.4ei.com/ars3.gif" border="0" align="absmiddle" hspace="2"></a>');
}
function StoreLink16(){
    var title = str.replace(/'/g, '');
    var link = strl;
    document.write ('<a href="javascript:addCookieArrayp(\'' + title + '\',\'' + link + '\');"><img id="floatimgp" src="http://www.4ei.com/ars3.gif" border="0" align="absmiddle" hspace="2"></a>');
}
function StoreLink17(){
    var title = str.replace(/'/g, '');
    var link = strl;
    document.write ('<a href="javascript:addCookieArrayq(\'' + title + '\',\'' + link + '\');"><img id="floatimgq" src="http://www.4ei.com/ars3.gif" border="0" align="absmiddle" hspace="2"></a>');
}
function StoreLink18(){
    var title = str.replace(/'/g, '');
    var link = strl;
    document.write ('<a href="javascript:addCookieArrayr(\'' + title + '\',\'' + link + '\');"><img id="floatimgr" src="http://www.4ei.com/ars3.gif" border="0" align="absmiddle" hspace="2"></a>');
}
function StoreLink19(){
    var title = str.replace(/'/g, '');
    var link = strl;
    document.write ('<a href="javascript:addCookieArrays(\'' + title + '\',\'' + link + '\');"><img id="floatimgs" src="http://www.4ei.com/ars3.gif" border="0" align="absmiddle" hspace="2"></a>');
}
function StoreLink20(){
    var title = str.replace(/'/g, '');
    var link = strl;
    document.write ('<a href="javascript:addCookieArrayt(\'' + title + '\',\'' + link + '\');"><img id="floatimgt" src="http://www.4ei.com/ars3.gif" border="0" align="absmiddle" hspace="2"></a>');
}

function ViewPage(){
    document.write ('<a href="http://www.4ei.com/results.html"><img src="http://www.4ei.com/gball.gif" border="0" align="absmiddle" hspace="2"><font face="Verdana" size="1">View or Email Saved Results</font></a>');
}
function OpenLink(){
    var linkk = strr;
    document.write ('<a href="javascript:http://linkk"><img src="http://www.4ei.com/n.gif" border="0" align="absmiddle" hspace="2"><font face="Verdana" size="1">Open Link In New Window</font></a>');
}		
function ClearResultsLink(){
    document.write ('<a href="javascript:del();"><img src="http://www.4ei.com/wball.gif" border="0" align="absmiddle" hspace="2"><font face="Verdana" size="1">Clear Saved Results</font></a>');
}
function Refresh(){
    document.write ('<a href="javascript:location.reload();"><img src="http://www.4ei.com/ar.gif" border="0" align="absmiddle" hspace="2"><font face="Verdana" size="1">Update Results List</font></a><br><br>');
}			
function ShowResultsLink(){
  var i = 0;
  //document.write ('<ul>');
  while (getCookie('names' + i) !== null) {
   document.write ('');  
   document.write ('<a href="' + getCookie('urls' + i) + '">' + getCookie('names' + i) + '</a>' );
   document.write ('<br>');
   i++; 
  }  
  if (i===0){
   document.write ('<img src="http://www.4ei.com/ar.gif" width="15" border="0" align="absmiddle" hspace="2">');  
   document.write ('<font face="Verdana" size="1">No Results Stored - Click on "Save Result(s)" During Your Searches to Add.</font>' );
   document.write ('<br>');
  }
  //document.write ('</ul>');
  
}
function EmailResultsLink(){
  var i = 0;
  //document.write ('<TEXTAREA name="thetext" rows="20" cols="80">');
    document.write ('<a href="mailto:?subject=4ei.com results&body=');
  //document.write ('<ul>');
  while (getCookie('names' + i) != null) {
   document.write ('');  
   document.write ('' + getCookie('names' + i) + ' ' + getCookie('urls' + i) + '' );
   document.write ('%0D%0A');
   i++; 
  }  
  if (i==0){
   document.write ('"></a>');
   document.write ('<img src="http://www.4ei.com/ar.gif" width="15" border="0" align="absmiddle" hspace="2">');  
   document.write ('<font face="Verdana" size="1">No Results Stored For Emailing - Click on "Save Result(s)" During Your Searches to Add.</font>' );
   document.write ('<br>');
   document.write ('<a href="');
  }
  //document.write ('</ul>');
   document.write ('"><img src="http://www.4ei.com/blb.gif" width="15" border="0" align="absmiddle" hspace="2"><font face="Verdana" size="1">Email Results</font></a>');
 //document.write ('</TEXTAREA>');
}
function getCookie (name) {
var dcookie = document.cookie; 
var cname = name + "=";
var clen = dcookie.length;
var cbegin = 0;
  while (cbegin < clen) {
  var vbegin = cbegin + cname.length;
  if (dcookie.substring(cbegin, vbegin) == cname) { 
    var vend = dcookie.indexOf (";", vbegin);
    if (vend == -1) {vend = clen;}
    return unescape(dcookie.substring(vbegin, vend));
  }
  cbegin = dcookie.indexOf(" ", cbegin) + 1;
  if (cbegin === 0) {break;}
  }
return null;
}
function setCookie (name, value, expires) {
if (!expires) {expires = new Date();}
document.cookie=name+"="+escape (value)+"; expires="+expires.toGMTString()+"; path=/";
}
function setCookieArray(name){
this.length = setCookieArray.arguments.length - 1;
  for (var i = 0; i < this.length; i++) {
  this[i + 1] = setCookieArray.arguments[i + 1];
  setCookie (name + i, this[i + 1], expdate);
  }  
}
function addCookieArray(name, val){
  
  var i = 0;
  var found=false;
    
  while (getCookie('names' + i) !== null) { 
    if (getCookie('names' + i) == name) {found=true;}
    i++;	
  }    
  

  if (!found) {
  
  setCookie ('names' + i, name, expdate);
  setCookie ('urls' + i, val, expdate);
  var floatimg = document.getElementById("floatimg");
  floatimg.setAttribute("src", "http://4ei.com/ars2.gif");
   }
  else {
  var floatimg = document.getElementById("floatimg");
  floatimg.setAttribute("src", "http://4ei.com/arsx.gif");
  //alert('This Page Was Already Added To Your Results');
  }
  
}

function addCookieArrayaa(name, val){
  
  var i = 0;
  var found=false;
    
  while (getCookie('names' + i) !== null) { 
    if (getCookie('names' + i) == name) {found=true;}
    i++;	
  }    
  

  if (!found) {
  
  setCookie ('names' + i, name, expdate);
  setCookie ('urls' + i, val, expdate);
  var floatimgaa = document.getElementById("floatimgaa");
  floatimgaa.setAttribute("src", "http://4ei.com/ars2.gif");
   }
  else {
  var floatimgaa = document.getElementById("floatimgaa");
  floatimgaa.setAttribute("src", "http://4ei.com/arsx.gif");
  //alert('This Page Was Already Added To Your Results');
  }
  
}

function addCookieArraya(name, val){
  
  var i = 0;
  var found=false;
    
  while (getCookie('names' + i) !== null) { 
    if (getCookie('names' + i) == name) {found=true;}
    i++;	
  }    
  

  if (!found) {
  
  setCookie ('names' + i, name, expdate);
  setCookie ('urls' + i, val, expdate);
  var floatimga = document.getElementById("floatimga");
  floatimga.setAttribute("src", "http://4ei.com/ars2.gif");
   }
  else {
  var floatimga = document.getElementById("floatimga");
  floatimga.setAttribute("src", "http://4ei.com/arsx.gif");
  //alert('This Page Was Already Added To Your Results');
  }
  
}



function addCookieArrayb(name, val){
  
  var i = 0;
  var found=false;
    
  while (getCookie('names' + i) !== null) { 
    if (getCookie('names' + i) == name) {found=true;}
    i++;	
  }    
  

  if (!found) {
  
  setCookie ('names' + i, name, expdate);
  setCookie ('urls' + i, val, expdate);
  var floatimgb = document.getElementById("floatimgb");
  floatimgb.setAttribute("src", "http://4ei.com/ars2.gif");
   }
  else {
  var floatimgb = document.getElementById("floatimgb");
  floatimgb.setAttribute("src", "http://4ei.com/arsx.gif");
  //alert('This Page Was Already Added To Your Results');
  }
  
}

function addCookieArrayc(name, val){
  
  var i = 0;
  var found=false;
    
  while (getCookie('names' + i) !== null) { 
    if (getCookie('names' + i) == name) {found=true;}
    i++;	
  }    
  

  if (!found) {
  
  setCookie ('names' + i, name, expdate);
  setCookie ('urls' + i, val, expdate);
  var floatimgc = document.getElementById("floatimgc");
  floatimgc.setAttribute("src", "http://4ei.com/ars2.gif");
   }
  else {
  var floatimgc = document.getElementById("floatimgc");
  floatimgc.setAttribute("src", "http://4ei.com/arsx.gif");
  //alert('This Page Was Already Added To Your Results');
  }
  
}

function addCookieArrayd(name, val){
  
  var i = 0;
  var found=false;
    
  while (getCookie('names' + i) !== null) { 
    if (getCookie('names' + i) == name) {found=true;}
    i++;	
  }    
  

  if (!found) {
  
  setCookie ('names' + i, name, expdate);
  setCookie ('urls' + i, val, expdate);
  var floatimgd = document.getElementById("floatimgd");
  floatimgd.setAttribute("src", "http://4ei.com/ars2.gif");
   }
  else {
  var floatimgd = document.getElementById("floatimgd");
  floatimgd.setAttribute("src", "http://4ei.com/arsx.gif");
  //alert('This Page Was Already Added To Your Results');
  }
  
}

function addCookieArraye(name, val){
  
  var i = 0;
  var found=false;
    
  while (getCookie('names' + i) !== null) { 
    if (getCookie('names' + i) == name) {found=true;}
    i++;	
  }    
  

  if (!found) {
  
  setCookie ('names' + i, name, expdate);
  setCookie ('urls' + i, val, expdate);
  var floatimge = document.getElementById("floatimge");
  floatimge.setAttribute("src", "http://4ei.com/ars2.gif");
   }
  else {
  var floatimge = document.getElementById("floatimge");
  floatimge.setAttribute("src", "http://4ei.com/arsx.gif");
  //alert('This Page Was Already Added To Your Results');
  }
  
}

function addCookieArrayf(name, val){
  
  var i = 0;
  var found=false;
    
  while (getCookie('names' + i) !== null) { 
    if (getCookie('names' + i) == name) {found=true;}
    i++;	
  }    
  

  if (!found) {
  
  setCookie ('names' + i, name, expdate);
  setCookie ('urls' + i, val, expdate);
  var floatimgf = document.getElementById("floatimgf");
  floatimgf.setAttribute("src", "http://4ei.com/ars2.gif");
   }
  else {
  var floatimgf = document.getElementById("floatimgf");
  floatimgf.setAttribute("src", "http://4ei.com/arsx.gif");
  //alert('This Page Was Already Added To Your Results');
  }
  
}

function addCookieArrayg(name, val){
  
  var i = 0;
  var found=false;
    
  while (getCookie('names' + i) !== null) { 
    if (getCookie('names' + i) == name) {found=true;}
    i++;	
  }    
  

  if (!found) {
  
  setCookie ('names' + i, name, expdate);
  setCookie ('urls' + i, val, expdate);
  var floatimgg = document.getElementById("floatimgg");
  floatimga.setAttribute("src", "http://4ei.com/ars2.gif");
   }
  else {
  var floatimgg = document.getElementById("floatimgg");
  floatimgg.setAttribute("src", "http://4ei.com/arsx.gif");
  //alert('This Page Was Already Added To Your Results');
  }
  
}

function addCookieArrayh(name, val){
  
  var i = 0;
  var found=false;
    
  while (getCookie('names' + i) !== null) { 
    if (getCookie('names' + i) == name) {found=true;}
    i++;	
  }    
  

  if (!found) {
  
  setCookie ('names' + i, name, expdate);
  setCookie ('urls' + i, val, expdate);
  var floatimgh = document.getElementById("floatimgh");
  floatimgh.setAttribute("src", "http://4ei.com/ars2.gif");
   }
  else {
  var floatimgh = document.getElementById("floatimgh");
  floatimgh.setAttribute("src", "http://4ei.com/arsx.gif");
  //alert('This Page Was Already Added To Your Results');
  }
  
}

function addCookieArrayi(name, val){
  
  var i = 0;
  var found=false;
    
  while (getCookie('names' + i) !== null) { 
    if (getCookie('names' + i) == name) {found=true;}
    i++;	
  }    
  

  if (!found) {
  
  setCookie ('names' + i, name, expdate);
  setCookie ('urls' + i, val, expdate);
  var floatimgi = document.getElementById("floatimgi");
  floatimgi.setAttribute("src", "http://4ei.com/ars2.gif");
   }
  else {
  var floatimgi = document.getElementById("floatimgi");
  floatimgi.setAttribute("src", "http://4ei.com/arsx.gif");
  //alert('This Page Was Already Added To Your Results');
  }
  
}

function addCookieArrayj(name, val){
  
  var i = 0;
  var found=false;
    
  while (getCookie('names' + i) !== null) { 
    if (getCookie('names' + i) == name) {found=true;}
    i++;	
  }    
  

  if (!found) {
  
  setCookie ('names' + i, name, expdate);
  setCookie ('urls' + i, val, expdate);
  var floatimgj = document.getElementById("floatimgj");
  floatimgj.setAttribute("src", "http://4ei.com/ars2.gif");
   }
  else {
  var floatimgj = document.getElementById("floatimgj");
  floatimgj.setAttribute("src", "http://4ei.com/arsx.gif");
  //alert('This Page Was Already Added To Your Results');
  }
  
}

function addCookieArrayk(name, val){
  
  var i = 0;
  var found=false;
    
  while (getCookie('names' + i) !== null) { 
    if (getCookie('names' + i) == name) {found=true;}
    i++;	
  }    
  

  if (!found) {
  
  setCookie ('names' + i, name, expdate);
  setCookie ('urls' + i, val, expdate);
  var floatimgk = document.getElementById("floatimgk");
  floatimgk.setAttribute("src", "http://4ei.com/ars2.gif");
   }
  else {
  var floatimgk = document.getElementById("floatimgk");
  floatimgk.setAttribute("src", "http://4ei.com/arsx.gif");
  //alert('This Page Was Already Added To Your Results');
  }
  
}



function addCookieArrayl(name, val){
  
  var i = 0;
  var found=false;
    
  while (getCookie('names' + i) !== null) { 
    if (getCookie('names' + i) == name) {found=true;}
    i++;	
  }    
  

  if (!found) {
  
  setCookie ('names' + i, name, expdate);
  setCookie ('urls' + i, val, expdate);
  var floatimgl = document.getElementById("floatimgl");
  floatimgl.setAttribute("src", "http://4ei.com/ars2.gif");
   }
  else {
  var floatimgl = document.getElementById("floatimgl");
  floatimgl.setAttribute("src", "http://4ei.com/arsx.gif");
  //alert('This Page Was Already Added To Your Results');
  }
  
}

function addCookieArraym(name, val){
  
  var i = 0;
  var found=false;
    
  while (getCookie('names' + i) !== null) { 
    if (getCookie('names' + i) == name) {found=true;}
    i++;	
  }    
  

  if (!found) {
  
  setCookie ('names' + i, name, expdate);
  setCookie ('urls' + i, val, expdate);
  var floatimgm = document.getElementById("floatimgm");
  floatimgm.setAttribute("src", "http://4ei.com/ars2.gif");
   }
  else {
  var floatimgm = document.getElementById("floatimgm");
  floatimgm.setAttribute("src", "http://4ei.com/arsx.gif");
  //alert('This Page Was Already Added To Your Results');
  }
  
}

function addCookieArrayn(name, val){
  
  var i = 0;
  var found=false;
    
  while (getCookie('names' + i) !== null) { 
    if (getCookie('names' + i) == name) {found=true;}
    i++;	
  }    
  

  if (!found) {
  
  setCookie ('names' + i, name, expdate);
  setCookie ('urls' + i, val, expdate);
  var floatimgn = document.getElementById("floatimgn");
  floatimgn.setAttribute("src", "http://4ei.com/ars2.gif");
   }
  else {
  var floatimgn = document.getElementById("floatimgn");
  floatimgn.setAttribute("src", "http://4ei.com/arsx.gif");
  //alert('This Page Was Already Added To Your Results');
  }
  
}

function addCookieArrayo(name, val){
  
  var i = 0;
  var found=false;
    
  while (getCookie('names' + i) !== null) { 
    if (getCookie('names' + i) == name) {found=true;}
    i++;	
  }    
  

  if (!found) {
  
  setCookie ('names' + i, name, expdate);
  setCookie ('urls' + i, val, expdate);
  var floatimgo = document.getElementById("floatimgo");
  floatimgo.setAttribute("src", "http://4ei.com/ars2.gif");
   }
  else {
  var floatimgo = document.getElementById("floatimgo");
  floatimgo.setAttribute("src", "http://4ei.com/arsx.gif");
  //alert('This Page Was Already Added To Your Results');
  }
  
}

function addCookieArrayp(name, val){
  
  var i = 0;
  var found=false;
    
  while (getCookie('names' + i) !== null) { 
    if (getCookie('names' + i) == name) {found=true;}
    i++;	
  }    
  

  if (!found) {
  
  setCookie ('names' + i, name, expdate);
  setCookie ('urls' + i, val, expdate);
  var floatimgp = document.getElementById("floatimgp");
  floatimgp.setAttribute("src", "http://4ei.com/ars2.gif");
   }
  else {
  var floatimgp = document.getElementById("floatimgp");
  floatimgp.setAttribute("src", "http://4ei.com/arsx.gif");
  //alert('This Page Was Already Added To Your Results');
  }
  
}

function addCookieArrayq(name, val){
  
  var i = 0;
  var found=false;
    
  while (getCookie('names' + i) !== null) { 
    if (getCookie('names' + i) == name) {found=true;}
    i++;	
  }    
  

  if (!found) {
  
  setCookie ('names' + i, name, expdate);
  setCookie ('urls' + i, val, expdate);
  var floatimgq = document.getElementById("floatimgq");
  floatimgq.setAttribute("src", "http://4ei.com/ars2.gif");
   }
  else {
  var floatimgq = document.getElementById("floatimgq");
  floatimgq.setAttribute("src", "http://4ei.com/arsx.gif");
  //alert('This Page Was Already Added To Your Results');
  }
  
}

function addCookieArrayr(name, val){
  
  var i = 0;
  var found=false;
    
  while (getCookie('names' + i) !== null) { 
    if (getCookie('names' + i) == name) {found=true;}
    i++;	
  }    
  

  if (!found) {
  
  setCookie ('names' + i, name, expdate);
  setCookie ('urls' + i, val, expdate);
  var floatimgr = document.getElementById("floatimgr");
  floatimgr.setAttribute("src", "http://4ei.com/ars2.gif");
   }
  else {
  var floatimgr = document.getElementById("floatimgr");
  floatimgr.setAttribute("src", "http://4ei.com/arsx.gif");
  //alert('This Page Was Already Added To Your Results');
  }
  
}

function addCookieArrays(name, val){
  
  var i = 0;
  var found=false;
    
  while (getCookie('names' + i) !== null) { 
    if (getCookie('names' + i) == name) {found=true;}
    i++;	
  }    
  

  if (!found) {
  
  setCookie ('names' + i, name, expdate);
  setCookie ('urls' + i, val, expdate);
  var floatimgs = document.getElementById("floatimgs");
  floatimgs.setAttribute("src", "http://4ei.com/ars2.gif");
   }
  else {
  var floatimgs = document.getElementById("floatimgs");
  floatimgs.setAttribute("src", "http://4ei.com/arsx.gif");
  //alert('This Page Was Already Added To Your Results');
  }
  
}

function addCookieArrayt(name, val){
  
  var i = 0;
  var found=false;
    
  while (getCookie('names' + i) !== null) { 
    if (getCookie('names' + i) == name) {found=true;}
    i++;	
  }    
  

  if (!found) {
  
  setCookie ('names' + i, name, expdate);
  setCookie ('urls' + i, val, expdate);
  var floatimgt = document.getElementById("floatimgt");
  floatimgt.setAttribute("src", "http://4ei.com/ars2.gif");
   }
  else {
  var floatimgt = document.getElementById("floatimgt");
  floatimgt.setAttribute("src", "http://4ei.com/arsx.gif");
  //alert('This Page Was Already Added To Your Results');
  }
  
}

function getCookieArray(name){
var i = 0;
  while (getCookie(name + i) !== null) {
  this[i + 1] = getCookie(name + i);
  i++; this.length = i;
  }		
}
function del() {
var i = 0;
if (window.confirm('Clear All Stored Results?  ')) {

  while (getCookie('names' + i) !== null) {
  setCookie ('names' + i, '', olddate);
  setCookie ('urls' + i, '', olddate);
  i++; 
  }  
  i++; 
  setCookie ('names' + i, '', olddate);
  setCookie ('urls' + i, '', olddate);   
  //alert('Stored Results Have Been Cleared. ');
  location.reload();
}
}

function doHighlight(bodyText, searchTerm, highlightStartTag, highlightEndTag) 
{
  
  if ((!highlightStartTag) || (!highlightEndTag)) {
    highlightStartTag = "<font style=background-color:yellow;>";
    highlightEndTag = "</font>";
  }

  var newText = "";
  var i = -1;
  var lcSearchTerm = searchTerm.toLowerCase();
  var lcBodyText = bodyText.toLowerCase();
    
  while (bodyText.length > 0) {
    i = lcBodyText.indexOf(lcSearchTerm, i+1);
    if (i < 0) {
      newText += bodyText;
      bodyText = "";
    } else {
            if (bodyText.lastIndexOf(">", i) >= bodyText.lastIndexOf("<", i)) {
                if (lcBodyText.lastIndexOf("/script>", i) >= lcBodyText.lastIndexOf("<script", i)) {
          newText += bodyText.substring(0, i) + highlightStartTag + bodyText.substr(i, searchTerm.length) + highlightEndTag;
          bodyText = bodyText.substr(i + searchTerm.length);
          lcBodyText = bodyText.toLowerCase();
          i = -1;
        }
      }
    }
  }
  
  return newText;
}

function undoHighlight(bodyText, searchTerm, unhighlightStartTag, unhighlightEndTag) 
{
  
  if ((!unhighlightStartTag) || (!unhighlightEndTag)) {
    unhighlightStartTag = "<font style=background-color:white;>";
    unhighlightEndTag = "</font>";
  }

  var newText = "";
  var i = -1;
  var lcSearchTerm = searchTerm.toLowerCase();
  var lcBodyText = bodyText.toLowerCase();
    
  while (bodyText.length > 0) {
    i = lcBodyText.indexOf(lcSearchTerm, i+1);
    if (i < 0) {
      newText += bodyText;
      bodyText = "";
    } else {
            if (bodyText.lastIndexOf(">", i) >= bodyText.lastIndexOf("<", i)) {
                if (lcBodyText.lastIndexOf("/script>", i) >= lcBodyText.lastIndexOf("<script", i)) {
          newText += bodyText.substring(0, i) + unhighlightStartTag + bodyText.substr(i, searchTerm.length) + unhighlightEndTag;
          bodyText = bodyText.substr(i + searchTerm.length);
          lcBodyText = bodyText.toLowerCase();
          i = -1;
        }
      }
    }
  }
  
  return newText;
}

function highlightSearchTerms(searchText, treatAsPhrase, warnOnFailure, highlightStartTag, highlightEndTag)
{
  
  if (treatAsPhrase) {
    searchArray = [searchText];
  } else {
    searchArray = searchText.split(" ");
  }
  
  if (!document.body || typeof(document.body.innerHTML) == "undefined") {
    if (warnOnFailure) {
      alert("Sorry, for some reason the text of this page is unavailable. Searching will not work.");
    }
    return false;
  }
  
  var bodyText = document.body.innerHTML;
  for (var i = 0; i < searchArray.length; i++) {
    bodyText = doHighlight(bodyText, searchArray[i], highlightStartTag, highlightEndTag);
  }
  
  document.body.innerHTML = bodyText;
  return true;
}

function unhighlightSearchTerms(searchText, treatAsPhrase, warnOnFailure, unhighlightStartTag, unhighlightEndTag)
{
  
  if (treatAsPhrase) {
    searchArray = [searchText];
  } else {
    searchArray = searchText.split(" ");
  }
  
  if (!document.body || typeof(document.body.innerHTML) == "undefined") {
    if (warnOnFailure) {
      alert("Sorry, for some reason the text of this page is unavailable. Searching will not work.");
    }
    return false;
  }
  
  var bodyText = document.body.innerHTML;
  for (var i = 0; i < searchArray.length; i++) {
    bodyText = undoHighlight(bodyText, searchArray[i], unhighlightStartTag, unhighlightEndTag);
  }
  
  document.body.innerHTML = bodyText;
  return true;
}


function searchPhrase(defaultText, treatAsPhrase, textColor, bgColor)
{ 
    if (!defaultText) {
    defaultText = "";
  }
  
   if ((!textColor) || (!bgColor)) {
    highlightStartTag = "";
    highlightEndTag = "";
  } else {
    highlightStartTag = "<font style='color:" + textColor + "; background-color:" + bgColor + ";'>";
    highlightEndTag = "</font>";
  }
  
  //if (treatAsPhrase) {
  //  promptText = "Please enter the exact phrase you'd like to highlight:";
  //} else {
  //  promptText = "Please enter the words you'd like to search for, separated by spaces:";
  //}
  
  //searchText = prompt(promptText, defaultText);
  searchText = defaultText;

  if (!searchText)  {
    alert("No search terms were entered. Exiting function.");
    return false;
  }
  
  return highlightSearchTerms(searchText, treatAsPhrase, true, highlightStartTag, highlightEndTag);
}

