You can't put the if
like that. It's the event which run a code. When you have the click
event, you can put you condition.
Try with something like this :
$("#images_holder").children().click(function(){
// if has class run this code
// else if has this class, run this code
...
});