
function artifactAlt(obj, evnt, show) {
	var art_id = obj.getAttribute('div_id');
	var artifact_alt = gebi('artifact_alt');
	if (!artifact_alt) return;

	var act1 = obj.getAttribute('act1');
	var act2 = obj.getAttribute('act2');
	var act3 = obj.getAttribute('act3');
	if (act3 == 0) act3 = '' // костыль что бы не переименовывать картинки в локализациях
	if (show == 2) {
		document.onmousemove=function(e) {artifactAlt(obj, e||event, 1);}

		if (!artifact_alt.getAttribute('art_id') || obj.getAttribute('div_id') != artifact_alt.getAttribute('art_id')) {
			if (art_alt[art_id] && art_alt[art_id] != undefined) {
				artifact_alt.innerHTML = renderArtifactAlt(art_id);
			}
			artifact_alt.setAttribute('art_id',obj.getAttribute('div_id'));
		}

		artifact_alt.style.display = 'block';
		if (act1 || act2 || act3) {
			_background(obj, (locale_path + "images/itemact-"+ act1) + act2 + (act3 +".gif"));
		}

		obj = obj;
//		if (show_alt) {
//			show_alt();
//		}
	}
	if (!show) {
		if (act1 || act2 || act3) {
			_background(obj, 'images/d.gif');
		}
		artifact_alt.style.display = 'none';
		document.onmousemove=function(){}
		return;
	}

	var coor = getCoords(obj);
	var ex = evnt.clientX;
	var ey = evnt.clientY + (document.documentElement.scrollTop || document.body.scrollTop);

	if (act1 || act2 || act3) {
		obj.style.cursor = 'pointer'
		obj.onclick = (act1 != 0 ? function(){try{artifactAct(obj, act1)}catch(e){}} : function(){showArtifactInfo(obj.getAttribute('aid'), obj.getAttribute('art_id'))});
		_background(obj, (locale_path + "images/itemact-"+ act1) + act2 + (act3 + ".gif"));
		var coord = getCoords(obj)
		var cont = gebi("item_list")
		var rel_x = (ex + cont.scrollLeft - coord.l - coor.l)
		if (rel_x >= 40) {
			var rel_y = (ey + cont.scrollTop - coord.t - coor.t)
			if (rel_y < 20) {
				if (obj.getAttribute('store')) { // в магазине при клике на info необходимо выводить товар по артикулу
					obj.onclick = function(){showArtifactInfo(false, obj.getAttribute('art_id'))};
				} else {
					obj.onclick = function(){showArtifactInfo(obj.getAttribute('aid'))}
				}
				_background(obj, locale_path + 'images/itemact_info' + act2 + (act3 + '.gif'));
				try{obj.style.cursor = 'hand'} catch(e){}
				try{obj.style.cursor = 'pointer'} catch(e){}
			}
			if (act2 != 0 && rel_y >= 40) {
				obj.onclick = function(){try{artifactAct(obj, act2)}catch(e){}}
				_background(obj, locale_path + 'images/itemact_drop' + act2 + (act3 + '.gif'));
				try{obj.style.cursor = 'hand'} catch(e){}
				try{obj.style.cursor = 'pointer'} catch(e){}
			}
		}
		if (act3 > 0 && rel_x < 20) {
			var rel_y = (ey + cont.scrollTop - coord.t - coor.t);
			if (rel_y < 20) {
				obj.onclick = function(){try{artifactAct(obj, act3)}catch(e){}};
				_background(obj, locale_path + 'images/itemact_use' + act2 + (act3 + '.gif'));
				try {obj.style.cursor = 'hand'} catch(e){}
				try {obj.style.cursor = 'pointer'} catch(e){}
			}
		}
	}
	var x = ex + artifact_alt.offsetWidth > document.body.clientWidth - 20 ? ex - artifact_alt.offsetWidth - 10 : ex + 10;
	var y = ey + artifact_alt.offsetHeight > (document.documentElement.clientHeight||document.body.clientHeight) - 30 ? ey - artifact_alt.offsetHeight - 10 : ey + 30;

	artifact_alt.style.left = x + 'px';
	artifact_alt.style.top = y + 'px';
	return;
}

function renderArtifactAlt(id) {
	var a = art_alt[id];
	var bg = false;
	var i = 0;
	var content = '';

	content += '<div class="art-alt-new">';
	content += '<div class="head"><div class="h-l"><div class="h-r" style="' + a.color + '">' + a.title + '</div></div></div>';
	content += '<div class="t-l"><div class="t-r"></div></div>';
	content += '<div class="m-l"><div class="m-r"><div class="m-c">';
	content += '<!-- ' + a.image + ' -->';
	if (a.count && a.count != undefined) {
		content += '<div class="bpdig">' + a.count + '</div>';
	} else if (a.enchant_icon && a.enchant_icon != undefined) {
		content += a.enchant_icon;
	} else {
		content += '';
	}
	if (a.epic && a.epic != undefined) {
		content += '<div class="epic">';
		content += '<!-- Эпичность предмета -->';
		content += '<div class="e-bar">';
		content += '<div class="empty"><div class="e-bar-l"></div><div class="e-bar-r"></div><div class="e-bar-c"></div></div>';
		content += '<div class="full" style="width: 56%;"><div class="e-bar-l"></div><div class="e-bar-r"></div><div class="e-bar-c"></div></div>';
		content += '<div class="val">1000/1500</div>';
		content += '</div>';
		content += '</div>';
	}
	content += '<div>';
	content += '<ul class="art-info">';
	content += '<li><img src="images/type.gif" width="11" height="10" align="absmiddle">&nbsp;' + a.kind + '</li>';
	if (a.dur && a.dur != undefined) {
		content += '<li><img src="images/durability.png" width="11" height="10" align="absmiddle"> <span class="red">' + a.dur + '</span>/' + a.dur_max + '</li>';
	}
	if (a.price && a.price != undefined) {
		content += '<li class="b red"><img src="images/price.png" width="11" height="10" align="absmiddle">' + a.price + '</li>';
	}
	if (a.com && a.com != undefined) {
		content += '<li class="b red">' + a.com.title + ' ' + a.com.value + '</li>';
	}
	if (a.owner && a.owner != undefined) {
		content += '<li><b class="b red">' + a.owner.title + '</b>' + a.owner.value + '</li>';
	}
	if (a.lev && a.lev != undefined) {
		content += '<li><img src="images/level.png" width="11" height="10" align="absmiddle"> ' + a.lev.title + ' <b class="red">' + a.lev.value + '</b></li>';
	}
	if (a.trend && a.trend != undefined) {
		content += '<li><img src="images/style_' + a.trend_num + '.png" width="11" height="10" align="absmiddle">&nbsp;' + a.trend + '</li>';
	}
	if (a.cls && a.cls != undefined) {
		content += '<li><img src="images/class.gif" width="11" height="10" align="absmiddle"> ';
		for (i in a.cls) {
			content += a.cls[i];
		}
		content += '</li>'
	}
	content += '</ul>';
	if (a.magic && a.magic != undefined) {
		content += '<div class="magic double"><div class="circle-frame"></div></div>';
	}
	content += '<table>';
	if (a.skills && a.skills != undefined) {
		for (i in a.skills) {
			content += '<tr class="' + (bg ? 'bg-2' : '') + '"><td>' + a.skills[i].title + '</td><td class="red" align="right">' + a.skills[i].value + '</td></tr>';
			bg = !bg;
		}
	}
	if (a.skills_e && a.skills_e != undefined) {
		for (i in a.skills_e) {
			content += '<tr class="' + (bg ? 'bg-2' : '') + '"><td>' + a.skills_e[i].title + '</td><td class="red" align="right">' + a.skills_e[i].value + '</td></tr>';
			bg = !bg;
		}
	}
	if (a.enchant && a.enchant != undefined) {
		content += '<tr class="' + (bg ? 'bg-2' : '') + '"><td>' + a.enchant.title + '</td><td class="red" align="right">' + a.enchant.value + '</td></tr>';
		bg = !bg;
	}
	if (a.enchant_mod && a.enchant_mod != undefined) {
		content += '<tr class="' + (bg ? 'bg-2' : '') + '"><td>' + a.enchant_mod.title + '</td><td class="red" align="right">' + a.enchant_mod.value + '</td></tr>';
		bg = !bg;
	}
	if (a.set && a.set != undefined) {
		content += '<tr class="' + (bg ? 'bg-2' : '') + '"><td>' + a.set.title + '</td><td class="red" align="right">' + a.set.value + '</td></tr>';
		bg = !bg;
	}
	if (a.exp && a.exp != undefined) {
		content += '<tr class="' + (bg ? 'bg-2' : '') + '"><td>' + a.exp.title + '</td><td class="grnn b" align="right">' + a.exp.value + '</td></tr>';
		bg = !bg;
	}
	if (a.change && a.change != undefined) {
		content += '<tr class="' + (bg ? 'bg-2' : '') + '"><td colspan="2" class="redd b">' + a.change + '</td></tr>';
		bg = !bg;
	}
	if (a.boe && a.boe != undefined) {
		content += '<tr class="' + (bg ? 'bg-2' : '') + '"><td colspan="2" class="redd b">' + a.boe + '</td></tr>';
		bg = !bg;
	}
	if (a.note && a.note != undefined) {
		content += '<tr class="' + (bg ? 'bg-2' : '') + '"><td colspan="2">' + a.note + '</td></tr>';
		bg = !bg;
	}
	if (a.engrave && a.engrave != undefined) {
		content += '<tr class="' + (bg ? 'bg-2' : '') + '"><td colspan="2">' + a.engrave + '</td></tr>';
		bg = !bg;
	}
	if (a.desc && a.desc != undefined) {
		content += '<tr class="' + (bg ? 'bg-2' : '') + '"><td colspan="2">' + a.desc + '</td></tr>';
		bg = !bg;
	}
	content += '</table>';
	content += '</div>';
	content += '</div></div></div>';
	content += '<div class="b-l"><div class="b-r"></div></div>';
	content += '</div>';

	return content;
}

