// Copyright At Hand Creations

  var spi="http://athand.org/start.praying.it/";
  var ad=new Array(); var an=new Array();
  var pvw;
  var lkm;

  var isGk=!isIE&&!window.opera&&!isSf;

function deURI(v) {
  var v;
  try { v=decodeURIComponent(v); }
  catch(e) { v=""; }
  return v;
}
  
function cuclk(t) {
  if(typeof(t.cutxt)!='string') t.cutxt='';
  if(t.value=='') {
    t.value=t.cutxt;
    t.select()
  }
  return true;
}  

function cudclk(t) {
  var v=t.value; 
  if(typeof(t.cutxt)!='string') t.cutxt='';
  t.value=(v=='')?t.cutxt:'';
  t.cutxt=v;
  t.select();
  return true;
}

function getTitle(i) { 
  var u=deURI(ad[i]);
  i=u.indexOf("?");
  return u.substr(0,i<0?u.length:i);
}

function getThumb(i) { 
  var u=deURI(ad[i]);
  var j=u.indexOf("?");
  if(j>=0) u=u.substr(0,j);
  if(u.charAt(0)=="$") u="https://"+u.substr(1);
  else if((j=aff(u))>=0) {
    j=affi[j];
    if(j.charAt(0)=="/") j="../t"+j;
    return j;
  }
  return "http://open.thumbshots.org/image.pxf?url="+encodeURIComponent(u);
}

var affl= new Array(
"ebay.co.uk",
"energyhelpline.com",
"athand.org",
"athand.org/start.praying.it",
"start.praying.it",
"athand.org/siteseeing",
"athand.org/gotochurch",
"athand.org/highstreet",
"direct.gov.uk",
""
);

var affi= new Array(
"http://rover.ebay.com/ar/1/710-53481-19255-4/1?campid=5335865650&toolid=55643&customid=pi&mpt=[CACHEBUSTER]&adtype=1&size=120x60&def=u7v&z5m=1&y6d=1&v1e=1&l3s=1&p9m=1&n3y=1&a3h=1&k4v=1&u7v=1&x6n=1&b4x=1&m9q=1&mpvc=",
"http://b1.perfb.com/b1.php?ID=2223&PURL=energyhelpline.at/athand",
"/ah.jpg",
"/initial.jpg",
"/initial.jpg",
"/seeing.jpg",
"/mychurch.jpg",
"/high.jpg",
"/direct.gif",
"/site.jpg"
);

var affu= new Array(
"rover.ebay.com/rover/1/710-53481-19255-4/1?campid=5335865650&toolid=55643&customid=pi&def=u7v&z5m=1&y6d=1&v1e=1&l3s=1&p9m=1&n3y=1&a3h=1&k4v=1&u7v=1&x6n=1&b4x=1&m9q=1&mpvc=",
"energyhelpline.at/athand?CTY=3&CID=269",
"www.athand.org",
"athand.org/start.praying.it/?ini",
"athand.org/start.praying.it/?ini",
"athand.org/siteseeing",
"athand.org/gotochurch",
"athand.org/highstreet",
"www.direct.gov.uk",
""
);

function aff(u) {
  var c=u.toLowerCase();
  var j=c.indexOf("?");
  if(j>=0) c=c.substr(0,j);
  j=c.length-1;
  if(c.lastIndexOf("/")==j) c=c.substr(0,j);
  if(c.substr(0,4)=="www.") c=c.substr(4);
  j=0;
  while(j<affl.length)
  {
    if(c==affl[j]) return j;
    j++;
  }
  return -1;
}

function getIName(i) { 
  var n=an[i];
  if(n=='') return '&nbsp;';
  n=deURI(n);
  i='';
  while(n.length) {
    i+=n.charAt(0);
    if(n.charAt(0)=='&') i+='amp;';
    n=n.substr(1);
  }
  return i;
}

function drThumbs() {
  var i=0;
  if(!document.images["i0"]) return;
  while(i<10) document.images["i"+i].src=getThumb(i++);
}

function chkThumbs() {
  var i=0;
  while(i<10) {
    var c=document.images["i"+i];
    if(c&&c.complete && c.width!=120) c.src="../t/site.jpg";
    i++;
  }
  setTimeout("chkThumbs()",1180);
}

function valid(v) {
  var i=0;
  var n=deURI(v);
  while(i<n.length) {
    var c=n.charCodeAt(i++);
    if(c<32||c>126||c==37||c==60||c==62) return '';
  }
  return v;
}

function drLinks(l,fn) {
  var i=0;
  lkm=1;
  document.write('<tr><td colspan=5 align=right><a onmousedown="return false" style="font-size:14px;color:#6060D0" href="http://learn.thumbshots.com/?&logo-src=http%3a%2f%2fwww.athand.org%2fstart.praying.it%2fi%2flogo.jpg&logo-href=javascript:window.close()&page-bgcolor=%23FFFFFF&text-font=normal+normal+normal+10pt+arial&text-color=%23000020&label-font=normal+normal+bold+12pt+arial&label-color=%23000020&link-font=normal+normal+normal+12pt+arial&link-color=%236666FF&topic-hide=asfc" target="_blank">About thumbshots</a></td></tr>');

  if(l.charAt(0)=="/") {
    l=l.substr(1);
    if(l.charAt(0)=="/") l='';
  }
  if(l.length<9) {
    lkm=0;
    l="initial%20homepage@start.praying.it/go%20to%20church@athand.org%2Fgotochurch/site%20seeing@athand.org%2Fsiteseeing/High%20Street@athand.org%2Fhighstreet/www.athand.org@www.athand.org/ebay@www.ebay.co.uk/energy%20helpline@energyhelpline.com/Wikipedia@en.wikipedia.org%2F/News%20(BBC)@news.bbc.co.uk/Public%20Services@www.direct.gov.uk/@@@@@@@@@!";
  }
  l+='/';
  i=0;
  while(i<10) {
    var j=l.indexOf("@");
    an[i]=valid(l.substr(0,j));
    l=l.substr(j+1);
    j=l.indexOf("/");
    ad[i]=l.substr(0,j);
    l=l.substr(j+1);

    if(i%5<1) document.write('<tr valign=bottom align=center>');
    document.write('<td width=150><a target="AtHand_h" href="go.htm" onclick="'+fn+'('+i+');return false">');
    document.write('<img id="i'+i+'" title="'+getTitle(i)+'" src="../t/site.jpg" onmousedown="return false" style="border:1px solid black">');
    document.write('</a><br><span style="cursor:url(\'ig/cur.cur\'),pointer" onmousedown="return HLgt(this)" class="nw">'+getIName(i)+'</span></td>');
    if(++i%5<1) document.write('</tr><tr><td colspan=5>&nbsp;</td></tr>');
  }
  return l;
}

function HLgt(v) {
  var t=document; var i=0;
  while(i<t.forms[0].length) t.forms[0][i++].blur();
  
  if(isIE) {
    t=t.body.createTextRange();
    t.moveToElementText(v);
    t.select();
  }
  else {
    var s=window.getSelection();
    t=t.createRange();
    t.selectNode(v);
    if(s.rangeCount>0) s.removeAllRanges();
    s.addRange(t);
  }
  return true;
}

function txtSnips(v)
{
  var i; var c=1; var t="";
  while((i=v.indexOf("@"))>=0) {
    var s=deURI(v.substr(0,i));
    s=s.replace(/&/g,"&amp;");
    t+="<span class='cov' onmousedown='return HLgt(this)'>"+s+"</span> ";
    v=v.substr(i+1);
    c++;
  }
  return t;
}

onld+="drThumbs();";
setTimeout('chkThumbs()',280);

