// preloads graphics representing alternate states 
var imagesDirectory = "images/";
x = 500;
y = 26;
if (document.images){
  image0= new Image(x,y); 
  image0.src = imagesDirectory + "bg_accBar_open.gif"; 
  image1= new Image(x,y); 
  image1.src = imagesDirectory + "bg_accBar_closed.gif"; 
  image2= new Image(19,19); 
  image2.src = imagesDirectory + "btn_videoCTA.gif"; 
}

// this value is assigned in the page
var totalItems;

// opens first box, sets display attribute for boxes to assist access by JS
function itemSetup(){
	for (i=1; i<(totalItems +1); i++){
		otherId = "item" + i + "_content";
		document.getElementById(otherId).style.display = "none";
	}
	document.getElementById("item1_content").style.display = "block";
	document.getElementById("item1").style.backgroundImage = "url("+imagesDirectory+"bg_accBar_open.gif)";
}

function snap(thisItem){
// acquires elements
	theItem = document.getElementById(thisItem);
	contentId = thisItem + "_content";
	itemContent = document.getElementById(contentId);
// toggles state of header and content
	if (itemContent.style.display == "none"){
		theItem.style.backgroundImage = "url("+imagesDirectory+"bg_accBar_open.gif)";
		itemContent.style.display = "block";
	} else {
		theItem.style.backgroundImage = "url("+imagesDirectory+"bg_accBar_closed.gif)";
		itemContent.style.display = "none";
	}
// close all other content boxes
	for (i=1; i<(totalItems +1); i++){
		otherHeader = "item" + i;
		otherId = "item" + i + "_content";
		if (otherId != contentId){
			otherContent = document.getElementById(otherId);
			otherContent.style.display = "none";
			otherItem = document.getElementById(otherHeader);
			otherItem.style.backgroundImage = "url("+imagesDirectory+"bg_accBar_closed.gif)";
		}
	}
}

