/**
 * Detectar browser engine
 */
var ie  = document.all && !document.getElementById;
var dom = document.getElementById;
var ns  = document.layers;


/**
 * Abre janela com mapa
 */
function abreMapa()
{
    var screen_width = 800, screen_height = 600;
    if (dom)
    {
        screen_width  = screen.availWidth;
        screen_height = screen.availHeight;
    }
    var left_pos = Math.round((screen_width - 480) / 2), top_pos = Math.round((screen_height - 472) / 2);

    window.open('mapa.html', 'mapa', 'toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=0,width=477,height=472,left=' + left_pos + ',top=' + top_pos);
}


/**
 * Desabilitar botão direito do mouse
 */
var message='Desculpe, função desabilitada para proteger direitos autorais.';
function clickIe()
{
    if (document.all)
    {
        alert(message);
        return false;
    }
}
function clickNs(e)
{
    if (ns || (dom && !document.all))
    {
        if (e.which == 2 || e.which == 3)
        {
            alert(message);
            return false;
        }
    }
}
function protege(imagem)
{
    if (dom && !document.all)
    {
        document.captureEvents(Event.MOUSEDOWN);
        if (document.images)
        {
            imagem.onmousedown = clickNs;
        }
    }
    else
    {
        if (document.images)
        {
            document.onmouseup   = clickNs;
            imagem.oncontextmenu = clickIe;
        }
    }
}


/**
 * Alternar botões do menu
 */
function alternaImagem(qual, imagem)
{
    qual.src = 'graficos/' + imagem;
}
