<!--
var ImageArray = new Array();
var LinkArray = new Array();
var SecondaryWindow;

function AddImage(Description, ImageUrl, ImageWidth, ImageHeight, LinkUrl)
{
	var Index = ImageArray.length;
	
	ImageArray[Index] = new Image();
	
	ImageArray[Index].alt=Description; 
	ImageArray[Index].src=ImageUrl; 
	ImageArray[Index].width=ImageWidth; 
	ImageArray[Index].height=ImageHeight;
	
	LinkArray[Index]=LinkUrl;

}	

function Initialize() 
{
	// If you change these then dont forget to change brochure.js too.
	
	AddImage("Buell Logo", 							"images/logo.jpg",						155,93, "brochure.htm?PageName=Cover Page");
	AddImage("Anodized Bar Ends", 					"images/Parts/large/barend.jpg",		188,93, "images/Brochure/d06.jpg");
	AddImage("Anodized Levers",						"images/Parts/large/lever.jpg",			188,93, "images/Brochure/d03.jpg");
	AddImage("Anodized Reservoir Cover (front)",	"images/Parts/large/rescov1.jpg",		188,93, "images/Brochure/d04.jpg");
	AddImage("Anodized Reservoir Cover (rear)",		"images/Parts/large/rescov2.jpg",		188,93, "images/Brochure/d05.jpg");
	AddImage("Belt Tensioner",						"images/Parts/large/beltten.jpg",		141,93, "images/Brochure/d02.jpg");
	AddImage("Carbon Air Duct",						"images/Parts/large/airduct.jpg",		188,93, "images/Brochure/c06.jpg");
	AddImage("Carbon Beam Protector",				"images/Parts/large/beamprot.jpg",		188,93, "images/Brochure/c04.jpg");
	AddImage("Carbon Beam Protectors",				"images/Parts/large/beamprotb.jpg",		188,93, "images/Brochure/c04.jpg");
	AddImage("Carbon Belly Pan",					"images/Parts/large/bellypan.jpg",		188,93, "images/Brochure/c05.jpg");
	AddImage("Carbon Cowel",						"images/Parts/large/faringS.jpg",		150,93, "images/Brochure/c10.jpg");
	AddImage("Carbon Drive Belt Cover",				"images/Parts/large/drbltcov.jpg",		188,93, "images/Brochure/c09.jpg");
	AddImage("Carbon Front Fairing",				"images/Parts/large/faringR.jpg",		188,93, "images/Brochure/c10.jpg");
	AddImage("Carbon Front Fender",					"images/Parts/large/frontfender.jpg",	188,93, "images/Brochure/c07.jpg");
	AddImage("Carbon Front Sprocket Cover",			"images/Parts/large/frsprcov.jpg",		188,93, "images/Brochure/c08.jpg");
	AddImage("Carbon Hugger",						"images/Parts/large/hugger.jpg",		141,93, "images/Brochure/c02.jpg");
	AddImage("Carbon Oil Cooler Cover",				"images/Parts/large/aircooler.jpg",		188,93, "images/Brochure/c01.jpg");
	AddImage("Carbon Tail Unit",					"images/Parts/large/tailunit.jpg",		173,93, "images/Brochure/c12.jpg");
	AddImage("Carbon Tank",							"images/Parts/large/fueltank.jpg",		188,93, "images/Brochure/c03.jpg");
	AddImage("Carbon Swinging Arm Protector",		"images/Parts/large/swarmprot.jpg",		150,93, "images/Brochure/c11.jpg");
	AddImage("Exhaust",								"images/Parts/large/exhaust.jpg",		188,93, "images/Brochure/d09.jpg");
	AddImage("Footpeg Hangers",						"images/Parts/large/ftpeg.jpg",			93,150, "images/Brochure/d01.jpg");
	AddImage("Mirrors",								"images/Parts/large/mirror.jpg",		188,93, "images/Brochure/d08.jpg");
	AddImage("Micro Indicators",					"images/Parts/large/indicat.jpg",		188,93, "images/Brochure/d07.jpg");
	AddImage("Stubby Tail Unit",					"images/Parts/large/stub.jpg",			150,93, "images/Brochure/c13.jpg");

	UpdateProgress();
}	

function Finalize() 
{
	// Close the prograss bar and open the main page
	document.getElementById("Loading").style.visibility = "hidden";
	document.getElementById("MainPage").style.visibility = "visible";
	document.getElementById("HoverInfo").style.visibility = "visible";
}

function UpdateProgress()
{
	var i, Tenths;
	var Total = ImageArray.length;
	var ProgressImage = document.getElementById("ProgressBar");
	var Loaded = 0;
	var ProgressWidth = 300
	
	for(i=0;i < Total;i++)
		if(ImageArray[i].complete)
			Loaded++;
	
//	Tenths = Math.round((10/Total) * Loaded);
//	for(i=0;i < Tenths;i++)
//		Columns[i].bgColor="#0000CC";

	ProgressImage.width = Math.round((ProgressWidth/Total) * Loaded);

	if(Loaded < Total) {
		setTimeout("UpdateProgress();", 1000);
	}
}

function ShowMain(MainImageURL, MainImageMap, HaveBackButton)
{
		var Index;
		
		if (HaveBackButton) {
			// Turn on the Back and brochure buttons
			document.getElementById("HoverInfo").style.visibility = "hidden";
			document.getElementById("BackButton").style.visibility = "visible";
			document.getElementById("BrochureButton").style.visibility = "visible";

			document.getElementById("BackButton").top = document.images.MainPic.top;
			document.getElementById("BrochureButton").top = document.images.MainPic.top;

			document.getElementById("BackButton").left = (document.images.MainPic.left + document.images.MainPic.width) - document.getElementById("BackButton").width;
			document.getElementById("BrochureButton").left = document.images.MainPic.left;
		} else {
			// Hide the Back and Brochure buttons
			document.getElementById("HoverInfo").style.visibility = "visible";
			document.getElementById("BackButton").style.visibility = "hidden";
			document.getElementById("BrochureButton").style.visibility = "hidden";

			document.getElementById("HoverInfo").top = document.images.MainPic.top;
			document.getElementById("HoverInfo").left = document.images.MainPic.left;
		}
		
		Index = FindImageFromDescription(MainImageURL);
		if (Index >= 0) {
			document.images.MainPic.src=ImageArray[Index].src;
		} else {
			document.images.MainPic.src=MainImageURL;
		}
		document.images.MainPic.useMap=MainImageMap;
}

function ShowBike(Index)
{
	if (Index > 0) {
		// a normal call, set the picture to be the index
		document.images.S_Side.border = "0px";
		document.images.S_Front.border = "0px";
		document.images.R_Side.border = "0px";
		document.images.R_Front.border = "0px";
		switch(Index) {
		case 1:
			document.images.S_Side.border = "2px";	
			break;
		case 2:
			document.images.S_Front.border = "2px";	
			break;
		case 3:
			document.images.R_Side.border = "2px";	
			break;
		case 4:
			document.images.R_Front.border = "2px";	
			break;
		}
	} else {
		document.getElementById("BackButton").style.visibility = "hidden";
		// find the index already in use and use that
		if (document.images.S_Side.border != 0) {
				Index = 1;
		} else {
			if (document.images.S_Front.border != 0) {
					Index = 2;
			} else {
				if (document.images.R_Side.border != 0) {
						Index = 3;
				} else {
					if (document.images.R_Front.border != 0) {
							Index = 4;
					} else {
							Index = 1;
					}
				}
			}
		}
	}
	// Now show the picture for the coosen index
	switch(Index) {
	case 1:
		ShowMain('images/redmc_side.jpg', '#redmc_side', false);
		break;
	case 2:
		ShowMain('images/redmc.jpg', '#redmc', false);
		break;
	case 3:
		ShowMain('images/bluemc.jpg', '#bluemc', false);
		break;
	case 4:
		ShowMain('images/faringR.jpg', '#faringR', false);
		break;
	}
}

function ShowDetail(Description)
{
	var Index;
	
	Index = FindImageFromDescription(Description);
	if (Index <0) {
			Index = 0;
	}
	document.images.DetailPic.alt = ImageArray[Index].alt;
	document.images.DetailPic.src = ImageArray[Index].src;
	document.images.DetailPic.height = ImageArray[Index].height;
	document.images.DetailPic.width = ImageArray[Index].width;
			
//	DetailedLink.href = 
//	document.images.DetailPic.onClick = "ShowSubPage("+Description+");";
}

function ShowDetailonMain(Description)
{
	var Index;
	
	Index = FindImageFromDescription(Description);
	if (Index <0) {
			Index = 0;
	}
	ShowMain(ImageArray[Index].src, '', true);
}

function FindImageFromDescription(Description)
{
	for(var i=0; i<ImageArray.length; i++) {
		if(Description == ImageArray[i].alt ) {
			return(i);
		}
	}
	return (-1);
}

function Clear()
{
//	document.images.DetailPic.src = "";
//	document.images.DetailPic.alt = "Please hover over the area you are interested in";
}


function ShowSubPage(Description)
{
//	var Index;
	
//	Index = FindImageFromDescription(Description);
//	if (Index >= 0) {
		SecondaryWindow = window.open(
			"brochure.htm?PageName="+Description, //			LinkArray[Index], 
			"Brochure",
			"toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width=700, height=768"
		);
		SecondaryWindow.focus();
//	}
}

function ShowFullImage(SomeURL)
{
	SecondaryWindow = window.open(
		SomeURL, 
		"Brochure",
		"toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no"
	);
	SecondaryWindow.focus();
}

//-->

