// Header Slide Show - Fades In and Out

	var slideshow2_noFading = false;
	var slideshow2_timeBetweenSlides = 8000;	// Amount of time between each image(1000 = 1 second)
	var slideshow2_fadingSpeed = 8;	// Speed of fading	(Lower value = faster)
	
	var slideshow2_galleryContainer;	// Reference to the gallery div
	var slideshow2_galleryWidth;	// Width of gallery
	var slideshow2_galleryHeight;	// Height of galery
	var slideshow2_slideIndex = -1;	// Index of current image shown
	var slideshow2_slideIndexNext = false;	// Index of next image shown
	var slideshow2_imageDivs = new Array();	// Array of image divs(Created dynamically)
	var slideshow2_currentOpacity = 100;	// Initial opacity
	var slideshow2_imagesInGallery = false;	// Number of images in gallery
	var Opera = navigator.userAgent.indexOf('Opera')>=0?true:false;
	function createParentDivs(imageIndex)
	{
		if(imageIndex==slideshow2_imagesInGallery){			
			showGallery();
		}else{
			var imgObj = document.getElementById('galleryImage' + imageIndex);	
			if(Opera)imgObj.style.position = 'static';
			slideshow2_imageDivs[slideshow2_imageDivs.length] =  imgObj;
			imgObj.style.visibility = 'hidden';	
			imageIndex++;
			createParentDivs(imageIndex);	
		}		
	}
	
	function showGallery()
	{
		if(slideshow2_slideIndex==-1)slideshow2_slideIndex=0; else slideshow2_slideIndex++;	// Index of next image to show
		if(slideshow2_slideIndex==slideshow2_imageDivs.length)slideshow2_slideIndex=0;
		slideshow2_slideIndexNext = slideshow2_slideIndex+1;	// Index of the next next image
		if(slideshow2_slideIndexNext==slideshow2_imageDivs.length)slideshow2_slideIndexNext = 0;
		
		slideshow2_currentOpacity=100;	// Reset current opacity

		// Displaying image divs
		slideshow2_imageDivs[slideshow2_slideIndex].style.visibility = 'visible';
		if(Opera)slideshow2_imageDivs[slideshow2_slideIndex].style.display = 'inline';
		if(navigator.userAgent.indexOf('Opera')<0){
			slideshow2_imageDivs[slideshow2_slideIndexNext].style.visibility = 'visible';
		}
		
		if(document.all){	// IE rules
			slideshow2_imageDivs[slideshow2_slideIndex].style.filter = 'alpha(opacity=100)';
			slideshow2_imageDivs[slideshow2_slideIndexNext].style.filter = 'alpha(opacity=1)';
		}else{
			slideshow2_imageDivs[slideshow2_slideIndex].style.opacity = 0.99;	// Can't use 1 and 0 because of screen flickering in FF
			slideshow2_imageDivs[slideshow2_slideIndexNext].style.opacity = 0.01;
		}		
		

		setTimeout('revealImage()',slideshow2_timeBetweenSlides);		
	}
	
	function revealImage()
	{
		if(slideshow2_noFading){
			slideshow2_imageDivs[slideshow2_slideIndex].style.visibility = 'hidden';
			if(Opera)slideshow2_imageDivs[slideshow2_slideIndex].style.display = 'none';
			showGallery();
			return;
		}
		slideshow2_currentOpacity--;
		if(document.all){
			slideshow2_imageDivs[slideshow2_slideIndex].style.filter = 'alpha(opacity='+slideshow2_currentOpacity+')';
			slideshow2_imageDivs[slideshow2_slideIndexNext].style.filter = 'alpha(opacity='+(100-slideshow2_currentOpacity)+')';
		}else{
			slideshow2_imageDivs[slideshow2_slideIndex].style.opacity = Math.max(0.01,slideshow2_currentOpacity/100);	// Can't use 1 and 0 because of screen flickering in FF
			slideshow2_imageDivs[slideshow2_slideIndexNext].style.opacity = Math.min(0.99,(1 - (slideshow2_currentOpacity/100)));
		}
		if(slideshow2_currentOpacity>0){
			setTimeout('revealImage()',slideshow2_fadingSpeed);
		}else{
			slideshow2_imageDivs[slideshow2_slideIndex].style.visibility = 'hidden';	
			if(Opera)slideshow2_imageDivs[slideshow2_slideIndex].style.display = 'none';		
			showGallery();
		}
	}
	
	function initImageGallery()
	{
		slideshow2_galleryContainer = document.getElementById('imageSlideshowHolder');
		slideshow2_galleryWidth = slideshow2_galleryContainer.clientWidth;
		slideshow2_galleryHeight = slideshow2_galleryContainer.clientHeight;
		galleryImgArray = slideshow2_galleryContainer.getElementsByTagName('IMG');
		for(var no=0;no<galleryImgArray.length;no++){
			galleryImgArray[no].id = 'galleryImage' + no;
		}
		slideshow2_imagesInGallery = galleryImgArray.length;
		createParentDivs(0);		
		
	}
	function newwin(URL,W,H) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width='+W+',height='+H);");
}
var mmOpenContainer = null;
var mmOpenMenus = null;
var mmHideMenuTimer = null;

function MM_menuStartTimeout(hideTimeout) {
	mmHideMenuTimer = setTimeout("MM_menuHideMenus()", hideTimeout);	
}

function MM_menuHideMenus() {
	MM_menuResetTimeout();
	if(mmOpenContainer) {
		var c = document.getElementById(mmOpenContainer);
		c.style.visibility = "inherit";
		mmOpenContainer = null;
	}
	if( mmOpenMenus ) {
		for(var ii in mmOpenMenus) {
			var m = document.getElementById(mmOpenMenus[ii]);
			m.style.visibility = "hidden";			
		}
		mmOpenMenus = null;
	}
}

function MM_menuHideSubmenus(menuName) {
	if( mmOpenMenus ) {
		var h = false;
		var c = 0;
		for(var ii in mmOpenMenus) {
			if( h ) {
				var m = document.getElementById(mmOpenMenus[ii]);
				m.style.visibility = "hidden";
			} else if( mmOpenMenus[ii] == menuName ) {
				h = true;
			} else {
				c++;
			}
		}
		mmOpenMenus.length = c+1;
	}
}

function MM_menuOverMenuItem(menuName, subMenuSuffix) {
	MM_menuResetTimeout();
	MM_menuHideSubmenus(menuName);
	if( subMenuSuffix ) {
		var subMenuName = "" + menuName + "_" + subMenuSuffix;
		MM_menuShowSubMenu(subMenuName);
	}
}

function MM_menuShowSubMenu(subMenuName) {
	MM_menuResetTimeout();
	var e = document.getElementById(subMenuName);
	e.style.visibility = "inherit";
	if( !mmOpenMenus ) {
		mmOpenMenus = new Array;
	}
	mmOpenMenus[mmOpenMenus.length] = "" + subMenuName;
}

function MM_menuResetTimeout() {
	if (mmHideMenuTimer) clearTimeout(mmHideMenuTimer);
	mmHideMenuTimer = null;
}

function MM_menuShowMenu(containName, menuName, xOffset, yOffset, triggerName) {
	MM_menuHideMenus();
	MM_menuResetTimeout();
	MM_menuShowMenuContainer(containName, xOffset, yOffset, triggerName);
	MM_menuShowSubMenu(menuName);
}

function MM_menuShowMenuContainer(containName, x, y, triggerName) {	
	var c = document.getElementById(containName);
	var s = c.style;
	s.visibility = "inherit";
	
	mmOpenContainer = "" + containName;
}
<!-- 
// club method, used to route to a page that they host and 
// detects whether or not the entered zipcode is theirs. 
// 
// this implementation passes the user off to the AES ZipCode Application with 
// rclub and rurl parameters for this club and page 
function verifyUserIsInOurTerritory(clubNumber) { 
// verify client is in our territory via ZCG, must escape the rurl for proper processing by browsers
window.location = "http://www.aaa.com/?rclub=" + clubNumber + "&rurl=" + escape(window.location);
} 

// checks to see if the client is a spider, major engines listed 
function spiderClient() { 
var spiderFound = false; 
var useragent = window.navigator.userAgent; 
useragent = useragent.toUpperCase(); 
if(useragent.substring(0, 6) == "GOOGLE" || useragent.substring(0, 7) == "BACKRUB") { 
// should match all Google Spiders 
spiderFound = true; 
} else if(useragent.substring(0, 5) == "YAHOO") { 
// should match all Yahoo spiders 
spiderFound = true; 
} else if(useragent.substring(0, 6) == "MSNBOT") { 
// should match all MSN spiders 
spiderFound = true; 
} else if(useragent.substring(0, 5) == "LYCOS") { 
// should match Lycos 
spiderFound = true; 
} else if(useragent.substring(0, 8) == "MERCATOR") { 
// should match AltaVista 
spiderFound = true; 
} 
return spiderFound; 
} 

// gets the zipcode cookie data from the club's cookie
function getCookie(CookieName) {
var search = CookieName + "=";
if(document.cookie.length > 0) {
offset = document.cookie.indexOf(search);
if(offset != -1) {
offset += search.length;
end = document.cookie.indexOf(";", offset);
if(end == -1) {
end = document.cookie.length;
}
return document.cookie.substring(offset, end);
}
}
}

// This method should be used by clubs hosting pages on aaa.com 
// that are referenced under the domains ww1.aaa.com, ww2.aaa.com and www.aaa.com 
// since these pages will have access to the zipcode cookie written under aaa.com. 
function validateUserInClub(clubNumber) { 
var ourUser = false; 
var foundAssociation = ""; 
var foundClub = ""; 
var startIndex = 0; 
var pipe = ""; 
var cookieData = getCookie("zipcode"); 
var foundZipCode = ""; 

if(cookieData > "") { 
// get the zipcode 
pipe = cookieData.indexOf("|"); 
if(pipe > 4) { 
foundZipCode = cookieData.substring(startIndex, pipe); 
// find association 
startIndex = pipe + 1; 
pipe = cookieData.indexOf("|", startIndex); 
if(pipe > 8) { 
foundAssociation = cookieData.substring(startIndex, pipe); 
// get the club 
startIndex = pipe + 1; 
if(cookieData.length > startIndex) { 
foundClub = cookieData.substring(startIndex); 
} 
} 
} 
} 
if(foundZipCode > "" && foundAssociation > "" && foundClub > "") { 
// we have valid data 
if(foundClub == clubNumber) { 
// this is our user, keep them here. 
ourUser = true; 
} else { 
// not our user, calling method will get them to the 
// ZipCode Gateway and then routed to their club. 
ourUser = false; 
} 
} else { 
// returning false, in this case meaning we could not validate 
// the user, the calling method will call the ZipCode Gateway 
// which will take care of validating the user 
ourUser = false; 
} 
return ourUser; 
} 

// going to mark the user via a cookie as 
// a validated user belonging to our club
function tagOurUser() {
// write the zipcode cookie since not under aaa.com
var today = new Date();
var expirationDate = new Date();
var foundZipcode = window.location.search.substring(startingIndex);
if(foundZipcode.length > 5) {
var endingIndex = foundZipcode.indexOf("&");
if(endingIndex > 0) {
// cut down the zipcode
foundZipcode = foundZipcode.substring(0, endingIndex);
}
}
// set expiration date to one year.
expirationDate.setTime(today.getTime() + 31536000);
document.cookie = "zipcode=" + foundZipcode + "|AAA|164; expires=" + expirationDate.toGMTString();
}
// --> 

// only going to process if an actual end user

if(!spiderClient()) {

// check the zipcode cookie to see if the user has already been validated in our club 

if(validateUserInClub("164")) {

// the user has been validated, allow them to continue

// the page will now display

} else {

// if being referred to from the AES Gateway the

// validated zipcode will be sent as zip=nnnnn

var startingIndex = window.location.search.indexOf("zip=");

if(startingIndex >= 0) {

// this page is being referred to by the AES Gateway

tagOurUser();

} else {

// user will be sent over to the Zip Code Gateway for validation

verifyUserIsInOurTerritory("164");

}}}

/* DCS TAG IMPLENTATION START 
var dcsURI=window.location.pathname;
var dcsQRY=window.location.search;
var dcsEXT="";
var dcsRef=window.document.referrer;
var dcsDomain=window.location.hostname;
var dcsClub= "164";
var dcsMemStat = "Unknown";
var dcsGif = "dcs.gif";

function dcsLog(dcs_URI,dcs_QRY,dcs_EXT,dcs_Ref)
{
	var dCurrent = new Date();
	var P = "";
	P+="http"+(window.location.protocol.indexOf('https:')==0?'s':'')+"://dcs.aaa.com/" + dcsGif + "?";
	P+="dcsuri="+escape(dcs_URI);
	P+="&dcsqry="+escape(dcs_QRY);
	if ((dcs_Ref != "") && (dcs_Ref != "-"))
	{
		if (!(navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) < 4) )
		{
			P+="&dcsref="+escape(dcs_Ref);
		}
	}
	P+=dcs_EXT;
	P+="&dcssip="+dcsDomain;
	//P+="&dcsp3p=yourp3pheader";  //To issue P3P header, replace 'yourp3pheader' and remove the leading '//'.
	//P+="&dcscfg=yourcfg";  //To configure DCS, replace 'yourcfg' and remove the leading '//'.
	P+="&dcsdat="+escape(dCurrent.getTime());
	document.write('<IMG BORDER="0" NAME="DCSIMG" WIDTH="1" HEIGHT="1" SRC="'+P+'">');
}


function logPage(a,b)
{
  setClub(a,b);
  setHost("Club");
  dcsExtend("Club",dcsClub);
  dcsExtend("MemberStatus",dcsMemStat);
  dcsLog(dcsURI,dcsQRY,dcsEXT,dcsRef);
}

function setMemberStatus(a){dcsMemStat=a;}
function setCategory(a){dcsExtend("WT.cg_n",a)}
function setSubcategory(a){dcsExtend("WT.cg_s",a);}
function setPageType(a){dcsExtend("PageType",a);}
function setUser(a){dcsExtend("User",a);}
function setURL(a){dcsURI=a;}
function setDomain(a){dcsDomain=a;}
function setLastPage(a){dcsRef=a;}
function setSaleAmount(a){dcsExtend("SaleAmount",a);}
function setLocation(a){dcsExtend("Location",a);}
function dcsExtend(N,V){dcsEXT+="&"+N+"="+escape(V);}
function setClub(a,b){dcsGif="DCS000"+a+"_"+b+"/dcs.gif";dcsClub=a;}
function setMagicKey(a,b){setClub(a,b);}
function setHost(a){dcsExtend("Host",a);}
/*DCS TAG IMPLENTATION FROM NATIONAL AAA END */
