// --------------------------------------------------------------------
// -- Copyright (c) 2004 E3Media 
// --------------------------------------------------------------------
// Desc:  Custom scripts for Triumph Bikes Page
// Reliant on: "includes/onload.js"


// Triumph bikes page  
// Desc:  Pull out selected content from page (mostly hidden via the javascript stylesheet) and push to an array.
// Author:  JDG
// Date: 01/12/05

var aBikes = new Array(); // great global array
var bActivateButtons = false;

function fnBikes() {
	if (document.getElementById("topTarget") && document.getElementById("footerRightLink")) {				
		aBikes[0] = document.getElementById("default").innerHTML;
		aBikes[1] = document.getElementById("intro").innerHTML;
		aBikes[2] = document.getElementById("specifications").innerHTML;	
		aBikes[3] = document.getElementById("gallery").innerHTML;	
		aBikes[4] = document.getElementById("colours").innerHTML;
		aBikes[5] = document.getElementById("threeSixty").innerHTML;	
		bActivateButtons = true;
	}	
}				
	
// Triumph bikes hide and show layers
var currentState = "intro";
function fnShow(idToShow) {		
//	if (document.getElementById("topTarget") && document.getElementById("footerRightLink")){
	if(bActivateButtons){
			var topTarget = document.getElementById("topTarget");
			var bottomTarget = document.getElementById("bottomTarget");		
			var nav = document.getElementById("subNavBikes");		
			
			switch (idToShow) {
				case "intro": 
					if(currentState != "specifications") {
						topTarget.innerHTML = aBikes[0];
					}				
					if(currentState != "gallery" || currentState != "colours") {
						bottomTarget.innerHTML = aBikes[1]
					}
					nav.className = "intro";
				break
				case "specifications": 
					if(currentState != "intro") {
						topTarget.innerHTML = aBikes[0];
					}
					bottomTarget.innerHTML = aBikes[2]
					nav.className = "specifications";							
				break
				case "gallery": 
					topTarget.innerHTML = aBikes[3]	
					if(currentState != "intro" || currentState != "colours") {
						bottomTarget.innerHTML = aBikes[1]
					}
					nav.className = "gallery";				
				break
				case "colours": 
					topTarget.innerHTML = aBikes[4]		
					if(currentState != "gallery" || currentState != "intro") {
						bottomTarget.innerHTML = aBikes[1]
					}
					nav.className = "colours";							
				break	
				case "threeSixty": 
					topTarget.innerHTML = aBikes[0];
					bottomTarget.innerHTML = aBikes[5];
					nav.className = "threeSixty";							
				break			
			}		
			currentState = idToShow;
		}
}
	

function fnC(targ) {
	document.getElementById("rollOver").innerHTML = targ.firstChild.alt;
} 

function fnColour(targ) {
	var imgs = document.getElementById("topTarget").getElementsByTagName("img");	
	imgs[(imgs.length-1)].src = targ;
}
function fnGallery(targ) {
	var imgs = document.getElementById("topTarget").getElementsByTagName("img");	
	imgs[(imgs.length-1)].src = targ;
}


/********************************************************************************

Name: 				Quicktime embed
Description:		Writeout Quicktime code. Fixes Eolas patent bug for IE as well.
@param	mov			String path to mov file
@param	width		Number|String value of movie width
@param	height		Number|String value of movie height

*********************************************************************************/
quicktime = new Object();
quicktime.insert = function(mov,width,height) {
	quicktimeObject = '<embed src="'+mov+'" controller="true" width="'+width+'" height="'+(height+15)+'" type="video/quicktime" pluginspage="http://www.apple.com/qtactivex/qtplugin.cab" scale="tofit" />'
	document.write(quicktimeObject);
}

/********************************************************************************
Name: 				Sound media embed. Will use default media player on system (Quicktime and windows media player mainly)
Description:		Writeout Quicktime code. Fixes Eolas patent bug for IE as well.
@param	mov		String path to sound file
@param	width		Number|String value of width for media player
@param	height	Number|String value of height for media player (44 works well - different players require more/less height)
@param   bgcolor  String hex color for background around media player, if player is narrower than given height (quicktime is) e.g. "#193468"
*********************************************************************************/
soundfile = new Object();
soundfile.insert = function(mov,width,height,bgcolor) {
	quicktimeObject = '<embed src="'+mov+'" controller="true" width="'+width+'" height="'+height+'" type="video/quicktime" pluginspage="http://www.apple.com/qtactivex/qtplugin.cab" bgcolor="'+bgcolor+'" />'
	document.write(quicktimeObject);
}
