// JavaScript Document

var current = 1;
var bmax = 4;

var info = new Array;

info[1] = new Array("","Introducing Wall Maps from Thomas Bros., a Rand McNally Company! up to 9x12 feet delivered as fast as next day.","Learn More", "products/TB-CA.aspx", "images1/banners/pic1.jpg")
info[2] = new Array("","","", "products/maps.aspx", "images1/banners/pic2.jpg")
info[3] = new Array("","","", "products/maps.aspx", "images1/banners/pic3.jpg")
info[4] = new Array("","","", "products/maps.aspx", "images1/banners/pic4.jpg")


function startrotate() {
	writenumbers(1);
}

function chngnum(which) {
	clearTimeout(mytimeout);
	if (document.getElementById) {
		document.getElementById('banner.title').innerHTML = info[which][0];
		document.getElementById('banner.desc').innerHTML = info[which][1];
		document.getElementById('banner.link').innerHTML = '<a href="'+info[which][3]+'">'+info[which][2]+'</a>';
		document.getElementById('banner.table').style.backgroundImage = "url('"+info[which][4]+"')";
	}else if (document.all) {
		document.all['banner.title'].innerHTML = info[which][0];
		document.all['banner.desc'].innerHTML = info[which][1];
		document.all['banner.link'].innerHTML = '<a href="'+info[which][3]+'">'+info[which][2]+'</a>';
		document.all['banner.table'].style.backgroundImage = "url('"+info[which][4]+"')";
	}
	current = which;
	writenumbers(current);
}

function writenumbers(which) {
	var outputid = 'banner.numbers';
	var output = '';
	var i2;
	for (i2=1;i2<=bmax;i2++) {
		//alert(i2);
		if (i2==which) {
			output = output + '<a href="javas'+'cript:chngnum(\''+i2+'\');"><strong>'+i2+'</strong></a>&nbsp;';
		}else{
			output = output + '<a href="javas'+'cript:chngnum(\''+i2+'\');">'+i2+'</a>&nbsp;';
		}
	}
	//alert(output);
	if (document.getElementById) {
		document.getElementById(outputid).innerHTML = output;
	}else if (document.all) {
		document.getElementById[outputid].innerHTML = output;
	}
	mytimeout = setTimeout("moveban('next')", 7000);
}

function moveban(dir) {
	if (dir=='next') {
		if(current==bmax){
			current = 1;
		}else{
			current++;
		}
	}else{
		if(current==1){
			current = bmax;
		}else{
			current--;
		}
	}
	chngnum(current);
}

function change(which) {
var i;
	for (i=1; i<8; i++) {
			if (document.getElementById)
			{
				document.getElementById('div'+i).style.display = 'none';
				document.getElementById('td'+i).style.fontWeight = 'normal';
				//this.document['img'+i].src="images/arrow_normal.gif"
			}
			else if (document.all)
			{
				document.all['div'+i].style.display = 'none';
				document.all['td'+i].style.fontWeight = 'normal';
				//this.document['img'+i].src="images/arrow_normal.gif"
			}
			else if (document.layers)
			{
				alert ('This link does not work in your browser.');
			}
			else alert ('This link does not work in your browser.');
		}
	 if (document.getElementById)
			{
				document.getElementById('div'+which).style.display = 'block';
				document.getElementById('td'+which).style.fontWeight = 'bold';
				//this.document['img'+which].src="images/arrow_left.gif"
			}
			else if (document.all)
			{
				document.all['div'+which].style.display = 'block';
				document.all['div'+which].style.fontWeight = 'bold';
				//this.document['img'+which].src="images/arrow_left.gif"
			}
			else if (document.layers)
			{
				alert ('This link does not work in your browser.');
			}
			else alert ('This link does not work in your browser.');
}

