event refactor, landing on HEAD!
[freeside.git] / httemplate / elements / fckeditor / editor / css / behaviors / showtableborders.htc
1 <public:component lightweight="true">\r
2 \r
3 <public:attach event="oncontentready" onevent="ShowBorders()" />\r
4 <public:attach event="onpropertychange" onevent="OnPropertyChange()" />\r
5 \r
6 <script language="javascript">\r
7 \r
8 var oClassRegex = /\s*FCK__ShowTableBorders/ ;\r
9 \r
10 function ShowBorders()\r
11 {\r
12         if ( this.border == 0 )\r
13         {\r
14                 if ( !oClassRegex.test( this.className ) )\r
15                         this.className += ' FCK__ShowTableBorders' ;\r
16         }\r
17         else\r
18         {\r
19                 if ( oClassRegex.test( this.className ) )\r
20                 {\r
21                         this.className = this.className.replace( oClassRegex, '' ) ;\r
22                         if ( this.className.length == 0 )\r
23                                 this.removeAttribute( 'className', 0 ) ;\r
24                 }\r
25         }\r
26 }\r
27 \r
28 function OnPropertyChange()\r
29 {\r
30         if ( event.propertyName == 'border' || event.propertyName == 'className' )\r
31                 ShowBorders.call(this) ;\r
32 }\r
33 \r
34 </script>\r
35 \r
36 </public:component>\r