/* Original creation by: Mike Hudson: http://www.afrozeus.com */

function setupQuotes() {
  arrTitles[0]="Once I quit this planet, I care not one whit about the leftovers and I wouldn’t mind a bit if they were put to good use by the animals of the northern forest, but I would like my passing to be noticed by at least one other human being";
  arrTitles[1]="We only have one world, yet we seem bent on destroying it";
  arrTitles[2]="Conservation or extinction? Extinction is forever!";
  arrTitles[3]="Teach skin-out biology, the curriculum of life";
  arrTitles[4]="In nature, everything is connected to everything else";
  arrTitles[5]="Nature is careless of the individual, but careful of the species";
  arrTitles[6]="The media only covers environmental issues when there is a disaster";
  arrTitles[7]="Put yourself in neutral";
  arrTitles[8]="The killing of animals for dissection continues. What an irony! We look at death and we believe that we are studying life!";
  arrTitles[9]="In the final analysis, you should by now realize that you are responsible for the mess of pollution. You are one of 'The Poison Makers'";
  arrTitles[10]="If population is not curbed, social and environmental chaos will erupt by the second decade of the twenty first century";
  arrTitles[11]="Nature balances itself. Nature spends the interest on its capital, but does not spend the capital";
  arrTitles[12]="Intelligence, I believe, is demonstrated by those organisms that are capable of living successfully within their own environment (something that most humans are unable to do)";
  arrTitles[13]="Our species will self-destruct if we do not radically change our lifestyle and our philosophy";
  arrTitles[14]="Nature can be the salvation of mankind, if we ever come to understand its workings, and respect all life";
  arrTitles[15]="Now, as I listen to the wolves howling, I feel that it is the spirit of the wilderness that is calling to me";
  arrTitles[16]="Yesterday is the experience that  allows a person to live today, in order to be ready for tomorrow";
  arrTitles[17]="How can you be lonely when you are surrounded by life?";
  arrTitles[18]="All living things are individuals";
  arrTitles[19]="Conservation or extinction";
  arrTitles[20]="Every living thing is unique";
  arrTitles[21]="Writers have the last word";
  arrTitles[22]="Wolves eat with their livers (drop in glucose). Humans eat with their cortex";
  arrTitles[23]="Good smells, bad smells...Wolves just smell";
  arrTitles[24]="Explore, discover, dream, write";
  arrTitles[25]="When the ocean speaks, I listen";
  arrTitles[26]="Mans attitude threatens the global environment";
  arrTitles[27]="A weed is a plant, the benefit of which (for humans) has not yet been discovered";
  arrTitles[28]="Through mud and blood to the green fields beyond";
  arrTitles[29]="The wolf's voice had travelled into space and had joined the dancing sprits of the night";
  arrTitles[30]="The science of Bio-Geography concerns itself with the distribution on Earth of all plants and animals";
  arrTitles[31]="Good, better, best; never let it rest until your good is better and your better is best";
  
  // Now randomise the contents of the array
  arrTitles.sort(function() {return 0.5 - Math.random()})
  }

var m_iInterval;
var m_Height;
var iScroll=0;
var arrTitles;
var arrCursor = 0;
var arrMax;
//window.onload=wl;

// This is the entry point, run onload from HTML page
function wl() {
  m_iInterval = setInterval(ontimer, 75);		// Bottom to Middle delay in Ms
  var base = document.getElementById("jump_base");

  m_Height = base.offsetHeight;

  var divi = parseInt(m_Height/5);
  m_Height = divi*5;

  var td1 = document.getElementById("td1");
  var td2 = document.getElementById("td2");
  var td3 = document.getElementById("td3");
  td1.height = m_Height-5;
  td2.height = m_Height-5;
  td3.height = m_Height-5;

  arrTitles = new Array();

  setupQuotes();
  arrMax = arrTitles.length-1;
  setLink();
  }

function setLink() {
  var ilink = document.getElementById("jump_link");
  ilink.innerHTML = arrTitles[arrCursor];
  }

function ontimer() {
  var base = document.getElementById("jump_base");
  iScroll+=5;
  if (iScroll>(m_Height*2)) {
    iScroll=0;
    arrCursor++;
    if (arrCursor>arrMax) {
      arrCursor=0;
      }
    setLink();
    }
  if (iScroll==m_Height) {
    pause();
    m_iInterval = setTimeout(resume, 3000);		// Set time in MS that the text remains still
    }
  base.scrollTop=iScroll;
  }

function pause() {
  clearInterval(m_iInterval);
  }

function resume() {
  m_iInterval = setInterval(ontimer, 75);		// Middle to top delay in Ms
  }
