// JavaScript Document
dirImages = '/reklama.bzcompany.cz/images/';

function getElement(name)
{
    if (document.getElementById)
    return document.getElementById(name)
    else if (document.all)
    return document.all.name
    return false;
}

function trySubmit (id)
{
    if ( form = getElement(id) ) form.submit();
}

function unBlur(element)
{
    if ( element.blur ) element.blur();
}

function preloadImage()
{
    images = new Array();
	for ( var i=0; i < arguments.length; i++ )
    {
        images[i] = new Image(25, 25);
        images[i].src = dirImages + arguments[i];
        //images[i].onerror = onerror;
	}
}

function toggle()
{
	for ( var i=0; i < arguments.length; i++ )
    {
        if ( e = getElement(arguments[i]) )
        {
            e.style.display = ((e.style.display == 'none') || ((e.style.display=='') && (e.offsetWidth==0))) ? 'block' : 'none';
        }
	}
}

function onLoad()
{
    unBlurAllLinks();
}

    function unBlurAllLinks()
    {
        rList = document.getElementsByTagName('A');
        for (var i = 0; i < rList.length; i++)
        {
            rList[i].onfocus = new Function('if (this.blur) this.blur();');
        }
    }

function inputLoginEventOnFocus()
{
    if ( e = getElement('inputLogin') )
    {
        if ( e.value == 'přihlašovací jméno' )
            e.value = '';
        else
            e.oldvalue = e.value;
    }
}

function foc()
{
    if (f = getElement('focusThis'))
    {
        f.focus();
    }
}

function popUp(type, id, x, y)
{
    switch (type)
    {
        case 'banner':
            if (!x)
                x=640;
            if (!y)
                x=480;
            nw = window.open(dirImages+'../file.php?s=banner&id='+id+'&o=html','Foto','width='+x+', height='+y+', toolbar=0, scrollbars=yes, resizable');
            break;
    }
    if ( typeof(nw) != 'undefined' )
        nw.focus();
}

function popupText(url)
{
    nw = window.open(url,'PopUp','width=700, height=200, toolbar=0, scrollbars=yes, resizable');
    if ( typeof(nw) != 'undefined' )
    {
        //nw.document.getElementsByTagName('body')[0].innerHTML = '1';
        nw.focus();
    }
}

window.onload = onLoad;
