function _USER() 
{
	this.user_data = [];

	this.name = 0;
	this.pict = 1;
	this.align = 2;
	this.clan_id = 3;
	this.sex = 4;

	this.attack_base = 5;
	this.defence_base = 6;
	this.power_base = 7;
	this.knowledge_base = 8; 
	this.ups = 9;
	this.weigth = 10;
	this.weigth_max = 11;

	//this. = 12;

	this.attack = 13;
	this.defence = 14;
	this.power = 15;
	this.knowledge = 16; 
	this.luck = 17;
	this.morale = 18;
	this.initiative = 19;

	this.energy_now = 20;
	this.energy_max = 21;
/*
	this. = 22;
*/
	this.min_damage = 23;
	this.max_damage = 24;
/*
	this. = 25;
	this. = 26;
	this. = 27;
*/
	this.won = 28;
	this.lost = 29;
	this.level = 30;	
	
	this.casino_all = 31;
	this.casino_put = 32;
	this.casino_won = 33;	

	this.user_online = 34;
	this.user_last_online = 35;

	this.user_data_stat = [['attack', this.attack], ['defence', this.defence], ['power', this.power], 
		['knowledge', this.knowledge], ['luck', this.luck], ['morale', this.morale], ['initiative', this.initiative]];

	this.exp = [
		['miner', 6, [0, 16, 40, 96, 216, 464, 968]],
		['seller', 6, [0, 16, 40, 96, 216, 464, 968]],
		['worker', 5, [0, 40, 216, 968]],
		['transporter', 3, [0, 40, 216, 968]],
		['manufacturer', 8, [0, 16, 40, 96, 216, 464, 968]],
		['battle', 1, [0, 0, 2000, 5000, 11500, 25000, 52500, 108000, 219500, 443000, 890500, 1786000, 3577500, 7161000, 14328500]],
		['fraction', 7, [0]]
	];

//	this.resource_name = [, 'Кристаллы', 'Камни', 'Древесина', 'Железо', 'Руда', 'Уголь'];
	this.resource = [0,0,0,0,0,0,0,0,0];

  this.crystal = 1;
  this.stone = 2;
  this.wood = 3;
  this.iron = 4;
  this.ore = 5;
  this.coal = 6;
  this.euro = 7;
  this.grur = 8;

	this.user_hp = [];

  this.hp_now = 0;
  this.hp_max = 1;
  this.hp_regen = 2;

	
	this.wear_on = [];
	this.wear_on_list = '';
	this.thing = [];

	this.slot = [0,0,0,0,0,0,0,0,0];

	this.timer_hp = -1;	
	
  this.load_user_hp = function(arr) 
	{
		this.user_hp = [parseFloat(arr[0]), parseInt(arr[1]), parseFloat(arr[2])];
  }

  this.load_user_data = function(arr) 
	{
		this.user_data = arr;
  }

  this.refresh_user_data = function(a) 
	{
		if (!a) a = this.user_data;
		
		var txt = '0,' + a[this.ups] + ',' + a[this.attack] + ',' + a[this.min_damage] + '-' + a[this.max_damage] + ',' + a[this.defence] + ',' + 
			a[this.power] + ',' + a[this.knowledge] + ',' + 
			a[this.luck] + ',' + a[this.morale] + ',' + a[this.initiative] + '%,' + a[this.ups];
		
		alert(txt);
		
		var f = $f('stat');
		f.stat_update(txt);
		
		
/*
		for (i = 0; i < this.user_data_exp.length; i++)
		{
			$('id_'+this.user_data_exp[i][0]).innerHTML = a[this.user_data_exp[i][1]]+' ('+a[this.user_data_exp[i][2]]+') <span class="small">+'+a[this.user_data_exp[i][2]]+'</span>';
		}
*/		
	/*	el = $('id_battle_all');
		if (el)
		{
			el.innerHTML = parseInt(a[this.won])+parseInt(a[this.lost]);
			$('id_battle_won').innerHTML = a[this.won];
			$('id_battle_lose').innerHTML = a[this.lost];
		}

		el = $('id_casino_all');
		if (el)
		{
			el.innerHTML = a[this.casino_all];
			$('id_casino_put').innerHTML = round_ex(a[this.casino_put], 2);
			$('id_casino_won').innerHTML = round_ex(a[this.casino_won], 2);
		}
		
		el = $('id_user_online');
		if (el)
		{
			el.innerHTML = a[this.user_online] == '1' ? 'Сейчас в игре' : 'Нет в игре ('+a[this.user_last_online]+')';
		}
		
		if (top.frames.length>0)
		{
			el = top.frames['main'].$('id_user_grur');
			if (el)
			{
				el.innerHTML = round_ex(this.resource[this.grur], 2);
			}
		}*/
  }
  
  this.refresh_user_exp = function(a)
  {
		z = 0;
		cnt = this.exp.length;
		i = 0;
		while (i < cnt)
		{
			name = this.exp[i][0];
			cnt2 = this.exp[i][1];
			
			value = 0;
			while (value++ < cnt2)
			{
				lvl = parseInt(a[z++]);
				exp = parseFloat(a[z++]);
				$(name + '_' + value).innerHTML = lvl + ' (' + exp + ') ' + (this.exp[i][2][lvl + 1] ? '+' + (this.exp[i][2][lvl + 1] - exp) : '+0');
			}
			++i;
		}
  }
  
  this.load_resource = function(a)
  {
		this.resource = a.split('\t');
		/*if (a2.length == 8)
		{
			this.resource = [0].concat(a2);
		}*/
	}
	
	this.get_resource = function(a)
	{
		if (!a) a = this.resource;

		return AC_SWF_TXT(650, 25, 'topres', 'topres', 'ver=_1&data=650,1,1,' + a, '#F7F7F7', 'transparent');
	}

}

var USER = new _USER();