// Ticker

// <![CDATA[
var news=Array("We pay excellent rates for your opinion", "CPD leaders wanted urgently - earn £150", "London and Manchester CPD sessions", "www.schoolzone.co.uk/surveys/2008/eligibilityLGT", "Other research work available at www.schoolzone.co.uk/community/current.asp", "Register now - www.schoolzone.co.uk/register/register.asp");
var cursor="_"; // set cursor
var delay=10; // seconds between each news item


var newsp, cursp, flash, item=0;
window.onload=function() { if (document.getElementById) {
  var span=document.getElementById("news");
  while (span.childNodes.length) span.removeChild(span.childNodes[0]);
  delay*=1000;
  newsp=document.createElement("span");
  cursp=document.createElement("span");
  cursp.appendChild(document.createTextNode(String.fromCharCode(160)+cursor));
  span.appendChild(newsp);
  span.appendChild(cursp);
  ticker();
}}

function ticker() {
  var i;
  while (newsp.childNodes.length) newsp.removeChild(newsp.childNodes[0]);
  newsp.appendChild(document.createTextNode(news[item].substring(0,1)));
  for (i=1; i<news[item].length; i++) setTimeout('newsp.firstChild.nodeValue="'+news[item].substring(0, i+1)+'"', 100*i);
  if (news[item].indexOf("www")!=-1) setTimeout('linkit('+item+')', 100*i);
  setTimeout('flash=setInterval("cursp.style.visibility=(cursp.style.visibility==\'visible\')?\'hidden\':\'visible\'", 234)', 100*i)
  setTimeout('clearInterval(flash)', delay);
  setTimeout('cursp.style.visibility="visible"', delay);
  setTimeout('ticker()', delay);
  item=++item%news.length;
}

function linkit(q) {
  var a,p,e,l;
  p=news[q].indexOf("www");
  e=news[q].indexOf(" ", p);
  if (e==-1) e=news[q].length;
  l=news[q].substring(p, e);
  while (newsp.childNodes.length) newsp.removeChild(newsp.childNodes[0]);
  newsp.appendChild(document.createTextNode(news[q].substring(0, p)));
  a=document.createElement("a");
  a.href="http://"+l;
  a.appendChild(document.createTextNode(l));
  newsp.appendChild(a);
  newsp.appendChild(document.createTextNode(news[q].substring(e)));
}
// ]]>