I think you're just trying to swap the IDs to change the colors.
In that case try this:
var id = "pop0";
$(".pop").bind('click', function(){
var oldId = $(this).attr('id');
$(this).attr('id', id);
id = oldId;
});
Fiddle: http://jsfiddle.net/kjTBG/20/
Basically what it does is this:
Initially, the three DIVs have the IDs "pop1", "pop2" and "pop3".
Example 1: When you click on "pop1" first, its ID changes to "pop0".
When you then click on "pop2", its ID changes to "pop1".
And so on.
Example 2: When you click on "pop2" first, its ID changes to "pop0".
When you then click on "pop1", its ID changes to "pop2".
And so on.
It keeps track of the original ID of the last "pop" you clicked on and then swaps that out with the ID of the next "pop" you click on.