var which = -1; var checker = 0; var AutoLoadInfo = "True"; var ModelAvailable = 1; var CatalogueAvailable = "True"; var NextButton = "False"; var photos = new Array() var photosStart = new Array() var photosEnd = new Array() var Year = new Array() var YearStart = new Array() var YearEnd = new Array() var Attribute = new Array() var AttributeStart = new Array() var AttributeEnd = new Array() for (i = 0; i < Car.length; i++)//Extracts the car data from the car database { photosStart[i] = 0; photosEnd[i] = Car[i].indexOf("^^^", 1); photos[i] = Car[i].substring(photosStart[i], photosEnd[i]); YearStart[i] = photosEnd[i] + 3; YearEnd[i] = Car[i].indexOf("^^^", YearStart[i]); Year[i] = Car[i].substring(YearStart[i], YearEnd[i]); AttributeStart[i] = YearEnd[i] + 3; AttributeEnd[i] = Car[i].indexOf("^^^", AttributeStart[i]); // AttributeEnd[i] = Car[i].length; Attribute[i] = Car[i].substring(AttributeStart[i], AttributeEnd[i]); } function PreviousCar() { if(which <= 0) { which = 1; } which--; AutoLoadInfo = "False"; document.rotater.elements["ViewParts"].disabled=false; CarAvailable(); if (ModelAvailable == 1) { document.rotater.elements["ViewCar"].disabled=false; } else { document.rotater.elements["ViewCar"].disabled=true; } UpdateDisplay(); CarYearList(); CarAttributeList(); ButtonEnable() } function NextCar() { if(which >= photos.length - 1) { which = photos.length - 2; } if(AutoLoadInfo == "True" && NextButton == "True") { which = 0; } else { which++; } NextButton = "False"; AutoLoadInfo = "False"; document.rotater.elements["ViewParts"].disabled=false; CarAvailable(); if (ModelAvailable == 1) { document.rotater.elements["ViewCar"].disabled=false; } else { document.rotater.elements["ViewCar"].disabled=true; } UpdateDisplay(); CarYearList(); CarAttributeList(); ButtonEnable() } function ButtonEnable() { if (which == 0) { document.rotater.elements["B1"].disabled=true; document.rotater.elements["B2"].disabled=true; document.rotater.elements["B3"].disabled=true; document.rotater.elements["B4"].disabled=false; document.rotater.elements["B5"].disabled=false; document.rotater.elements["B6"].disabled=false; } else { if (which == (photos.length - 1)) { document.rotater.elements["B1"].disabled=false; document.rotater.elements["B2"].disabled=false; document.rotater.elements["B3"].disabled=false; document.rotater.elements["B4"].disabled=true; document.rotater.elements["B5"].disabled=true; document.rotater.elements["B6"].disabled=true; } else { document.rotater.elements["B1"].disabled=false; document.rotater.elements["B2"].disabled=false; document.rotater.elements["B3"].disabled=false; document.rotater.elements["B4"].disabled=false; document.rotater.elements["B5"].disabled=false; document.rotater.elements["B6"].disabled=false; } } } function SearchLibraryGo() { if (document.LibrarySearch.MySelect.selectedIndex >= 0) { Selected_C_Number = document.LibrarySearch.MySelect.options[document.LibrarySearch.MySelect.selectedIndex].value + "_"; for (i = 0;i < photos.length; i++) { if (photos[i].search(Selected_C_Number) == 0) { which = i - 1; NextCar(); } } } else { alert('Please select a model'); } } function nullOptionsLibrary(aMenu) { tot = aMenu.options.length; if (aMenu.options.length>0) for (i = 0;i < tot;i++) { aMenu.options[i]=null; } aMenu.options.length=0; } function ResetBrowser() { document.rotater.c_number.value = "Ref Number"; document.rotater.x_of_max.value = "0 of " + photos.length; document.rotater.description.value = "Description"; document.images.photoslider.alt = ""; nullOptionsLibrary(document.rotater.CarYears); document.rotater.CarYears.options[0] = new Option('Years available:'); document.images.Headlamps.src = "../Car_Attributes/Thumbs/Headlights_NOT_ACTIVE_thumb.gif"; document.images.Rearlamps.src = "../Car_Attributes/Thumbs/Tail_lights_NOT_ACTIVE_thumb.gif"; document.images.Brakelamps.src = "../Car_Attributes/Thumbs/Brake_lights_NOT_ACTIVE_thumb.gif"; document.images.TurboFlash.src = "../Car_Attributes/Thumbs/TurboFlash_NOT_ACTIVE_thumb.gif"; document.images.RoofLight.src = "../Car_Attributes/Thumbs/RoofLight_NOT_ACTIVE_thumb.gif"; document.images.Magnatraction.src = "../Car_Attributes/Thumbs/Magnatraction_NOT_ACTIVE_thumb.gif"; document.images.FourWheelDrive.src = "../Car_Attributes/Thumbs/FourWheelDrive_NOT_ACTIVE_thumb.gif"; document.images.GuideBlade360.src = "../Car_Attributes/Thumbs/360_Guide_NOT_ACTIVE_thumb.gif"; document.images.YouSteer.src = "../Car_Attributes/Thumbs/YouSteer_NOT_ACTIVE_thumb.gif"; } function NoCarFound() { document.images.photoslider.src = "../Thumbs/blank_thumb.gif"; AutoLoadInfo = "True"; document.rotater.elements["ViewParts"].disabled=true; document.rotater.elements["ViewCar"].disabled=true; ResetBrowser() } function LoadingImage() { document.images.photoslider.src = "../Thumbs/Loading_Image.gif"; ResetBrowser() } function ShowSearch() { document.getElementById('Searching').style.visibility = "visible"; LoadingImage() } function HideSearch() { document.getElementById('Searching').style.visibility = "hidden"; } function MySearchLibrary() { nullOptionsLibrary(document.LibrarySearch.MySelect); var joined=new Array(); var C_Number = new Array(); var C_Description = new Array(); var j = 0; var checker = 0; Searchphrase=document.LibrarySearch.MyText.value; if (document.LibrarySearch.MyText.value.length > 0) { for (i = 0; i < photos.length; i++) { joined[i] = (photos[i].toUpperCase()); joined[i] = (joined[i].replace(/_/g, " ")); } for (i = 0; i < photos.length; i++) { if (joined[i].indexOf(Searchphrase.toUpperCase()) > -1) { checker += 1; j++; C_Number[j] = photos[i].slice(0, photos[i].search("_")); C_Description[j] = " " + photos[i].replace(/_/g, " "); } } if (checker > 0) { AutoLoadInfo = "False"; for (j=1;j -1) { CarYearList = Year[ii].split("_"); if (CarYearList[1] != "") { for (CountList = 1; CountList < CarYearList.length; CountList++) { if (CarYearList[CountList] == "False") { CatalogueAvailable = "False"; } else { CatalogueAvailable = "True"; } } for (CountList = 1; CountList < CarYearList.length; CountList++) { CarYears[CountList] = parseInt(CarYearList[CountList]) + 1959; if (CarYears[CountList] > 1959) { if (CarYears[CountList] < 1969) { Space = " "; } else { Space = " "; } if (CatalogueAvailable == "True") { CarYears[CountList] = CarYears[CountList] + " - " + "Catalogue" + " " + CarYearList[CountList] + Space + ">"; } else { CarYears[CountList] = CarYears[CountList] + " - " + "Not in catalogue"; } document.rotater.CarYears.options[(CountList-1)] = new Option(CarYears[CountList], CarYearList[CountList]); document.rotater.CarYears.selectedIndex = 0; } } } else { document.rotater.CarYears.options[1] = new Option(" No information available", ""); } } } } function CarAttributeList() { var CarAttributeList = new Array(); for (iii = 0; iii < Attribute.length; iii++) { if (Attribute[iii].indexOf((Car_C_Number + "_")) > -1) { CarAttributeList = Attribute[iii].split("_"); if (CarAttributeList[1].indexOf("H") > -1) { document.images.Headlamps.src = "../Car_Attributes/Thumbs/Headlights_ACTIVE_thumb.gif"; }else{ document.images.Headlamps.src = "../Car_Attributes/Thumbs/Headlights_NOT_ACTIVE_thumb.gif"; } if (CarAttributeList[1].indexOf("R") > -1) { document.images.Rearlamps.src = "../Car_Attributes/Thumbs/Tail_lights_ACTIVE_thumb.gif"; }else{ document.images.Rearlamps.src = "../Car_Attributes/Thumbs/Tail_lights_NOT_ACTIVE_thumb.gif"; } if (CarAttributeList[1].indexOf("B") > -1) { document.images.Brakelamps.src = "../Car_Attributes/Thumbs/Brake_lights_ACTIVE_thumb.gif"; }else{ document.images.Brakelamps.src = "../Car_Attributes/Thumbs/Brake_lights_NOT_ACTIVE_thumb.gif"; } if (CarAttributeList[1].indexOf("T") > -1) { document.images.TurboFlash.src = "../Car_Attributes/Thumbs/TurboFlash_ACTIVE_thumb.gif"; }else{ document.images.TurboFlash.src = "../Car_Attributes/Thumbs/TurboFlash_NOT_ACTIVE_thumb.gif"; } if (CarAttributeList[1].indexOf("P") > -1) { document.images.RoofLight.src = "../Car_Attributes/Thumbs/RoofLight_ACTIVE_thumb.gif"; }else{ document.images.RoofLight.src = "../Car_Attributes/Thumbs/RoofLight_NOT_ACTIVE_thumb.gif"; } if (CarAttributeList[1].indexOf("M") > -1) { document.images.Magnatraction.src = "../Car_Attributes/Thumbs/Magnatraction_ACTIVE_thumb.gif"; }else{ document.images.Magnatraction.src = "../Car_Attributes/Thumbs/Magnatraction_NOT_ACTIVE_thumb.gif"; } if (CarAttributeList[1].indexOf("F") > -1) { document.images.FourWheelDrive.src = "../Car_Attributes/Thumbs/FourWheelDrive_ACTIVE_thumb.gif"; }else{ document.images.FourWheelDrive.src = "../Car_Attributes/Thumbs/FourWheelDrive_NOT_ACTIVE_thumb.gif"; } if (CarAttributeList[1].indexOf("G") > -1) { document.images.GuideBlade360.src = "../Car_Attributes/Thumbs/360_Guide_ACTIVE_thumb.gif"; }else{ document.images.GuideBlade360.src = "../Car_Attributes/Thumbs/360_Guide_NOT_ACTIVE_thumb.gif"; } if (CarAttributeList[1].indexOf("Y") > -1) { document.images.YouSteer.src = "../Car_Attributes/Thumbs/YouSteer_ACTIVE_thumb.gif"; }else{ document.images.YouSteer.src = "../Car_Attributes/Thumbs/YouSteer_NOT_ACTIVE_thumb.gif"; } } } } function ClearYearOption(YearMenu) { total = YearMenu.options.length; if (YearMenu.options.length > 0) for (CountList = 0; CountList < total; CountList++) { YearMenu.options[CountList]=null; } YearMenu.options.length=0; } function GoToCatalogue() { CatalogueNumber = document.rotater.CarYears.options[document.rotater.CarYears.selectedIndex].value; if (CatalogueNumber != "") { if (CatalogueAvailable == "True") { CatalogueYear = parseInt(CatalogueNumber) + 1959; CatalogueNumber = parseInt(CatalogueNumber); if (CatalogueNumber < 10) { CatalogueNumber = "0" + CatalogueNumber; } CatalogueURL = "../2000_2009/" + "Catalogue_" + CatalogueNumber + "/Catalogue_" + CatalogueNumber + "_1.htm"; if (CatalogueYear < 2000) { CatalogueURL = "../1990_1999/" + "Catalogue_" + CatalogueNumber + "/Catalogue_" + CatalogueNumber + "_1.htm"; } if (CatalogueYear < 1990) { CatalogueURL = "../1980_1989/" + "Catalogue_" + CatalogueNumber + "/Catalogue_" + CatalogueNumber + "_1.htm"; } if (CatalogueYear < 1980) { CatalogueURL = "../1970_1979/" + "Catalogue_" + CatalogueNumber + "/Catalogue_" + CatalogueNumber + "_1.htm"; } if (CatalogueYear < 1970) { CatalogueURL = "../1960_1969/" + "Catalogue_" + CatalogueNumber + "/Catalogue_" + CatalogueNumber + "_1.htm"; } if (CatalogueYear > 1959) { location = CatalogueURL; } } } } function UpdateDisplay() { document.images.photoslider.src = "../Thumbs/" + photos[which] + "_thumb.jpg"; document.rotater.c_number.value = photos[which].slice(0, photos[which].search("_")); document.rotater.x_of_max.value = (which+1) + " of " + photos.length; document.rotater.description.value = photos[which].substring(photos[which].search("_")+1).replace(/_/g, " "); Car_C_Number = photos[which].slice(0, photos[which].search("_")); document.rotater.SearchCarText.value = Car_C_Number; document.images.photoslider.alt = photos[which].slice(0, photos[which].search("_")) + " " + photos[which].substring(photos[which].search("_")+1).replace(/_/g, " ");; } function CarAvailable() { Car_C_Number = photos[which].slice(0, photos[which].search("_")); ModelAvailable = 1; for (count = 0;count < Desc.length; count++) { if (Desc[count].indexOf(Car_C_Number + " ") == 0) { ModelAvailable = 1; count = Desc.length; } else { ModelAvailable = 0; } } } // End --> // -->