/*** SET BUTTON'S FOLDER HERE ***/
var buttonFolder = "buttons/";

/*** SET BUTTONS' FILENAMES HERE ***/
upSources = new Array("button1up.png","button2up.png","button3up.png","button4up.png","button5up.png","button6up.png","button7up.png","button8up.png","button9up.png","button10up.png","button11up.png","button12up.png","button13up.png","button14up.png","button15up.png","button16up.png","button17up.png","button18up.png","button19up.png","button20up.png","button21up.png","button22up.png","button23up.png","button24up.png","button25up.png","button26up.png");

overSources = new Array("button1over.png","button2over.png","button3over.png","button4over.png","button5over.png","button6over.png","button7over.png","button8over.png","button9over.png","button10over.png","button11over.png","button12over.png","button13over.png","button14over.png","button15over.png","button16over.png","button17over.png","button18over.png","button19over.png","button20over.png","button21over.png","button22over.png","button23over.png","button24over.png","button25over.png","button26over.png");

// SUB MENUS DECLARATION, YOU DONT NEED TO EDIT THIS
subInfo = new Array();
subInfo[1] = new Array();
subInfo[2] = new Array();
subInfo[3] = new Array();
subInfo[4] = new Array();
subInfo[5] = new Array();
subInfo[6] = new Array();
subInfo[7] = new Array();
subInfo[8] = new Array();
subInfo[9] = new Array();
subInfo[10] = new Array();
subInfo[11] = new Array();
subInfo[12] = new Array();
subInfo[13] = new Array();
subInfo[14] = new Array();
subInfo[15] = new Array();
subInfo[16] = new Array();
subInfo[17] = new Array();
subInfo[18] = new Array();
subInfo[19] = new Array();
subInfo[20] = new Array();
subInfo[21] = new Array();
subInfo[22] = new Array();
subInfo[23] = new Array();
subInfo[24] = new Array();
subInfo[25] = new Array();
subInfo[26] = new Array();


//*** SET SUB MENUS TEXT LINKS AND TARGETS HERE ***//
subInfo[1][1] = new Array("Australian Saddles","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=7300&keywords=all","_top");
subInfo[1][2] = new Array("Australian Fittings","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=7300&keywords=all","_top");
subInfo[1][3] = new Array("Australian Strap Goods","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=7500&keywords=all","_top");
subInfo[1][4] = new Array("Australian Miscellaneous","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=7900&keywords=all","_top");
subInfo[1][5] = new Array("Australian Saddle Pads","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=7401&keywords=all","_top");


subInfo[2][1] = new Array("Western Bits","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=8200&keywords=all","_top");
subInfo[2][2] = new Array("English Bits","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=8201&keywords=all","_top");
subInfo[2][3] = new Array("Walking Horse Bits","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=8202&keywords=all","_top");
subInfo[2][4] = new Array("Bosals and Hackamores Bits","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=8203&keywords=all","_top");

subInfo[3][1] = new Array("English Books","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=1300&keywords=all","_top");
subInfo[3][2] = new Array("Western Books","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=1400&keywords=all","_top");
subInfo[3][3] = new Array("Health and Management Books","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=1200&keywords=all","_top");
subInfo[3][4] = new Array("Breed Books","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=1500&keywords=all","_top");
subInfo[3][5] = new Array("Children Books","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=1600&keywords=all","_top");
subInfo[3][6] = new Array("Miscellaneous Books","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=1900&keywords=all","_top");


subInfo[4][1] = new Array("English Boots","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=4300&keywords=all","_top");
subInfo[4][2] = new Array("Saddle Seat Boots","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=5300&keywords=all","_top");
subInfo[4][3] = new Array("Western Boots","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=6300&keywords=all","_top");
subInfo[4][4] = new Array("Work Boots","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=4301&keywords=all","_top");
subInfo[4][5] = new Array("Children Boots","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=4302&keywords=all","_top");
subInfo[4][6] = new Array("Winter Boots","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=4303&keywords=all","_top");
subInfo[4][7] = new Array("Hiking Boots","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=4304&keywords=all","_top");
subInfo[4][8] = new Array("Casual Boots","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=4305&keywords=all","_top");
subInfo[4][9] = new Array("Boot Accessories","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=4306&keywords=all","_top");
subInfo[4][10] = new Array("Half Chaps","http://www.kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=4307&keywords=all","_top");


subInfo[6][1] = new Array("Shampoo and Conditioner","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=2500&keywords=all","_top");
subInfo[6][2] = new Array("Grooming Spray and Detangler","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=2501&keywords=all","_top");
subInfo[6][3] = new Array("Show Polishes","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=2700&keywords=all","_top");
subInfo[6][4] = new Array("Liniment and Hoof Products","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=2800&keywords=all","_top");


subInfo[8][1] = new Array("Dressage Clothing","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=4100&keywords=all","_top");
subInfo[8][2] = new Array("Hunt Clothing","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=4100&keywords=all","_top");
subInfo[8][3] = new Array("Saddle Seat Clothing","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=5100&keywords=all","_top");

subInfo[9][1] = new Array("Dressage Tack","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=4601&keywords=all","_top");
subInfo[9][2] = new Array("Hunt Tack","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=4600&keywords=all","_top");
subInfo[9][3] = new Array("Saddle Seat Tack","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=5500&keywords=all","_top");
subInfo[9][4] = new Array("English Saddle Pads","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=4001&keywords=all","_top");



subInfo[11][1] = new Array("Breyer Toys","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=3100&keywords=all","_top");
subInfo[11][2] = new Array("T-Shirts","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=3200&keywords=all","_top");
subInfo[11][3] = new Array("Jewelry","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=3300&keywords=all","_top");
subInfo[11][4] = new Array("Cards and Stationary","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=3400&keywords=all","_top");
subInfo[11][5] = new Array("Souviners","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=3500&keywords=all","_top");
subInfo[11][6] = new Array("Mugs and Dishware","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=3600&keywords=all","_top");
subInfo[11][7] = new Array("Miscellaneous Novelties","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=3900&keywords=all","_top");

subInfo[16][1] = new Array("Supplies","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=2600&keywords=all","_top");
subInfo[16][2] = new Array("Winter Blankets","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=9201&keywords=all","_top");





subInfo[17][1] = new Array("Australian Saddle Pads","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=7401&keywords=all","_top");
subInfo[17][2] = new Array("English Saddle Pads","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=4001&keywords=all","_top");
subInfo[17][3] = new Array("Western Saddle Pads","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=6007&keywords=all","_top");

subInfo[18][1] = new Array("Saddle Seat Clothing","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=5100&keywords=all","_top");
subInfo[18][2] = new Array("Saddle Seat Boots","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=5300&keywords=all","_top");
subInfo[18][3] = new Array("Saddle Seat Saddles","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=5400&keywords=all","_top");
subInfo[18][4] = new Array("Saddle Seat Strap Goods","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=5500&keywords=all","_top");

subInfo[19][1] = new Array("Western Saddles","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=6400&keywords=all","_top");
subInfo[19][2] = new Array("Dressage Saddles","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=4500&keywords=all","_top");
subInfo[19][3] = new Array("Saddle Seat Saddles","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=5400&keywords=all","_top");
subInfo[19][4] = new Array("English Saddles","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=4400&keywords=all","_top");


subInfo[21][1] = new Array("Hardware","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=9600&keywords=all","_top");
subInfo[21][2] = new Array("Leather Care","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=9700&keywords=all","_top");
subInfo[21][3] = new Array("Miscellaneous","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=9900&keywords=all","_top");


subInfo[23][1] = new Array("Lunge Equipment","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=8600&keywords=all","_top");
subInfo[23][2] = new Array("Training Reins","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=8700&keywords=all","_top");
subInfo[23][3] = new Array("Gaited Equipment","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=8800&keywords=all","_top");
subInfo[23][4] = new Array("Misc. Training Equipment","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=8900&keywords=all","_top");
subInfo[23][5] = new Array("Bitting Rigs","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=8500&keywords=all","_top");


subInfo[25][1] = new Array("Western Clothing","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=6100&keywords=all","_top");
subInfo[25][2] = new Array("Western Hats","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=6800&keywords=all","_top");
subInfo[25][3] = new Array("Western Jewelry","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=3300&keywords=all","_top");

subInfo[26][1] = new Array("Horse Blankets and Sheets","http://kyhorsesupply.com/cgi-bin/commerce.cgi?search=action&category=9201&keywords=all","_top")


//*** SET SUB MENU POSITION ( RELATIVE TO BUTTON ) ***//
var xSubOffset = 120;
var ySubOffset = 0;



//*** NO MORE SETTINGS BEYOND THIS POINT ***//
var overSub = false;
var delay = 1000;
totalButtons = upSources.length;

// GENERATE SUB MENUS
for ( x=0; x<totalButtons; x++) {
	// SET EMPTY DIV FOR BUTTONS WITHOUT SUBMENU
	if ( subInfo[x+1].length < 1 ) { 
		document.write('<div id="submenu' + (x+1) + '">');
	// SET DIV FOR BUTTONS WITH SUBMENU
	} else {
		document.write('<div id="submenu' + (x+1) + '" class="dropmenu" ');
		document.write('onMouseOver="overSub=true;');
		document.write('setOverImg(\'' + (x+1) + '\',\'\');"');
		document.write('onMouseOut="overSub=false;');
		document.write('setTimeout(\'hideSubMenu(\\\'submenu' + (x+1) + '\\\')\',delay);');
		document.write('setOutImg(\'' + (x+1) + '\',\'\');">');


		document.write('<ul>');
		for ( k=0; k<subInfo[x+1].length-1; k++ ) {
			document.write('<li>');
			document.write('<a href="' + subInfo[x+1][k+1][1] + '" ');
			document.write('target="' + subInfo[x+1][k+1][2] + '">');
			document.write( subInfo[x+1][k+1][0] + '</a>');
			document.write('</li>');
		}
		document.write('</ul>');
	}
	document.write('</div>');
}





//*** MAIN BUTTONS FUNCTIONS ***//
// PRELOAD MAIN MENU BUTTON IMAGES
function preload() {
	for ( x=0; x<totalButtons; x++ ) {
		buttonUp = new Image();
		buttonUp.src = buttonFolder + upSources[x];
		buttonOver = new Image();
		buttonOver.src = buttonFolder + overSources[x];
	}
}

// SET MOUSEOVER BUTTON
function setOverImg(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder + overSources[But-1];
}

// SET MOUSEOUT BUTTON
function setOutImg(But, ID) {
	document.getElementById('button' + But + ID).src = buttonFolder + upSources[But-1];
}



//*** SUB MENU FUNCTIONS ***//
// GET ELEMENT ID MULTI BROWSER
function getElement(id) {
	return document.getElementById ? document.getElementById(id) : document.all ? document.all(id) : null; 
}

// GET X COORDINATE
function getRealLeft(id) { 
	var el = getElement(id);
	if (el) { 
		xPos = el.offsetLeft;
		tempEl = el.offsetParent;
		while (tempEl != null) {
			xPos += tempEl.offsetLeft;
			tempEl = tempEl.offsetParent;
		} 
		return xPos;
	} 
} 

// GET Y COORDINATE
function getRealTop(id) {
	var el = getElement(id);
	if (el) { 
		yPos = el.offsetTop;
		tempEl = el.offsetParent;
		while (tempEl != null) {
			yPos += tempEl.offsetTop;
			tempEl = tempEl.offsetParent;
		}
		return yPos;
	}
}

// MOVE OBJECT TO COORDINATE
function moveObjectTo(objectID,x,y) {
	var el = getElement(objectID);
	el.style.left = x;
	el.style.top = y;
}

// MOVE SUBMENU TO CORRESPONDING BUTTON
function showSubMenu(subID, buttonID) {
	hideAllSubMenus();
	butX = getRealLeft(buttonID);
	butY = getRealTop(buttonID);
	moveObjectTo(subID,butX+xSubOffset, butY+ySubOffset);
}

// HIDE ALL SUB MENUS
function hideAllSubMenus() {
	for ( x=0; x<totalButtons; x++) {
		moveObjectTo("submenu" + (x+1) + "",-500, -500 );
	}
}

// HIDE ONE SUB MENU
function hideSubMenu(subID) {
	if ( overSub == false ) {
		moveObjectTo(subID,-500, -500);
	}
}



//preload();

