// main_init function

main_init = function(mc){
 sx = Math.cos(shade_direction / 180 * Math.PI) * shade_offset;
 sy = -Math.sin(shade_direction / 180 * Math.PI) * shade_offset;
}

// main_effect function

main_effect = function(mc,frame){
 if (subs_done) end_effect = true;
}

// sub_init function

sub_init = function(mc){
 mc.duplicateMovieClip("c"+mc._i,mc._i-$sub_cnt);
 cmc = mc._parent["c"+mc._i]; 
 if (!out_effect) mc._alpha = 0;
 cmc._alpha = mc._alpha * shade_alpha / 100;
 cmc._x = mc.__x + sx;
 cmc._y = mc.__y + sy;
 clr = new Color(cmc);
 clr.setRGB(0); 
 
}

// sub_effect function

sub_effect = function(mc,frame){
 perc = frame / lastsubframe;
 if (out_effect) perc = 1 - perc;
 cmc = mc._parent["c"+mc._i]; 
 d = (1 - perc) * 40;
 mc._x = mc.__x + d; cmc._x = mc.__x - d + sx;
 mc._alpha = perc * 100; cmc._alpha = mc._alpha * shade_alpha / 100;
 if (frame == lastsubframe) mc.done=true;
}

