// main_init function

main_init = function(mc){
 spectrumbox = function(mc,tl_x, tl_y, br_x, br_y ){
  mc.lineStyle();
  if (rainbow_spectrum){  
   var colors = [0xff0000,0xffff00,0x00ff00,0x00ffff,0x0000ff,0xff00ff,0xff0000];
   var alphas = [100,100,100,100,100,100,100];
   var ratios = [0,43,85,128,171,213,255];
  } else {
   var colors = [spectrum_color1,spectrum_color2,spectrum_color1];
   var alphas = [100,100,100];
   var ratios = [0,128,255];
  }  
  var matrix = {matrixType:'box',w:br_x-tl_x,h:br_y-tl_y,x:tl_x-0,y:tl_y-0,r:cycle_vertical ? deg90:0};
  mc.beginGradientFill('linear',colors,alphas,ratios,matrix);
  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;
 if (shade_offset){
  mc.duplicateMovieClip('shade',2);
  shade._x = Math.cos(shade_direction / 180 * Math.PI) * shade_offset;
  shade._y = -Math.sin(shade_direction / 180 * Math.PI) * shade_offset;
  shade._alpha = shade_alpha;
  clr = new Color(shade);
  clr.setRGB(0); 
 }
 createEmptyMovieClip('bar',3);
 mc.duplicateMovieClip('mask',4);
 bar.setMask(mask);
 mc._alpha=orig_text_alpha;
 b=mc.getBounds(mc);
 if (cycle_vertical){
  spec_cnt = Math.ceil(mc._height / spectrum_size)+1; 
  for (i=0;i<spec_cnt;i++) spectrumbox(bar,b.xMin,b.yMin+i*spectrum_size,b.xMax,b.yMin+(i+1)*spectrum_size);
  bar._y = (-spectrum_start) % spectrum_size;
 } else {
  spec_cnt = Math.ceil(mc._width / spectrum_size)+1; 
  for (i=0;i<spec_cnt;i++) spectrumbox(bar,b.xMin+i*spectrum_size,b.yMin,b.xMin+(i+1)*spectrum_size,b.yMax);
  bar._x = (-spectrum_start) % spectrum_size;
 } 
}

// main_effect function

main_effect = function(mc,frame){
 if (cycle_vertical){
  bar._y = (bar._y - cycle_speed) % spectrum_size;
 } else {
  bar._x = (bar._x - cycle_speed) % spectrum_size;
 }
}

// sub_init function

sub_init = function(mc){
}

// sub_effect function

sub_effect = function(mc,frame){
}

