// text resize functions -------------------------------------------------

var currentTextSize = null;
var currentLineHeight = null;
// check for cookie
if (get_text_cookie("ewffontsize")) {
    currentTextSize = parseFloat(get_text_cookie("ewffontsize"));
} else {
    currentTextSize = 1;
    createCookie("ewffontsize",currentTextSize,1000);
}
//currentLineHeight = currentTextSize + 5;

// creates a cookie with the given parameters
function createCookie(name,value,days){
        if (days){
                var date = new Date();
                date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
                var expires = "; expires=" + date.toGMTString();
        } else {
                var expires = "";
        }
        document.cookie = name + "=" + value + expires + "; path=/";
}

function textSize(dir) {
    if (dir == 'up') {
        if (currentTextSize <= 1.5) {
            currentTextSize += .2;
        }
    } else if (dir == 'down') {
        if (currentTextSize >= 1.2) {
            currentTextSize -= .2;
        }
    }
    //currentLineHeight = currentTextSize + 5;
    document.getElementById('fontSizeWrap').style.fontSize = currentTextSize + 'em';
    //document.getElementById('twoColumn-right').style.lineHeight = currentLineHeight + 'em';
    // write/rewrite cookie
    createCookie("ewffontsize",currentTextSize,1000);
}

function get_text_cookie ( cookie_name )
{
  var results = document.cookie.match ( cookie_name + '=(.*?)(;|$)' );

  if ( results ) {
    return ( unescape ( results[1] ) );
  }
  else { return null; }
}

