//*** This code is copyright 2003 by Gavin Kistner, gavin@refinery.com //*** It is covered under the license viewable at http://phrogz.net/JS/_ReuseLicense.txt //*** Reuse or modification is free provided you abide by the terms of that license. //*** (Including the first two lines above in your source code satisfies the conditions.) //***Find the CSS rule by its selector text. //***e.g. FindRule(document.styleSheets[0],'a.selected').style.fontWeight='bold'; function FindRule(ss,selText){ if (!ss) return; if (ss.cssRulesCache==null) ss.cssRulesCache={}; var cssRulesCache=ss.cssRulesCache; //Following line fixes IEMac at the expense of Safari //if (navigator && navigator.platform && navigator.platform=="MacPPC") selText = selText.replace(/(^|(\s+))([\#\.])/gi,"$2*$3"); selText=selText.toLowerCase(); //screw case sensitivity; IE and Mozilla don't agree on case for elements if (cssRulesCache[selText]) return cssRulesCache[selText]; var rules = document.all?ss.rules:ss.cssRules; for (var i=0;i