
// **** Begin Processes

function zxcCSBanner(zxcid, zxcvh, zxcw, zxcspd, zxcaary)
	{
	var zxcp = document.getElementById(zxcid);
	var zxcary = [];
	if (zxcaary)
		{
		var zxcpth = zxcaary[0];
		for (var zxc0 = 1; zxc0 < zxcaary.length; zxc0++)
			{
			zxcary[zxc0 - 1] = zxcaary[zxc0];
			for (var zxc1 = 0; zxc1 < zxcary[zxc0 - 1].length; zxc1++)
				{
				if (zxcary[zxc0 - 1][zxc1] == '')
					{
					zxcary[zxc0 - 1][zxc1] = null;
					}
				}
			}
		}
	else
		{
		var zxceles=zxcp.childNodes;
		for (var zxc0 = 0; zxc0 < zxceles.length; zxc0++)
			{
			if (zxceles[zxc0].tagName == 'DIV')
				{
				zxcary.push([zxceles[zxc0],zxceles[zxc0].offsetWidth,zxceles[zxc0].offsetHeight]);
				}
			}
		for (var zxc1 = 0; zxc1 < zxcary.length; zxc1++)
			{
			zxcp.removeChild(zxcary[zxc1][0]);
			}
		}
	var zxcwh = (zxcvh == 'H') ? [zxcp.offsetHeight, zxcp.offsetWidth, 'left', 'top', 'width', 'height'] : [zxcp.offsetWidth, zxcp.offsetHeight, 'top', 'left', 'height', 'width'];
	zxcp.set = true;
	var zxcd = zxcStyle('DIV', {position:'absolute', left:'0px', top:'0px', width:zxcwh[0] + 'px'});
	zxcp.appendChild(zxcd);
	zxcp.ary = [zxcd, zxcd.cloneNode(true), zxcd.cloneNode(true), zxcd.cloneNode(true)];
	for (var zxc2 = 1; zxc2 < zxcp.ary.length; zxc2++)
		{
		zxcp.appendChild(zxcp.ary[zxc2]);
		}
	var zxcobj;
	for (var zxc3 = 0; zxc3 < zxcp.ary.length; zxc3++)
		{
		var zxccnt=0;
		var zxctp=0;
		for (var zxc4 = 0; zxc4 < Math.max(zxcary.length, Math.ceil(zxcwh[1] / zxcwh[0]) + 1); zxc4++)
			{
			zxcobj = zxcStyle('IMG');
			zxcobj.src = zxcpth + 'images/thumbs/' + zxcary[zxccnt][0] + '.jpg';
			zxcobj.alt = zxcary[zxccnt][1];
			zxcobj.url = zxcpth + 'vehicle_pages/' + zxcary[zxccnt][0] + '.shtml';

			zxcStyle(zxcobj, { cursor:((document.all) ? 'hand' : 'pointer')});
			zxcobj.onclick = function(){ zxcLink(this); }
			zxcobj.onmouseover = function(){ zxcOver(this); }
			zxcobj.onmouseout = function(){ zxcOut(this); }

			zxcStyle(zxcobj, {position:'absolute'});
			zxcobj.style[zxcwh[4]] = zxcw + 'px';

			zxctp += 20;
			zxcobj.style[zxcwh[2]] = (zxctp) + 'px';
			zxcobj.style[zxcwh[3]] = '0px';
			zxcp.ary[zxc3].appendChild(zxcobj);
			zxcp.ary[zxc3].style[zxcwh[4]] = (parseInt(zxcobj.style[zxcwh[2]]) + parseInt(zxcobj.style[zxcwh[4]])) + 'px';
			zxctp += parseInt(zxcobj.style[zxcwh[4]]);
			zxccnt = ++zxccnt%zxcary.length;
			
			}
		}
	var zxchw = parseInt(zxcp.ary[0].style[zxcwh[4]]);
	for (var zxc4 = 0; zxc4 < zxcp.ary.length; zxc4++)
		{
		zxcp.ary[zxc4].style[zxcwh[2]] = (zxchw * zxc4 - zxchw) + 'px';
		}
	if (!zxcp.oopbr)
		{
		zxcp.oopbr = new zxcOOPBannerRotate(zxcp, zxcvh, zxcspd, zxchw);
		}
	}

function zxcCngDirection(zxcid, zxcdir)
	{
	var zxcoop = document.getElementById(zxcid).oopbr;
	if (!zxcoop)
		{
		return;
		}
	clearTimeout(zxcoop.to);
	zxcdir = zxcdir || - zxcoop.dir;
	if (zxcdir > 0)
		{
		zxcoop.dir = 1;
		}
	else
		{
		zxcoop.dir = -1;
		}
	zxcoop.rotate();
	}

function zxcBannerStop(zxcid)
	{
	var zxcoop=document.getElementById(zxcid).oopbr;
	if (!zxcoop)
		{
		return;
		}
	clearTimeout(zxcoop.to);
	}

function zxcBannerStart(zxcid, zxcdir)
	{
	var zxcoop = document.getElementById(zxcid).oopbr;
	if (!zxcoop)
		{
		return;
		}
	clearTimeout(zxcoop.to);
	zxcoop.dir = zxcdir || zxcoop.dir;
	zxcoop.rotate();
	}

function zxcLink(zxcobj)
	{
	if (zxcobj.url.match('^|^'))
		{
		zxcExternal(zxcobj.url);
		return;
		}
	window.top.location = zxcobj.url;
	}

function zxcExternal(url)
	{
	window.top.location = url;
	}

function zxcOver(zxcobj)
	{
	document.getElementById('featured_title').innerHTML = '<div class="featured_title_background">' + zxcobj.alt + '</div><div class="featured_title_foreground">' + zxcobj.alt + '</div>';
	//zxcobj.style.borderStyle = 'dashed';
	}

function zxcOut(zxcobj)
	{
	//zxcobj.style.borderStyle = 'double';
	}

function onOut()
	{
	var tid = '';
	document.getElementById('featured_title').innerHTML = '';
	tid = setTimeout("showTitle()", 500);
	}

function showTitle()
	{
	if (document.getElementById('featured_title').innerHTML == '')
		{
		document.getElementById('featured_title').innerHTML = document.getElementById('featured_caption').innerHTML;
		}
	}

function zxcStyle(zxcele, zxcstyle)
	{
	if (typeof(zxcele) == 'string')
		{
		zxcele = document.createElement(zxcele);
		}
	for (key in zxcstyle)
		{
		zxcele.style[key] = zxcstyle[key];
		}
	return zxcele;
	}

function zxcOOPBannerRotate(zxcp, zxcvh, zxcspd, zxchw)
	{
	this.ref = 'zxcoobr' + zxcp.id;
	this.wh = (zxcvh == 'H') ? 'left' : 'top';
	window[this.ref] = this;
	this.ary = zxcp.ary;
	this.spd = zxcspd || 100;
	this.to = null;
	this.dir = 1;
	this.h = zxchw;
	}

zxcOOPBannerRotate.prototype.rotate = function()
	{
	this.ary[1].style[this.wh] = (parseInt(this.ary[1].style[this.wh]) + this.dir) + 'px';
	this.ary[0].style[this.wh] = (parseInt(this.ary[1].style[this.wh]) - this.h) + 'px';
	this.ary[2].style[this.wh] = (parseInt(this.ary[2].style[this.wh]) + this.dir) + 'px';
	this.ary[3].style[this.wh] = (parseInt(this.ary[2].style[this.wh]) + this.h * 2) + 'px';
	if (this.dir < 0 && parseInt(this.ary[1].style[this.wh]) + this.h < 0)
		{
		this.ary[1].style[this.wh] = (parseInt(this.ary[2].style[this.wh]) + this.h) + 'px';
		this.ary.reverse();
		}
	if (this.dir > 0 && parseInt(this.ary[1].style[this.wh]) > this.h)
		{
		this.ary[1].style[this.wh] = (parseInt(this.ary[2].style[this.wh]) - this.h) + 'px';
		this.ary.reverse();
		}
	this.setTimeOut('rotate();', this.spd);
	}

zxcOOPBannerRotate.prototype.setTimeOut = function(zxcf,zxcd)
	{
	this.to = setTimeout('window.' + this.ref + '.' + zxcf, zxcd);
	}

function slideTitle(p)
	{
	var tid = 0;
	p = parseInt(p);
	p -= 20;
	if (p > 0)
		{
		document.getElementById('featured_title').style.left = p + 'px';
		document.getElementById('featured_footer').style.left = p + 'px';
		tid = setTimeout("slideTitle('" + p + "')", 50);
		}
	else
		{
		document.getElementById('featured_title').style.left = '0px';
		document.getElementById('featured_footer').style.left = '0px';
		openFeatured(0);
		}
	}

function openFeatured(p)
	{
	document.getElementById('featured_title_outer').style.height = '24px';
	document.getElementById('featured_title').style.height = '24px';
	document.getElementById('featured_images').style.display = 'block';
	var tid = 0;
	p = parseInt(p);
	p += 10;
	if (p < 155)
		{
		document.getElementById('featured_images').style.height = p + 'px';
		document.getElementById('featured_images_outer').style.height = p + 'px';
		tid = setTimeout("openFeatured('" + p + "')", 50);
		}
	else
		{
		document.getElementById('featured_images').style.height = '155px';
		document.getElementById('featured_images_outer').style.height = '155px';
		tid = setTimeout("runBanner()", 500);
		}
	}

function runBanner()
	{
	zxcCSBanner('featured_images', 'H', 155, 10, ContentAry);
	zxcCngDirection('featured_images', -1);
	showBanner(0,0);
	}

function showBanner(num1,num2)
	{
	var tid = '';
	num1 = parseFloat(num1);
	num2 = parseFloat(num2);
	if (num1 < 1)
		{
		num1 += .1;
		num2 += 10;
		document.getElementById('featured_images').style.opacity = num1;
		document.getElementById('featured_images').style.filter = 'alpha(opacity="' + num2 + '")';
		tid = setTimeout ("showBanner('" + num1 + "','" + num2 + "')", 100);
		}
	}
