Create css classes which sets the background color red and green respectively.
Now use method addStyleClass to add new style to your HBOX. Based on your condition set the class using IF .. ELSE statement.
Now after rendering you again want to change the style of your HBOX.
Take the id of your HBOX and use syntax
$("#"+Hbox.getId()).addClass("red");
or
$("#"+Hbox.getId()).removeClass("blue") ;
to add and remove class.
Regards
KK