/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


function str_replace(haystack, needle, replacement) {
    var temp = haystack.split(needle);
    return temp.join(replacement);
}

var sizeMaxIncrement = 4
var sizeMinIncrement = -2

var increment = 0



function fontPlus() {
    
    var elems = $('#content > *').find('p,li,h1,h2,h3');

    if(increment < sizeMaxIncrement) {
        increment++;
        elems.each(function(){
            
            size =  str_replace($(this).css('fontSize'), 'px', '');
            line =  str_replace($(this).css('line-height'), 'px', '');
            //console.info(line);
            $(this).css({
                fontSize:++size,
                lineHeight:++line+'px'
            })
        })
    }

    return false;
}

function fontMinus() {

    var elems = $('#content > *').find('p,li,h1,h2,h3');

    if(increment > sizeMinIncrement) {
        increment--;
        
        elems.each(function(){

            size =  str_replace($(this).css('fontSize'), 'px', '');
            line =  str_replace($(this).css('line-height'), 'px', '');

            $(this).css({
                fontSize:--size,
                 lineHeight:--line+'px'
            })
        })
    }

    return false;
}

