// Cufón is only used if the font is not installed.
// This is done with a font detection script - but that relies on the DOM being loaded.
// Because of this moment being too late to properly load Cufón a cookie based approach
// ist used that definitely renders Cufón the first time and after that detects if the
// desired font is installed and stores the result in a cookie.
// The cookie information, if present, is used to decide rendering with Cufòn or not
// on subsequent calls to the page.

// Cufon.replace is best to not be pushed inside document.ready or similar construct.

(function () {
  
  var render_fonts = function () {
    Cufon.replace('#tag-line p.big')('h2.cufon')('h3.cufon')('h4');
  };
  
  var myriad_cookie = $.cookie('myriad_available');
  // Just for debugging.
  // if (myriad_cookie) {
  //   alert("Cookie available");
  // }
  
  if (!myriad_cookie || (myriad_cookie && myriad_cookie !== 'true')) {
    render_fonts();
  }

})();

$(function () {
  $.cookie('myriad_available', '' + $.font.test("'Myriad Pro', Myriad"));
});