// Browser detectvar ie4 = (document.all && !document.getElementById) ? true:false;var ns4 = (document.layers) ? true:false;var dom2 = (document.getElementById) ? true:false;var loc = new String(document.location);// Random number generator: 0 to (max - 1)function pickRandom(max) {	return Math.floor(Math.random() * max);}// Home bannerfunction buildhomebanner() {	var ran = pickRandom(2) + 1;	var homebannerstring = '<table width="100%" cellspacing="0" cellpadding="0" border="0"><tr valign="top"><td width="760"><img src="images/home/homebanner' + ran + '.jpg" alt="" width="760" height="236" border="0"></td>'	homebannerstring += '<td width="100%"><table width="100%" cellspacing="0" cellpadding="0" border="0"><tr><td background="images/home/homebanner' + ran + '_bg.jpg"><img src="/images/common/spacer.gif" alt="" width="5" height="219" border="0"></td></tr><tr><td><img src="/images/common/spacer.gif" alt="" width="5" height="17" border="0"></td></tr></table></td></tr></table>';		document.write(homebannerstring);}// Rollover functionsvar offstate = new Array();var onstate = new Array();function preloadmodelimages(imagedir,whichimg) {	offstate['blast'] = new Image();	offstate['blast'].src = imagedir + whichimg + 'blast_off.gif';	offstate['lightning']= new Image();	offstate['lightning'].src = imagedir + whichimg + 'lightning_off.gif';	offstate['firebolt'] = new Image();	offstate['firebolt'].src = imagedir + whichimg + 'firebolt_off.gif';	onstate['blast'] = new Image();	onstate['blast'].src = imagedir + whichimg + 'blast_on.gif';	onstate['lightning'] = new Image();	onstate['lightning'].src = imagedir + whichimg + 'lightning_on.gif';	onstate['firebolt'] = new Image();	onstate['firebolt'].src = imagedir + whichimg + 'firebolt_on.gif';}function modelrollon(whichmodel) {	document.images[whichmodel].src = onstate[whichmodel].src;}function modelrolloff(whichmodel) {	document.images[whichmodel].src = offstate[whichmodel].src;}// Photo galleryfunction buildgallerythumbnails() {	var gallerystring = '<span style="font-size: 6px">';	for (i = 0; i < numphotos; i++) {		gallerystring += '<a href="javascript:gallerypopup(' + (i + 1) + ')"><img src="' + photodir + photoname + (i + 1) + '_thumb.jpg" alt="" border="0" vspace="2"></a> ';	}	gallerystring += '</span>';	document.write(gallerystring);}function gallerypopup(whichphoto) {	var windowprops = 'width=' + popupwidth + ',height=' + popupheight + ',location=no,scrollbars=no,menubar=no,toolbar=no,resizable=no';	var whichdoc = popuppage + '?photo=' + whichphoto;	var newwin = window.open(whichdoc, photoname, windowprops);}// Color selectorfunction switchcolor(whichcolor) {	document.images['modelcolor'].src = colordir + 'color_' + whichcolor + '.jpg';}// Pop up functionsfunction popwin(loc,winname,w,h,scroll,resize) {	eval('var newwin = window.open("' + loc + '","' + winname + '","width=' + w + ',height=' + h + ',top=' + ((screen.height - h) / 2) + ',left=' + ((screen.width - w) / 2) + ',location=no,scrollbars=' + scroll + ',menubar=no,toolbar=no,resizable=' + resize + '")');}function popwinmenu(loc,winname,w,h,scroll,resize) {	eval('var newwin = window.open("' + loc + '","' + winname + '","width=' + w + ',height=' + h + ',top=' + ((screen.height - h) / 2) + ',left=' + ((screen.width - w) / 2) + ',location=no,scrollbars=' + scroll + ',menubar=yes,toolbar=yes,resizable=' + resize + '")');}function openinmain(whichpage) {	window.opener.location = whichpage;}function printpage() {	if (window.print){  		window.print();	} else {		alert("Printing Instructions:\n\n - If you are using a Macintosh, please select \"Print\" from the \"File\" menu.\n - If you are using Windows, right click the page and select \"Print\" from the pop-up menu.");	}}function dealerlocator() {	if (loc.indexOf('/en_us/') != -1) {		popwin('http://go.vicinity.com/buellintld/prxStart.d','dealer',610,500,'yes','yes');	} else if (loc.indexOf('/en_ca/') != -1) {		popwin('http://go.vicinity.com/buellintld/prxStart.d?E=sPaM9ooE-12l3A&AD4=CAN','dealer',610,500,'yes','yes');		} else if (loc.indexOf('/en_uk/') != -1) {		popwin('http://go.vicinity.com/buellintld/prxStart.d?E=sPaM9ooE-12l3A&AD4=GBR','dealer',610,500,'yes','yes');	} else if (loc.indexOf('/de_de/') != -1) {		popwin('http://go.vicinity.com/buellintld/prxStart.d?E=sPaM9ooF47t44&AD4=DEU','dealer',610,500,'yes','yes');	} else if (loc.indexOf('/it_it/') != -1) {		popwin('http://go.vicinity.com/buellintld/prxStart.d?E=sPaM9UzoZP6tI9Uyfao7w-Q&LL=it_it','dealer',610,500,'yes','yes');	} else if (loc.indexOf('/nl_be/') != -1) {		popwin('http://go.vicinity.com/buellintld/prxStart.d?E=sPaM9ooH7Id-ZA&AD4=BEL','dealer',610,500,'yes','yes');	} else if (loc.indexOf('/fr_fr/') != -1) {		popwin('http://go.vicinity.com/buellintld/prxStart.d?E=sPaM9UzoUlatI9Uyfao7w-Q&LL=fr_fr','dealer',610,500,'yes','yes');	} else if (loc.indexOf('/fr_be/') != -1) {		popwin('http://go.vicinity.com/buellintld/prxStart.d?E=sPaM9UzocSFGkeqZPtUd4fo&LL=fr_fr','dealer',610,500,'yes','yes');	} else if (loc.indexOf('/en_au/') != -1) {		popwin('http://go.vicinity.com/buellintld/prxStart.d?LL=en_us&AD4=AUS','dealer',610,500,'yes','yes');	} else {		popwin('http://go.vicinity.com/buellintld/prxStart.d','dealer',610,500,'yes','yes');	}}function riderlocator() {	if (loc.indexOf('/en_us/') != -1) {		popwin('/locator/ridersedge_us.asp','dealer',610,590,'yes','yes');	} else {		dealerlocator();	}}function lightningminisite() {	popwin(linkbase + 'xb9s_mini/index.html','xsenhanced',745,335,'no','no');}function fireboltminisite() {	popwin(linkbase + 'xb_mini/popup.html','xbenhanced',745,335,'no','no');}function ridersedge() {	var newwin = window.open('http://www.ridersedge.com/home_re01.html','riderpop','toolbar=yes,menubar=yes,width=750,height=444,scrollbars=no');}function inforequest() {	popwin(linkbase + 'other/inforequestconsent.asp','inforequest',610,500,'yes','yes');}function press_xb12r() {	popwin(linkbase + 'other/press_xb12r.asp','inforequest',610,500,'yes','yes');}function press_xb12s() {	popwin(linkbase + 'other/press_xb12s.asp','inforequest',610,500,'yes','yes');}function paymentcalculator(bike) {	var querystring = ''	if (bike != null) {		var querystring = '?bike=' + bike;	} 	var whichdoc = linkbase + 'products/financial/paymentcalc.asp' + querystring;	popwin(whichdoc,'payment',700,550,'yes','yes');}function openinmain(whichpage) {	window.opener.location = whichpage;}// Universal image rollover functionsvar akamai = false;function checkforakamai() {	mainloop:for (i = 0; i < document.images.length; i++) {		var imgsrc = document.images[i].src;		if (imgsrc.indexOf('akamai.net') != -1) {			akamai = true;			break mainloop;		}	}}function replaceakamai(whichstring) {	if (akamai) {		whichstring = whichstring.replace(new RegExp('http://[a-zA-Z0-9/.\-?=_\*]*www\.buell\.com','g'),'http://www.buell.com');	}	return whichstring;}function imghighlight(whichimg) {	var imgsrc = new String(whichimg.src);	imgsrc = replaceakamai(imgsrc);	imgsrc = imgsrc.replace(new RegExp('_off\.','g'),'_on\.');	whichimg.src = imgsrc;}function imgnohighlight(whichimg) {	var imgsrc = new String(whichimg.src);	imgsrc = replaceakamai(imgsrc);	imgsrc = imgsrc.replace(new RegExp('_on\.','g'),'_off\.');	whichimg.src = imgsrc;}// Navigation rollover functionsfunction sidenavon(whichnav) {	document.images['sidenav' + whichnav].src = '/images/common/yellowbullet.gif';}function sidenavoff(whichnav) {	document.images['sidenav' + whichnav].src = '/images/common/ltgraybullet.gif';}function switchbullet(name,number,color) {	document.images[name + number].src = '/images/common/' + color + 'bullet.gif';}function menurollon(whichdoc,whichimg) {	if (ns4 && whichdoc != '') {		eval('document.layers["' + whichdoc + '"].document.images["' + whichimg + '"].src = "' + linkbase + 'images/nav/' + whichimg + '_on.gif"');	} else {		eval('document.images["' + whichimg + '"].src = "' + linkbase + 'images/nav/' + whichimg + '_on.gif"');	}}function menurolloff(whichdoc,whichimg) {	if (ns4 && whichdoc != '') {		if (whichdoc != '') {			eval('document.layers["' + whichdoc + '"].document.images["' + whichimg + '"].src = "' + linkbase + 'images/nav/' + whichimg + '_off.gif"');		}	} else {		eval('document.images["' + whichimg + '"].src = "' + linkbase + 'images/nav/' + whichimg + '_off.gif"');	}}function uppercaser(text) {	text = text.toUpperCase();	text = text.replace(new RegExp('&AMP;','g'),'&amp;');	text = text.replace(new RegExp('UML;','g'),'uml;');	text = text.replace(new RegExp('ACUTE;','g'),'acute;');	text = text.replace(new RegExp('GRAVE;','g'),'grave;');	text = text.replace(new RegExp('CEDIL;','g'),'cedil;');	text = text.replace(new RegExp('CIRC;','g'),'circ;');	text = text.replace(new RegExp('TILDE;','g'),'tilde;');	text = text.replace(new RegExp('RING;','g'),'ring;');	text = text.replace(new RegExp('LIG;','g'),'lig;');	return text;}// Cookie functionsfunction checkcookie(locale,whichcookie) {	var allcookies = document.cookie;	var pos = allcookies.indexOf('lastseen' + locale + '=');	if (pos != -1) {		var start = pos + 9 + locale.length;		var end = allcookies.indexOf(";",start);		if (end == -1) {			end = allcookies.length;		}		var value = allcookies.substring(start,end);		if (value != whichcookie) {			if (locale == 'uk') {				uk_promo();			} else if (locale == 'us') {			american_muscle();			} else if (locale == 'de') {			RockTheHouse();				}		}	} else {		if (locale == 'uk') {			uk_promo();		} else if (locale == 'us') {		american_muscle();		} else if (locale == 'de') {		RockTheHouse();			}	}}function writecookie(locale,whichcookie) {	var mydate = new Date();	mydate.setMonth(mydate.getMonth() + 6);//	document.cookie = "lastseen=" + popupname + "; expires=" + mydate.toGMTString() + ";";	document.cookie = "lastseen" + locale + "=" + whichcookie + ";expires=" + mydate.toGMTString() + ";path=/";}function lightningmicrosite() {	popwin(linkbase + 'products/motorcycles/lightning/microsite/index.html','microsite',750,450,'no','no');}function fireboltmicrosite() {	popwin(linkbase + 'products/motorcycles/firebolt/microsite/index.html','microsite',750,450,'no','no');}// ****** MOVE THESE TO LOCAL COMMON.JS FILES ******// Opens pop-up window - Add to init() function to open on loading of home page.function american_muscle() {	popwinmenu('/en_us/promos/american_muscle/index.asp','american_muscle',680,530,'yes','yes');}function RockTheHouse() {	popwinmenu('/de_de/promos/rockthehouse/nikolaus.asp','RockTheHouse',630,530,'yes','yes');}function financingpromo() {	popwin(linkbase + 'promos/399apr/399apr.asp','financing',670,510,'yes','no');}function warrantypromo() {	popwin(linkbase + 'promos/extendedwarranty/extended_warranty.html','warranty',550,400,'no','no');}function lightninglow() {	popwin(linkbase + 'promos/lightninglow/lightninglow.html','xb9slow',700,475,'no','no');}function fr_newprice() {	popwin(linkbase + 'promos/newprice/newprice.html','nouveautarif',415,300,'no','no');}function outofstorage() {	popwin(linkbase + 'promos/outofstorage/storage.asp','storage',660,520,'yes','yes');}function slaydragon() {	popwin(linkbase + 'promos/slaydragon2/slaydragon.asp','dragon',740,550,'yes','yes');}function it_promo() {	popwin('promos/buellweekend/buellweekend.asp','buellweekend',515,545,'no','no');}function uk_promo() {	popwin('promos/openhouse/openhouse.asp','openhouse',500,545,'no','no');}function sliders() {	popwin('promos/sliders/sliders.asp','sliders',704,570,'yes','no');}function au_financing() {	popwin('promos/norepayments/norepay.asp','norepay',710,570,'yes','no');}