// Global Image Preloads
loadImg('bbfeedback_off','/images/WSR/ucpath/bbfeedback_off.gif');
loadImg('bbfeedback_on','/images/WSR/ucpath/bbfeedback_on.gif');

loadImg('UC_continueButton_off','/images/WSR/ucpath/UC_continueButton_off.gif');
loadImg('UC_continueButton_on','/images/WSR/ucpath/UC_continueButton_on.gif');
loadImg('UC_updateButton_off','/images/WSR/ucpath/UC_updateButton_off.gif');
loadImg('UC_updateButton_on','/images/WSR/ucpath/UC_updateButton_on.gif');

loadImg('listusedicon_OFF_bluebg','/images/WSR/NewCar_Forsale_off.gif');
loadImg('listusedicon_ON_bluebg','/images/WSR/NewCar_Forsale_on.gif');
loadImg('searchusedicon_OFF_bluebg','/images/WSR/BBC_Used_icon_off.gif');
loadImg('searchusedicon_ON_bluebg','/images/WSR/BBC_Used_icon_on.gif');
loadImg('ncbb_OFF_bluebg','/images/WSR/NewCar_BB_book_off.gif');
loadImg('ncbb_ON_bluebg','/images/WSR/NewCar_BB_book_on.gif');

loadImg('ncbbr_overviewTab','/images/wsr/nchub/ncbbr_overview.gif');
loadImg('ncbbr_overviewTabRO','/images/wsr/nchub/ncbbr_overview_ro.gif');
loadImg('ncbbr_opinionTab','/images/wsr/nchub/ncbbr_opinion.gif');
loadImg('ncbbr_opinionTabRO','/images/wsr/nchub/ncbbr_opinion_ro.gif');
loadImg('ncbbr_detailsTab','/images/wsr/nchub/ncbbr_details.gif');
loadImg('ncbbr_detailsTabRO','/images/wsr/nchub/ncbbr_details_ro.gif');
loadImg('ncbbr_notesTab','/images/wsr/nchub/ncbbr_notes.gif');
loadImg('ncbbr_notesTabRO','/images/wsr/nchub/ncbbr_notes_ro.gif');


loadImg('homeTab','/images/wsr/header/homeTab_v1.gif');
loadImg('homeTabOn','/images/wsr/header/homeTabOn_v1.gif');
loadImg('newCarsTab','/images/wsr/header/newCarsTab_v1.gif');
loadImg('newCarsTabOn','/images/wsr/header/newCarsTabOn_v1.gif');
loadImg('usedCarsTab','/images/wsr/header/usedCarsTab_v1.gif');
loadImg('usedCarsTabOn','/images/wsr/header/usedCarsTabOn_v1.gif');
loadImg('compareNewCarsTab','/images/wsr/header/compareNewCarsTab_v1.gif');
loadImg('compareNewCarsTabOn','/images/wsr/header/compareNewCarsTabOn_v1.gif');
loadImg('reviewsTab','/images/wsr/header/reviewsTab_v1.gif');
loadImg('reviewsTabOn','/images/wsr/header/reviewsTabOn_v1.gif');
loadImg('adviceTab','/images/wsr/header/adviceTab_v1.gif');
loadImg('adviceTabOn','/images/wsr/header/adviceTabOn_v1.gif');
loadImg('financeTab','/images/wsr/header/financeTab_v1.gif');
loadImg('financeTabOn','/images/wsr/header/financeTabOn_v1.gif');

loadImg('whatsThis','/images/wsr/nchub/whatsThis.gif');
loadImg('whatsThisOn','/images/wsr/nchub/whatsThisOn.gif');

loadImg('whatsThisUpArrow','/images/wsr/nchub/whatsThisUpArrow.gif');
loadImg('whatsThisUpArrowOn','/images/wsr/nchub/whatsThisUpArrowOn.gif');

loadImg('clickDetails','/images/wsr/clickDetails.gif');
loadImg('clickDetailsOn','/images/wsr/clickDetailsOn.gif');
loadImg('paymentClickDetails','/images/wsr/click_details_on.gif');
loadImg('paymentClickDetailsOn','/images/wsr/click_details_off.gif');

loadImg('catCoupe','/images/wsr/ncpath/coupe_off.gif');
loadImg('catCoupeOn','/images/wsr/ncpath/coupe_on.gif');
loadImg('catSedan','/images/wsr/ncpath/sedan_off.gif');
loadImg('catSedanOn','/images/wsr/ncpath/sedan_on.gif');
loadImg('catWagon','/images/wsr/ncpath/wagon_off.gif');
loadImg('catWagonOn','/images/wsr/ncpath/wagon_on.gif');
loadImg('catHatchback','/images/wsr/ncpath/hatchback_off.gif');
loadImg('catHatchbackOn','/images/wsr/ncpath/hatchback_on.gif');
loadImg('catSUV','/images/wsr/ncpath/suv_off.gif');
loadImg('catSUVOn','/images/wsr/ncpath/suv_on.gif');
loadImg('catConvertible','/images/wsr/ncpath/convertible_off.gif');
loadImg('catConvertibleOn','/images/wsr/ncpath/convertible_on.gif');
loadImg('catLuxury','/images/wsr/ncpath/luxury_off.gif');
loadImg('catLuxuryOn','/images/wsr/ncpath/luxury_on.gif');
loadImg('catPickup','/images/wsr/ncpath/pickup_off.gif');
loadImg('catPickupOn','/images/wsr/ncpath/pickup_on.gif');
loadImg('catVan','/images/wsr/ncpath/van_off.gif');
loadImg('catVanOn','/images/wsr/ncpath/van_on.gif');
loadImg('catHybrid','/images/wsr/ncpath/hybrid_off.gif');
loadImg('catHybridOn','/images/wsr/ncpath/hybrid_on.gif');


loadImg('uc_searchusedicon_OFF','/images/WSR/uc_searchusedicon_OFF.gif');
loadImg('uc_searchusedicon_ON','/images/WSR/uc_searchusedicon_ON.gif');
loadImg('uc_listusedicon_OFF','/images/WSR/uc_listusedicon_OFF.gif');
loadImg('uc_listusedicon_ON','/images/WSR/uc_listusedicon_ON.gif');

loadImg('step1a','/images/WSR/fdpq_arrowstep1a.gif');
loadImg('step1b','/images/WSR/fdpq_arrowstep1b.gif');
loadImg('step1c','/images/WSR/fdpq_arrowstep1c.gif');
loadImg('step1d','/images/WSR/fdpq_arrowstep1d.gif');
loadImg('step2c','/images/WSR/fdpq_arrowstep2c.gif');
loadImg('step2d','/images/WSR/fdpq_arrowstep2d.gif');

loadImg('goldGetQuote','/images/WSR/goldGetQuote.gif');
loadImg('goldGetQuoteOn','/images/WSR/goldGetQuoteOn.gif');

loadImg('blueFinance','/images/WSR/blueFinance.gif');
loadImg('blueFinanceOn','/images/WSR/blueFinanceOn.gif');
loadImg('blueInsurance','/images/WSR/blueInsurance.gif');
loadImg('blueInsuranceOn','/images/WSR/blueInsuranceOn.gif');
loadImg('blueListYourCar','/images/WSR/blueListYourCar.gif');
loadImg('blueListYourCarOn','/images/WSR/blueListYourCarOn.gif');

loadImg('goldSubmit','/images/WSR/goldSubmit.gif');
loadImg('goldSubmitOn','/images/WSR/goldSubmitOn.gif');
loadImg('goldContinue','/images/WSR/goldContinue.gif');
loadImg('goldContinueOn','/images/WSR/goldContinueOn.gif');

loadImg('goArrowGoldSmall','/images/WSR/goArrowGoldSmall.gif');
loadImg('goArrowGoldSmallOn','/images/WSR/goArrowGoldSmallOn.gif');
loadImg('goArrowGraySmall','/images/WSR/goArrowGraySmall.gif');
loadImg('goArrowGraySmallOn','/images/WSR/goArrowGraySmallOn.gif');

loadImg('dealerQuote','/images/WSR/header_new/fdpq.gif');
loadImg('dealerQuoteOn','/images/WSR/header_new/fdpq-over.gif');
loadImg('listYourCar','/images/WSR/header_new/lycfs.gif');
loadImg('listYourCarOn','/images/WSR/header_new/lycfs-over.gif');
loadImg('usedCarListings','/images/WSR/header_new/sucl.gif');
loadImg('usedCarListingsOn','/images/WSR/header_new/sucl-over.gif');
loadImg('goArrowBlueSmall','/images/WSR/goArrowBlueSmall.gif');
loadImg('goArrowBlueSmallOn','/images/WSR/goArrowBlueSmallOn.gif');

loadImg('circleArrowBlue','/images/WSR/circleArrowBlue.gif');
loadImg('circleArrowBlueOn','/images/WSR/circleArrowBlueOn.gif');
loadImg('circleArrowBlueGrey','/images/WSR/circleArrowBlueGrey.gif');
loadImg('circleArrowBlueGreyOn','/images/WSR/circleArrowBlueGreyOn.gif');
loadImg('circleArrowGrey','/images/WSR/circleArrowGrey.gif');
loadImg('circleArrowGreyOn','/images/WSR/circleArrowGreyOn.gif');

loadImg('blueArrow','/images/WSR/blueArrow.gif');
loadImg('blueArrowOn','/images/WSR/blueArrowOn.gif');
loadImg('blueArrowLeft','/images/WSR/blueArrowLeft.gif');
loadImg('blueArrowLeftOn','/images/WSR/blueArrowLeftOn.gif');
loadImg('goArrowBlueSmOff','/images/WSR/goArrowBlueSmOff.gif');
loadImg('goArrowBlueSmOn','/images/WSR/goArrowBlueSmOn.gif');

loadImg('blueArrowWrap','/images/WSR/blueArrowWrap.gif');
loadImg('blueArrowWrapOn','/images/WSR/blueArrowWrapOn.gif');
loadImg('safetyGlossary','/images/WSR/btn-glossary-off.gif');
loadImg('safetyGlossaryOn','/images/WSR/btn-glossary-on.gif');

// from reviewsRatings.js
loadImg('gcompareArray1Photo','/images/WSR/crossover.jpg');
loadImg('gcompareArray2Photo','/images/WSR/fullSizeSUV.jpg');
loadImg('gcompareArray3Photo','/images/WSR/convertables.jpg');
loadImg('gcompareArray4Photo','/images/WSR/pickups.jpg');
loadImg('gcompareArray5Photo','/images/WSR/familySedans.jpg');
loadImg('gcompareArray6Photo','/images/WSR/gasChamps.jpg');
loadImg('gcompareArray7Photo','/images/WSR/luxurySedans.jpg');
loadImg('gcompareArray8Photo','/images/WSR/midSizeSUV1.jpg');
loadImg('gcompareArray9Photo','/images/WSR/midSizeSUV2.jpg');
loadImg('gcompareArray10Photo','/images/WSR/compactSUV.jpg');
loadImg('gcompareArray11Photo','/images/WSR/minivans.jpg');

// from home.js
loadImg('blueQuickArrow','/images/WSR/blueQuickArrow.gif');
loadImg('blueQuickArrowOn','/images/WSR/blueQuickArrowOn.gif');
loadImg('goArrowBlue','/images/WSR/Go_Arrowblue.gif');
loadImg('goArrowBlueOn','/images/WSR/Go_Arrowblue_over.gif');
loadImg('goArrowGold','/images/WSR/Go_Arrowgold.gif');
loadImg('goArrowGoldOn','/images/WSR/Go_Arrowgold_over.gif');
loadImg('goldQuickArrow','/images/WSR/goldQuickArrow.gif');
loadImg('goldQuickArrowOn','/images/WSR/goldQuickArrowOn.gif');

// This is the code to handle the Navigation Tabs
// It's basic hide/show Layer functions, but as a failsafe, we always set the new visibleLayer
// in the showLayer function, and hide the old.  We also clear the visibleLayer value in the hideLayer
// function to prevent stickiness.

var visibleLayer = "";

function showLayer(layerId) {
	document.getElementById(layerId).style.visibility = 'visible';
	if(visibleLayer != "") {
		document.getElementById(visibleLayer).style.visibility = 'hidden';
	}
	visibleLayer = layerId;
}

function hideLayer(layerId) {
	document.getElementById(layerId).style.visibility = 'hidden';
	visibleLayer = "";
}


// Basic Image Rollover code.  Short and sweet.

function rollImage(srcObject, state) {
	//alert(document.getElementById(srcObject));
	eval('document.getElementById(srcObject).src = ' + state + '.src');
}

function showAlert( msg ) {
	document.getElementById('alertimg').innerHTML = "<img src='/images/wsr/alert.gif'>";
	document.getElementById('alertspacer').innerHTML = "<img src='/images/wsr/spacer.gif' width='1' height='10'>";
	document.getElementById('alertmsg').innerHTML = msg;
}

function initRollovers() {
	if (!document.getElementById) return

	var aPreLoad = new Array();
	var sTempSrc;
	var aImages = document.getElementsByTagName('img');

	for (var i = 0; i < aImages.length; i++) {
		if (aImages[i].className == 'imgOver') {
			var src = aImages[i].getAttribute('src');
			var ftype = src.substring(src.lastIndexOf('.'), src.length);
			var hsrc = src.replace(ftype, 'On'+ftype);

			aImages[i].setAttribute('hsrc', hsrc);

			aPreLoad[i] = new Image();
			aPreLoad[i].src = hsrc;

			aImages[i].onmouseover = function() {
				sTempSrc = this.getAttribute('src');
				this.setAttribute('src', this.getAttribute('hsrc'));
			}

			aImages[i].onmouseout = function() {
				if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('On'+ftype, ftype);
				this.setAttribute('src', sTempSrc);
			}
		}
	}
}

window.onload = initRollovers;




// Compare and Review Section Functions
// First we declare the content for each rollover.  this is all in array format
// like this: var compareArray1 =  new Array('IMAGE PATH', 'TITLE COPY', 'BODY COPY')

var compareArray1 = new Array("/images/WSR/crossover.jpg", "Crossover Vehicles", "Though crossovers are not intended for true off-road adventuring, their safety and handling are typically better than SUVs.");
var compareArray2 = new Array("/images/WSR/fullSizeSUV.jpg", "Full-Size SUVs", "Characterized by their generous seating capacity and powerful V8 engines, these vehicles have become the descendent of the family wagon");
var compareArray3 = new Array("/images/WSR/convertables.jpg", "Affordable Convertibles", "Looking for a red-hot convertible that won't drive you into poverty? We've compiled a list of the most popular models with a base price under $36K.");
var compareArray4 = new Array("/images/WSR/pickups.jpg", "Pickups", "Can't decide which pickup truck suits your needs best?  Check out our list of the most popular compact and full-size pickups to help you find what you're looking for.");
var compareArray5 = new Array("/images/WSR/familySedans.jpg", "Family Sedans", "Research these well-equipped sedans with automatic transmission, tilt-wheel, air conditioning, power windows, power door locks and ABS.");
var compareArray6 = new Array("/images/WSR/gasChamps.jpg", "Gas Mileage Champs", "The Environmental Protection Agency (EPA) tests vehicles for fuel efficiency in two categories: city and highway. These are the best of that list.");
var compareArray7 = new Array("/images/WSR/luxurySedans.jpg", "Luxury Sedans", "We've tested ten flagship sedans that showcase each manufacturer's technological and artistic talents. Which is your ideal luxury car?");
var compareArray8 = new Array("/images/WSR/midSizeSUV1.jpg", "Midsize SUVs I", "We know there are a lot of midsize SUVs to choose from so we've compiled a list of the most popular models on the market.");
var compareArray9 = new Array("/images/WSR/midSizeSUV2.jpg", "Midsize SUVs II", "With all the midsize SUVs to choose from, we've compiled a second list of the most popular models on the market.");
var compareArray10 = new Array("/images/WSR/compactSUV.jpg", "Compact SUVs", "We know there are a lot of compact SUVs to choose from so we've compiled a list of the most popular models on the market.");
var compareArray11 = new Array("/images/WSR/minivans.jpg", "Minivans", "Looking for a minivan? We know there are a lot to choose from so we've compiled a list of the most popular models on the market.");

function showComparison(arrayName) {
	theArray = eval('compareArray' + arrayName);
	document.getElementById('comparePhoto').innerHTML = "<img src=\"" + theArray[0] + "\" width=\"151\" height=\"56\" border=\"0\">";
	document.getElementById('compareTitle').innerHTML = "<b>" + theArray[1] + "</b>";
	document.getElementById('compareCopy').innerHTML = theArray[2];
}