function dbg(msg) {
  if(typeof(console) != 'undefined') console.log(msg);
}
var ie = ($.browser.msie && parseFloat($.browser.version) < 9) ? true : false;

function setFs(fs) {  
  $('body').css('font-size', fs+'%');  
}

var fs = { // these are the font size 'options'.
  cookie : $.JSONCookie('fontsize') || {}, 
  range : 40,  
  stepping : 3.33,
  normal : 66.7  
};

fs.current = (fs.cookie.size) ? fs.cookie.size : fs.normal;



$(function(){
  
  setFs(fs.current);
  
  $('#sizebtns').click(function()  { if (fs.current >= fs.normal-fs.range) fs.current -= fs.stepping; setFs(fs.current) });
  $('#sizebtnm').click(function() { fs.current = fs.normal; setFs(fs.current) });
  $('#sizebtnl').click(function()  { if (fs.current <= fs.normal+fs.range) fs.current += fs.stepping; setFs(fs.current) });

  
  $('.fancybox').fancybox({
    overlayOpacity: .8,
    overlayColor: '#000'
  });
  
  if (ie && $('#subnav').length > 0) {
    $('#subnav').css('height', $('#main').height() + 20 + 'px');
  }  
  
});



$(window).load(function() {
  //
});

$(window).unload(function() {
  var fsCookie = { size: fs.current };  
  $.JSONCookie('fontsize', fsCookie, {path: '/'});
});
