Dear Itamar,
I was doing exactly the same, even got the desired result and saw your reply hinting in the same direction. Really thanks for the answer . I have attached a picture of the result as well.
The reason I wanted to modify the php so as to give a more professional solution to my problem and also I wanted to keep the css clean. But anyways, its ok for now and thanks again to you.