//<![CDATA[
   
    /**
     * DivPopup
     * Author: Jefferson Luís Pereira - jeffersonlpti[at]gmail[dot]com
     * Date: 04-20-10
     * Since: 0.1
     *
     * @TODO
     * Auto create divs
     *     id="box-popup-bg" onclick="hidePopup()"
     *     id="box-popup"
     * Refence: http://jquery.com/demo/thickbox/
     **/


    /**
     * @id = id of element content
     * @options = css options Ex: width:120;height:50;
     *
     * @TODO remove the if of width and height..allow px in css options
     */
    function showPopup(id, options){
        var popup = document.getElementById("box-popup");
        var popup_bg = document.getElementById("box-popup-bg");
        var content = document.getElementById(id);

        var opts = options.split(";"); var i = 0;
        while(i < opts.length){
            if(opts[i] != ""){
                a = opts[i].split(":")[0];
                b = opts[i].split(":")[1];
                if(!isNaN(b)) c = 'px'; else c = '';
                css = 'popup.style.' + a + ' = "' + b + c + '";';
                eval(css);
                /* Alinha no centro da página */
                if(a == 'width') popup.style.marginLeft = (parseInt(b/2)/-1)+'px';
                if(a == 'height') popup.style.marginTop = (parseInt(b/2)/-1)+'px';
            }
            i++;
        }
        popup.innerHTML = content.innerHTML;
        popup.style.display = "block";
        popup_bg.style.display = "block";
    }

    /**
     * Hide DivPopup
     */
    function hidePopup(){
        document.getElementById("box-popup").style.display = "none";
        document.getElementById("box-popup-bg").style.display = "none";
    }


    /**
     * Acessibilidade - Texto
     */

    /**
     * @id = id of element content
     * @opt = -1 decrease / 1 increase
     * @limit = limit size
     * @TODO convert em to px
     */
     function changeSizeText(id, opt, limit){
        var x = document.getElementById(id);
        fSize = x.style.fontSize.replace('px', '');
        lHeight = x.style.lineHeight.replace('px', '');
        if(!lHeight)lHeight = 16;

        if(fSize == limit) return;

        if(opt > 0){
            fSize = (fSize/1)+2;
            lHeight = (lHeight/1)+2;
        }else{
            fSize = (fSize/1)-2;
            lHeight = (lHeight/1)-2;
        }
        x.style.fontSize = (fSize+'px');
        x.style.lineHeight = (lHeight+'px');

        

    }

    function changeSizeTextC(classe, opt, limit){

        $$('.'+classe).each(function(node){
            var x = node;
            fSize = x.style.fontSize.replace('px', '');
            lHeight = x.style.lineHeight.replace('px', '');
            if(!lHeight)lHeight = 16;

            if(fSize == limit) return;

            if(opt > 0){
            fSize = (fSize/1)+2;
            lHeight = (lHeight/1)+2;
        }else{
            fSize = (fSize/1)-2;
            lHeight = (lHeight/1)-2;
        }

            x.style.fontSize = (fSize+'px');
            x.style.lineHeight = (lHeight+'px');
        });

    }
//]]>
