
// main_init function

main_init = function(mc){
 circle = function ( mc, tl_x, tl_y, br_x, br_y, th ){
  mc.lineStyle();
  mc.beginFill(color,alpha);
  var mx = ( tl_x + br_x ) / 2;
  var my = ( tl_y + br_y ) / 2;
  var cx = (br_x - tl_x) * .022;
  var cy = (br_y - tl_y) * .022;
  mc.moveTo ( mx, tl_y );
  mc.curveTo ( br_x-cx, tl_y+cy, br_x, my );
  mc.curveTo ( br_x-cx, br_y-cy, mx, br_y );
  mc.curveTo ( tl_x+cx, br_y-cy, tl_x, my );
  mc.curveTo ( tl_x+cx, tl_y+cy, mx, tl_y );
  tl_x += th;
  tl_y += th;
  br_x -= th;
  br_y -= th;
  mc.lineTo ( mx, tl_y );
  mc.curveTo ( tl_x+cx, tl_y+cy, tl_x, my );
  mc.curveTo ( tl_x+cx, br_y-cy, mx, br_y );
  mc.curveTo ( br_x-cx, br_y-cy, br_x, my );
  mc.curveTo ( br_x-cx, tl_y+cy, mx, tl_y );
  mc.endFill();
 }
 createEmptyMovieClip("rain",4); 
}

// main_effect function

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

// sub_init function

sub_init = function(mc){
 rain.createEmptyMovieClip("s"+mc._i+"r1",mc._i*2);
 rain.createEmptyMovieClip("s"+mc._i+"r2",mc._i*2+1);
 r1 = rain["s"+mc._i+"r1"];
 r2 = rain["s"+mc._i+"r2"]; 
 r2._x = r1._x = mc.__x;
 r2._y = r1._y = mc.__y; 
 r2._visible = r1._visible = false;
 d = Math.max(mc._width,mc._height);
 circle(r1,-d,-d,d,d,d/3);
 circle(r2,-d,-d,d,d,d/3);
 mc._alpha = 0;
 mc._xscale = 101; 
}

// sub_effect function

sub_effect = function(mc,frame){
 perc = frame / lastsubframe;
 if (mc._xscale > 100){
  mc._xscale = mc._yscale = initial_char_scale - Math.min(initial_char_scale-100,perc * 800); 
  mc._alpha = 100;
 } else {
  r1 = rain["s"+mc._i+"r1"]; 
  r2 = rain["s"+mc._i+"r2"]; 
  r1._xscale = Math.min(100,perc * 150);
  r1._yscale = r1._xscale * yxfactor;
  r1._alpha = 100 - r1._xscale; 
  r2._xscale = Math.max(0,perc * 150 - 50);
  r2._yscale = r2._xscale * yxfactor;
  r2._alpha = 100 - r2._xscale; 
  r1._visible = r2._visible = true;
  if (frame == lastsubframe) mc.done=true;
 }  
}

