Some problem Need help.

Hi i pasted some code maybe someone might be able to help.
void Draw(void)
{
int r,i,x,y,x2,y2,rcount=0,bcount=0;

glClear(GL_COLOR_BUFFER_BIT);

if (once==1)
for (i=0;i<9;i++)
{
if (rect[i].color==0)
glColor3f(1,0,0);
else if (rect[i].color==1)
glColor3f(1,1,1);
else if (rect[i].color==2)
glColor3f(0,0,1);
glRectf(rect[i].px,rect[i].py,rect[i].px2,rect[i].py2);
}

if (once==0) {
x=100;y=100;x2=200;y2=200;
for (i=0;i<9;i++)
{
r = rand()%3;
if (r==0)
if (rcount<2) {rcount++; glColor3f(1,0,0);}
else glColor3f(1,1,1);
if (r==1) glColor3f(1,1,1);
if (r==2)
if (bcount<2) {bcount++; glColor3f(0,0,1);}
else glColor3f(1,1,1);

glRectf(x,y,x2,y2);
rect[i].px=x;
rect[i].py=y;
rect[i].px2=x2;
rect[i].py2=y2;
rect[i].color=r;

x+=150;x2+=150;
if (i==2)
{y=250;y2=350;x=100;x2=200;}

if (i==5)
{y=400;y2=500;x=100;x2=200;}

}
once=1;
}

glFlush();
}//end

Now once is integer so the rectangles colors wont be randmoized twice and only one time. Im savin the data(color and coordiantes into a structure) durin the first time (once=0).
After a mouse click (the function Does NOTIHNG but PostRedisplay) the colors change although im usin in once==1 the same data i inserted into the structure at the beginning…Im desperate the colors basicly stay the same but from time to time few rectangles change color without i applied anything. All i do is just draw the data i put into the structure at the beginging and its givin me other results (simliar but still other). Am i insertin data correctly or what? im DESPERAEWd… HELP PLZ.
by the way the structure is defined like this :
typedef struct p{
int px;
int py;
int px2;
int py2;
int color;
} Rectangle;
Rectangle rect[9];

Thanks alot if anyone can figure it out.