Accordion how to open particular header using script

Hi,

I have created a accordion menu using the following code

 [LEFT]                      [COLOR=#000000] [COLOR=#007700]<[/COLOR][COLOR=#0000BB]h3[/COLOR][COLOR=#007700]>[/COLOR][COLOR=#0000BB]Level 1[/COLOR][COLOR=#007700]</[/COLOR][COLOR=#0000BB]h3[/COLOR][COLOR=#007700]> 

<[/COLOR][COLOR=#0000BB]div[/COLOR][COLOR=#007700]>[/COLOR][COLOR=#0000BB]Content[/COLOR][COLOR=#007700]</[/COLOR][COLOR=#0000BB]div[/COLOR][COLOR=#007700]>
<[/COLOR][COLOR=#0000BB]h3[/COLOR][COLOR=#007700]>[/COLOR][COLOR=#0000BB]Level 2[/COLOR][COLOR=#007700]</[/COLOR][COLOR=#0000BB]h3[/COLOR][COLOR=#007700]>
<[/COLOR][COLOR=#0000BB]div[/COLOR][COLOR=#007700]>[/COLOR][COLOR=#0000BB]Content[/COLOR][COLOR=#007700]</[/COLOR][COLOR=#0000BB]div[/COLOR][COLOR=#007700]>
<[/COLOR][COLOR=#0000BB]h3[/COLOR][COLOR=#007700]>[/COLOR][COLOR=#0000BB]Level 3[/COLOR][COLOR=#007700]</[/COLOR][COLOR=#0000BB]h3[/COLOR][COLOR=#007700]>
<[/COLOR][COLOR=#0000BB]div[/COLOR][COLOR=#007700]>[/COLOR][COLOR=#0000BB]Content[/COLOR][COLOR=#007700]</[/COLOR][COLOR=#0000BB]div[/COLOR][COLOR=#007700]>
[/COLOR] [/COLOR]
[/LEFT]

I want to open the different level headers using code. I tried looking into accordion and widgets code but could not find anything.

Please help me what code should be used to open a particular header. Also how to find if the head which should open is already open or not.

I also tried using
$(“#rightMenuAccordion”).activate(‘activate’,1)

as listed here but it says it does not exist

[EDIT]
Finally found the solution
$(“#rightMenuAccordion”).accordion(‘activate’, 2);