var htmlCurrentSize = 0;

function Back()
{
    history.back();
}

function EnlargeFont()
{
    htmlCurrentSize = htmlCurrentSize + 1;
    ChangeStyle(htmlCurrentSize);
}

function ReduceFont()
{
    htmlCurrentSize = htmlCurrentSize - 1;
    ChangeStyle(htmlCurrentSize);
}

function PrintPage(url)
{
    // Verifica se é HTML
    if (url.toLowerCase().indexOf('demon.htm') > 0)
    {
        var newURL = window.document.demon.location.toString().toLowerCase();
        
        newURL = newURL.replace('ignore=1', '');
        
        if (newURL.indexOf('?') > 0)
        {
            if (newURL.indexOf('?') == newURL.length-1)
            {
                newURL = newURL + 'print=1'
            }
            else
            {
                newURL = newURL + '&print=1'
            }
        }
        else
        {
            newURL = newURL + '?print=1'
        }
        
        impressao = window.open(newURL, '_blank', 'location=0,menubar=0,resizable=0,scrollbars==0,status=0,titlebar=0,toolbar=0,height=1,width=0,top=5000,left=5000');
    }
    else if (url.toLowerCase().indexOf('/html') > 0)
    {
        impressao = window.open(url, '_blank', 'location=0,menubar=0,resizable=0,scrollbars==0,status=0,titlebar=0,toolbar=0,height=1,width=0,top=5000,left=5000');
    }
    else
    {
       // Exibe a Impressão
        window.print();
    }
}

function ChangeImage(control, sulfix)
{
    if (sulfix == 'on')
    {   
        control.src = control.src.replace('_off.gif', '_on.gif');
    }
    else
    {
        control.src = control.src.replace('_on.gif', '_off.gif');
    }
}

function ChangeStyle(size) 
{
    var style = findDOM('HTMLStyles', 0);
    if (style == null)
        style = findDOM('ctl00_HTMLStyles', 0);
    style.href = '/itausa/htmlDynamicCSS.ashx?size=' + size; 
}
