Thank you so much for taking an interest in my problem and also for the quick replies.
Now in my concept the balls can be swapped. The player has to do the swapping and then create a situation like in the image I posted earlier. At that point the seven balls get destroyed. That's where I am stuck.
Using the idea from zatyka, I did something like the image below, calling the funtion "FindMatches" for each ball after each swap.
<img src="http://i39.tinypic.com/syru6d.jpg" border="0" />
But it is not working. Can you guys help some more.