﻿
function toggleRowVisibility(elem)
{
    // ie
    try{
        if(elem.style.display == "none") {
            elem.style.setAttribute("cssText",  "display:table-row");
            focusIfVisible(elem);
        }
        else{
            elem.style.setAttribute("cssText",  "display:none");
        }
    } catch(ex)
    {
        // firefox
        try{
            if(elem.style.display == "none") {
                elem.setAttribute("style",  "display:table-row");
                focusIfVisible(elem);
            }
            else{
                elem.setAttribute("style",  "display:none");
            }
        } catch(ex){}
    }
    
}


function toggleInlineVisibility(elem)
{
    // ie
    try{
        if(elem.style.display == "none") {
            elem.style.setAttribute("cssText",  "display:inline");
            focusInlineIfVisible(elem);
        }
        else{
            elem.style.setAttribute("cssText",  "display:none");
        }
    } catch(ex)
    {
        // firefox
        try{
            if(elem.style.display == "none") {
                elem.setAttribute("style",  "display:inline");
                focusInlineIfVisible(elem);
            }
            else{
                elem.setAttribute("style",  "display:none");
            }
        } catch(ex){}
    }
}

function focusIfVisible(elem)
{
    (new Spry.Effect.Highlight(elem, {duration: 800, from:'#FFD42A', to:'#ffffff', toggle: false })).start();
}

function focusInlineIfVisible(elem)
{
    (new Spry.Effect.Shake(elem, {duration: 500} )).start();
}

/*
---------------------------
*/

function addRegistsValue()
{
    // total
    toggleInlineVisibility(document.getElementById("ctl00_ContentPlaceHolder_resValueCasaProntaTotal1"));
    toggleInlineVisibility(document.getElementById("ctl00_ContentPlaceHolder_resValueCasaProntaTotal2"));

    toggleRowVisibility(document.getElementById("regists1"));
    toggleRowVisibility(document.getElementById("regists2"));
    
    
    //focusIfVisible(document.getElementById("regists1"));
}

function addNotariosPrivadosOffline()
{
    // total
    toggleInlineVisibility(document.getElementById("ctl00_ContentPlaceHolder_resValueNotarioPrivadoTotal1"));
    toggleInlineVisibility(document.getElementById("ctl00_ContentPlaceHolder_resValueNotarioPrivadoTotal2"));

    toggleRowVisibility(document.getElementById("notarioPrivadoPaper1"));
    toggleRowVisibility(document.getElementById("notarioPrivadoInternet1"));
    
    toggleRowVisibility(document.getElementById("notarioPrivadoPaper2"));
    toggleRowVisibility(document.getElementById("notarioPrivadoInternet2"));
    
}

function addNotariosPublicosOffline()
{
    // total
    toggleInlineVisibility(document.getElementById("ctl00_ContentPlaceHolder_resValueNotarioPublicoTotal1"));
    toggleInlineVisibility(document.getElementById("ctl00_ContentPlaceHolder_resValueNotarioPublicoTotal2"));

    toggleRowVisibility(document.getElementById("notarioPublicoPaper1"));
    toggleRowVisibility(document.getElementById("notarioPublicoInternet1"));
    
    toggleRowVisibility(document.getElementById("notarioPublicoPaper2"));
    toggleRowVisibility(document.getElementById("notarioPublicoInternet2"));
    
}

function addBalcaoUnicoOutrasOffline()
{
    // total
    toggleInlineVisibility(document.getElementById("ctl00_ContentPlaceHolder_resValueBalcaoUnicoOutrosTotal1"));
    toggleInlineVisibility(document.getElementById("ctl00_ContentPlaceHolder_resValueBalcaoUnicoOutrosTotal2"));

    toggleRowVisibility(document.getElementById("balcaoUnicoOutrasPaper1"));
    toggleRowVisibility(document.getElementById("balcaoUnicoOutrasInternet1"));
    
}
