﻿// JScript File

/** Sets display property of the element's style.
 *  @param  id     Element ID.
 *  @param  value  A string containing the new value of display property.
 */
function Main_master_SetElementDisplayCSS(id, value)
{
    var elem = document.getElementById(id);
    if (!elem || !elem.style)
        return
    elem.style.display = value;
}


/** Opens a new window with the specified content.
 *  @param  url     A URL to load into the new window.
 *  @param  name    The name of the new window.
 *  @param  width   The window width.
 *  @param  height  The window height.
 */
function Main_master_openWindow(url, name, width, height)
{
    return window.open(url, name, "width=" + width + ",height=" + height + ",resizable=yes,location=no,menubar=no,toolbar=no,directories=no");
}


/** Adds the specified URL to bookmarks.
 *  @param  linkObj     Link object (the <a> tag).
 *  @param  addUrl      A URL to add to bookmarks.
 *  @param  addTitle    The bookmark description.
 */
function add_favorite(linkObj, addUrl, addTitle)
{
    if(document.all && !window.opera) //IE
    {
        window.external.AddFavorite(addUrl, addTitle);
        return false;
    }
    else if(window.opera && window.print) //Opera
    {
        linkObj.title = addTitle;
        linkObj.rel = "sidebar";
        return true;
    }
    else if((typeof window.sidebar=='object') && (typeof window.sidebar.addPanel=='function')) //Mozilla
    {
        if(window.confirm('Přidat oblíbenou stránku jako nový panel?')) {
            window.sidebar.addPanel(addTitle, addUrl, '');
            return false;
        }
    }

    //nerozpoznan prohlizec
    window.alert('Po potvrzení stiskněte CTRL-D,\nstránka bude přidána k Vašim oblíbeným odkazům.');
    return false;
}

