/*
** Create grow and shrink effect on Cowboy Culture Home page buttons
** Copyright 2001, John Bishop © Cowboy Culture
**
*/
/*
** GLOBALS
*/
var index = 0;
var speed = 0;
var btnTypes = new Array ("dc", "se", "ch", "tc", "cm");
var btnimgs; // Array of button images
var btnIndex = 0;
var bcode = "dc";

function createBtnImageArray(n)
{
	var i,t;

	if (document.images) {
		this.length = n * btnTypes.length;
		for (t=0; t<this.length; t++)
			for (i=0; i<=n; i++) 
				this[btnTypes[t]+i] = new Image();  
		return this;
	}
}

function loadButtons()
{
	var nextimg = "";
	var i,t;

	btnimgs = new createBtnImageArray(7);
	for (t=0; t<btnTypes.length; t++) {
		bcode = btnTypes[t];
		for (i=1; i<=7; i++) {
			nextimg = "graphics/Animated%20GIFS/"+bcode+"grow_seq000"+i+".gif";
			btnimgs[bcode+i].src = nextimg;
		}
	}
}

function growBtext(b)
{
	var bType = "dc";
 	index = 1;
	speed = 40;
	
 	btnindex = b;
 	for (i=0; i<=7; i++)
 		time = setTimeout('grow()',speed*i);
 	clearTimeout(time);
	
	// Clear any 'stuck' buttons
	if (document.images) {
		for (i=0;i<=4;i++) {
			if (i == btnindex) continue;
			bType = btnTypes[i];
			document.images[bType+"StaticImg"].src = btnimgs[bType+1].src
		}
	}
 }
	 
function grow()
{
	if(document.images) {
		if(index>0 && index<=7) {
			document.images[btnTypes[btnindex]+"StaticImg"].src=btnimgs[btnTypes[btnindex]+index].src;
			index++;
		}
	}
}	 
	 
function shrinkBtext(b)
{
	var i = 0;

 	index = 7;
	speed = 25;
	btnindex = b;
 	for (i=0;i<=7;i++)
 		time=setTimeout('shrink()',speed*i);
 	clearTimeout(time);
}
	 	 
function shrink()
{
	if (document.images) {
		if(index>0 && index<=7) {
			document.images[btnTypes[btnindex]+"StaticImg"].src=btnimgs[btnTypes[btnindex]+index].src;
			index--;
		}
	}
}
