// JavaScript Document
//prv,username,imgClan,imgAlj,imgDial,invalid,typeuserClass,level,imgPol,imgInvalid
//,prv,username
function flashShow() {
	if (!ie) {
		flw_ = document.getElementById("swfid");
		if (flw_ != null) {
			if (flw_.style.visibility != 'hidden')
			{
				flw_.style.visibility = "hidden";
				flw_.style.display = "none";
			} else
			{
				flw_.style.visibility = "";
				flw_.style.display = "";
			}
		}
	}
}
function showNameBlock(typeuserClass, uid, username, level, pol, inv, prv, dialer, clan, clanurl, clantitle, alj) {
	var prvtxt = '';
	var imgClantxt = '';
	var imgPol = '';
	var imgInvalid = '';
	var dialertxt = '';
	var aljtext = '';
	if (prv == 1) {
		prvtxt = '<img src="' + layout_url_all + '/img/xfn/prv.gif"  onClick="S_pr(\'' + username + '\');"  style="cursor:pointer;" >';
	}
	if (uid != 3) {
		if (pol == 0) {
			imgPol = '<a href="index.php?file=infouser&cuid=' + uid + '" target="_blank"><img src="' + layout_url_all
					+ '/img/man.gif" alt="" border="0" ></a>';
		}
		if (pol == 1) {
			imgPol = '<a href="index.php?file=infouser&cuid=' + uid + '" target="_blank"><img src="' + layout_url_all
					+ '/img/woman.gif" alt="" border="0" ></a>';
		}
		if (inv == 1) {
			imgInvalid = '<img style="cursor:pointer"  onClick="opw(\'invalidinfo.php?uid=' + uid + '\',300,200,1); return false;" src="'
					+ layout_url_all + '/img/xfn/invalid2.gif" alt="" border="0">';
		}
	}
	if (clan) {
		imgClantxt = '<a href="http://' + clanurl + '" target="_blank" ><img src="' + img_server + '/pics/clanpic/' + clan + '" alt="'
				+ clantitle + '" title="' + clantitle + '" border="0"></a>';
	}
	if (dialer == 1) {
		dialertxt = '<a href="/guide/gold.php" target="_blank"><img src="' + img_server + '/pics/clanpic/guild/el-hdealer-sm.gif" alt="Официальный дилер Bloody World" title="Официальный дилер Bloody World" border="0"></a>';
	}
	if (alj > 0) {
		aljtext = '<img src="' + img_server + '/pics/alc/ali_' + alj + '.gif" alt="" border="0">';
	}
	// <img src="'.$_CONF['img_server'].'/pics/clanpic/guild/clan.gif'.'" alt="" border="0">
	document.write('<table border=0 cellspacing=0 cellpadding=0 class=TB-HeroName><tr><td class=TD-HeroName-CTL><img src="'
			+ layout_url_all
			+ '/img/el-blank10px.gif" border=0 width=10px></td><td class=TD-HeroName-T></td><td class=TD-HeroName-CTR><img src="'
			+ layout_url_all
			+ '/img/el-blank10px.gif" border=0 width=10px></td></tr><tr><td class=TD-HeroName-L></td><td class=TD-HeroName>'
			+ '<table border=0 cellspacing=0 cellpadding=0><tr><td>' + prvtxt + '</td><td class=TD-HeroClan ><nobr>' + dialertxt + aljtext
			+ imgClantxt + '</nobr></td><td class=TD-HeroName-TXT><span class="S-Live-' + typeuserClass + '">' + username + ' [' + level
			+ ']</span></td><td class=TD-HeroClan><nobr>' + imgPol + imgInvalid
			+ '</nobr></td></tr></table></td><td class=TD-HeroName-R></td></tr><tr><td class=TD-HeroName-CBL><img src="' + layout_url_all
			+ '/img/el-blank10px.gif" border=0 width=10px></td><td class=TD-HeroName-B></td><td class=TD-HeroName-CBR><img src="'
			+ layout_url_all + '/img/el-blank10px.gif" border=0 width=10px></td></tr></table>');
}
var SlotImg = new Array(26);
var SlotHelp = new Array(26);
SlotImg['weapon'] = 'ge-weapon.gif';
SlotHelp['weapon'] = '';
SlotImg['hand'] = 'ge-naruch.gif';
SlotHelp['hand'] = '';
SlotImg['crossbow'] = 'ge-crossbow.gif';
SlotHelp['crossbow'] = '';
SlotImg['darts'] = 'ge-dart.gif';
SlotHelp['darts'] = '';
SlotImg['shlem'] = 'ge-helm.gif';
SlotHelp['shlem'] = '';
SlotImg['armours'] = 'ge-armor.gif';
SlotHelp['armours'] = '';
SlotImg['boots'] = 'ge-boots.gif';
SlotHelp['boots'] = '';
SlotImg['ring'] = 'ge-ring.gif';
SlotHelp['ring'] = '';
SlotImg['ring1'] = 'ge-ring.gif';
SlotHelp['ring1'] = '';
SlotImg['ring2'] = 'ge-ring.gif';
SlotHelp['ring2'] = '';
SlotImg['ring3'] = 'ge-ring.gif';
SlotHelp['ring3'] = '';
SlotImg['ring4'] = 'ge-ring.gif';
SlotHelp['ring4'] = '';
SlotImg['belt'] = 'ge-belt.gif';
SlotHelp['belt'] = '';
SlotImg['necklace'] = 'ge-necklace.gif';
SlotHelp['necklace'] = '';
SlotImg['gloves'] = 'ge-gloves.gif';
SlotHelp['gloves'] = '';
SlotImg['weapon2'] = 'ge-weapon.gif';
SlotHelp['weapon2'] = '';
SlotImg['raincoat'] = 'ge-cloak.gif';
SlotHelp['raincoat'] = '';
SlotImg['magic1'] = 'ge-spell.gif';
SlotHelp['magic1'] = '';
SlotImg['magic2'] = 'ge-spell.gif';
SlotHelp['magic2'] = '';
SlotImg['magic3'] = 'ge-spell.gif';
SlotHelp['magic3'] = '';
SlotImg['magic4'] = 'ge-spell.gif';
SlotHelp['magic4'] = '';
SlotImg['magic5'] = 'ge-spell.gif';
SlotHelp['magic5'] = '';
SlotImg['magic6'] = 'ge-spell.gif';
SlotHelp['magic6'] = '';
SlotImg['magic7'] = 'ge-spell.gif';
SlotHelp['magic7'] = '';
SlotImg['magic8'] = 'ge-spell.gif';
SlotHelp['magic8'] = '';
SlotImg['magic9'] = 'ge-spell.gif';
SlotHelp['magic9'] = '';
SlotImg['magic10'] = 'ge-spell.gif';
SlotHelp['magic10'] = '';
SlotImg['magic11'] = 'ge-spell.gif';
SlotHelp['magic11'] = '';
SlotImg['magic12'] = 'ge-spell.gif';
SlotHelp['magic12'] = '';
SlotImg['magic13'] = 'ge-spell.gif';
SlotHelp['magic13'] = '';
SlotImg['magic14'] = 'ge-spell.gif';
SlotHelp['magic14'] = '';
SlotImg['magic15'] = 'ge-spell.gif';
SlotHelp['magic15'] = '';
SlotImg['magic16'] = 'ge-spell.gif';
SlotHelp['magic16'] = '';
SlotImg['magic17'] = 'ge-spell.gif';
SlotHelp['magic17'] = '';
SlotImg['magic18'] = 'ge-spell.gif';
SlotHelp['magic18'] = '';
function PrinTimg(slot, imgset, ArrCloth) {
	var alfaTxt = '';
	var goAlfa = 0;
	if ((imgset == '' || imgset == undefined)) {
		if (SlotImg[slot] != null) {
			ImgTxt = layout_url_all + '/subject/defaults/' + SlotImg[slot];
		}
	} else if (slot == 'magic9' && imgset == 'arrow_r.gif' || slot == 'magic18' && imgset == 'arrow_l.gif') {
		ImgTxt = layout_url + '/img/rassa/mframe/' + imgset;
	} else {
		ImgTxt = layout_url_all + '/subject/' + imgset;
	}
	if (slot == 'armours') {
		if (ArrCloth['aarmours2']) {
			var goAlfa = 1;
		}
	}
	if (ArrCloth['a' + slot] || goAlfa == 1) {
		if (ie) {
			alfaTxt = 'style="filter:Alpha(Opacity=\'80\',FinishOpacity=\'60\',Style=\'2\'); background-color:#FF0000"';
		} else {
			alfaTxt = 'style=" background-color:#FF0000"';
		}
	} else {
		alfaTxt = 'class=img';
	}
	if (ArrCloth[slot + '_wid']) {
		wid = ArrCloth[slot + '_wid'];
	} else {
		wid = '';
	}
	var key = '';
	TxtShowhelp = '';
	typeMag = '';
	idMag = '';
	if (ArrCloth['id' + slot] || ArrCloth['bg_' + slot] == 'rm') {
		var idShow = slot;
		if (ArrCloth['mg' + slot]) {
			typeMag = ArrCloth['mg' + slot];
		}
		idMag = ArrCloth['id' + slot];
	} else {
		var idShow = '';
	}
	TxtShowhelp = '  onMouseOut="tip_hd();" onMouseMove="tip_mv(event);" onMouseOver="tip_sh(event,\'' + slot + '\',\'' + ArrCloth['uid']
			+ '\');" ';
	var onclick = ' onClick="Totakeoff(event,\'' + slot + '\',\'' + wid + '\',\'' + typeMag + '\',\'' + idMag + '\');" ';
	if (slot == 'magic9' && imgset == 'arrow_r.gif' || slot == 'magic18' && imgset == 'arrow_l.gif') {
		onclick = null;
	}
	document.write('<img src="' + ImgTxt + '" alt="" border=0 id="' + slot + '" ' + onclick + ' ' + TxtShowhelp + alfaTxt + '>');
}
var ArrCstr = '';
function ClothRetClass(ArrCloth, slot) {
	var Checkslot = 'bg_' + slot;
	if (ArrCloth[Checkslot]) {
		if (ArrCloth[Checkslot] == 'r') {
			return ' id=td"' + slot + '" class=weapon_red';
		}
		if (ArrCloth[Checkslot] == 'y') {
			return 'id=td"' + slot + '" class=weapon_yelow';
		}
		if (ArrCloth[Checkslot] == 'o') {
			return ' id=td"' + slot + '" class=weapon_orange';
		}
		if (ArrCloth[Checkslot] == 'rm') {
			return ' id=td"' + slot + '" class=weapon_red_max';
		}
	} else {
		return '';
	}
}
function ClothRetCenter(type) {
	if (type == '1') {
		return '<table border=0 cellspacing=0 cellpadding=0 style="visibility:hidden;width: 100%; text-align: center; " id=DEF height=119px><tr><td></td><td><input name="shit[]" type=checkbox value=head class=checkboxfire onClick="SelectM(this);"></td><td></td></tr><tr><td><input name="shit[]" type=checkbox value=righthend class=checkboxfire onClick="SelectM(this);"></td><td><input name="shit[]" type=checkbox value=body class=checkboxfire onClick="SelectM(this);"></td><td><input name="shit[]" type=checkbox value=lefthend class=checkboxfire onClick="SelectM(this);"></td></tr><tr><td></td><td><input name="shit[]" type=checkbox value=lags onClick="SelectM(this);"></td><td></td></tr></table>';
	}
	if (type == '2') {
		return '<table border=0 cellspacing=0 cellpadding=0 style="visibility:hidden;width: 100%; text-align: center; height: 179px; " id=ATK><tr valign=middle><td></td><td><input id="fire[head]" type=radio name=fire value=head onClick="SelectRB();"></td><td></td></tr><tr><td><input id="fire[righthend]" type=radio name=fire value=righthend onClick="SelectRB();"></td><td><input id="fire[body]" type=radio name=fire value=body onClick="SelectRB();"></td><td><input id="fire[lefthend]" type=radio name=fire value=lefthend onClick="SelectRB();"></td></tr><tr><td></td><td><input id="fire[lags]" type=radio name=fire value=lags onClick="SelectRB();"></td><td></td></tr></table>';
	}
	if (type == '3')
		return '<table border=0 cellspacing=0 cellpadding=0 style="visibility:hidden; text-align: center; height: 179px; " id=ATK width=50><tr valign=middle><td></td><td><nobr> <input type=checkbox class=checkboxfire name="fire[]" value=head onClick="SelectA(this);"> <input type=checkbox class=checkboxfire name="fire[]" value=head onClick="SelectA(this);"> <input type=checkbox class=checkboxfire name="fire[]" value=head style="visibility:hidden;display:none" onClick="SelectA(this);" id="fire3_1"> <input type=checkbox class=checkboxfire name="fire[]" value=head style="visibility:hidden;display:none" onClick="SelectA(this);" id="fire4_1"> </nobr></td><td></td></tr><tr><td><nobr> <input type=checkbox class=checkboxfire name="fire[]" value=righthend onClick="SelectA(this);"><br><input type=checkbox class=checkboxfire name="fire[]" value=righthend onClick="SelectA(this);"><br><input type=checkbox class=checkboxfire name="fire[]" value=righthend style="visibility:hidden;display:none" onClick="SelectA(this);" id="fire3_2"><br><input type=checkbox class=checkboxfire name="fire[]" value=righthend style="visibility:hidden;display:none" onClick="SelectA(this);" id="fire4_2"> </nobr></td><td><input type=checkbox class=checkboxfire name="fire[]" value=body onClick="SelectA(this);"><br><input type=checkbox class=checkboxfire name="fire[]" value=body onClick="SelectA(this);"><br><input type=checkbox class=checkboxfire name="fire[]" value=body style="visibility:hidden;display:none" onClick="SelectA(this);" id="fire3_3"><br><input type=checkbox class=checkboxfire name="fire[]" value=body style="visibility:hidden;display:none" onClick="SelectA(this);" id="fire4_3"></td><td><nobr> <input type=checkbox class=checkboxfire name="fire[]" value=lefthend onClick="SelectA(this);"><br><input type=checkbox class=checkboxfire name="fire[]" value=lefthend onClick="SelectA(this);"><br><input type=checkbox class=checkboxfire name="fire[]" value=lefthend style="visibility:hidden;display:none" onClick="SelectA(this);" id="fire3_4"><br><input type=checkbox class=checkboxfire name="fire[]" value=lefthend style="visibility:hidden;display:none" onClick="SelectA(this);" id="fire4_4"> </nobr></td></tr><tr><td></td><td><nobr> <input type=checkbox class=checkboxfire name="fire[]" value=lags onClick="SelectA(this);"> <input type=checkbox class=checkboxfire name="fire[]" value=lags onClick="SelectA(this);"> <input type=checkbox class=checkboxfire name="fire[]" value=lags style="visibility:hidden;display:none" onClick="SelectA(this);" id="fire3_5"> <input type=checkbox class=checkboxfire name="fire[]" value=lags style="visibility:hidden;display:none" onClick="SelectA(this);" id="fire4_5"> </nobr></td><td></td></tr></table>';
	return '';
}
function ClothShFlash(url, loader) {
	document.write('<div id="swfid" STYLE="position:absolute;z-index:2;">');
	if (AC_FL_RunContent == 0) {
		alert("This page requires flash.js");
	} else {
		var urlFlash = layout_url_all + '/Hero_obraz/client/ui-loader' + loader + '.swf?srcimg=' + layout_url_all + '/Hero_obraz/' + url
				+ '-s.swf&race=gnome&imgopen=1';
		if (urlFlash != '') {
			AC_FL_RunContent('codebase', 'https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0', 'width',
					'210', 'height', '260', 'align', 'middle', 'src', urlFlash, 'id', 'check_code', 'bgcolor', '#cccccc', 'name',
					'check_code', 'quality', 'high', 'pluginspage', 'https://www.macromedia.com/go/getflashplayer', 'play', 'true', 'loop',
					'false', 'scale', 'noscale', 'wmode', 'transparent', 'devicefont', 'false', 'menu', 'false', 'allowScriptAccess',
					'sameDomain', 'movie', urlFlash, 'salign', '');
		}
	}
	document.write('</div>');
}
function dump(arr, level) {
	var dumped_text = "";
	if (!level)
		level = 0;
	// The padding given at the beginning of the line.
	var level_padding = "";
	for ( var j = 0; j < level + 1; j++)
		level_padding += "    ";
	if (typeof (arr) == 'object') { // Array/Hashes/Objects
		for ( var item in arr) {
			var value = arr[item];
			if (typeof (value) == 'object') { // If it is an array,
				dumped_text += level_padding + "'" + item + "' ...\n";
				dumped_text += dump(value, level + 1);
			} else {
				dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
			}
		}
	} else { // Stings/Chars/Numbers etc.
		dumped_text = "===>" + arr + "<===(" + typeof (arr) + ")";
	}
	return dumped_text;
}
function ClothSh(ArrCstr) {
	// var picTxt='';
	ArrCloth = eval('(' + ArrCstr + ')');
	var picTxt = '';
	if (ArrCloth['pic']) {
		picTxt = 'background="' + layout_url_all + '/Hero_obraz/' + ArrCloth['pic'] + '"';
	}
	if (ArrCloth['u']) {
		picTxt = picTxt + ' title="' + ArrCloth['u'] + '"';
	}
	if (ArrCloth['swf']) {
		ClothShFlash(ArrCloth['swf'], ArrCloth['swfl']);
	}
	document.write('<style type="text/css">.weapon_yelow{background-color:#FFFF00;}.weapon_orange{background-color:#FF8000;}'
			+ '.weapon_red{background-color:#FF0000;}.weapon_red_max{background-color:blue;}'
			+ '.img{CURSOR:pointer;}</style><table border=0 cellspacing=0 cellpadding=0><tr><td>'
			+ '<table border=0 cellspacing=0 cellpadding=0><tr><td ' + ClothRetClass(ArrCloth, 'crossbow') + '>');
	PrinTimg('crossbow', ArrCloth['crossbow'], ArrCloth);
	document.write('</td><td ' + ClothRetClass(ArrCloth, 'darts') + '>');
	PrinTimg('darts', ArrCloth['darts'], ArrCloth);
	document.write('</td><td ' + ClothRetClass(ArrCloth, 'shlem') + '>');
	PrinTimg('shlem', ArrCloth['shlem'], ArrCloth);
	document.write('</td><td><table border=0 cellspacing=0 cellpadding=0 id="cloth_mag1"><tr><td>');
	PrinTimg('magic1', ArrCloth['magic1'], ArrCloth);
	document.write('</td><td>');
	PrinTimg('magic2', ArrCloth['magic2'], ArrCloth);
	document.write('</td><td>');
	PrinTimg('magic3', ArrCloth['magic3'], ArrCloth);
	document.write('</td></tr><tr><td>');
	PrinTimg('magic4', ArrCloth['magic4'], ArrCloth);
	document.write('</td><td>');
	PrinTimg('magic5', ArrCloth['magic5'], ArrCloth);
	document.write('</td><td>');
	PrinTimg('magic6', ArrCloth['magic6'], ArrCloth);
	document.write('</td></tr><tr><td>');
	PrinTimg('magic7', ArrCloth['magic7'], ArrCloth);
	document.write('</td><td>');
	PrinTimg('magic8', ArrCloth['magic8'], ArrCloth);
	// Кнопка переключения на другую закладку
	document.write('</td><td' + (ArrCloth['magic9'] == 'arrow_r.gif' ? ' onclick="showClothMag2()"' : '') + '>');
	PrinTimg('magic9', ArrCloth['magic9'], ArrCloth);
	document.write('</td></tr></table><table border=0 cellspacing=0 cellpadding=0 id="cloth_mag2" style="display: none;"><tr><td>');
	PrinTimg('magic10', ArrCloth['magic10'], ArrCloth);
	document.write('</td><td>');
	PrinTimg('magic11', ArrCloth['magic11'], ArrCloth);
	document.write('</td><td>');
	PrinTimg('magic12', ArrCloth['magic12'], ArrCloth);
	document.write('</td></tr><tr><td>');
	PrinTimg('magic13', ArrCloth['magic13'], ArrCloth);
	document.write('</td><td>');
	PrinTimg('magic14', ArrCloth['magic14'], ArrCloth);
	document.write('</td><td>');
	PrinTimg('magic15', ArrCloth['magic15'], ArrCloth);
	document.write('</td></tr><tr><td>');
	PrinTimg('magic16', ArrCloth['magic16'], ArrCloth);
	document.write('</td><td>');
	PrinTimg('magic17', ArrCloth['magic17'], ArrCloth);
	document.write('</td><td' + (ArrCloth['magic18'] == 'arrow_l.gif' ? ' onclick="showClothMag1()"' : '') + '>');
	PrinTimg('magic18', ArrCloth['magic18'], ArrCloth);
	document.write('</td></tr>');
	document.write('</table></td></tr></table></td></tr><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td rowspan=2>');
	document.write('<table border=0 cellspacing=0 cellpadding=0><tr><td ' + ClothRetClass(ArrCloth, 'hand') + ' >');
	PrinTimg('hand', ArrCloth['hand'], ArrCloth);
	document.write('</td></tr><tr><td ' + ClothRetClass(ArrCloth, 'weapon') + '>');
	PrinTimg('weapon', ArrCloth['weapon'], ArrCloth);
	document.write('</td></tr><tr><td ' + ClothRetClass(ArrCloth, 'armours') + '>');
	PrinTimg('armours', ArrCloth['armours'], ArrCloth);
	document.write('</td></tr><tr><td ' + ClothRetClass(ArrCloth, 'boots') + '>');
	PrinTimg('boots', ArrCloth['boots'], ArrCloth);
	document.write('</td></tr></table></td>');
	if (!ie && !ArrCloth['cntr'])
	{
		document.write('<td height=179 width=100 valign="top" ' + picTxt + '>' + '<img style="cursor:pointer" src="'+layout_url_all+'/img/arrow_swf.jpg" hspace="3" vspace="3" onClick="flashShow(); return false;">' + '</td>');
	} else
	{
		document.write('<td height=179 width=100 align=center" ' + picTxt + '>' + ClothRetCenter(ArrCloth['cntr']) + '</td>');
	}
	document.write('<td rowspan=2><table border=0 cellspacing=0 cellpadding=0><tr><td ' + ClothRetClass(ArrCloth, 'necklace') + '>');
	PrinTimg('necklace', ArrCloth['necklace'], ArrCloth);
	document.write('</td></tr><tr><td ' + ClothRetClass(ArrCloth, 'gloves') + '>');
	PrinTimg('gloves', ArrCloth['gloves'], ArrCloth);
	document.write('</td></tr><tr><td ' + ClothRetClass(ArrCloth, 'weapon2') + '>');
	PrinTimg('weapon2', ArrCloth['weapon2'], ArrCloth);
	document.write('</td></tr><tr><td ' + ClothRetClass(ArrCloth, 'raincoat') + '>');
	PrinTimg('raincoat', ArrCloth['raincoat'], ArrCloth);
	document.write('</td></tr></table></td></tr><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td ' + ClothRetClass(ArrCloth,
			'ring') + '>');
	PrinTimg('ring', ArrCloth['ring'], ArrCloth);
	document.write('</td><td rowspan="2" ' + ClothRetClass(ArrCloth, 'belt') + '>');
	PrinTimg('belt', ArrCloth['belt'], ArrCloth);
	document.write('</td><td ' + ClothRetClass(ArrCloth, 'ring3') + '>');
	PrinTimg('ring3', ArrCloth['ring3'], ArrCloth);
	document.write('</td></tr><tr><td ' + ClothRetClass(ArrCloth, 'ring2') + '>');
	PrinTimg('ring2', ArrCloth['ring2'], ArrCloth);
	document.write('</td><td ' + ClothRetClass(ArrCloth, 'ring4') + '>');
	PrinTimg('ring4', ArrCloth['ring4'], ArrCloth);
	document.write('</td></tr></table></td></tr></table></td></tr>');
}
function showClothMag1() {
	$('cloth_mag2').hide();
	$('cloth_mag1').show();
}
function showClothMag2() {
	$('cloth_mag1').hide();
	$('cloth_mag2').show();
}
function ClothShH(strong, flexibility, intuition, power, reason, uid) {
	document.write('<tr><td class=TD-USERSKILLS><table border=0 cellspacing=0 cellpadding=0 align=center class=TB-USERSKILLS><tr><td><b>'
			+ '<div id="div_strong">С:' + strong + '</div></b></td><td><b><div id="div_flexibility">В:' + flexibility
			+ '</div></b></td><td><b><div id="div_intuition">И:' + intuition + '</div></b></td><td><b><div id="div_power">М:' + power
			+ '</div></b></td><td><b><div id="div_reason">Р:' + reason + '</div></b></td></tr></table>');
	document.write('</tr></table>');
	/*
	document.write('<div id="tipLayer" style="visibility:hidden;display:none;position:absolute;width:230;height:0px;margin:0px;padding:0px;">'
					+ '<table width=260 border=0 cellspacing=0 cellpadding=0 align=center><tr><td height=7><img src="'
					+ layout_url_all
					+ '/img/rassa/mframe/item_desc/bg-itdes-top.gif" alt="" width=213 height=7 border=0></td></tr><tr><td class=TD-id-header>'
					+ '<div id="tipLayerTitle">Подождите...</div></td></tr	<tr><td height=21><img src="'
					+ layout_url_all
					+ '/img/rassa/mframe/item_desc/bg-itdes-middle.gif" alt="" width=213 height=21 border=0></td></tr>'
					+ '<tr><td class=TD-id-middle><div id="tipLayerContent">Загрузка данных...</div></td></tr><tr><td height=7><img src="'
					+ layout_url_all
					+ '/img/rassa/mframe/item_desc/bg-itdes-bottom.gif" alt="" width=213 height=7 border=0></td></tr></table></div>');
						*/
	document.write('<div id="tipLayer" style="visibility:hidden;display:none;position:absolute;margin:0px;padding:0px;z-index:2">'+
	'<table cellpadding="0" cellspacing="0" border="0" width="230">'+
		'<tr><td class="header_bg" colspan="3"><table cellpadding="0" cellspacing="0" border="0" width="100%"><tr valign="top">'+
        '<td><img src="'+layout_url_all+'/img/popup/header_l_t_corn.gif" alt="" /></td>'+
        '<td class="header_bg_top"></td>'+
        '<td><img src="'+layout_url_all+'/img/popup/header_r_t_corn.gif" alt="" /></td></tr>'+
        '<tr><td class="header_bg_l"></td><td class="txt_header pad_10" id="tipLayerTitle">Призрачный клинок</td><td class="header_bg_r"></td></tr>'+
        '<tr>'+
			'<td><img src="'+layout_url_all+'/img/popup/header_l_b_corn.gif" alt="" /></td>'+
			'<td class="header_bg_b" align="center"><img src="'+layout_url_all+'/img/popup/header_patt_b.gif" alt="" /></td>'+
			'<td><img src="'+layout_url_all+'/img/popup/header_r_b_corn.gif" alt="" /></td>'+
        '</tr>'+
      '</table>'+
    '</td>'+
  '</tr>'+
  '<tr>'+
  	'<td class="content_bg" colspan="3">'+
    	'<table cellpadding="0" cellspacing="0" border="0" width="100%">'+
      	'<tr valign="top">'+
        	'<td class="cont_l_bg"><img src="'+layout_url_all+'/img/popup/1px.gif" alt="" width="7" height="1" /></td>'+
          '<td class="pad_5">'+
          	'<table cellpadding="0" cellspacing="1" border="0" width="100%">'+
            '	<tr>'+
             ' 	<td align="center" class="cell_bg" colspan="2"><span class="txt_bold" id="tipLayerDolg">0/40</span></td>'+
             ' </tr>'+
              '<tr align="center">'+
              	'<td colspan="2" id="grade">'+
              	'</td>'+
              '</tr>'+
            '</table>'+
			'<span id="tbl_h"></span>'+
          '</td>'+
          '<td class="cont_l_bg"><img src="'+layout_url_all+'/img/popup/1px.gif" alt="" width="7" height="1" /></td>'+
        '</tr>'+
      '</table>'+
    '</td>'+
  '</tr>'+
  '<tr>'+
  	'<td colspan="3">'+
    	'<table cellpadding="0" cellspacing="0" width="100%" border="0">'+
      	'<tr>'+
        	'<td width="1%"><img src="'+layout_url_all+'/img/popup/cont_corn.gif" alt="" /></td>'+
          '<td class="cont_b_bg"><img src="'+layout_url_all+'/img/popup/1px.gif" alt="" width="1" height="7" /></td>'+
          '<td width="1%" align="right"><img src="'+layout_url_all+'/img/popup/cont_corn.gif" alt="" /></td>'+
     '   </tr>'+
    '  </table>'+
   ' </td>'+

 ' </tr>'+
'</table></div>');


}
function ClothShowMonstr(imgs, type) {
	document.write('<table width=212 height=285 border=0 cellspacing=0 cellpadding=0><tr><td class=TD-MF-ContentBox-TL><img src="'
			+ layout_url_all
			+ '/img/el-blank5px.gif" border=0></td><td class=TD-MF-ContentBox-TC></td><td class=TD-MF-ContentBox-TR><img src="'
			+ layout_url_all + '/img/el-blank5px.gif" border=0></td></tr><tr><td class=TD-MF-ContentBox-ML></td><td background="'
			+ layout_url_all + '/bots/' + imgs
			+ '" class=TD-MF-ContentBoxMidle><table width=194 height=267 border=0 cellspacing=0 cellpadding=0><tr><td><img src="'
			+ layout_url_all + '/img/el-blank1px.gif" border=0></td><td><img src="' + layout_url_all
			+ '/img/el-blank1px.gif" border=0></td><td><img src="' + layout_url_all
			+ '/img/el-blank1px.gif" border=0></td></tr><tr><td width=62><img src="' + layout_url_all
			+ '/img/el-blank1px.gif" border=0></td><td align=center>' + ClothRetCenter(type) + '</td><td width=62><img src="'
			+ layout_url_all + '/img/el-blank1px.gif" border=0></td></tr><tr><td><img src="' + layout_url_all
			+ '/img/el-blank1px.gif" border=0></td><td><img src="' + layout_url_all + '/img/el-blank1px.gif" border=0></td><td><img src="'
			+ layout_url_all + '/img/el-blank1px.gif" border=0></td></tr></table></td><td class=TD-MF-ContentBox-MR></td></tr>'
			+ '<tr><td class=TD-MF-ContentBox-BL><img src="' + layout_url_all
			+ '/img/el-blank5px.gif" border=0></td><td class=TD-MF-ContentBox-BC></td><td class=TD-MF-ContentBox-BR><img src="'
			+ layout_url_all + '/img/el-blank5px.gif" border=0></td></tr></table>');
}
var timerID = 0;
var showdelay = new Array();
var showok = new Array();
function Totakeoff(event, slot, wId, typeMag, idMag) {
	var r, re, slotMagicV, strmag;
	// alert('slot='+slot+' wId='+wId+ ' typeMag='+typeMag+' idmag='+idMag);
	// MagicArrID = mag2;
	// Declare variables.
	// MagicArr = mag1;
	slotObject = document.getElementById(slot);
	slotBattleObject = document.getElementById("weapon_arrow");
	slotBattleObject2 = document.getElementById("weapon_magic_");
	// alert(slotBattleObject);
	if (slotObject != null) {
		var s = slotObject.src;
		r = s.search("mframe");
		r2 = s.search("defaults");
	}
	if (r2 > 0) {
		return '';
	}
	if (slot && r < 0 && r2 < 0 && document.WeaponFormSlot) { // alert(document.getElementById(slot));
		if (slotObject) {
			slotObject.style['background'] = '';
		}
		document.WeaponFormSlot.slot.value = slot;
		document.WeaponFormSlot.submit();
		return ''
	}
	if (slot.search("magic") == 0 && r < 0) {
		magicFlag = 1;
		if (m2 = document.getElementById("login_magic_")) {
			m2.value = "";
		}
	} else {
		magicFlag = 0;
	}
	if (slotBattleObject != null && slot == "crossbow" && r < 0) {
		slotBattleObject.value = "0";
		LastMessageSpan = document.getElementById("LastMessage");
		if (LastMessageSpan != null) {
			LastMessageSpan.innerHTML = "";
		}
	}
	if (slotBattleObject != null && slot == "darts" && r < 0) {
		slotBattleObject.value = "1";
		LastMessageSpan = document.getElementById("LastMessage");
		if (LastMessageSpan != null) {
			// LastMessageSpan.style.class="S-FightTimeOun" ;
			LastMessageSpan.innerHTML = "<font color=green>Выстрелить</font>";
		}
	}
	if (slotBattleObject2 != null && magicFlag && r < 0) {
		slotBattleObject2.value = slot;
		LastMessageSpan2 = document.getElementById("LastMessage2");
		LastMessageSpan2 = document.getElementById("LastMessage2");
		if (LastMessageSpan2 != null) {
			LastMessageSpan2.innerHTML = "";
		}
		if (typeMag == 'ml') {
			ShowMagicLoginAlert(idMag, slot, 0);
		}
		if (typeMag == 'bml') {
			moments_ = document.getElementById("moment_");
			if (moments_ != null) {
				moments_.value = 1;
			}
			ShowMagicLoginAlert(idMag, slot, 1);
			if (LastMessageSpan2 != null) {
				LastMessageSpan2.innerHTML = "<font color=#0000ff> Свиток готов к использованию </font>";
			}
		}
		if (typeMag == '') {
			ShowMagicLoginAlert(idMag, slot, 3);
		}
		if (typeMag == "bm") {
			if (slotMagicV = document.getElementById("slotMagic2_")) {
				slotMagicV.value = slot;
			}
			if (slotMagicV2 = document.getElementById("weapon_magic_")) {
				slotMagicV2.value = idMag;
			}
			if (LastMessageSpan2 != null) {
				LastMessageSpan2.innerHTML = "<font color=#0000ff> Свиток готов к использованию </font>";
			}
		}
	}
	if ((!document.WeaponFormSlot) && wId) {
		window.open("index.php?file=library&weaponID2=" + wId, "_blank",
				"scrollbars=yes,width=800,height=600, location=yes, toolbar=yes,directories=yes,status=yes,menubar=yes,resizable=yes");
	}
	return;
}
function DefaultImages(slot, img, uid) {
	if (slot) {
		slotObject = document.getElementById(slot);
		if ((slotObject != null) && img != null) {
			slotObject.src = img;
			var r2 = img.search("defaults");
			if (r2 > 0) {
				delete(obgItems[uid][slot]);
				slotObject.style['background'] = '';// ='';
			}
		}
	}
	return;
}
function SetHelp(slot, name, d, i, h, ds, uid) {
	obgItems[uid][slot] = {};
	obgItems[uid][slot]['n'] = name;
	obgItems[uid][slot]['d'] = d;
	obgItems[uid][slot]['i'] = i;
	obgItems[uid][slot]['h'] = h;
	obgItems[uid][slot]['ds'] = ds;
}
// %%%%%%%%%%%%%%%%%%%%%%% Ajax %%%%%%%%%%%%%%%%%%%%%%%//
var eventClientX = 0;
var eventClientY = 0;
var idClothMsg = 0;
var weaponId = 0;
var weaponIduid = 0;
var isShowCloth = new Array();
var ie = navigator.appName == "Microsoft Internet Explorer";
function CreateHelps(VO) {
	var TextH = '';
	if (VO.bw) {
		if (VO.w) {
			TextH = TextH + 'Долговечность ' + VO.w + '/' + VO.bw;
		} else {
			TextH = TextH + 'Долговечность 0/' + VO.bw;
		}
	}
	if (VO.shp) {
		TextH = TextH + '<li><font color="blue">умение стрелка : ' + VO.shp + '%</font></li>';
	}
	if (VO.f5) {
		TextH = TextH + '<li>Жизнь:' + VO.f5 + '</li>';
	}
	if (VO.f7) {
		TextH = TextH + '<li>Мана:' + VO.f7 + '</li>';
	}
	if (VO.f51) {
		TextH = TextH + '<li>Минимальный урон:' + VO.f51 + '</li>';
	}
	if (VO.f50) {
		TextH = TextH + '<li>Максимальный урон:' + VO.f50 + '</li>';
	}
	if (VO.f18) {
		TextH = TextH + '<li>Броня головы:' + VO.f18 + '</li>';
	}
	if (VO.f19) {
		TextH = TextH + '<li>Броня корпуса:' + VO.f19 + '</li>';
	}
	if (VO.f24) {
		TextH = TextH + '<li>Броня рук:' + VO.f24 + '</li>';
	}
	if (VO.f21) {
		TextH = TextH + '<li>Броня ног:' + VO.f21 + '</li>';
	}
	if (VO.f52) {
		TextH = TextH + '<li>Дополнительная защита min:' + VO.f52 + '</li>';
	}
	if (VO.f53) {
		TextH = TextH + '<li>Дополнительная защита max:' + VO.f53 + '</li>';
	}
	if (VO.fi) {
		TextH = TextH + '<li>Износ в бою:' + VO.fi + '%</li>';
	}
	if (VO.dscr) {
		TextH = TextH + '<i>' + VO.dscr + '</i>';
	}
	if (VO.tr) {
		TextH = TextH + '<li>Увечье на ' + VO.trH + ' часов ' + VO.trM + ' мин.</li>';
	}
	return TextH;
}
function SetRedSlot(slot) {
	slotObject = document.getElementById(slot);
	if (slotObject) {
		slotObject.style['background'] = '#ff0000';// ='';
	}
}
var helpCasheClothX = new Array();

function _showClothEl()
{
	isShowCloth[weaponId] = true;
	clothLayer = $("tipLayer");
	try
	{
		if (obgItems && obgItems[weaponIduid] && obgItems[weaponIduid][weaponId] && obgItems[weaponIduid][weaponId]['n'])
		{
			var arrWeapon = obgItems[weaponIduid][weaponId];
			if ($("tipLayerTitle"))
			{
				$("tipLayerTitle").innerHTML = '';
				if (arrWeapon['n'])
				{
					$("tipLayerTitle").innerHTML = arrWeapon['n'];
				}
			}
			if ($("tbl_h"))
			{
				var tbl = '<table class="txt" cellpadding="1" cellspacing="1" border="0" width="100%">';
				var params = arrWeapon['h'].split(';');
				for (var p = 0;p < params.length-1; p++)
				{
					var param1 = params[p].split(':');
					var h = param1[1].replace(/@r/g, '<span class="red">');
					var h = h.replace(/@g/g, '<span class="green">');
					var h = h.replace(/@b/g, '<span class="blue">');
					var h = h.replace(/@s/g, '</span>');

					tbl += '<tr>'+
						'<td class="cell_bg" nowrap>'+param1[0]+'</td>'+
						'<td class="cell_bg2" align="center" nowrap>'+h+'</td>'+
						'</tr>';
				}
				if (arrWeapon['ds'] && arrWeapon['ds'] != '')
				{
					tbl += '<tr>'+
						'<td class="blue2" colspan="2" align="center"><i>'+arrWeapon['ds']+'</i></td>'+
						'</tr>';
				}
				tbl += '</table>';
				$("tbl_h").innerHTML = tbl;

				var g = '<table cellpadding="0" cellspacing="1" border="0" width="100%">'+
                '	<tr align="center">';
				if (arrWeapon['i'] && arrWeapon['i'] != '')
				{
					var paramsgr = arrWeapon['i'].split(';');
					for (var p = 0;p < paramsgr.length-1; p++)
					{
						var param1gr = paramsgr[p].split(':');
						var color = 'blue';
						var name = 'patch';
						if (param1gr[0] == 2) {color = 'red';name = 'zatochka';}
						if (param1gr[0] == 3) {color = 'green';name = 'grayd';}
						g += '<td><table align="center" cellpadding="0" cellspacing="0"><tr><td><img src="'+layout_url_all+'img/popup/'+name+'.gif" align="absmiddle" /></td><td><span class="txt_bold '+color+'">'+param1gr[1]+'</span></td></tr></table></td>';
					}
				}
				g += '</tr></table>';
				$("grade").innerHTML = g;
				$("tipLayerDolg").innerHTML = 'Долговечность: '+arrWeapon['d'];
				if (arrWeapon['travma'] && arrWeapon['travma'] == 1)
				{
					$("tipLayerDolg").innerHTML = '<li>Увечье на '+arrWeapon['h']+' час. '+arrWeapon['m']+' мин.</li>';
				}
			}
			clothLayer.style.left = eventClientX + 15;
			clothLayer.style.top = eventClientY;
			clothLayer.style.z = 99;
			clothLayer.style.visibility = "visible";
			clothLayer.style.display = "block";
		}
	}
	catch (e)
	{
		if (e instanceof Error) {alert(e.name + ': ' + e.message);}
	}
}

function _showClothEl_old() {
	isShowCloth[weaponId] = true;
	clothLayer = $("tipLayer");
	try {
		if (weaponIduid > 0)
		{
			if (SlotHelp[weaponId] == '') {
				var keys = 'h_' + weaponId + weaponIduid;

			if (typeof (window[keys]) == "undefined") {
					return "";
				}
				if (keys) {
					var Vk = eval(keys);
					if (Vk) {
						VO = eval("(" + Vk + ")");
					}
				} else {
					return '';
				}
			} else // Уст другую подсказку
			{
				var keys = SlotHelp[weaponId];

			if (keys == ' ') {
					return '';
				}
				VO = eval("(" + keys + ")");
			}
			if (VO) {
				if (VO.n) {
					$("tipLayerTitle").innerHTML = VO.n;
				}
				$("tipLayerContent").innerHTML = CreateHelps(VO);

				if (VO.wid)
				{ if (helpCasheClothX[VO.wid])
				  	{
						$("tipLayerContent").innerHTML +=helpCasheClothX[VO.wid];
					}else
					{
					 	GetDescribeAdjax(VO.wid);
						$("tipLayerContent").innerHTML +='<div id=\'hl_'+VO.wid+'\'>Загрузка характеристики...</div>';
					}
				}
			}
		}

		clothLayer.style.left = eventClientX + 15;
		clothLayer.style.top = eventClientY;
		clothLayer.style.z = 99;
		clothLayer.style.visibility = "visible";
		clothLayer.style.display = "block";
	} catch (e) {
		if (e instanceof Error) {
			alert(e.name + ': ' + e.message);
		}
	}
}
function hideCloth() {
	isShowCloth[weaponId] = false;
	clothLayer = $("tipLayer");
	clothLayer.style.visibility = "hidden";
	clothLayer.style.display = "none";
}
function tip_sh(event, idmsg, uid) {
	weaponId = idmsg;
	weaponIduid = uid;
	// idmsg?parseInt(idmsg.substring(5, idmsg.length)):0;
	if (weaponId) {
		idClothMsg = 'tipLayer';
		eventClientX = ie ? window.event.clientX : event.clientX;
		eventClientY = ie ? window.event.clientY : event.clientY;
		var _time = 500;
		timerID = setTimeout("_showClothEl();", _time);
	}
}
function tip_mv(event) {
	eventClientX = ie ? window.event.clientX : event.clientX;
	eventClientY = ie ? window.event.clientY : event.clientY;
	if (isShowCloth[weaponId] != undefined && isShowCloth[weaponId] == 1) {
		clothLayer = $("tipLayer");
		clothLayer.style.left = eventClientX + 15;
		clothLayer.style.top = eventClientY;
	}
}
function tip_hd() {
	hideCloth();
	clearTimeout(timerID);
}
// %%%%%%%%%%%%%%%%%%%%%%% End Ajax %%%%%%%%%%%%%%%%%%%%%%%//
function ShowMagicLoginAlert(wID, slot, types) {
	if (l = document.getElementById("usemagic")) {
		if (m = document.getElementById("frm_usemagic")) {
			m.MagicweaponID.value = "";
			m.slotMagic.value = "";
			m.login.value = "";
			m2 = document.getElementById("login_magic_");
			m2.value = "";
			if (types == 3) {
				if (l2 = document.getElementById("magic_login")) {
					l2.style.visibility = "hidden";
				}
				if (l3 = document.getElementById("magic_battle")) {
					l3.style.visibility = "";
					l3.style.display = "";
				}
			}
			if (types == 0) {
				m.MagicweaponID.value = wID;
				m.slotMagic.value = slot;
			}
			if (types == 1) {
				m.MagicweaponID.value = wID;
				m.slotMagic.value = slot;
			}
			l.style.visibility = "";
			l.style.display = "";
		}
	}
}
function opw(url, w, h, sb) {
	if (ie) {
		atr = '';
		if (w) {
			atr = atr + 'dialogWidth:' + w + 'px;';
			atr = atr + 'dialogHeight:' + h + 'px;';
		} else {
			atr = atr + 'dialogWidth:700px;';
			atr = atr + 'dialogHeight:500px;';
		}
		atr = atr + 'toolbar:no;';
		if (sb) {
			atr = atr + 'scroll:no;';
		} else {
			atr = atr + 'scroll:yes;';
		}
		// atr = atr + 'location:no;';
		atr = atr + 'status:no;';
		atr = atr + 'menubar:no;';
		atr = atr + 'resizable:no;';
		new_window = showModalDialog(url, '', atr);
		// alert(new_window);
		// new_window.focus();
	} else {
		atr = '';
		atr = atr + 'toolbar=no,';
		if (sb) {
			atr = atr + 'scrollbars=no,';
		} else {
			atr = atr + 'scrollbars=yes,';
		}
		atr = atr + 'location=no,';
		atr = atr + 'statusbar=no,';
		atr = atr + 'menubar=no,';
		atr = atr + 'resizable=no,';
		if (w) {
			atr = atr + 'width=' + w + ',';
			atr = atr + 'height=' + h;
		} else {
			atr = atr + 'width=700,';
			atr = atr + 'height=500';
		}
		new_window = window.open(url, 'popup', atr);
		// new_window.focus();
	}
}
var startAjax=0;
var WidAdjax=0;
function GetDescribeAdjax(widTable)
{ 	if (startAjax)
		{
			return;
		}
	startAjax=1;
	WidAdjax=widTable;
	var url = '/index.php';
	var pars = 'file=object_ajax&action=object_magicF&widTable='+widTable;
	var myAjax = new Ajax.Request(url, {method: 'get', parameters: pars, onComplete: _showDetailMagic});
	startAjax=0;
}

function _showDetailMagic(originalRequest) {
	if (WidAdjax>0)
	{
		var tmpHelps=$('hl_'+WidAdjax);
		if (tmpHelps)
		{
			tmpHelps.innerHTML = originalRequest.responseText;
			helpCasheClothX[WidAdjax]=originalRequest.responseText;
		}
	}

//$('detail_'+id)
	//_showDetailEl ();
}

function AddAjaxItems()
{

}
