/*
* @version		$Id: newsticker.js 2009-03-17 20:17:59Z myers $
* @package		Association
* @link			http://www.myersnetwork.com
* @copyright	Copyright (C) 2009 Myers Network. All rights reserved.
* @license		GNU/GPL
*/

/*
Orginal Code By:
//------------------------------------------------------------------------------
// Highligher Scroller script- By JavaScript Kit                               |
// All rights reserved.                                                        |
// Web : http://www.javascriptkit.com/                                         |
// For this and over 400+ free scripts, visit http://www.javascriptkit.com/    |
// This notice must stay intact                                                |
//------------------------------------------------------------------------------
*/

var currentmessage = 0;
var clipwidth = 0;
var link = '';

function NewsTickerChange() {
	crosstick.style.clip = "rect(0px 0px auto 0px)";
	crosstick.innerHTML = tickercontents[currentmessage];
	
	crosstick.onclick = NewsTickerOnClick;
	link = tickerlinks[currentmessage];
	if( link == '' ) crosstick.style.cursor = "auto";
	
	NewsTickerHighLightMessage();
}
function  NewsTickerOnClick( ) {
	if( link != '' ) {
		window.location = link;
	}
}

function NewsTickerHighLightMessage() {
	var msgwidth=crosstick.offsetWidth;
	if( clipwidth < msgwidth ) {
		clipwidth += highlightspeed;
		crosstick.style.clip = "rect(0px "+clipwidth+"px auto 0px)";
		beginclip = setTimeout("NewsTickerHighLightMessage()",20);
	}
	else{
		clipwidth = 0;
		clearTimeout(beginclip);
		if( currentmessage == (tickercontents.length - 1) ) currentmessage = 0; else currentmessage++;
		setTimeout( "NewsTickerChange()", tickdelay );
	}
}
function NewsTickerStart() {
	crosstick = document.getElementById? document.getElementById("highlighter") : document.all.highlighter;
	crosstickParent=crosstick.parentNode? crosstick.parentNode : crosstick.parentElement;
	if( parseInt(crosstick.offsetHeight) > 0 ) crosstickParent.style.height=crosstick.offsetHeight+'px'; else setTimeout("crosstickParent.style.height=crosstick.offsetHeight+'px'",100); //delay for Mozilla's sake
	NewsTickerChange();
}
