﻿//<script language="javascript">
//<!--
//<!-- Original:  Robert Bui (astrogate@hotmail.com) -->
//<!-- Adaptation Martin Mc Arthur (martin@rmweb.co.za -->

//<!-- Re-coding by Netlive KZN (support@netlive.co.za -->

//<!-- Begin
var interval = 8; // delay between changing quotes (in seconds)
var random_display = 1; // 0 = no, 1 = yes
interval *= 1000;

var quote_index = 0;
quote_list = new Array();
quote_list[quote_index++] = "Monitor Distributors is pleased to announce that we are now a level 2, BEE contributor. Click to read more...";
quote_list[quote_index++] = "Monitor Distributors develop a portable high pressure cleaning system on a trailer. Click to read more...";
quote_list[quote_index++] = "Stope washing machines have new versions with a lot of new features. Click to read more...";
quote_list[quote_index++] = "Monitor is now offering customers a lifetime free oil change service for all Hawk high pressure cleaners. Click to read more...";
quote_list[quote_index++] = "A new range of Hawk stainless steel hose reels will soon be available at very reasonable prices. Click to read more...";
var number_of_quotes = quote_list.length;

function generate(x, y) {
var range = y - x + 1;
return Math.floor(Math.random() * range) + x;
}

function getNextQuote() {
	if (random_display) {
		quote_index = generate(0, number_of_quotes-1);
	}
	else {
		quote_index = (quote_index+1) % number_of_quotes;
	}
	var new_quote = quote_list[quote_index];
	return(new_quote);
}

function changeQuote(div_id) {

	_findObj(div_id).innerHTML = getNextQuote();
	var recur_call = "changeQuote('"+div_id+"')";
	setTimeout(recur_call, interval);
}
//  End -->

function _findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
//</script>
