// main_init function

main_init = function(mc){
 sub_delay = lastsubframe;
 createEmptyMovieClip('sun',6);
 with (sun){
  lineStyle();
  var colors = [suncolin,suncolout];
  var alphas = [sunalphain,sunalphaout];
  var ratios = [0,255];
  var matrix = {matrixType:'box',w:240,h:240,x:-120,y:-120,r:0};
  beginGradientFill('radial',colors,alphas,ratios,matrix);
  angle=deg180/5;r2=90;
  moveTo(0,-120);
  for (i=angle; i<=deg360;i+=angle){              
   curveTo(Math.sin(i-angle/2)*50,-Math.cos(i-angle/2)*50,Math.sin(i)*r2,-Math.cos(i)*r2);
   if (r2==120) r2=90 else r2=120;
  }
  endFill();
  _xscale=_yscale=0;
 }
}

// main_effect function

main_effect = function(mc,frame){
 sun._rotation += sunspeed;
 if (subs_done) end_effect=true;
}

// sub_init function

sub_init = function(mc){
 mc.step = 0;
 if (!out_effect) mc._alpha = 0;
 mc.r = Math.max(mc._width,mc._height)-$padding+10;
}

// sub_effect function

sub_effect = function(mc,frame){
 prev_done = ($i>0 ? $smc[$i-1].done : true );
 if (prev_done){
  mc.step++;
  perc = mc.step / lastsubframe;
  sun._x = mc._x; sun._y = mc._y;
  sun._xscale = sun._yscale = mc.r * Math.sin(perc * deg180);
  if(perc == 0.5) mc._alpha = 100 - mc._alpha;
  if(mc.step == lastsubframe) mc.done = true;
 }
}

