var data = new Array(); 
data['aha'] = new Array(); data['ahe'] = new Array(); data['ahf'] = new Array();
data['eha'] = new Array(); data['ehe'] = new Array(); data['ehf'] = new Array();
data['fha'] = new Array(); data['fhe'] = new Array(); data['fhf'] = new Array();
//access
data['aha'][0] = '/images/menu/aha/tabs.png';
data['aha'][1] = '0,50,7,13,84,4,93,19,81,50';
data['aha'][2] = '83,50,100,4,216,10,221,25,216,50';
data['aha'][3] = '0';

data['ahe'][0] = '/images/menu/ahe/tabs.png';
data['ahe'][1] = '0,50,7,11,87,1,105,50';
data['ahe'][2] = '106,50,93,17,99,0,217,9,222,24,217,50';
data['ahe'][3] = '0';

data['ahf'][0] = '/images/menu/ahf/tabs.png';
data['ahf'][1] = '0,46,7,12,85,3,92,19,82,50';
data['ahf'][2] = '82,50,98,2,217,9,234,75';
data['ahf'][3] = '0';
//ego
data['ehe'][0] = '/images/menu/ehe/tabs.png';
data['ehe'][1] = '0';
data['ehe'][2] = '107,50,94,19,100,3,217,9,228,50';
data['ehe'][3] = '229,50,223,26,226,14,346,3,369,50';

data['eha'][0] = '/images/menu/eha/tabs.png';
data['eha'][1] = '0';
data['eha'][2] = '105,50,93,20,100,2,217,9,222,27,216,50';
data['eha'][3] = '217,50,224,13,349,1,370,50';

data['ehf'][0] = '/images/menu/ehf/tabs.png';
data['ehf'][1] = '0';
data['ehf'][2] = '81,50,98,1,217,9,228,50';
data['ehf'][3] = '229,50,223,30,226,13,346,3,366,50';
//flavour
data['fhf'][0] = '/images/menu/fhf/tabs.png';
data['fhf'][1] = '2,50,7,12,86,3,93,20,82,50';
data['fhf'][2] = '0';
data['fhf'][3] = '228,47,223,26,226,14,347,3,366,47';

data['fhe'][0] = '/images/menu/fhe/tabs.png';
data['fhe'][1] = '1,50,6,12,86,3,105,50';
data['fhe'][2] = '0';
data['fhe'][3] = '230,50,223,26,226,14,346,3,367,50';

data['fha'][0] = '/images/menu/fha/tabs.png';
data['fha'][1] = '1,50,6,13,85,3,94,20,82,50';
data['fha'][2] = '0';
data['fha'][3] = '215,50,225,13,347,1,370,50';

function menu(flag) {
  document.getElementById('tab_image').src = data[flag][0];
  document.getElementById('area_ego').coords = data[flag][1];
  document.getElementById('area_favour').coords = data[flag][2];
  document.getElementById('area_access').coords = data[flag][3];
}

var fade = window.setInterval("fade_out()", 10000);
var appear_;
var pos = 1;

function fade_out() {
  element = document.getElementById('headerImage');
  if(Element.getStyle(element, 'display') != 'none') {
 	  rand = Math.round(Math.random()*10);
	  if(rand<2) new Effect.Fade(element, { duration: 0.3 });
		else if(rand<4) new Effect.Fold(element, { duration: 0.3 }); 
		else if(rand<6) new Effect.Squish(element, { duration: 0.3 });  
	  else if(rand<8) new Effect.DropOut(element, { duration: 0.3 });  
	  else new Effect.Fade(element, { duration: 0.3 }); 
 	  window.clearInterval(fade);
		appear_ = window.setInterval("appear()", 500);
  }
}

function appear() {
	element = document.getElementById('headerImage');
  if(Element.getStyle(element, 'display') == 'none') {
	  file = get_next_header_file();
	  element.style.backgroundImage = 'url(/images/header/' + file +')';
 	  rand = Math.round(Math.random()*10);
	  if(rand<4) new Effect.Grow(element, { duration: 0.3 });
		else Effect.Appear(element, { duration: 1 });
 	  window.clearInterval(appear_);
		fade = window.setInterval("fade_out()", 10000);
  }
}

function get_next_header_file() {
  if (pos <= 	9) { pos ++; }
  else { pos = 1; }
  return pos + '_header.png';
}