if(!('open' in document.createElement('details'))){
	document.documentElement.className+=' no-details'
};


$j(function() {

 // Execute the fallback only if thereÕs no native `details` support
 if (!('open' in document.createElement('details'))) {

  // Loop through all `details` elements
  $j('details').each(function() {
   // Store a reference to the current `details` element in a variable
   var $details = $j(this),
       // Store a reference to the `summary` element of the current `details` element (if any) in a variable
       $detailsSummary = $j('summary', $details),
       // Do the same for the info within the `details` element
       $detailsNotSummary = $details.children(':not(summary)'),
       // This will be used later to look for direct child text nodes
       $detailsNotSummaryContents = $details.contents(':not(summary)');
   // If there is no `summary` in the current `details` elementÉ
   if (!$detailsSummary.length) {
    // Écreate one with default text
    $detailsSummary = $j(document.createElement('summary')).html('<a class="right">Read More &raquo;</a>').prependTo($details);
   };
   // Look for direct child text nodes
   if ($detailsNotSummary.length !== $detailsNotSummaryContents.length) {
    // Wrap child text nodes in a `div` element
    $detailsNotSummary = $detailsNotSummaryContents.wrap('<div>').parent();
    $details.attr('open') ? $detailsNotSummary.show() : $detailsNotSummary.hide();
   };
   // Set the `tabindex` attribute of the `summary` element to 0 to make it keyboard accessible
   $detailsSummary.attr('tabindex', 0).click(function() {
    // Focus on the `summary` element
    $detailsSummary.focus();
    // Toggle the `open` attribute of the `details` element
    $details.attr('open') ? $details.removeAttr('open') : $details.attr('open', 'open');
    $detailsSummary.hide();
    // Toggle the additional information in the `details` element
    $detailsNotSummary.toggle(0);
   }).keyup(function(event) {
    if (13 === event.keyCode || 32 === event.keyCode) {
     // Enter or Space is pressed Ñ trigger the `click` event on the `summary` element
     // Opera already seems to trigger the `click` event when Enter is pressed
     if (!($j.browser.opera && 13 === event.keyCode)) {
      event.preventDefault();
      $detailsSummary.click();
     };
    };
   });
  });

  // Make the following CSS work in IE6:
  //   details > * { display: none; }
  //   details[open] > * { display: block; }
  // Note that $j('details').children() is faster than $j('details > *')
  if ($j.browser.msie && $j.browser.version < 7) {
   $detailsNotSummary.hide();
   $j('details[open]').show();
  };

 };

});

