if (typeof PWCC == "undefined" || !PWCC) { //create PWCC namespace if it hasn't been done already PWCC = new Object(); } /* credit due dynamicCSS.js v1.0 Copyright 2005 Bobby van der Sluis This software is licensed under the CC-GNU LGPL changes - moved to pwcc namespace - added media to passed variables */ PWCC.createStyleRule = function (selector, declaration, media) { if (media == null) { media = 'screen'; } if (!document.getElementsByTagName || !(document.createElement || document.createElementNS)) return; var agt = navigator.userAgent.toLowerCase(); var is_ie = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1)); var is_iewin = (is_ie && (agt.indexOf("win") != -1)); var is_iemac = (is_ie && (agt.indexOf("mac") != -1)); if (is_iemac) return; // script doesn't work properly in IE/Mac var head = document.getElementsByTagName("head")[0]; var style = (typeof document.createElementNS != "undefined") ? document.createElementNS("http://www.w3.org/1999/xhtml", "style") : document.createElement("style"); if (!is_iewin) { var styleRule = document.createTextNode(selector + " {" + declaration + "}"); style.appendChild(styleRule); // bugs in IE/Win } style.setAttribute("type", "text/css"); style.setAttribute("media", media); head.appendChild(style); if (is_iewin && document.styleSheets && document.styleSheets.length > 0) { var lastStyle = document.styleSheets[document.styleSheets.length - 1]; if (typeof lastStyle.addRule == "object") { lastStyle.addRule(selector, declaration); } } } PWCC.equalHeight = function (expr, className, media) { if (className == null) { className = 'equalHeight'; } if (media == null) { media = 'screen'; //default } //split expr at = signs var sections = expr.split("="); //generate class name var classRandom = Math.floor(Math.random()*999999); className = className + '-' + classRandom; //get column heights, add class name to html elemenets var objects = new Array(); var maxHeight = 0; for(var i=0; i < sections.length; i++) { objects[i] = document.getElementById(sections[i]); PWCC.addClass(objects[i], className); //addClass is in base.js - it adds a class to an element. if (objects[i].offsetHeight > maxHeight) { maxHeight = objects[i].offsetHeight; } } //create css declaration var classDeclaration = 'min-height: ' + maxHeight + 'px;' var ie6Declaration = 'height: ' + maxHeight + 'px;' PWCC.createStyleRule('.' + className, classDeclaration, media); PWCC.createStyleRule('* html .' + className, ie6Declaration, media); } PWCC.addLoadEvent(function() { //addLoadEvent is in base.js - adds code to window.onload PWCC.equalHeight('content=sidebar'); });