if (!window.Richfaces) { window.Richfaces = {}; } Richfaces.mergeStyles = function(userStyles,commonStyles) { var i; for(i in userStyles) { if (typeof userStyles[i] == "object") { this.mergeStyles(userStyles[i],commonStyles[i]); } else { if (commonStyles[i]) { commonStyles[i] += " " + userStyles[i]; } else { commonStyles[i] = userStyles[i]; } } } return commonStyles; }; Richfaces.getComputedStyle = function(eltId, propertyName) { var elt = $(eltId); if (elt.nodeType != Node.ELEMENT_NODE) { return ""; } if (elt.currentStyle) { return elt.currentStyle[propertyName]; } if (document.defaultView && document.defaultView.getComputedStyle) { var styles = document.defaultView.getComputedStyle(elt, null); if (styles) { return styles.getPropertyValue(propertyName); } } return ""; }; Richfaces.getComputedStyleSize = function(eltId, propertyName) { var value = Richfaces.getComputedStyle(eltId, propertyName); if (value) { value = value.strip(); value = value.replace(/px$/, ""); return parseFloat(value); } return 0; }; Richfaces.getWindowSize = function() { var myWidth = 0, myHeight = 0; if( typeof( window.innerWidth ) == 'number' ) { myWidth = window.innerWidth; myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { myWidth = document.body.clientWidth; myHeight = document.body.clientHeight; } return {"width":myWidth,"height":myHeight}; }; Richfaces.removePX = function(str) { var pxIndex = str.indexOf("px") if ( pxIndex == -1 ) return str; return str.substr(0,pxIndex); }; Richfaces.visitTree = function(root, callback) { var node = root; if (!node) { node = document; } callback.call(this, node); var child = node.firstChild; while (child) { Richfaces.visitTree(child, callback); child = child.nextSibling; } }; Richfaces.getNSAttribute = function (name, element) { if (element.getAttributeNS) { var attr = element.getAttributeNS('http://richfaces.ajax4jsf.org/rich', name); if (attr) { return attr; } } var attributes = element.attributes; var attrName = "rich:" + name; var attr = attributes[attrName]; if (attr) { return attr.nodeValue; } // for (var i = 0; i < attributes.length; i++) { // attr = attributes[i]; // if (attr && attrName == attr.nodeName) { // return attr.nodeValue; // } // } return null; }; Richfaces.VARIABLE_NAME_PATTERN = /^\s*[_,A-Z,a-z][\w,_\.]*\s*$/; Richfaces.getObjectValue = function (str, object) { var a=str.split("."); var value=object[a[0]]; var c=1; while (value && c=0 && oy>=0 && theBest.square=0 && oy>=0 && theBest.square=0 && oy>=0 && theBest.squares) {ox=theBest.x; oy=theBest.y} } } } } } element.style.left = ox + 'px'; element.style.top = oy + 'px'; }; Richfaces.Position.getOffsetDimensions = function(element) { // from prototype 1.5.0 // Pavel Yascenko element = $(element); var display = $(element).getStyle('display'); if (display != 'none' && display != null) // Safari bug return {width: element.offsetWidth, height: element.offsetHeight}; // All *Width and *Height properties give 0 on elements with display none, // so enable the element temporarily var els = element.style; var originalVisibility = els.visibility; var originalPosition = els.position; var originalDisplay = els.display; els.visibility = 'hidden'; els.position = 'absolute'; els.display = 'block'; var originalWidth = element.offsetWidth; // was element.clientWidth // Pavel Yascenko var originalHeight = element.offsetHeight; // was element.clientHeight // Pavel Yascenko els.display = originalDisplay; els.position = originalPosition; els.visibility = originalVisibility; return {width: originalWidth, height: originalHeight}; }; Richfaces.Position.checkCollision = function(elementRect, windowRect, windowOffset) { if (elementRect.left >= windowRect.left && elementRect.top >= windowRect.top && elementRect.right <= windowRect.right && elementRect.bottom <= windowRect.bottom) return 0; var rect = {left: (elementRect.left>windowRect.left ? elementRect.left : windowRect.left), top: (elementRect.top>windowRect.top ? elementRect.top : windowRect.top), right: (elementRect.right