hi need help here .. writing a function using query

hi need help here .. writing a function using query

i have below scenario:

<div1> <div2> <div3>


all are clickable


<div1> click -> <div4> opens, <div5>should hide


<div2> click -> <div5> opens, <div4> should hide



now on clicking <div4>, <div6> opens everything else should hide.


i have written jquery for this, but in separate functons using all div ids separately.. i want to club this up and make a single function..


please tell me hw to do so..

thanks!