Custom Menu

Hello Guys,

I have a custom menu ( ul li menu )

Books | Food | Electronics | Home Made | Other

and I have my Categories









------------->Dry Food






The problem is When some one click the link Books I need the menu color to change it to green

if they click on C or C++ ( any subcategory under Books must remain green)

if you click any product under [size=4]Books( including the sub category the link must remain green[/size]

[size=4]i use this method[/size]

{if $category_data.category_id == 1 || $category_data.category_id == 20 }

color :green


but the problem is category_id(Books) once i click the subcategory it no longer work or even if I click on a product

I just want diffrent color for each menu item(main category), because I have so many categories