echi-converter 0.4.2 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,11 +0,0 @@
1
- require File.dirname(__FILE__) + '/test_helper.rb'
2
-
3
- class TestEchiConverter < Test::Unit::TestCase
4
-
5
- def setup
6
- end
7
-
8
- def test_truth
9
- assert true
10
- end
11
- end
@@ -1,2 +0,0 @@
1
- require 'test/unit'
2
- require File.dirname(__FILE__) + '/../lib/echi_converter'
@@ -1,199 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
- <head>
5
- <link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
6
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
7
- <title>
8
- ECHI Converter
9
- </title>
10
- <script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
11
- <style>
12
-
13
- </style>
14
- <script type="text/javascript">
15
- window.onload = function() {
16
- settings = {
17
- tl: { radius: 10 },
18
- tr: { radius: 10 },
19
- bl: { radius: 10 },
20
- br: { radius: 10 },
21
- antiAlias: true,
22
- autoPad: true,
23
- validTags: ["div"]
24
- }
25
- var versionBox = new curvyCorners(settings, document.getElementById("version"));
26
- versionBox.applyCornersToAll();
27
- }
28
- </script>
29
- </head>
30
- <body>
31
- <div id="main">
32
-
33
- <h1>ECHI Converter</h1>
34
- <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/echi-converter"; return false'>
35
- <p>Get Version</p>
36
- <a href="http://rubyforge.org/projects/echi-converter" class="numbers">0.4.2</a>
37
- </div>
38
- <h1>&#8216;echi-converter&#8217;</h1>
39
- <h2>The <span class="caps">ECHI</span> (External Call History Interface) Converter</h2>
40
- <p>Provides a Ruby based utility for fetching Avaya <span class="caps">CMS</span> / <span class="caps">ECHI</span> files in binary/<span class="caps">ASCII</span> form from an <span class="caps">FTP</span> server, converting them, if necessary, to <span class="caps">ASCII</span> and then inserting them into a database via ActiveRecord. With this utility you only need the standard Avaya <span class="caps">CMS</span> Release 13 or better without any additional software or utilities from Avaya, as this utility will process either binary or <span class="caps">ASCII</span> output from the Avaya <span class="caps">CMS</span>.</p>
41
- <h2>Status</h2>
42
- <p>This release is now in production use within Call Centers using the Avaya <span class="caps">CMS</span>. The utility successfully and reliably imports the data provided by the Avaya <span class="caps">CMS</span> <span class="caps">ECHI</span> into various databases, including Microsoft Sqlserver, Oracle and MySQL. This provides the repository of call segments that may then be used to provide detailed Cradle to Grave reporting for the call center.</p>
43
- <h2>Features</h2>
44
- <p>The utility provides the following capabilities:<br />
45
- <br />
46
- # Support of ActiveRecord (means you may use Oracle, MySQL, MS-<span class="caps">SQL</span>, Postgres, DB2, <span class="caps">ODBC</span>, etc)<br />
47
- # Generate your schema via ActiveRecord Migrations automatically<br />
48
- # Fetch Binary or <span class="caps">ASCII</span> <span class="caps">CSV</span> files from the Avaya <span class="caps">CMS</span> platform via <span class="caps">FTP</span><br />
49
- # Insert the records into the defined database table using database transactions, via ActiveRecord, on a per file basis to support recovery on failure<br />
50
- # Change schema structure via <span class="caps">YML</span> configuration file to accommodate various releases of the <span class="caps">ECHI</span> format<br />
51
- # Supports inserting data from the various &#8216;.dat&#8217; files provided by the Avaya <span class="caps">CMS</span> into associated tables<br />
52
- # Runs as a daemon (via fork) on Posix (*NIX) and a service on Windows<br />
53
- # Has a watchdog process on Posix or you may set a service watch on Windows<br />
54
- # Allows for multiple <span class="caps">FTP</span> sessions to be used for greater performance (via <a href="http://en.wikipedia.org/wiki/Green_threads">green threads</a>)</p>
55
- <ol>
56
- <li>Table names:
57
- <ol>
58
- <li>echi_records &#8211; stores all <span class="caps">ECHI</span> data</li>
59
- <li>echi_logs &#8211; stores a log entry for each file processed</li>
60
- <li>echi_acds &#8211; stores the data from the acd.dat file</li>
61
- <li>echi_agents &#8211; stores the data from the agname.dat file</li>
62
- <li>echi_aux_reasons &#8211; stores the data from the aux_rsn.dat file</li>
63
- <li>echi_cwcs &#8211; stores data from the cwc.dat file</li>
64
- <li>echi_splits &#8211; stores data from the split.dat file</li>
65
- <li>echi_trunk_groups &#8211; stores data from the tkgrp.dat file</li>
66
- <li>echi_vdns &#8211; stores data from the vdn.dat file</li>
67
- <li>echi_vectors &#8211; stores data from the vector.dat file</li>
68
- </ol></li>
69
- </ol>
70
- <h2>What <span class="caps">ECHI</span>-Converter is not</h2>
71
- <p># A reporting engine<br />
72
- # A set of database maintenance scripts<br />
73
- <br />
74
- h2. Requirements</p>
75
- <p># <a href="http://www.ruby-lang.org/">Ruby v1.8.6+</a><br />
76
- # <a href="http://www.rubygems.org/">Rubygems v1.2+</a> <br />
77
- # <a href="http://activerecord.rubyforge.org/">ActiveRecord v2.1+</a><br />
78
- # <a href="http://activesupport.rubyforge.org/">ActiveSupport v2.1+</a><br />
79
- # <a href="http://daemons.rubyforge.org/">Daemons v1.0.10+</a><br />
80
- # <a href="http://fastercsv.rubyforge.org/">FasterCSV v1.2.3+</a><br />
81
- # <a href="http://rake.rubyforge.org/">Rake v0.8.1+</a><br />
82
- # <a href="http://sporkmonger.com/projects/uuidtools/">UUIDTools v1.0.3+</a><br />
83
- # <a href="http://win32utils.rubyforge.org/">Win32-service v.0.6.1+</a> (Manual install for Windows only)<br />
84
- # <a href="http://rubyforge.org/projects/seattlerb/">Hoe v1.7+</a><br />
85
- # Avaya <span class="caps">CMS</span> <span class="caps">ECHI</span> Release 12+ enabled and configured to send to an <span class="caps">FTP</span> server</p>
86
- <h2>Installing</h2>
87
- <pre syntax="ruby">sudo gem install echi-converter</pre>
88
- <p>or</p>
89
- <pre syntax="ruby">gem install echi-converter</pre>
90
- <h2>Setup</h2>
91
- <p>First, create the directory with all of the project files where you will run this application from:</p>
92
- <pre syntax="ruby">echi-converter create myproject</pre>
93
- <p>Once you have installed a project into your preferred directory, you then need to configure for your environment. The first step is to modify each of these files:</p>
94
- <p># config/application.yml<br />
95
- ## Change each of the &#8216;echi&#8217; settings for connecting to your local <span class="caps">FTP</span> server where the <span class="caps">CMS</span> puts the <span class="caps">ASCII</span>/binary files<br />
96
- ## Select which schema you would like to use (ie &#8211; extended_version12.yml) based on what you have in place<br />
97
- # config/database.yml<br />
98
- ## Change to match your local database and database login credentials, full ActiveRecord support<br />
99
- ## Note: Your database user and database must exist before running rake, as rake will then create the schema</p>
100
- <p>Once this is complete, then simply run these commands from the project directory:</p>
101
- <p># rake migrate (creates the tables required for the system)<br />
102
- # echi-converter (starts the server daemon, refer to its usage)</p>
103
- <p>Note: When using a Windows <span class="caps">FTP</span> server, you must configure the <span class="caps">FTP</span> server to provide a <span class="caps">UNIX</span> directory listing format.</p>
104
- <h2>Usage</h2>
105
- <ol>
106
- <li>echi-converter create myproject &#8211; create the local project to run the <span class="caps">ECHI</span> converter from</li>
107
- <li>echi-converter upgrade myproject &#8211; location of project to upgrade after a new gem is installed</li>
108
- </ol>
109
- <p>For <span class="caps">POSIX</span> (*NIX):</p>
110
- <ol>
111
- <li>echi-converter run myproject &#8211; Run the <span class="caps">ECHI</span> converter interactively from the location given</li>
112
- <li>echi-converter start myproject &#8211; Start the <span class="caps">ECHI</span> converter in daemon mode from the location given</li>
113
- <li>echi-converter stop myproject &#8211; Stop the <span class="caps">ECHI</span> converter daemon</li>
114
- <li>echi-converter restart myproject &#8211; Restart the <span class="caps">ECHI</span> converter</li>
115
- <li>echi-converter zap myproject &#8211; If there has been an unexpected close and the system still thinks the converter is running, clean up the pid files</li>
116
- </ol>
117
- <p>For MS-Windows:</p>
118
- <ol>
119
- <li>echi-converter install myproject &#8211; install the service (must specify complete path such as c:\path\to\my\project &#8211; if the directory name or path has any spaces, please enclose the &#8220;myproject&#8221; in double quotes )</li>
120
- <li>echi-converter start &#8211; start the service</li>
121
- <li>echi-converter stop &#8211; stop the service</li>
122
- <li>echi-converter pause &#8211; pause the service</li>
123
- <li>echi-converter resume &#8211; resume the service</li>
124
- <li>echi-converter status &#8211; returns the status of a configured service</li>
125
- <li>echi-converter delete &#8211; delete the service&quot;</li>
126
- </ol>
127
- <ol>
128
- <li>If you would like to run the script interactively, you may also execute this command:
129
- <ol>
130
- <li>ruby &#8220;c:\myproject\lib\main_win32.rb&#8221;</li>
131
- </ol></li>
132
- </ol>
133
- <p>Multi-byte character support:</p>
134
- <ol>
135
- <li>If you require multi-byte character support be sure to set your database to &#8216;utf8&#8217; as well as uncomment the option &#8216;encoding: utf8&#8217; in the config/database.yml file</li>
136
- </ol>
137
- <h2>Demonstration of usage</h2>
138
- <p>Start the daemon/service:</p>
139
- <pre syntax="ruby">echi-converter start myproject</pre>
140
- <p>Stop the daemon/service:</p>
141
- <pre syntax="ruby">echi-converter stop myproject</pre>
142
- <h2>Supported Platforms</h2>
143
- <p>While the use of Ruby allows for operation on a multitude of platforms, these are the platforms that have actually been tested on. If you have success running on other platforms, please feel free to provide details on the Google Group.</p>
144
- <h4>Operating Systems</h4>
145
- <ol>
146
- <li><span class="caps">POSIX</span></li>
147
- <li>Windows XP SP2</li>
148
- <li>Windows 2000</li>
149
- <li>Windows 2003</li>
150
- </ol>
151
- <h4>Databases</h4>
152
- <ol>
153
- <li>MySQL</li>
154
- <li>Microsoft Sqlserver</li>
155
- <li>DB2</li>
156
- <li>Sqlite3</li>
157
- <li>Postgres</li>
158
- <li>Oracle</li>
159
- </ol>
160
- <h4><span class="caps">FTP</span> Servers</h4>
161
- <ol>
162
- <li><span class="caps">VSFTP</span></li>
163
- <li>Windows 2003/XP <span class="caps">FTP</span> Servers (When using a Windows <span class="caps">FTP</span> server, you must configure the <span class="caps">FTP</span> server to provide a <span class="caps">UNIX</span> directory listing format.)</li>
164
- </ol>
165
- <h2>Related Avaya Documentation for <span class="caps">ECHI</span></h2>
166
- <ol>
167
- <li><a href="http://support.avaya.com/elmodocs2/cms/R14/ECHI.pdf">Avaya Call Management System Release 14 External Call History Interface</a></li>
168
- <li><a href="http://support.avaya.com/elmodocs2/cms_r13_1/07-300737_ECHI.pdf">Avaya Call Management System Release 13 External Call History Interface</a></li>
169
- </ol>
170
- <h2>Screencast</h2>
171
- <p>You may view the screencast on howto install and use the <span class="caps">ECHI</span>-Converter <a href="http://www.screencast.com/t/lQQkIVkUZMr">here</a>.</p>
172
- <h2>Consulting Services</h2>
173
- <p>If you would like help installing, configuring or adding features please do not hesitate to contact the consulting services of Adhearsion <a href="http://new.adhearsion.com/consulting">here</a>.</p>
174
- <h2>Forum</h2>
175
- <p>Please report questions here:</p>
176
- <p><a href="http://groups.google.com/group/echi-converter">Google Groups &#8211; <span class="caps">ECHI</span> Converter</a></p>
177
- <p>Please report bugs here:</p>
178
- <p><a href="http://rubyforge.org/tracker/?atid=15802&amp;group_id=4110&amp;func=browse">Ruby Forge Bug Tracker &#8211; <span class="caps">ECHI</span> Converter</a></p>
179
- <h2>How to submit patches</h2>
180
- <p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people&#8217;s code</a> and for section <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups">8b: Submit patch to Google Groups</a>, use the Google Group above.</p>
181
- <p>The trunk repository is <code>svn://rubyforge.org/var/svn/echi-converter/trunk</code> for anonymous access.</p>
182
- <h2>License</h2>
183
- <p>This code is free to use under the terms of the <span class="caps">LGPL</span> license.</p>
184
- <h2>Contact</h2>
185
- <p>Comments are welcome. Send an email to <a href="mailto:jason@goecke.net">jason [at] goecke.net</a>.</p>
186
- <h2>Brought to you by</h2>
187
- <ol>
188
- <li><a href="http://www.adhearsion.com">Adhearsion</a>, the open-source, unconventional voice framework that ties technologies together neatly.</li>
189
- </ol>
190
- <p class="coda">
191
- <a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>, 20th February 2009<br>
192
- Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
193
- </p>
194
- </div>
195
-
196
- <!-- insert site tracking codes here, like Google Urchin -->
197
-
198
- </body>
199
- </html>
@@ -1,194 +0,0 @@
1
- h1. ECHI Converter
2
-
3
- h1. 'echi-converter'
4
-
5
-
6
- h2. The ECHI (External Call History Interface) Converter
7
-
8
- Provides a Ruby based utility for fetching Avaya CMS / ECHI files in binary/ASCII form from an FTP server, converting them, if necessary, to ASCII and then inserting them into a database via ActiveRecord. With this utility you only need the standard Avaya CMS Release 13 or better without any additional software or utilities from Avaya, as this utility will process either binary or ASCII output from the Avaya CMS.
9
-
10
- h2. Status
11
-
12
- This release is now in production use within Call Centers using the Avaya CMS. The utility successfully and reliably imports the data provided by the Avaya CMS ECHI into various databases, including Microsoft Sqlserver, Oracle and MySQL. This provides the repository of call segments that may then be used to provide detailed Cradle to Grave reporting for the call center.
13
-
14
-
15
- h2. Features
16
-
17
- The utility provides the following capabilities:
18
-
19
- # Support of ActiveRecord (means you may use Oracle, MySQL, MS-SQL, Postgres, DB2, ODBC, etc)
20
- # Generate your schema via ActiveRecord Migrations automatically
21
- # Fetch Binary or ASCII CSV files from the Avaya CMS platform via FTP
22
- # Insert the records into the defined database table using database transactions, via ActiveRecord, on a per file basis to support recovery on failure
23
- # Change schema structure via YML configuration file to accommodate various releases of the ECHI format
24
- # Supports inserting data from the various '.dat' files provided by the Avaya CMS into associated tables
25
- # Runs as a daemon (via fork) on Posix (*NIX) and a service on Windows
26
- # Has a watchdog process on Posix or you may set a service watch on Windows
27
- # Allows for multiple FTP sessions to be used for greater performance (via "green threads":http://en.wikipedia.org/wiki/Green_threads)
28
-
29
- # Table names:
30
- ## echi_records - stores all ECHI data
31
- ## echi_logs - stores a log entry for each file processed
32
- ## echi_acds - stores the data from the acd.dat file
33
- ## echi_agents - stores the data from the agname.dat file
34
- ## echi_aux_reasons - stores the data from the aux_rsn.dat file
35
- ## echi_cwcs - stores data from the cwc.dat file
36
- ## echi_splits - stores data from the split.dat file
37
- ## echi_trunk_groups - stores data from the tkgrp.dat file
38
- ## echi_vdns - stores data from the vdn.dat file
39
- ## echi_vectors - stores data from the vector.dat file
40
-
41
- h2. What ECHI-Converter is not
42
-
43
- # A reporting engine
44
- # A set of database maintenance scripts
45
-
46
- h2. Requirements
47
-
48
- # "Ruby v1.8.6+":http://www.ruby-lang.org/
49
- # "Rubygems v1.2+":http://www.rubygems.org/
50
- # "ActiveRecord v2.1+":http://activerecord.rubyforge.org/
51
- # "ActiveSupport v2.1+":http://activesupport.rubyforge.org/
52
- # "Daemons v1.0.10+":http://daemons.rubyforge.org/
53
- # "FasterCSV v1.2.3+":http://fastercsv.rubyforge.org/
54
- # "Rake v0.8.1+":http://rake.rubyforge.org/
55
- # "UUIDTools v1.0.3+":http://sporkmonger.com/projects/uuidtools/
56
- # "Win32-service v.0.6.1+":http://win32utils.rubyforge.org/ (Manual install for Windows only)
57
- # "Hoe v1.7+":http://rubyforge.org/projects/seattlerb/
58
- # Avaya CMS ECHI Release 12+ enabled and configured to send to an FTP server
59
-
60
- h2. Installing
61
-
62
- <pre syntax="ruby">sudo gem install echi-converter</pre>
63
-
64
- or
65
-
66
- <pre syntax="ruby">gem install echi-converter</pre>
67
-
68
- h2. Setup
69
-
70
- First, create the directory with all of the project files where you will run this application from:
71
-
72
- <pre syntax="ruby">echi-converter create myproject</pre>
73
-
74
- Once you have installed a project into your preferred directory, you then need to configure for your environment. The first step is to modify each of these files:
75
-
76
- # config/application.yml
77
- ## Change each of the 'echi' settings for connecting to your local FTP server where the CMS puts the ASCII/binary files
78
- ## Select which schema you would like to use (ie - extended_version12.yml) based on what you have in place
79
- # config/database.yml
80
- ## Change to match your local database and database login credentials, full ActiveRecord support
81
- ## Note: Your database user and database must exist before running rake, as rake will then create the schema
82
-
83
- Once this is complete, then simply run these commands from the project directory:
84
-
85
- # rake migrate (creates the tables required for the system)
86
- # echi-converter (starts the server daemon, refer to its usage)
87
-
88
- Note: When using a Windows FTP server, you must configure the FTP server to provide a UNIX directory listing format.
89
-
90
- h2. Usage
91
-
92
- # echi-converter create myproject - create the local project to run the ECHI converter from
93
- # echi-converter upgrade myproject - location of project to upgrade after a new gem is installed
94
-
95
- For POSIX (*NIX):
96
-
97
- # echi-converter run myproject - Run the ECHI converter interactively from the location given
98
- # echi-converter start myproject - Start the ECHI converter in daemon mode from the location given
99
- # echi-converter stop myproject - Stop the ECHI converter daemon
100
- # echi-converter restart myproject - Restart the ECHI converter
101
- # echi-converter zap myproject - If there has been an unexpected close and the system still thinks the converter is running, clean up the pid files
102
-
103
- For MS-Windows:
104
-
105
- # echi-converter install myproject - install the service (must specify complete path such as c:\path\to\my\project - if the directory name or path has any spaces, please enclose the "myproject" in double quotes )
106
- # echi-converter start - start the service
107
- # echi-converter stop - stop the service
108
- # echi-converter pause - pause the service
109
- # echi-converter resume - resume the service
110
- # echi-converter status - returns the status of a configured service
111
- # echi-converter delete - delete the service"
112
-
113
- # If you would like to run the script interactively, you may also execute this command:
114
- ## ruby "c:\myproject\lib\main_win32.rb"
115
-
116
- Multi-byte character support:
117
-
118
- # If you require multi-byte character support be sure to set your database to 'utf8' as well as uncomment the option 'encoding: utf8' in the config/database.yml file
119
-
120
- h2. Demonstration of usage
121
-
122
- Start the daemon/service:
123
-
124
- <pre syntax="ruby">echi-converter start myproject</pre>
125
-
126
- Stop the daemon/service:
127
-
128
- <pre syntax="ruby">echi-converter stop myproject</pre>
129
-
130
- h2. Supported Platforms
131
-
132
- While the use of Ruby allows for operation on a multitude of platforms, these are the platforms that have actually been tested on. If you have success running on other platforms, please feel free to provide details on the Google Group.
133
-
134
- h4. Operating Systems
135
-
136
- # POSIX
137
- # Windows XP SP2
138
- # Windows 2000
139
- # Windows 2003
140
-
141
- h4. Databases
142
-
143
- # MySQL
144
- # Microsoft Sqlserver
145
- # DB2
146
- # Sqlite3
147
- # Postgres
148
- # Oracle
149
-
150
- h4. FTP Servers
151
-
152
- # VSFTP
153
- # Windows 2003/XP FTP Servers (When using a Windows FTP server, you must configure the FTP server to provide a UNIX directory listing format.)
154
-
155
- h2. Related Avaya Documentation for ECHI
156
-
157
- # "Avaya Call Management System Release 14 External Call History Interface":http://support.avaya.com/elmodocs2/cms/R14/ECHI.pdf
158
- # "Avaya Call Management System Release 13 External Call History Interface":http://support.avaya.com/elmodocs2/cms_r13_1/07-300737_ECHI.pdf
159
-
160
- h2. Screencast
161
-
162
- You may view the screencast on howto install and use the ECHI-Converter "here":http://www.screencast.com/t/lQQkIVkUZMr.
163
-
164
- h2. Consulting Services
165
-
166
- If you would like help installing, configuring or adding features please do not hesitate to contact the consulting services of Adhearsion "here":http://new.adhearsion.com/consulting.
167
-
168
- h2. Forum
169
-
170
- Please report questions here:
171
-
172
- "Google Groups - ECHI Converter":http://groups.google.com/group/echi-converter
173
-
174
- Please report bugs here:
175
-
176
- "Ruby Forge Bug Tracker - ECHI Converter":http://rubyforge.org/tracker/?atid=15802&group_id=4110&func=browse
177
-
178
- h2. How to submit patches
179
-
180
- Read the "8 steps for fixing other people's code":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/ and for section "8b: Submit patch to Google Groups":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups, use the Google Group above.
181
-
182
- The trunk repository is <code>svn://rubyforge.org/var/svn/echi-converter/trunk</code> for anonymous access.
183
-
184
- h2. License
185
-
186
- This code is free to use under the terms of the LGPL license.
187
-
188
- h2. Contact
189
-
190
- Comments are welcome. Send an email to "jason [at] goecke.net":mailto:jason@goecke.net.
191
-
192
- h2. Brought to you by
193
-
194
- # "Adhearsion":http://www.adhearsion.com, the open-source, unconventional voice framework that ties technologies together neatly.
@@ -1,285 +0,0 @@
1
-
2
- /****************************************************************
3
- * *
4
- * curvyCorners *
5
- * ------------ *
6
- * *
7
- * This script generates rounded corners for your divs. *
8
- * *
9
- * Version 1.2.9 *
10
- * Copyright (c) 2006 Cameron Cooke *
11
- * By: Cameron Cooke and Tim Hutchison. *
12
- * *
13
- * *
14
- * Website: http://www.curvycorners.net *
15
- * Email: info@totalinfinity.com *
16
- * Forum: http://www.curvycorners.net/forum/ *
17
- * *
18
- * *
19
- * This library is free software; you can redistribute *
20
- * it and/or modify it under the terms of the GNU *
21
- * Lesser General Public License as published by the *
22
- * Free Software Foundation; either version 2.1 of the *
23
- * License, or (at your option) any later version. *
24
- * *
25
- * This library is distributed in the hope that it will *
26
- * be useful, but WITHOUT ANY WARRANTY; without even the *
27
- * implied warranty of MERCHANTABILITY or FITNESS FOR A *
28
- * PARTICULAR PURPOSE. See the GNU Lesser General Public *
29
- * License for more details. *
30
- * *
31
- * You should have received a copy of the GNU Lesser *
32
- * General Public License along with this library; *
33
- * Inc., 59 Temple Place, Suite 330, Boston, *
34
- * MA 02111-1307 USA *
35
- * *
36
- ****************************************************************/
37
-
38
- var isIE = navigator.userAgent.toLowerCase().indexOf("msie") > -1; var isMoz = document.implementation && document.implementation.createDocument; var isSafari = ((navigator.userAgent.toLowerCase().indexOf('safari')!=-1)&&(navigator.userAgent.toLowerCase().indexOf('mac')!=-1))?true:false; function curvyCorners()
39
- { if(typeof(arguments[0]) != "object") throw newCurvyError("First parameter of curvyCorners() must be an object."); if(typeof(arguments[1]) != "object" && typeof(arguments[1]) != "string") throw newCurvyError("Second parameter of curvyCorners() must be an object or a class name."); if(typeof(arguments[1]) == "string")
40
- { var startIndex = 0; var boxCol = getElementsByClass(arguments[1]);}
41
- else
42
- { var startIndex = 1; var boxCol = arguments;}
43
- var curvyCornersCol = new Array(); if(arguments[0].validTags)
44
- var validElements = arguments[0].validTags; else
45
- var validElements = ["div"]; for(var i = startIndex, j = boxCol.length; i < j; i++)
46
- { var currentTag = boxCol[i].tagName.toLowerCase(); if(inArray(validElements, currentTag) !== false)
47
- { curvyCornersCol[curvyCornersCol.length] = new curvyObject(arguments[0], boxCol[i]);}
48
- }
49
- this.objects = curvyCornersCol; this.applyCornersToAll = function()
50
- { for(var x = 0, k = this.objects.length; x < k; x++)
51
- { this.objects[x].applyCorners();}
52
- }
53
- }
54
- function curvyObject()
55
- { this.box = arguments[1]; this.settings = arguments[0]; this.topContainer = null; this.bottomContainer = null; this.masterCorners = new Array(); this.contentDIV = null; var boxHeight = get_style(this.box, "height", "height"); var boxWidth = get_style(this.box, "width", "width"); var borderWidth = get_style(this.box, "borderTopWidth", "border-top-width"); var borderColour = get_style(this.box, "borderTopColor", "border-top-color"); var boxColour = get_style(this.box, "backgroundColor", "background-color"); var backgroundImage = get_style(this.box, "backgroundImage", "background-image"); var boxPosition = get_style(this.box, "position", "position"); var boxPadding = get_style(this.box, "paddingTop", "padding-top"); this.boxHeight = parseInt(((boxHeight != "" && boxHeight != "auto" && boxHeight.indexOf("%") == -1)? boxHeight.substring(0, boxHeight.indexOf("px")) : this.box.scrollHeight)); this.boxWidth = parseInt(((boxWidth != "" && boxWidth != "auto" && boxWidth.indexOf("%") == -1)? boxWidth.substring(0, boxWidth.indexOf("px")) : this.box.scrollWidth)); this.borderWidth = parseInt(((borderWidth != "" && borderWidth.indexOf("px") !== -1)? borderWidth.slice(0, borderWidth.indexOf("px")) : 0)); this.boxColour = format_colour(boxColour); this.boxPadding = parseInt(((boxPadding != "" && boxPadding.indexOf("px") !== -1)? boxPadding.slice(0, boxPadding.indexOf("px")) : 0)); this.borderColour = format_colour(borderColour); this.borderString = this.borderWidth + "px" + " solid " + this.borderColour; this.backgroundImage = ((backgroundImage != "none")? backgroundImage : ""); this.boxContent = this.box.innerHTML; if(boxPosition != "absolute") this.box.style.position = "relative"; this.box.style.padding = "0px"; if(isIE && boxWidth == "auto" && boxHeight == "auto") this.box.style.width = "100%"; if(this.settings.autoPad == true && this.boxPadding > 0)
56
- this.box.innerHTML = ""; this.applyCorners = function()
57
- { for(var t = 0; t < 2; t++)
58
- { switch(t)
59
- { case 0:
60
- if(this.settings.tl || this.settings.tr)
61
- { var newMainContainer = document.createElement("DIV"); newMainContainer.style.width = "100%"; newMainContainer.style.fontSize = "1px"; newMainContainer.style.overflow = "hidden"; newMainContainer.style.position = "absolute"; newMainContainer.style.paddingLeft = this.borderWidth + "px"; newMainContainer.style.paddingRight = this.borderWidth + "px"; var topMaxRadius = Math.max(this.settings.tl ? this.settings.tl.radius : 0, this.settings.tr ? this.settings.tr.radius : 0); newMainContainer.style.height = topMaxRadius + "px"; newMainContainer.style.top = 0 - topMaxRadius + "px"; newMainContainer.style.left = 0 - this.borderWidth + "px"; this.topContainer = this.box.appendChild(newMainContainer);}
62
- break; case 1:
63
- if(this.settings.bl || this.settings.br)
64
- { var newMainContainer = document.createElement("DIV"); newMainContainer.style.width = "100%"; newMainContainer.style.fontSize = "1px"; newMainContainer.style.overflow = "hidden"; newMainContainer.style.position = "absolute"; newMainContainer.style.paddingLeft = this.borderWidth + "px"; newMainContainer.style.paddingRight = this.borderWidth + "px"; var botMaxRadius = Math.max(this.settings.bl ? this.settings.bl.radius : 0, this.settings.br ? this.settings.br.radius : 0); newMainContainer.style.height = botMaxRadius + "px"; newMainContainer.style.bottom = 0 - botMaxRadius + "px"; newMainContainer.style.left = 0 - this.borderWidth + "px"; this.bottomContainer = this.box.appendChild(newMainContainer);}
65
- break;}
66
- }
67
- if(this.topContainer) this.box.style.borderTopWidth = "0px"; if(this.bottomContainer) this.box.style.borderBottomWidth = "0px"; var corners = ["tr", "tl", "br", "bl"]; for(var i in corners)
68
- { if(i > -1 < 4)
69
- { var cc = corners[i]; if(!this.settings[cc])
70
- { if(((cc == "tr" || cc == "tl") && this.topContainer != null) || ((cc == "br" || cc == "bl") && this.bottomContainer != null))
71
- { var newCorner = document.createElement("DIV"); newCorner.style.position = "relative"; newCorner.style.fontSize = "1px"; newCorner.style.overflow = "hidden"; if(this.backgroundImage == "")
72
- newCorner.style.backgroundColor = this.boxColour; else
73
- newCorner.style.backgroundImage = this.backgroundImage; switch(cc)
74
- { case "tl":
75
- newCorner.style.height = topMaxRadius - this.borderWidth + "px"; newCorner.style.marginRight = this.settings.tr.radius - (this.borderWidth*2) + "px"; newCorner.style.borderLeft = this.borderString; newCorner.style.borderTop = this.borderString; newCorner.style.left = -this.borderWidth + "px"; break; case "tr":
76
- newCorner.style.height = topMaxRadius - this.borderWidth + "px"; newCorner.style.marginLeft = this.settings.tl.radius - (this.borderWidth*2) + "px"; newCorner.style.borderRight = this.borderString; newCorner.style.borderTop = this.borderString; newCorner.style.backgroundPosition = "-" + (topMaxRadius + this.borderWidth) + "px 0px"; newCorner.style.left = this.borderWidth + "px"; break; case "bl":
77
- newCorner.style.height = botMaxRadius - this.borderWidth + "px"; newCorner.style.marginRight = this.settings.br.radius - (this.borderWidth*2) + "px"; newCorner.style.borderLeft = this.borderString; newCorner.style.borderBottom = this.borderString; newCorner.style.left = -this.borderWidth + "px"; newCorner.style.backgroundPosition = "-" + (this.borderWidth) + "px -" + (this.boxHeight + (botMaxRadius + this.borderWidth)) + "px"; break; case "br":
78
- newCorner.style.height = botMaxRadius - this.borderWidth + "px"; newCorner.style.marginLeft = this.settings.bl.radius - (this.borderWidth*2) + "px"; newCorner.style.borderRight = this.borderString; newCorner.style.borderBottom = this.borderString; newCorner.style.left = this.borderWidth + "px"
79
- newCorner.style.backgroundPosition = "-" + (botMaxRadius + this.borderWidth) + "px -" + (this.boxHeight + (botMaxRadius + this.borderWidth)) + "px"; break;}
80
- }
81
- }
82
- else
83
- { if(this.masterCorners[this.settings[cc].radius])
84
- { var newCorner = this.masterCorners[this.settings[cc].radius].cloneNode(true);}
85
- else
86
- { var newCorner = document.createElement("DIV"); newCorner.style.height = this.settings[cc].radius + "px"; newCorner.style.width = this.settings[cc].radius + "px"; newCorner.style.position = "absolute"; newCorner.style.fontSize = "1px"; newCorner.style.overflow = "hidden"; var borderRadius = parseInt(this.settings[cc].radius - this.borderWidth); for(var intx = 0, j = this.settings[cc].radius; intx < j; intx++)
87
- { if((intx +1) >= borderRadius)
88
- var y1 = -1; else
89
- var y1 = (Math.floor(Math.sqrt(Math.pow(borderRadius, 2) - Math.pow((intx+1), 2))) - 1); if(borderRadius != j)
90
- { if((intx) >= borderRadius)
91
- var y2 = -1; else
92
- var y2 = Math.ceil(Math.sqrt(Math.pow(borderRadius,2) - Math.pow(intx, 2))); if((intx+1) >= j)
93
- var y3 = -1; else
94
- var y3 = (Math.floor(Math.sqrt(Math.pow(j ,2) - Math.pow((intx+1), 2))) - 1);}
95
- if((intx) >= j)
96
- var y4 = -1; else
97
- var y4 = Math.ceil(Math.sqrt(Math.pow(j ,2) - Math.pow(intx, 2))); if(y1 > -1) this.drawPixel(intx, 0, this.boxColour, 100, (y1+1), newCorner, -1, this.settings[cc].radius); if(borderRadius != j)
98
- { for(var inty = (y1 + 1); inty < y2; inty++)
99
- { if(this.settings.antiAlias)
100
- { if(this.backgroundImage != "")
101
- { var borderFract = (pixelFraction(intx, inty, borderRadius) * 100); if(borderFract < 30)
102
- { this.drawPixel(intx, inty, this.borderColour, 100, 1, newCorner, 0, this.settings[cc].radius);}
103
- else
104
- { this.drawPixel(intx, inty, this.borderColour, 100, 1, newCorner, -1, this.settings[cc].radius);}
105
- }
106
- else
107
- { var pixelcolour = BlendColour(this.boxColour, this.borderColour, pixelFraction(intx, inty, borderRadius)); this.drawPixel(intx, inty, pixelcolour, 100, 1, newCorner, 0, this.settings[cc].radius, cc);}
108
- }
109
- }
110
- if(this.settings.antiAlias)
111
- { if(y3 >= y2)
112
- { if (y2 == -1) y2 = 0; this.drawPixel(intx, y2, this.borderColour, 100, (y3 - y2 + 1), newCorner, 0, 0);}
113
- }
114
- else
115
- { if(y3 >= y1)
116
- { this.drawPixel(intx, (y1 + 1), this.borderColour, 100, (y3 - y1), newCorner, 0, 0);}
117
- }
118
- var outsideColour = this.borderColour;}
119
- else
120
- { var outsideColour = this.boxColour; var y3 = y1;}
121
- if(this.settings.antiAlias)
122
- { for(var inty = (y3 + 1); inty < y4; inty++)
123
- { this.drawPixel(intx, inty, outsideColour, (pixelFraction(intx, inty , j) * 100), 1, newCorner, ((this.borderWidth > 0)? 0 : -1), this.settings[cc].radius);}
124
- }
125
- }
126
- this.masterCorners[this.settings[cc].radius] = newCorner.cloneNode(true);}
127
- if(cc != "br")
128
- { for(var t = 0, k = newCorner.childNodes.length; t < k; t++)
129
- { var pixelBar = newCorner.childNodes[t]; var pixelBarTop = parseInt(pixelBar.style.top.substring(0, pixelBar.style.top.indexOf("px"))); var pixelBarLeft = parseInt(pixelBar.style.left.substring(0, pixelBar.style.left.indexOf("px"))); var pixelBarHeight = parseInt(pixelBar.style.height.substring(0, pixelBar.style.height.indexOf("px"))); if(cc == "tl" || cc == "bl"){ pixelBar.style.left = this.settings[cc].radius -pixelBarLeft -1 + "px";}
130
- if(cc == "tr" || cc == "tl"){ pixelBar.style.top = this.settings[cc].radius -pixelBarHeight -pixelBarTop + "px";}
131
- switch(cc)
132
- { case "tr":
133
- pixelBar.style.backgroundPosition = "-" + Math.abs((this.boxWidth - this.settings[cc].radius + this.borderWidth) + pixelBarLeft) + "px -" + Math.abs(this.settings[cc].radius -pixelBarHeight -pixelBarTop - this.borderWidth) + "px"; break; case "tl":
134
- pixelBar.style.backgroundPosition = "-" + Math.abs((this.settings[cc].radius -pixelBarLeft -1) - this.borderWidth) + "px -" + Math.abs(this.settings[cc].radius -pixelBarHeight -pixelBarTop - this.borderWidth) + "px"; break; case "bl":
135
- pixelBar.style.backgroundPosition = "-" + Math.abs((this.settings[cc].radius -pixelBarLeft -1) - this.borderWidth) + "px -" + Math.abs((this.boxHeight + this.settings[cc].radius + pixelBarTop) -this.borderWidth) + "px"; break;}
136
- }
137
- }
138
- }
139
- if(newCorner)
140
- { switch(cc)
141
- { case "tl":
142
- if(newCorner.style.position == "absolute") newCorner.style.top = "0px"; if(newCorner.style.position == "absolute") newCorner.style.left = "0px"; if(this.topContainer) this.topContainer.appendChild(newCorner); break; case "tr":
143
- if(newCorner.style.position == "absolute") newCorner.style.top = "0px"; if(newCorner.style.position == "absolute") newCorner.style.right = "0px"; if(this.topContainer) this.topContainer.appendChild(newCorner); break; case "bl":
144
- if(newCorner.style.position == "absolute") newCorner.style.bottom = "0px"; if(newCorner.style.position == "absolute") newCorner.style.left = "0px"; if(this.bottomContainer) this.bottomContainer.appendChild(newCorner); break; case "br":
145
- if(newCorner.style.position == "absolute") newCorner.style.bottom = "0px"; if(newCorner.style.position == "absolute") newCorner.style.right = "0px"; if(this.bottomContainer) this.bottomContainer.appendChild(newCorner); break;}
146
- }
147
- }
148
- }
149
- var radiusDiff = new Array(); radiusDiff["t"] = Math.abs(this.settings.tl.radius - this.settings.tr.radius)
150
- radiusDiff["b"] = Math.abs(this.settings.bl.radius - this.settings.br.radius); for(z in radiusDiff)
151
- { if(z == "t" || z == "b")
152
- { if(radiusDiff[z])
153
- { var smallerCornerType = ((this.settings[z + "l"].radius < this.settings[z + "r"].radius)? z +"l" : z +"r"); var newFiller = document.createElement("DIV"); newFiller.style.height = radiusDiff[z] + "px"; newFiller.style.width = this.settings[smallerCornerType].radius+ "px"
154
- newFiller.style.position = "absolute"; newFiller.style.fontSize = "1px"; newFiller.style.overflow = "hidden"; newFiller.style.backgroundColor = this.boxColour; switch(smallerCornerType)
155
- { case "tl":
156
- newFiller.style.bottom = "0px"; newFiller.style.left = "0px"; newFiller.style.borderLeft = this.borderString; this.topContainer.appendChild(newFiller); break; case "tr":
157
- newFiller.style.bottom = "0px"; newFiller.style.right = "0px"; newFiller.style.borderRight = this.borderString; this.topContainer.appendChild(newFiller); break; case "bl":
158
- newFiller.style.top = "0px"; newFiller.style.left = "0px"; newFiller.style.borderLeft = this.borderString; this.bottomContainer.appendChild(newFiller); break; case "br":
159
- newFiller.style.top = "0px"; newFiller.style.right = "0px"; newFiller.style.borderRight = this.borderString; this.bottomContainer.appendChild(newFiller); break;}
160
- }
161
- var newFillerBar = document.createElement("DIV"); newFillerBar.style.position = "relative"; newFillerBar.style.fontSize = "1px"; newFillerBar.style.overflow = "hidden"; newFillerBar.style.backgroundColor = this.boxColour; newFillerBar.style.backgroundImage = this.backgroundImage; switch(z)
162
- { case "t":
163
- if(this.topContainer)
164
- { if(this.settings.tl.radius && this.settings.tr.radius)
165
- { newFillerBar.style.height = topMaxRadius - this.borderWidth + "px"; newFillerBar.style.marginLeft = this.settings.tl.radius - this.borderWidth + "px"; newFillerBar.style.marginRight = this.settings.tr.radius - this.borderWidth + "px"; newFillerBar.style.borderTop = this.borderString; if(this.backgroundImage != "")
166
- newFillerBar.style.backgroundPosition = "-" + (topMaxRadius + this.borderWidth) + "px 0px"; this.topContainer.appendChild(newFillerBar);}
167
- this.box.style.backgroundPosition = "0px -" + (topMaxRadius - this.borderWidth) + "px";}
168
- break; case "b":
169
- if(this.bottomContainer)
170
- { if(this.settings.bl.radius && this.settings.br.radius)
171
- { newFillerBar.style.height = botMaxRadius - this.borderWidth + "px"; newFillerBar.style.marginLeft = this.settings.bl.radius - this.borderWidth + "px"; newFillerBar.style.marginRight = this.settings.br.radius - this.borderWidth + "px"; newFillerBar.style.borderBottom = this.borderString; if(this.backgroundImage != "")
172
- newFillerBar.style.backgroundPosition = "-" + (botMaxRadius + this.borderWidth) + "px -" + (this.boxHeight + (topMaxRadius + this.borderWidth)) + "px"; this.bottomContainer.appendChild(newFillerBar);}
173
- }
174
- break;}
175
- }
176
- }
177
- if(this.settings.autoPad == true && this.boxPadding > 0)
178
- { var contentContainer = document.createElement("DIV"); contentContainer.style.position = "relative"; contentContainer.innerHTML = this.boxContent; contentContainer.className = "autoPadDiv"; var topPadding = Math.abs(topMaxRadius - this.boxPadding); var botPadding = Math.abs(botMaxRadius - this.boxPadding); if(topMaxRadius < this.boxPadding)
179
- contentContainer.style.paddingTop = topPadding + "px"; if(botMaxRadius < this.boxPadding)
180
- contentContainer.style.paddingBottom = botMaxRadius + "px"; contentContainer.style.paddingLeft = this.boxPadding + "px"; contentContainer.style.paddingRight = this.boxPadding + "px"; this.contentDIV = this.box.appendChild(contentContainer);}
181
- }
182
- this.drawPixel = function(intx, inty, colour, transAmount, height, newCorner, image, cornerRadius)
183
- { var pixel = document.createElement("DIV"); pixel.style.height = height + "px"; pixel.style.width = "1px"; pixel.style.position = "absolute"; pixel.style.fontSize = "1px"; pixel.style.overflow = "hidden"; var topMaxRadius = Math.max(this.settings["tr"].radius, this.settings["tl"].radius); if(image == -1 && this.backgroundImage != "")
184
- { pixel.style.backgroundImage = this.backgroundImage; pixel.style.backgroundPosition = "-" + (this.boxWidth - (cornerRadius - intx) + this.borderWidth) + "px -" + ((this.boxHeight + topMaxRadius + inty) -this.borderWidth) + "px";}
185
- else
186
- { pixel.style.backgroundColor = colour;}
187
- if (transAmount != 100)
188
- setOpacity(pixel, transAmount); pixel.style.top = inty + "px"; pixel.style.left = intx + "px"; newCorner.appendChild(pixel);}
189
- }
190
- function insertAfter(parent, node, referenceNode)
191
- { parent.insertBefore(node, referenceNode.nextSibling);}
192
- function BlendColour(Col1, Col2, Col1Fraction)
193
- { var red1 = parseInt(Col1.substr(1,2),16); var green1 = parseInt(Col1.substr(3,2),16); var blue1 = parseInt(Col1.substr(5,2),16); var red2 = parseInt(Col2.substr(1,2),16); var green2 = parseInt(Col2.substr(3,2),16); var blue2 = parseInt(Col2.substr(5,2),16); if(Col1Fraction > 1 || Col1Fraction < 0) Col1Fraction = 1; var endRed = Math.round((red1 * Col1Fraction) + (red2 * (1 - Col1Fraction))); if(endRed > 255) endRed = 255; if(endRed < 0) endRed = 0; var endGreen = Math.round((green1 * Col1Fraction) + (green2 * (1 - Col1Fraction))); if(endGreen > 255) endGreen = 255; if(endGreen < 0) endGreen = 0; var endBlue = Math.round((blue1 * Col1Fraction) + (blue2 * (1 - Col1Fraction))); if(endBlue > 255) endBlue = 255; if(endBlue < 0) endBlue = 0; return "#" + IntToHex(endRed)+ IntToHex(endGreen)+ IntToHex(endBlue);}
194
- function IntToHex(strNum)
195
- { base = strNum / 16; rem = strNum % 16; base = base - (rem / 16); baseS = MakeHex(base); remS = MakeHex(rem); return baseS + '' + remS;}
196
- function MakeHex(x)
197
- { if((x >= 0) && (x <= 9))
198
- { return x;}
199
- else
200
- { switch(x)
201
- { case 10: return "A"; case 11: return "B"; case 12: return "C"; case 13: return "D"; case 14: return "E"; case 15: return "F";}
202
- }
203
- }
204
- function pixelFraction(x, y, r)
205
- { var pixelfraction = 0; var xvalues = new Array(1); var yvalues = new Array(1); var point = 0; var whatsides = ""; var intersect = Math.sqrt((Math.pow(r,2) - Math.pow(x,2))); if ((intersect >= y) && (intersect < (y+1)))
206
- { whatsides = "Left"; xvalues[point] = 0; yvalues[point] = intersect - y; point = point + 1;}
207
- var intersect = Math.sqrt((Math.pow(r,2) - Math.pow(y+1,2))); if ((intersect >= x) && (intersect < (x+1)))
208
- { whatsides = whatsides + "Top"; xvalues[point] = intersect - x; yvalues[point] = 1; point = point + 1;}
209
- var intersect = Math.sqrt((Math.pow(r,2) - Math.pow(x+1,2))); if ((intersect >= y) && (intersect < (y+1)))
210
- { whatsides = whatsides + "Right"; xvalues[point] = 1; yvalues[point] = intersect - y; point = point + 1;}
211
- var intersect = Math.sqrt((Math.pow(r,2) - Math.pow(y,2))); if ((intersect >= x) && (intersect < (x+1)))
212
- { whatsides = whatsides + "Bottom"; xvalues[point] = intersect - x; yvalues[point] = 0;}
213
- switch (whatsides)
214
- { case "LeftRight":
215
- pixelfraction = Math.min(yvalues[0],yvalues[1]) + ((Math.max(yvalues[0],yvalues[1]) - Math.min(yvalues[0],yvalues[1]))/2); break; case "TopRight":
216
- pixelfraction = 1-(((1-xvalues[0])*(1-yvalues[1]))/2); break; case "TopBottom":
217
- pixelfraction = Math.min(xvalues[0],xvalues[1]) + ((Math.max(xvalues[0],xvalues[1]) - Math.min(xvalues[0],xvalues[1]))/2); break; case "LeftBottom":
218
- pixelfraction = (yvalues[0]*xvalues[1])/2; break; default:
219
- pixelfraction = 1;}
220
- return pixelfraction;}
221
- function rgb2Hex(rgbColour)
222
- { try{ var rgbArray = rgb2Array(rgbColour); var red = parseInt(rgbArray[0]); var green = parseInt(rgbArray[1]); var blue = parseInt(rgbArray[2]); var hexColour = "#" + IntToHex(red) + IntToHex(green) + IntToHex(blue);}
223
- catch(e){ alert("There was an error converting the RGB value to Hexadecimal in function rgb2Hex");}
224
- return hexColour;}
225
- function rgb2Array(rgbColour)
226
- { var rgbValues = rgbColour.substring(4, rgbColour.indexOf(")")); var rgbArray = rgbValues.split(", "); return rgbArray;}
227
- function setOpacity(obj, opacity)
228
- { opacity = (opacity == 100)?99.999:opacity; if(isSafari && obj.tagName != "IFRAME")
229
- { var rgbArray = rgb2Array(obj.style.backgroundColor); var red = parseInt(rgbArray[0]); var green = parseInt(rgbArray[1]); var blue = parseInt(rgbArray[2]); obj.style.backgroundColor = "rgba(" + red + ", " + green + ", " + blue + ", " + opacity/100 + ")";}
230
- else if(typeof(obj.style.opacity) != "undefined")
231
- { obj.style.opacity = opacity/100;}
232
- else if(typeof(obj.style.MozOpacity) != "undefined")
233
- { obj.style.MozOpacity = opacity/100;}
234
- else if(typeof(obj.style.filter) != "undefined")
235
- { obj.style.filter = "alpha(opacity:" + opacity + ")";}
236
- else if(typeof(obj.style.KHTMLOpacity) != "undefined")
237
- { obj.style.KHTMLOpacity = opacity/100;}
238
- }
239
- function inArray(array, value)
240
- { for(var i = 0; i < array.length; i++){ if (array[i] === value) return i;}
241
- return false;}
242
- function inArrayKey(array, value)
243
- { for(key in array){ if(key === value) return true;}
244
- return false;}
245
- function addEvent(elm, evType, fn, useCapture) { if (elm.addEventListener) { elm.addEventListener(evType, fn, useCapture); return true;}
246
- else if (elm.attachEvent) { var r = elm.attachEvent('on' + evType, fn); return r;}
247
- else { elm['on' + evType] = fn;}
248
- }
249
- function removeEvent(obj, evType, fn, useCapture){ if (obj.removeEventListener){ obj.removeEventListener(evType, fn, useCapture); return true;} else if (obj.detachEvent){ var r = obj.detachEvent("on"+evType, fn); return r;} else { alert("Handler could not be removed");}
250
- }
251
- function format_colour(colour)
252
- { var returnColour = "#ffffff"; if(colour != "" && colour != "transparent")
253
- { if(colour.substr(0, 3) == "rgb")
254
- { returnColour = rgb2Hex(colour);}
255
- else if(colour.length == 4)
256
- { returnColour = "#" + colour.substring(1, 2) + colour.substring(1, 2) + colour.substring(2, 3) + colour.substring(2, 3) + colour.substring(3, 4) + colour.substring(3, 4);}
257
- else
258
- { returnColour = colour;}
259
- }
260
- return returnColour;}
261
- function get_style(obj, property, propertyNS)
262
- { try
263
- { if(obj.currentStyle)
264
- { var returnVal = eval("obj.currentStyle." + property);}
265
- else
266
- { if(isSafari && obj.style.display == "none")
267
- { obj.style.display = ""; var wasHidden = true;}
268
- var returnVal = document.defaultView.getComputedStyle(obj, '').getPropertyValue(propertyNS); if(isSafari && wasHidden)
269
- { obj.style.display = "none";}
270
- }
271
- }
272
- catch(e)
273
- { }
274
- return returnVal;}
275
- function getElementsByClass(searchClass, node, tag)
276
- { var classElements = new Array(); if(node == null)
277
- node = document; if(tag == null)
278
- tag = '*'; var els = node.getElementsByTagName(tag); var elsLen = els.length; var pattern = new RegExp("(^|\s)"+searchClass+"(\s|$)"); for (i = 0, j = 0; i < elsLen; i++)
279
- { if(pattern.test(els[i].className))
280
- { classElements[j] = els[i]; j++;}
281
- }
282
- return classElements;}
283
- function newCurvyError(errorMessage)
284
- { return new Error("curvyCorners Error:\n" + errorMessage)
285
- }