// JavaScript Document // setStyleByClass: given an element type and a class selector, // style property and value, apply the style. // args: // t - type of tag to check for (e.g., SPAN) // c - class name // p - CSS property // v - value var ie = (document.all) ? true : false; var defaultfontsize = 12; document.curfontsize = defaultfontsize; function setStyleByClass(t,c,p,v){ var elements; if(t == '*') { // '*' not supported by IE/Win 5.5 and below elements = (ie) ? document.all : document.getElementsByTagName('*'); } else { elements = document.getElementsByTagName(t); } for(var i = 0; i < elements.length; i++){ var node = elements.item(i); for(var j = 0; j < node.attributes.length; j++) { if(node.attributes.item(j).nodeName == 'class') { if(node.attributes.item(j).nodeValue == c) { eval('node.style.' + p + " = '" +v + "'"); } } } } } // getStyleByClass: given an element type, a class selector and a property, // return the value of the property for that element type. // args: // t - element type // c - class identifier // p - CSS property function getStyleByClass(t, c, p) { // first loop over elements, because if they've been modified they // will contain style data more recent than that in the stylesheet var elements; if(t == '*') { // '*' not supported by IE/Win 5.5 and below elements = (ie) ? document.all : document.getElementsByTagName('*'); } else { elements = document.getElementsByTagName(t); } for(var i = 0; i < elements.length; i++){ var node = elements.item(i); for(var j = 0; j < node.attributes.length; j++) { if(node.attributes.item(j).nodeName == 'class') { if(node.attributes.item(j).nodeValue == c) { var theStyle = eval('node.style.' + p); if((theStyle != "") && (theStyle != null)) { return theStyle; } } } } } // if we got here it's because we didn't find anything // try styleSheets var sheets = document.styleSheets; if(sheets.length > 0) { // loop over each sheet for(var x = 0; x < sheets.length; x++) { // grab stylesheet rules var rules = sheets[x].cssRules; if(rules.length > 0) { // check each rule for(var y = 0; y < rules.length; y++) { var z = rules[y].style; // selectorText broken in NS 6/Mozilla: see // http://bugzilla.mozilla.org/show_bug.cgi?id=51944 ugly_selectorText_workaround(); if(allStyleRules) { if((allStyleRules[y] == c) || (allStyleRules[y] == (t + "." + c))) { return z[p]; } } else { // use the native selectorText and style stuff if(((z[p] != "") && (z[p] != null)) && ((rules[y].selectorText == c) || (rules[y].selectorText == (t + "." + c)))) { return z[p]; } } } } } } return null; } function showPopup(location, width, height) { var left = (screen.width/2) - width/2; var top = (screen.height/2) - height/2-100; var styleStr = 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+',top='+top+',screenX='+left+',screenY='+top; var msgWindow = window.open(location, 'addresource', styleStr); msgWindow.focus(); } function initfont() { document.curfontsize=12; setTimeout("setStyleByClass('SPAN', 'resizable_text', 'fontSize', (document.curfontsize)+'px');", 166); return true; } window.onload=initfont();