
// The values and functions below control the behavior of the quote box.
var ScrollSpeed = 7000;
var QuoteObj = null;
var QuoteIndex = 0;
var QuoteMaxIndex = 0;

function RunOnce()
{
	// alert("I am RunOnce()!");
    QuoteIndex = 0;
	var tmp = Quotes.split("|");
	QuoteMaxIndex = tmp.length / 2;
    QuoteObj = document.getElementById('quote_box');
    QuoteObj.visibility = 'visible';
	ShowQuote();
}

var styles = [ "margin-top: 5px", "margin-right: 5px", "margin-bottom: 5px" ];

function ShowQuote()
{
	if (QuoteMaxIndex == 0)
		Quotes = "Give us a call to learn more....|";
	var tmp = Quotes.split("|");
	var i = QuoteIndex * 2;
	var quote = tmp[i];
	var source = tmp[i+1];
	var html = "";
	if (source != "")
		html = "&quot;" + quote + "&quot;<br><i>" + source + "</i>";
	else
		html = quote;
	QuoteObj.innerHTML = html;
	QuoteObj.style.verticalAlign = QuoteValign[QuoteIndex % QuoteValign.length];
    setTimeout("ShowQuote();", ScrollSpeed);
	if (++QuoteIndex >= QuoteMaxIndex)
		QuoteIndex = 0;
}



/*
	$line = chop($newarray[$rand]);
	$line_split = explode("|", $line);

	$quote = trim($line_split[0]);
	if ($quote == "")
		$quote = "Ask us for customer testimonials and references!";
	$quote = wordwrap($quote, 35, "<br>");
	$quote = str_replace('"', '&quot;', $quote);

	$source = trim($line_split[1]);
	$source = wordwrap($source, 35, "<br>");
	$source = str_replace('"', '&quot;', $source);
	if ($source != "") $source = "<br><em>" . $source . "</em>";

	if ($valign == "top")
		$divmargin = "style='margin-top: 5px'";
	else if ($valign == "middle")
		$divmargin = "style='margin-right: 5px'";
	else
		$divmargin = "style='margin-bottom: 5px'";

	// Save away the settings for valign, and the index of the last quote.
	$handle = fopen($lastfile, "wb");
	$tmp = $valign . "\r\n" . $rand . "\r\n";
	fwrite($handle, $tmp, strlen($tmp));
	fclose($handle);

	return array($valign, "<div class='quote'; " . $divmargin . ">" . $quote . $source . "</div>");
*/