/*
 * Make sure that you explicitly declare the visibility of any class you're 
 * using in the HTML style sheet as "table-cell" or "none", otherwise you'll 
 * get JS errors when you try to use this script.
 *
 * Using "block"/"none" as the display options caused
 * elements of the table to jump all over and just generally display badly.
 * Finally found a posting that said "don't use 'block', use 'table-cell'
 * as per the W3C standard." 
 *
 * Courtesy of
 * http://www.faqts.com/knowledge_base/view.phtml/aid/2147/fid/128
 *
 * But ... at the moment something about this doesn't work in IE.
 *
 */

function getStyleClass (className) {
  for (var s = 0; s < document.styleSheets.length; s++) {
    if(document.styleSheets[s].rules) {
      for (var r = 0; r < document.styleSheets[s].rules.length; r++) {
        if (document.styleSheets[s].rules[r].selectorText == '.' + className) {
          return document.styleSheets[s].rules[r];
        }
      }
    }
    else if(document.styleSheets[s].cssRules) {
      for (var r = 0; r < document.styleSheets[s].cssRules.length; r++) {
        if (document.styleSheets[s].cssRules[r].selectorText == '.' + className)
          return document.styleSheets[s].cssRules[r];
      }
    }
  }
  return null;
};

