var hWnd = null;

function showText(id)
{
	document.getElementById('link_' + id + '_off').style.display = 'none';
	document.getElementById('link_' + id + '_on').style.display = 'block';
	document.getElementById('text_' + id).style.display = 'block';
}

function hideText(id)
{
	document.getElementById('link_' + id + '_off').style.display = 'block';
	document.getElementById('link_' + id + '_on').style.display = 'none';
	document.getElementById('text_' + id).style.display = 'none';
}
function showbattle(battleid)
{
//	var battleid;
//	battleid = document.forms['battleid'];
//	battleid = battleid['id'].value;
	if(hWnd != null)
		hWnd.close();
//	hWnd = window.open('http://www.deathwing.ru/exp.php','','width=800,height=300,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=yes');
	hWnd = window.open('http://www.timezero.ru/sbtl.swf?battleid=' + battleid + '&language=ru','','width=1000,height=400,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no');
}

// **************************
// подсказки для статей
// **************************

dx = 10;
dy = -20;

function showArticleHint(article_id)
{
	document.getElementById('hint' + article_id).style.left = event.x + dx;
	document.getElementById('hint' + article_id).style.top = event.y + dy + document.body.scrollTop;
	document.getElementById('hint' + article_id).style.visibility = 'visible';
}

function hideArticleHint(article_id)
{
	document.getElementById('hint' + article_id).style.visibility = 'hidden';
}

function moveArticleHint(article_id)
{
	document.getElementById('hint' + article_id).style.left = event.x + dx;
	document.getElementById('hint' + article_id).style.top = event.y + dy + document.body.scrollTop;
}

// **************************
// конец подсказок для статей
// **************************

function showInfo(login, e){
	if (!login.length) { Out(); return; }
	var obj = document.getElementById("inf0");
		obj.innerHTML = '<table width=300 height=350 border=0 cellspacing="0" cellpadding="0"><tr><td><table border=1 height=15 width=100% cellspacing="0" cellpadding="0" bordercolor="#000000" bordercolordark="#000000" bordercolorlight="#000000"><tr><td width=100% bgcolor="#990000" bordercolor="#990000" bordercolorlight="#990000" bordercolordark="#990000" style="cursor:move"><font color="#FFFFFF"><b>Information about '+login+'</b></font></td><td style="cursor:hand" onclick="Out();" bgcolor="#808080" bordercolorlight="#000000" bordercolordark="#FFFFFF"><font color="#FFFFFF"><b>&nbsp;X&nbsp;</b></font></td></tr></table></td></tr><tr><td>'+
		'<iframe frameborder=0 marginwidth=0 marginheight=0 scrolling="no" width="300" height="335" id="info" src="http://www.timezero.ru/info.swf?login='+login+'"></iframe></td></tr></table>';
	obj.style.visibility = "visible";
	obj.style.left = document.body.scrollLeft + (e.clientX < document.body.clientWidth/2 ? e.clientX + 15 : e.clientX - 285);
	obj.style.top = document.body.scrollTop + (e.clientY+335 > document.body.clientHeight ? document.body.clientHeight-350 : e.clientY + 5);
}
function Out(){
	var obj = document.getElementById("inf0");
	if (obj) obj.style.visibility = "hidden";
}
var currentX, currentY, whichEl;
currentX = currentY = 0;
whichEl = null;
function grabEl()
{
 whichEl = event.srcElement;
 while (whichEl.id.indexOf("inf0") == -1)
 {
 whichEl = whichEl.parentElement;
 if (whichEl==null) { return; }
 };
 whichEl.style.pixelLeft = whichEl.offsetLeft;
 whichEl.style.pixelTop = whichEl.offsetTop;
 currentX = (event.clientX + document.body.scrollLeft);
 currentY = (event.clientY + document.body.scrollTop);
 };
 function moveEl()
 {
 if (whichEl==null)
 {
 return
 };
 newX = (event.clientX + document.body.scrollLeft);
 newY = (event.clientY + document.body.scrollTop);
 distanceX = (newX - currentX);
 distanceY = (newY - currentY);
 currentX = newX;
 currentY = newY;
 whichEl.style.pixelLeft += distanceX;
 whichEl.style.pixelTop += distanceY;
 event.returnValue = false;
 };
 function dropEl()
 {
 if(whichEl!=null)
 {
 var oid;
 oid = whichEl.objectid;
 currentX = whichEl.style.pixelLeft;
 currentY = whichEl.style.pixelTop;
 whichEl=null;
vx=currentX;vy=currentY;
 }
 whichEl=null;
 };
 function checkEl()
 {
 if (whichEl!=null) 
 {
 return false;
 }
 };
  document.onmousedown = grabEl; document.onmousemove = moveEl; document.onmouseup = dropEl; document.onselectstart = checkEl;