    var showDelay = 200;
    var showDelayStep = 40;

/*    var agt=navigator.userAgent.toLowerCase();
    var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));

    if (document.layers)
        document.captureEvents (Event.MOUSEMOVE);
    document.onmousemove = mouseTrack;

    function mouseTrack (e) {
        if (document.layers) {
            currentMouseX = e.pageX;
            currentMouseY = e.pageY;
        } else {
            currentMouseX = event.x;
            currentMouseY = event.y;
        }
   }
*/
    function resize (name, width, height) {
        document.getElementById (name).width = width;
        document.getElementById (name).height = height;
    }

    function hideObject (name) {
        cyclesCount = showDelay / showDelayStep;
        widthStep = document.getElementById (name).width / cyclesCount;
        heightStep = document.getElementById (name).height / cyclesCount;
        for (n = cyclesCount; n > 1; n--) {
            //alert( "resize('" + name + "'," + (widthStep * n) + "," + (heightStep * n) + ")" );
            setTimeout ("resize('" + name + "'," + (widthStep * n) + "," + (heightStep * n) + ")", showDelay - (showDelayStep * n));
        }
        setTimeout ("document.getElementById('" + name + "').style.display = 'none'", showDelay);

    }

    function showObject (name, width, height, underMouseCursor, currentMouseX, currentMouseY) {
        resize (name, 1, 1);
        if (underMouseCursor == 1) {
            document.getElementById (name).style.left = currentMouseX;
            document.getElementById (name).style.top = currentMouseY;
        }
        document.getElementById (name).style.display = 'inline';
        cyclesCount = showDelay / showDelayStep;
        widthStep = width / cyclesCount;
        heightStep = height / cyclesCount;
        for (n = 1; n < cyclesCount; n++) {
            setTimeout("resize('" + name + "'," + (widthStep * n) + "," + (heightStep * n) + ")", showDelayStep * n);
            //setTimeout( "resize('" + name + "'," + (widthStep * n) + "," + 40 + ")", showDelayStep * n );
        }
        setTimeout("resize('" + name + "'," + width + "," + height + ")", showDelay);
    }

    function replace(string,text,by) {
       // Replaces text with by in string
       var strLength = string.length, txtLength = text.length;
       if ((strLength == 0) || (txtLength == 0))
           return string;

       var i = string.indexOf(text);
       if ((!i) && (text != string.substring(0,txtLength)))
           return string;
        if (i == -1)
            return string;

        var newstr = string.substring(0,i) + by;

        if (i+txtLength < strLength)
            newstr += replace(string.substring(i+txtLength,strLength),text,by);

        return newstr;
    }

    function imgChange (imgName,imgSrc) {
        imgName.src = imgSrc;
    }

    function showPoem (id) {
        document.getElementById ('poemView').innerText = unescape (document.getElementById(id).value);
    }

    function showNoMsPoem (id) {
        var poem = document.getElementById(id).value;
        poem = replace (poem, "\n", "<br>");
        //var poem = replace (document.getElementById(id).value, "%22", "\"");
        window.open('nomspoem.php?poem=' + poem, 'Poem', 'width=300,height=400,scrollbars=yes');
    }

    function showNotchForm (parentId, space, currentMouseX, currentMouseY, article, articleTbl, articleName) {
        document.getElementById ('parentId').value = parentId;
        document.getElementById ('space').value = space;
        if ("none" == document.getElementById('addNotch').style.display)
            showObject ('addNotch', 400, 220, 1, currentMouseX, currentMouseY);
    }

    function hideNotchForm () {
        hideObject('addNotch');
    }

    function notchSubmit() {
        if (document.notchForm.autor.value == "") {
            alert ('Podpis snad zvládneš... Stačí i tři (či víc) kříľky')
            document.notchForm.autor.focus();
        }
        else if (document.notchForm.text.value == "") {
            alert ('Chápu, ľe snad nemáš co dodat... Přecejenom je pak ale zbytečné to odesílat, nemyslíš? :)');
            document.notchForm.text.focus();
        }
        else
            document.notchForm.submit();
    }

    function noMsNotchSubmit () {
        var submitUrl = 'notch.php?odeslano=true&autor=' + document.notchForm.autor.value +
             '&email=' + document.notchForm.emil.value + '&parentId=' + document.notchForm.parentId.value +
             '&text=' + document.notchForm.text.value + '&space=' + document.notchForm.space.value;
        if ('NULL' != document.notchForm.article.value)
             submitUrl += '&article=' + document.notchForm.article.value
             + '&articleTbl=' + document.notchForm.articleTbl.value + '&articleName=' + document.notchForm.articleName.value;
        self.opener.location = submitUrl;
        self.close();
    }

    function notchTextHide () {
        if (document.layers) {
            if (document.getElementById('text').indexOf ("Nápověda: ve svých komentářích se prosím vyhněte slovům jako") >= 0)
                document.getElementById('text') = '';
        }
        else
            if (document.getElementById('text').value.indexOf ("Nápověda: ve svých komentářích se prosím vyhněte slovům jako") >= 0)
                document.getElementById('text').value = '';
    }