// --------------------------------------------------------------------
// -- 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")) {                                
                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("specialedition").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 "specialedition": 
                                        topTarget.innerHTML = aBikes[4]                
                                        if(currentState != "gallery" || currentState != "intro") {
                                                bottomTarget.innerHTML = aBikes[1]
                                        }
                                        nav.className = "specialedition";                                                       
                                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;
}
