// main_init function

main_init = function(mc){
 box = function(mc,tl_x, tl_y, br_x, br_y, cf ){
  mc.lineStyle();
  mc.beginFill(cf);
  mc.moveTo (tl_x,tl_y);
  mc.lineTo (br_x,tl_y);
  mc.lineTo (br_x,br_y);
  mc.lineTo (tl_x,br_y);
  mc.endFill();
 }
 subs_done = true;
 mc.duplicateMovieClip("copy",6);
 createEmptyMovieClip("m1",7);
 createEmptyMovieClip("m2",8);
 mc.setMask(m1);
 copy.setMask(m2); 
 hw = mc._width / 2; hh = mc._height / 2;
 b = Math.ceil(Math.sqrt(hw*hw+hh*hh));
 
 for (i=-b; i<b; i+=2 * bar_size){
  box(m1,-b,i,b,i + bar_size,0);
  box(m2,-b,i + bar_size,b,i + 2 * bar_size,0);
 }

 if (!out_effect){
  cur_angle = angle + angle_rotation;
  m1._x = mc._x = mc.__x + Math.cos(cur_angle / 180 * Math.PI) * distance;
  m1._y = mc._y = mc.__y - Math.sin(cur_angle / 180 * Math.PI) * distance;
  m2._x = copy._x = -mc._x; m2._y = copy._y = -mc._y;
  if (fade) copy._alpha=mc._alpha=0;
  if (scale) m1._xscale=m1._yscale=m2._xscale=m2._yscale=copy._xscale=copy._yscale=mc._xscale=mc._yscale=0;
  m1._rotation = m2._rotation = -bar_angle - bar_angle_rotation;
 } else {
  m1._rotation = m2._rotation = -bar_angle;
 }

}

// main_effect function

main_effect = function(mc,frame){
 perc = frame / lastsubframe;
 perc = linear_speed ? 1-perc : 1-Math.sin(perc*deg90);
 if (out_effect) perc = 1-perc;

 cur_angle = angle + angle_rotation * perc;
 cur_bar_angle = bar_angle + bar_angle_rotation * perc;
 m1._x = mc._x = mc.__x + Math.cos(cur_angle / 180 * Math.PI) * distance * perc;
 m1._y = mc._y = mc.__y - Math.sin(cur_angle / 180 * Math.PI) * distance * perc;
 m2._x = copy._x = -mc._x; m2._y = copy._y = -mc._y;
 m1._rotation = m2._rotation = -cur_bar_angle;

 if (fade) copy._alpha=mc._alpha=100-perc*100;
 if (scale) m1._xscale=m1._yscale=m2._xscale=m2._yscale=copy._xscale=copy._yscale=mc._xscale=mc._yscale=100-perc*100;

 if (frame == lastsubframe){
  if (out_effect) mc._alpha = 0;
  mc.setMask(null);
  m1.removeMovieClip();
  m2.removeMovieClip();
  copy.removeMovieClip();  
  end_effect = true;
 }
}

// sub_init function

sub_init = function(mc){
}

// sub_effect function

sub_effect = function(mc,frame){
}
