
Dim LastClicked
function ChangeDownloadColor(strParentId)
        Set objParentText = Document.All("MF" & Mid(strParentId, 3))
        if LastClicked <> "" then
			LastClicked.style.color = "#0039ff"
        end if
        objParentText.style.color = "Red"
		Set LastClicked = Document.All("MF" & Mid(strParentId, 3))
end function

function ChangeDownloadColor2(strParentId)
        Set objParentText = Document.All("MT" & Mid(strParentId, 3))
        objParentText.style.color = "#E99595"
end function

    Sub clickHandler()
		
        Dim i
        Dim strParentId
        Dim objChild
        Dim objParentImage
        Dim sDisplay
        Dim sImage

        '== Identify the item clicked
        strParentId = Window.Event.SrcElement.ID
        If Left(strParentId, 1) = "M" Then
            '== Identify child DIV and parent IMG objects
            Set objChild = Document.All("C" & Mid(strParentId, 3))
            Set objParentImage = Document.All("MI" & Mid(strParentId, 3))
            Set objParentText = Document.All("MT" & Mid(strParentId, 3))
            '== manipulate their attributes
            If objChild.Style.Display = "none" Then
                objChild.Style.Display = ""
                objParentImage.Src = "/jamalbadawy/images/bullet-minus.gif"                
		objParentImage.alt = "Close Tree"
                objParentText.style.color = "#E99595"
            Else
                objChild.Style.Display = "none"
                objParentImage.Src = "/jamalbadawy/images/bullet-plus.gif"                
		objParentImage.alt = "Open Tree"
                objParentText.style.color = "#122AED"
            End If
            Set objChild = Nothing
            Set objParentImage = Nothing
        ElseIf Left(strParentId, 3) = "ALL" Then
            If Mid(strParentId, 4) = "Expand" Then
                sDisplay = ""
                sImage = "images/bullet-minus.gif"
            Else
                sDisplay = "none"
                sImage = "images/bullet-plus.gif"
            End If
            For i = 0 To Document.All.Length - 1
                If Left(Document.All(i).ID, 1) = "C" Then
                    Document.All(i).Style.Display = sDisplay
                End If
                If Left(Document.All(i).ID, 2) = "MI" Then
                    Document.All(i).Src = sImage
                End If
            Next
        End If

	
    End Sub

