﻿function hideFootnotePopUp()
{
    var div = GE('current_footnote');
    if (div != null)
    {
	div.className = 'footnote_new';
        SetDisplay(div, 'none');
	SetPositionXY(div, 0, 0);
    }
    return false;
}

function showFootnotePopUp(evt, id)
{
	var evt = evt || window.event;
	var o = evt.target || evt.srcElement;

	//Create new element
	var f = document.getElementById('current_footnote');
	if (f == null)
	{
		f = document.createElement('div');
		f.setAttribute('id', 'current_footnote');
		f.style.position = 'absolute';
		f.style.top = '0px';
		f.style.left = '0px';
		f.style.width = '200px';
		f.style.height = 'auto';
		f.style.background = '#fbfbe5';
		f.style.border = '#c3c3c3 1px solid';
		f.style.color = '#666666';
		f.style.display = 'none';
		f.style.fontSize = '11px';
		f.style.padding = '3px';
		f.style.position = 'absolute';
		f.style.zIndex = '10000';

		f.setAttribute('class', 'footnote_new');
		f.setAttribute('onclick', 'return hideFootnotePopUp();');
		document.body.appendChild(f);
	}

	f.innerHTML = '<img src="http://www.alania.mts.ru/upload/images/design/x.gif" height="13" width="13" border="0" id="x_image" style="cursor:pointer;float:right;" onclick="return hideFootnotePopUp();" /><div style="padding: 10px 13px">' + document.getElementById(id).innerHTML + '</div>';
	f.className = 'footnote_new_active';

	f.style.display = 'block';

	var o_coords = GetPosition(o);
	SetPosition(f, o_coords);
        return BlockEvent(evt);
}

function goto(id)
{
	var el = document.getElementById(id);
	if (el == null || typeof (el) == 'undefined') return;
	el.scrollIntoView();
}


//=============СТАРЫЕ ФУТНОТЫ

function hideFootnotes()
{
    return hideFootnotePopUp();
}

function showFootnote(evt, id)
{
    return showFootnotePopUp(evt, id);
}
