/*
   Copyright M. Vesey April 2006
   Information here should be duplicated in stoppress.htm
*/


var characterDelay = 50;
var storyDelay = 4000; 
var msg = "";

var nextStory  = -1; 
var currentLength = 0; 

var storyIndex = 0;
var storyCount = 1;
var maxStories = 1;

var storyDate = new Array(storyCount); 
var storyTitle = new Array(storyCount); 
var storyLink = new Array(storyCount); 

storyDate[storyIndex] = "";
storyTitle[storyIndex] = "Merry Christmas! We will reopen on Wednesday the 6th of January 2010.";
storyLink[storyIndex++] = "";
/*
storyDate[storyIndex] = "";
storyTitle[storyIndex] = "Open to the public from Wednesday - Saturday, 11am-3pm";
storyLink[storyIndex++] = "";

storyDate[storyIndex] = "";
storyTitle[storyIndex] = "... or contact us for group visits, guided tours and consultancy.";
storyLink[storyIndex++] = "http://www.syec.co.uk/contact.php";

storyDate[storyIndex] = "";
storyTitle[storyIndex] = "We now run a Green Building Service! Phone for details.";
storyLink[storyIndex++] = "http://www.syec.co.uk/contact.php";


storyDate[storyIndex] = "";
storyTitle[storyIndex] = "B & Q now selling Windsave wind turbines!";
storyLink[storyIndex++] = "http://www.diy.com/diy/jsp/bq/nav/nav.jsp?fh_search=Windsave&zone=all";

storyDate[storyIndex] = "";
storyTitle[storyIndex] = "Buy green products from us!";
storyLink[storyIndex++] = "http://www.syec.co.uk/sales.php";

storyDate[storyIndex] = "";
storyTitle[storyIndex] = "Read about the courses we're running.";
storyLink[storyIndex++] = "http://www.syec.co.uk/courses.php";

storyDate[storyIndex] = "";
storyTitle[storyIndex] = "Renewable Energy Grants severely rationed. Photovoltaic grant down from £3000 per kWp to £2000 from April.";
storyLink[storyIndex++] = "";
*/

function showTicker()
{
    var whichTimeout;

    if(currentLength == 0) {
      nextStory++;
      msg = "";
      if(nextStory >= maxStories) {
        nextStory = 0;
      }
      if(storyDate[nextStory] != "") {
        msg += storyDate[nextStory]+ ' : ';
      }
      if(storyLink[nextStory] != "") {
        msg += '<a href=\"' + storyLink[nextStory] + '\">';
      }

      msg += '<span id=\"stopPressStory\">&nbsp;<\/span>';

      if(storyLink[nextStory] != "") {
        msg += '<\/a>';
      }
      document.getElementById("stopPressText").innerHTML = msg;
    }
    if(storyTitle[nextStory] != "") {
      showMsg('stopPressStory',storyTitle[nextStory].substring(0,currentLength+1));
    }
    if(currentLength <= storyTitle[nextStory].length) {
        currentLength++; 
        whichTimeout = characterDelay;
    }
    else {
        currentLength = 0; 
        whichTimeout = storyDelay;
    }
    setTimeout("showTicker()", whichTimeout);
}
