function selectMenuList(tabId){
	switch(tabId){
		case "tab1":
			document.getElementById("tab1").className="tabNavSelected";
			document.getElementById("tab2").className="tabNavUnselected";
			document.getElementById("brandList").style.display="block";
			document.getElementById("typeList").style.display="none";
			break;
		case "tab2":
			document.getElementById("tab1").className="tabNavUnselected";
			document.getElementById("tab2").className="tabNavSelected";
			document.getElementById("brandList").style.display="none";
			document.getElementById("typeList").style.display="block";
			break;
	}
}

function showPopupImage(imageFileName,description,width,height){
	var left=(screen.availWidth-width)/2;
	var top=(screen.availHeight-height)/2;
	var specs="left=" + left + ", top=" + top + ", width=" + (width+20) + ", height=" + (height+120) + ", location=no, menubar=no, resizable=no, status=no";
	var p=window.open("", "Image", specs );
	
	p.document.write('<html><head><title>Paton Calvert - ' + description + '</title></head>',
									 '<body><h3>' + description + '</h3>',
									 '<img src="imgBig/' + imageFileName + '" width="' + width + '" height="' + height + '" border="0" alt="" />',
									 '<p align="center"><a href="javascript:window.close();">Close Window</a></p>',
									 '</body></html>');
	p.focus();
}

function toggleSection(id,initialSectionId){
	selectedSection = document.getElementById("sectionList" + id);
	selectedFlag = document.getElementById("sectionFlag" + id);
	
	if (selectedSection.className == "collapsedSection"){	
		// Collapse any expanded menu sections, provided they are not the initial section		
		x=document.getElementsByTagName("div");
		y=document.getElementsByTagName("img");		
		for (i=0;i<x.length;i++){
			if (x[i].className == "expandedSection" && x[i].id != ("sectionList"+initialSectionId)){
				x[i].className = "collapsedSection";
			}
		}			
		for (j=0;j<y.length;j++){
			if (y[j].className == "expandedFlag" && y[j].id != ("sectionFlag"+initialSectionId)){
				y[j].className = "collapsedFlag";
				y[j].src = "graphics/collapsed.png";
			}
		}			
		// expand selected section
		selectedSection.className = "expandedSection";
		selectedFlag.className = "expandedFlag";
		selectedFlag.src = "graphics/expanded.png";
	}	
	else{
		// collapse selected section, provided it is not the initial section
		if (id != initialSectionId){
			selectedSection.className = "collapsedSection";
			selectedFlag.className = "collapsedFlag";
			selectedFlag.src = "graphics/collapsed.png";
		}
	}	
}
function flagItem(imgId){
	imgFlag = document.getElementById(imgId);
	
	if (imgFlag.className != "selectedFlag"){
		imgFlag.src = "graphics/selected.png";
	}
}
function unflagItem(imgId){
	imgFlag = document.getElementById(imgId);
	
	if (imgFlag.className != "selectedFlag"){
		imgFlag.src = "graphics/unselected.png";
	}
}