﻿function ToggleVisibility(controlName, imageName, hiddenName)
{
    var control = document.getElementById(controlName);
    var imageControl = document.getElementById(imageName);
    var hiddenControl = document.getElementById(hiddenName);

    if (control == null)
        alert("cannot find control");

    if (control.style.display == "")
    {
        control.style.display = "none";
        
        if (imageControl)
            imageControl.src = "/images/collapse.gif";
            
        if (hiddenControl)
            hiddenControl.value = "0";
    }
    else
    {
        control.style.display = "";
        
        if (imageControl)
            imageControl.src = "/images/expand.gif";
            
        if (hiddenControl)
            hiddenControl.value = "1";
    }
}