/*
	SmoothBanner.js
	author:  Jeff Emminger http://www.jeffemminger.com/
	
	*** this script offered for free with no warranty ***
*/
var currL;
var el;
var newW;

function sb_smoothBannerInit() {
	el = document.getElementById("smoothBannerText");
	sb_fixWidth();
	sb_scrollBanner();
}
function sb_scrollBanner() {
	currL = parseInt(el.style.left,10);

	if (currL > (-newW)) {
		el.style.left = currL - parseInt(SB_STEP,10) + "px";
	}	else {
		el.style.left = document.getElementById("smoothBannerContainer").offsetWidth + "px";
	}
	window.setTimeout("sb_scrollBanner();", SB_DELAY);
}

function sb_fixWidth() {
	/*  if offsetHeight > line height, make el wider*/	
	var offH = el.offsetHeight;
	var offW = el.offsetWidth;

	var w = (el.style.width.length == 0)?offW:el.style.width;
	while (offH > 25 && w < 4000) {
		w += 10;
		el.style.width = w;
		offH = el.offsetHeight;
	}

	newW = el.offsetWidth;
}

function SmoothBanner(msg, delay, step) {
	self.SB_DELAY = delay || 10;
	self.SB_STEP = step || 1;
	
	document.write('<div id="smoothBannerContainer">'
		+ '<div id="smoothBannerText">' + msg + '</div></div>');
	
	sb_smoothBannerInit();
}

