--- /dev/null
+--Do not remove this if you are using--\r
+Original Author: Remiz Rahnas\r
+Original Author URL: http://www.htmlremix.com\r
+Published date: 2008/09/24\r
+\r
+Changes by Nick Fetchak:\r
+- IE8 standards mode compatibility\r
+- VML elements now positioned behind original box rather than inside of it - should be less prone to breakage\r
+Published date : 2009/11/18\r
+\r
+\r
+<public:attach event="oncontentready" onevent="oncontentready('v08vnSVo78t4JfjH')" />\r
+<script type="text/javascript">\r
+\r
+// findPos() borrowed from http://www.quirksmode.org/js/findpos.html\r
+function findPos(obj) {\r
+ var curleft = curtop = 0;\r
+\r
+ if (obj.offsetParent) {\r
+ do {\r
+ curleft += obj.offsetLeft;\r
+ curtop += obj.offsetTop;\r
+ } while (obj = obj.offsetParent);\r
+ }\r
+\r
+ return({\r
+ 'x': curleft,\r
+ 'y': curtop\r
+ });\r
+}\r
+\r
+function oncontentready(classID) {\r
+ if (this.className.match(classID)) { return(false); }\r
+\r
+ if (!document.namespaces.v) { document.namespaces.add("v", "urn:schemas-microsoft-com:vml"); }\r
+\r
+ this.className = this.className.concat(' ', classID);\r
+ var arcSize = Math.min(parseInt(this.currentStyle['-moz-border-radius'] ||\r
+ this.currentStyle['-webkit-border-radius'] ||\r
+ this.currentStyle['border-radius'] ||\r
+ this.currentStyle['-khtml-border-radius']) /\r
+ Math.min(this.offsetWidth, this.offsetHeight), 1);\r
+ var fillColor = this.currentStyle.backgroundColor;\r
+ var fillSrc = this.currentStyle.backgroundImage.replace(/^url\("(.+)"\)$/, '$1');\r
+ var strokeColor = this.currentStyle.borderColor;\r
+ var strokeWeight = parseInt(this.currentStyle.borderWidth);\r
+ var stroked = 'true';\r
+ if (isNaN(strokeWeight)) {\r
+ strokeWeight = 0;\r
+ strokeColor = fillColor;\r
+ stroked = 'false';\r
+ }\r
+\r
+ this.style.background = 'transparent';\r
+ this.style.borderColor = 'transparent';\r
+\r
+ // Find which element provides position:relative for the target element (default to BODY)\r
+ var el = this;\r
+ var limit = 100, i = 0;\r
+ while ((typeof(el) != 'unknown') && (el.currentStyle.position != 'relative') && (el.tagName != 'BODY')) {\r
+ el = el.parentElement;\r
+ i++;\r
+ if (i >= limit) { return(false); }\r
+ }\r
+ var el_zindex = parseInt(el.currentStyle.zIndex);\r
+ if (isNaN(el_zindex)) { el_zindex = 0; }\r
+ //alert('got tag '+ el.tagName +' with pos '+ el.currentStyle.position);\r
+\r
+ var rect_size = {\r
+ 'width': this.offsetWidth - strokeWeight,\r
+ 'height': this.offsetHeight - strokeWeight\r
+ };\r
+ var el_pos = findPos(el);\r
+ var this_pos = findPos(this);\r
+ this_pos.y = this_pos.y + (0.5 * strokeWeight) - el_pos.y;\r
+ this_pos.x = this_pos.x + (0.5 * strokeWeight) - el_pos.x;\r
+\r
+ var rect = document.createElement('v:roundrect');\r
+ rect.arcsize = arcSize +'px';\r
+ rect.strokecolor = strokeColor;\r
+ rect.strokeWeight = strokeWeight +'px';\r
+ rect.stroked = stroked;\r
+ rect.style.display = 'block';\r
+ rect.style.position = 'absolute';\r
+ rect.style.top = this_pos.y +'px';\r
+ rect.style.left = this_pos.x +'px';\r
+ rect.style.width = rect_size.width +'px';\r
+ rect.style.height = rect_size.height +'px';\r
+ rect.style.antialias = true;\r
+ rect.style.zIndex = el_zindex - 1;\r
+\r
+ var fill = document.createElement('v:fill');\r
+ fill.color = fillColor;\r
+ fill.src = fillSrc;\r
+ fill.type = 'tile';\r
+\r
+ rect.appendChild(fill);\r
+ el.appendChild(rect);\r
+\r
+ var css = el.document.createStyleSheet();\r
+ css.addRule("v\\:roundrect", "behavior: url(#default#VML)");\r
+ css.addRule("v\\:fill", "behavior: url(#default#VML)");\r
+\r
+ isIE6 = /msie|MSIE 6/.test(navigator.userAgent);\r
+ // IE6 doesn't support transparent borders, use padding to offset original element\r
+ if (isIE6 && (strokeWeight > 0)) {\r
+ this.style.borderStyle = 'none';\r
+ this.style.paddingTop = parseInt(this.currentStyle.paddingTop || 0) + strokeWeight;\r
+ this.style.paddingBottom = parseInt(this.currentStyle.paddingBottom || 0) + strokeWeight;\r
+ }\r
+\r
+ if (typeof(window.rounded_elements) == 'undefined') {\r
+ window.rounded_elements = new Array();\r
+\r
+ if (typeof(window.onresize) == 'function') { window.previous_onresize = window.onresize; }\r
+ window.onresize = window_resize;\r
+ }\r
+ this.element.vml = rect;\r
+ window.rounded_elements.push(this.element);\r
+}\r
+\r
+function window_resize() {\r
+ if (typeof(window.rounded_elements) == 'undefined') { return(false); }\r
+\r
+ for (var i in window.rounded_elements) {\r
+ var el = window.rounded_elements[i];\r
+\r
+ var strokeWeight = parseInt(el.currentStyle.borderWidth);\r
+ if (isNaN(strokeWeight)) { strokeWeight = 0; }\r
+\r
+ var parent_pos = findPos(el.vml.parentNode);\r
+ var pos = findPos(el);\r
+ pos.y = pos.y + (0.5 * strokeWeight) - parent_pos.y;\r
+ pos.x = pos.x + (0.5 * strokeWeight) - parent_pos.x;\r
+\r
+ el.vml.style.top = pos.y +'px';\r
+ el.vml.style.left = pos.x +'px';\r
+ }\r
+\r
+ if (typeof(window.previous_onresize) == 'function') { window.previous_onresize(); }\r
+}\r
+</script>\r
+\r