var maxIndex = 1;
function toggle(id, button) {
    var theObj = document.getElementById(id);
    var theToggle = document[button];
    if (theObj.style.display == "none") {
        theToggle.src = "images/minus.png";
        theObj.style.display = "";		
	} else {
        theToggle.src = "images/plus.png";
		theObj.style.display = "none";		
	}
}

function toggleTee(id, button) {
    var theObj = document.getElementById(id);
    var theToggle = document[button];
    if (theObj.style.display == "none") {
        theToggle.src = "images/tee-minus.png";
        theObj.style.display = "";		
	} else {
        theToggle.src = "images/tee-plus.png";
		theObj.style.display = "none";		
	}
}

function toggleElbow(id, button) {
	var theObj = document.getElementById(id);
	var theToggle = document[button];
	if (theObj.style.display == "none") {
        theToggle.src = "images/elbow-minus.png";
	    theObj.style.display = "";		
	} else {
        theToggle.src = "images/elbow-plus.png";
		theObj.style.display = "none";		
	}
}

function toggleAnnotation(id, button) {
    //alert("Toggle annotation: " + id + "; " + button);
    var theObj = document.getElementById(id);
    var theToggle = document.getElementById(button);
    if (theObj.style.display == "none") {
        theObj.style.display = "";
        maxIndex = maxIndex+1;
        theToggle.style.zIndex = maxIndex;          
    } else {
        theObj.style.display = "none";   
    }
}
