var opened_rankings;
opened_rankings = 0;
function switch_linky()
{
    var cLinky = document.getElementById('hidden_linky');
    if (cLinky.style.display == 'block')
    {
        cLinky.style.display = 'none';
    } else {
        cLinky.style.display = 'block';
    }

    return false;
}
function switch_rankings()
{
    var cRank = document.getElementById('hidden_rankings');
    var cFrame = document.getElementById('rankings_iframe');
    if (cRank.style.display == 'none')
    {
        if (opened_rankings == 0)
        {
            cFrame.src = 'http://www.mtg.sk/rankings.php';
            opened_rankings = 1;
        }
        cRank.style.display = 'block';
    } else {
        cRank.style.display = 'none';
    }

    return false;
}
function show_card(s)
{
inner_card_frame.location.href='/searchCard.php?vName='+s;
}
function open_card(t)
{
    window.open('/search_card.php?vName='+t,'search_card','width=220,height=450,scrollbars=0');
}
function fantasy_card(t)
{
    window.open('/fantasy_card.php?vName='+t,'fantasy_card','width=220,height=450,scrollbars=0');
}
function submitIt(id)
{
document.getElementById(id).submit();
return false;
}
function switchVisibility(what,button)
{
	if (document.all[what].style.display == 'none')
	{
		document.all[what].style.display = 'block';
		document.all[button].src = '/img/skins/km/minus.gif';
        document.cookie = what+'=minus; expires=Thu, 14-Jun-2017 00:00:01 GMT';
	} else {
		document.all[what].style.display = 'none';
		document.all[button].src = '/img/skins/km/plus.gif';
        document.cookie = what+'=plus; expires=Thu, 14-Jun-2017 00:00:01 GMT';
	}
}
function e(o){return document.getElementById(o)}
function go(url){location.href=url;}
function show_fullsize_image(img)
{
e('show_fullsize_image_image').src=img;
e('show_fullsize_image_div').style.display = 'block';
e('show_fullsize_image_inner_div').top = e('show_fullsize_image_image').height;
e('show_fullsize_image_inner_div').style.marginTop = -e('show_fullsize_image_image').height/2;
e('show_fullsize_image_inner_div').style.width = e('show_fullsize_image_image').width + 40;
window.setTimeout("dynamize_fullsize_image()", 200);
}
function dynamize_fullsize_image()
{
e('show_fullsize_image_inner_div').top = e('show_fullsize_image_image').height;
e('show_fullsize_image_inner_div').style.marginTop = -e('show_fullsize_image_image').height/2;
e('show_fullsize_image_inner_div').style.width = e('show_fullsize_image_image').width + 40;
}
function show_fullsize_image_ie(img)
{
e('show_fullsize_image_image').src=img;
e('show_fullsize_image_div').style.display = 'block';
e('show_fullsize_image_inner_div').style.width = e('show_fullsize_image_image').width + 40;
window.setTimeout("dynamize_fullsize_image_ie()", 200);
}
function dynamize_fullsize_image_ie()
{
e('show_fullsize_image_inner_div').top = e('show_fullsize_image_image').height;
e('show_fullsize_image_inner_div').style.width = e('show_fullsize_image_image').width + 40;
}
function x(o)
{
    var tmp;
    var p = e(o);
    tmp = 0;
    while(p && p.offsetParent)
    {
        p = p.offsetParent;
        tmp += p.offsetLeft;
    }
    return tmp;
}
function y(o)
{
    var tmp;
    var p = e(o);
    tmp = 0;
    while(p && p.offsetParent)
    {
        p = p.offsetParent;
        tmp += p.offsetTop;
    }
    return tmp;
}
function getXbyID(id)
{
    var abs_pos;
    abs_pos = 0;
    el = id;
    while(el.offsetParent != null)
    {
        el = el.offsetParent;
        if (el.offsetLeft != null) abs_pos += el.offsetLeft;
    }
    return abs_pos;    
}

function getYbyID(id)
{
    var abs_pos;
    abs_pos = 0; 
    el = id;
    while(el.offsetParent != null)
    {
        el = el.offsetParent;
        if (el.offsetLeft != null) abs_pos += el.offsetTop;
    }
    return abs_pos;    
}
function showCardNextToDecklist(o2,offsetX,offsetY,cardname)
{
    e('decklistCardImageSrc').src = cardname;
    moveObjectRelativeTo(e('decklistCardImageHolder'),o2,offsetX,offsetY);
}
function moveObjectRelativeTo(o1,o2,offsetX,offsetY)
{
    o1.style.top = getYbyID(o2)+offsetY;
    o1.style.left = getXbyID(o2)+offsetX;
    o1.style.display = 'block';
}
