packr 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/README ADDED
@@ -0,0 +1,83 @@
1
+ == PackR
2
+
3
+ PackR is a Ruby port of Dean Edwards' MIT-licensed JavaScript compressor, Packer:
4
+
5
+ # Packer version 3.0 (final) - copyright 2004-2007, Dean Edwards
6
+ # http://www.opensource.org/licenses/mit-license
7
+ http://dean.edwards.name/packer/
8
+
9
+ This version is based on Packer 3.0. You may find that the results it produces
10
+ are not strictly identical to those of the JavaScript version, but the difference is
11
+ just a question of how the base-62 word list is ordered -- your scripts
12
+ will work just like those produced with the online version. The level of
13
+ compression achieved is identical between the two versions.
14
+
15
+ === Usage
16
+
17
+ Usage is dead simple. Within your Rails app, you can compress pieces of code
18
+ like this:
19
+
20
+ compressed = Packr.pack(script)
21
+
22
+ # Pass options to control the type of compression
23
+ compressed = Packr.pack(script, :shrink_vars => true)
24
+ compressed = Packr.pack(script, :base62 => true)
25
+ compressed = Packr.pack(script, :shrink_vars => true, :base62 => true)
26
+
27
+ If you want to compress a particular file, you can do this:
28
+
29
+ Packr.pack_file(path, ... options as above ...)
30
+
31
+ Be careful with that - it will overwrite the contents of the file with
32
+ the packed version. Be a good kid and use version control in case something
33
+ goes wrong and you lose all your source code!
34
+
35
+ === Automated packing
36
+
37
+ PackR also comes with a rake task to let you batch-pack all your scripts.
38
+ To use it, store any files you want to serve in packed form in the directory
39
+ <tt>lib/javascripts</tt>. (The idea is that you won't be serving the source files to
40
+ the public, so why keep them in the public folder? Also, it keeps the source
41
+ files and packed copies nicely separated.) Then run:
42
+
43
+ rake packr:pack_libs
44
+
45
+ You can specify the type of packing using flags:
46
+
47
+ rake packr:pack_libs shrink_vars=
48
+ rake packr:pack_libs base62= shrink_vars=
49
+
50
+ PackR will put packed copies of all the scripts from <tt>lib/javascripts</tt> in
51
+ <tt>public/javascripts</tt>. Again, be careful as this will overwrite any pre-existing
52
+ files in your public directory.
53
+
54
+ It is not recommended to run this as part of your deployment process, as
55
+ you will need to verfiy that your JavaScript works when packed. PackR works
56
+ using regular expressions -- not a true JavaScript interpreter -- and cannot
57
+ fix missing semicolons for you.
58
+
59
+ Also, DO NOT use PackR to compress files on-the-fly in response to HTTP
60
+ requests. The packing process can be quite processor-intensive and it will
61
+ make you app very slow when serving script files.
62
+
63
+ === License
64
+
65
+ Copyright (c) 2007 Dean Edwards, James Coglan
66
+
67
+ Permission is hereby granted, free of charge, to any person obtaining
68
+ a copy of this software and associated documentation files (the "Software"),
69
+ to deal in the Software without restriction, including without limitation
70
+ the rights to use, copy, modify, merge, publish, distribute, sublicense,
71
+ and/or sell copies of the Software, and to permit persons to whom the
72
+ Software is furnished to do so, subject to the following conditions:
73
+
74
+ The above copyright notice and this permission notice shall be included
75
+ in all copies or substantial portions of the Software.
76
+
77
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
78
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
79
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
80
+ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
81
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
82
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
83
+ DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,122 @@
1
+ class Packr
2
+ class RegexpGroup
3
+
4
+ attr_accessor :values
5
+
6
+ IGNORE = "\\0"
7
+ BACK_REF = /\\(\d+)/
8
+ ESCAPE_CHARS = /\\./
9
+ ESCAPE_BRACKETS = /\(\?[:=!]|\[[^\]]+\]/
10
+ BRACKETS = /\(/
11
+ KEYS = "~"
12
+
13
+ def initialize(values, flags = nil)
14
+ @values = []
15
+ values.each { |key, value| @values << Item.new(key, value) }
16
+ if flags && flags.is_a(String)
17
+ @ignore_case = !!(flags =~ /i/)
18
+ end
19
+ end
20
+
21
+ def union(*args)
22
+ values = {}
23
+ @values.each { |item| values[item.expression] = item.replacement }
24
+ args.each do |arg|
25
+ arg.values.each { |item| values[item.expression] = item.replacement }
26
+ end
27
+ self.class.new(values)
28
+ end
29
+
30
+ def exec(string, &replacement)
31
+ string = string.to_s
32
+ regexp = value_of
33
+
34
+ replacement ||= lambda do |match|
35
+ return "" if match.nil?
36
+ arguments = [match] + $~.captures + [$~.begin(0), string]
37
+ offset, result = 1, ""
38
+ @values.each do |item|
39
+ nxt = offset + item.length + 1
40
+ if arguments[offset] # do we have a result?
41
+ rep = item.replacement
42
+ if rep.is_a?(Proc)
43
+ args = arguments[offset...nxt]
44
+ index = arguments[-2]
45
+ result = rep.call *(args + [index, string])
46
+ else
47
+ result = rep.is_a?(Numeric) ? arguments[offset + rep] : rep.to_s
48
+ end
49
+ end
50
+ offset = nxt
51
+ end
52
+ result
53
+ end
54
+
55
+ replacement.is_a?(Proc) ? string.gsub(regexp, &replacement) :
56
+ string.gsub(regexp, replacement.to_s)
57
+ end
58
+
59
+ def test(string)
60
+ exec(string) != string
61
+ end
62
+
63
+ def to_s
64
+ length = 0
65
+ "(" + @values.map { |item|
66
+ # Fix back references.
67
+ ref = item.to_s.gsub(BACK_REF) { |m| "\\" + (1 + $1.to_i + length).to_s }
68
+ length += item.length + 1
69
+ ref
70
+ }.join(")|(") + ")"
71
+ end
72
+
73
+ def value_of(type = nil)
74
+ return self if type == Object
75
+ flag = @ignore_case ? Regexp::IGNORECASE : nil
76
+ Regexp.new(self.to_s, flag)
77
+ end
78
+
79
+ class Item
80
+ attr_accessor :expression, :length, :replacement
81
+
82
+ def initialize(expression, replacement)
83
+ @expression = expression.is_a?(Regexp) ? expression.source : expression.to_s
84
+
85
+ if replacement.is_a?(Numeric)
86
+ replacement = "\\" + replacement.to_s
87
+ elsif replacement.nil?
88
+ replacement = ""
89
+ end
90
+
91
+ # does the pattern use sub-expressions?
92
+ if replacement.is_a?(String) and replacement =~ /\\(\d+)/
93
+ # a simple lookup? (e.g. "\2")
94
+ if replacement.gsub(/\n/, " ") =~ /^\\\d+$/
95
+ # store the index (used for fast retrieval of matched strings)
96
+ replacement = replacement[1..-1].to_i
97
+ else # a complicated lookup (e.g. "Hello \2 \1")
98
+ # build a function to do the lookup
99
+ q = (replacement.gsub(/\\./, "") =~ /'/) ? '"' : "'"
100
+ replacement = replacement.gsub(/\r/, "\\r").gsub(/\\(\d+)/,
101
+ q + "+(args[\\1]||" + q+q + ")+" + q)
102
+ replacement_string = q + replacement.gsub(/(['"])\1\+(.*)\+\1\1$/, '\1') + q
103
+ replacement = lambda { |*args| eval(replacement_string) }
104
+ end
105
+ end
106
+
107
+ @length = RegexpGroup.count(@expression)
108
+ @replacement = replacement
109
+ end
110
+
111
+ def to_s
112
+ @expression
113
+ end
114
+ end
115
+
116
+ def self.count(expression)
117
+ expression = expression.to_s.gsub(ESCAPE_CHARS, "").gsub(ESCAPE_BRACKETS, "")
118
+ expression.scan(BRACKETS).length
119
+ end
120
+
121
+ end
122
+ end
@@ -0,0 +1,84 @@
1
+ class Packr
2
+ class Words
3
+
4
+ WORDS = /\w+/
5
+ attr_accessor :words
6
+
7
+ def initialize(script)
8
+ script.to_s.scan(WORDS).each { |word| add(word) }
9
+ encode!
10
+ end
11
+
12
+ def add(word)
13
+ @words ||= []
14
+ @words << (stored_word = Item.new(word)) unless stored_word = get(word)
15
+ word = stored_word
16
+ word.count = word.count + 1
17
+ word
18
+ end
19
+
20
+ def get(word)
21
+ @words.find { |w| w.word == word.to_s }
22
+ end
23
+
24
+ def has?(word)
25
+ !!(get word)
26
+ end
27
+
28
+ def size
29
+ @words.size
30
+ end
31
+
32
+ def to_s
33
+ @words.join("|")
34
+ end
35
+
36
+ private
37
+
38
+ def encode!
39
+ # sort by frequency
40
+ @words = @words.sort_by { |word| word.count }.reverse
41
+
42
+ a = 62
43
+ e = lambda do |c|
44
+ (c < a ? '' : e.call((c.to_f / a).to_i) ) +
45
+ ((c = c % a) > 35 ? (c+29).chr : c.to_s(36))
46
+ end
47
+
48
+ # a dictionary of base62 -> base10
49
+ encoded = (0...(@words.size)).map { |i| e.call(i) }
50
+
51
+ index = 0
52
+ @words.each do |word|
53
+ if x = encoded.index(word.word)
54
+ word.index = x
55
+ def word.to_s; ""; end
56
+ else
57
+ index += 1 while has?(e.call(index))
58
+ word.index = index
59
+ index += 1
60
+ end
61
+ word.encoded = e.call(word.index)
62
+ end
63
+
64
+ # sort by encoding
65
+ @words = @words.sort_by { |word| word.index }
66
+ end
67
+
68
+ class Item
69
+ attr_accessor :word, :count, :encoded, :index
70
+
71
+ def initialize(word)
72
+ @word = word
73
+ @count = 0
74
+ @encoded = ""
75
+ @index = -1
76
+ end
77
+
78
+ def to_s
79
+ @word
80
+ end
81
+ end
82
+
83
+ end
84
+ end
data/lib/packr.rb ADDED
@@ -0,0 +1,227 @@
1
+ # PackR -- a Ruby port of Packer by Dean Edwards
2
+ # Packer version 3.0 (final) - copyright 2004-2007, Dean Edwards
3
+ # http://www.opensource.org/licenses/mit-license
4
+
5
+ require File.dirname(__FILE__) + '/string'
6
+ require File.dirname(__FILE__) + '/packr/regexp_group'
7
+ require File.dirname(__FILE__) + '/packr/words'
8
+
9
+ class Packr
10
+
11
+ class << self
12
+ def minify(script)
13
+ @packr ||= self.new
14
+ @packr.minify(script)
15
+ end
16
+
17
+ def pack(script, options = {})
18
+ @packr ||= self.new
19
+ @packr.pack(script, options)
20
+ end
21
+
22
+ def pack_file(path, options = {})
23
+ @packr ||= self.new
24
+ @packr.pack_file(path, options)
25
+ end
26
+ end
27
+
28
+ IGNORE = RegexpGroup::IGNORE
29
+ REMOVE = ""
30
+ SPACE = " "
31
+ WORDS = /\w+/
32
+
33
+ CONTINUE = /\\\r?\n/
34
+
35
+ ENCODE10 = "String"
36
+ ENCODE36 = "function(c){return c.toString(a)}"
37
+ ENCODE62 = "function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))}"
38
+
39
+ UNPACK = lambda do |p,a,c,k,e,r|
40
+ "eval(function(p,a,c,k,e,r){e=#{e};if(!''.replace(/^/,String)){while(c--)r[#{r}]=k[c]" +
41
+ "||#{r};k=[function(e){return r[e]}];e=function(){return'\\\\w+'};c=1};while(c--)if(k[c])p=p." +
42
+ "replace(new RegExp('\\\\b'+e(c)+'\\\\b','g'),k[c]);return p}('#{p}',#{a},#{c},'#{k}'.split('|'),0,{}))"
43
+ end
44
+
45
+ CLEAN = RegexpGroup.new(
46
+ "\\(\\s*;\\s*;\\s*\\)" => "(;;)", # for (;;) loops
47
+ "throw[^};]+[};]" => IGNORE, # a safari 1.3 bug
48
+ ";+\\s*([};])" => "\\1"
49
+ )
50
+
51
+ DATA = RegexpGroup.new(
52
+ # strings
53
+ "STRING1" => IGNORE,
54
+ 'STRING2' => IGNORE,
55
+ "CONDITIONAL" => IGNORE, # conditional comments
56
+ "(COMMENT1)\\n\\s*(REGEXP)?" => "\n\\3",
57
+ "(COMMENT2)\\s*(REGEXP)?" => " \\3",
58
+ "([\\[(\\^=,{}:;&|!*?])\\s*(REGEXP)" => "\\1\\2"
59
+ )
60
+
61
+ JAVASCRIPT = RegexpGroup.new(
62
+ :COMMENT1 => /(\/\/|;;;)[^\n]*/.source,
63
+ :COMMENT2 => /\/\*[^*]*\*+([^\/][^*]*\*+)*\//.source,
64
+ :CONDITIONAL => /\/\*@|@\*\/|\/\/@[^\n]*\n/.source,
65
+ :REGEXP => /\/(\\[\/\\]|[^*\/])(\\.|[^\/\n\\])*\/[gim]*/.source,
66
+ :STRING1 => /'(\\.|[^'\\])*'/.source,
67
+ :STRING2 => /"(\\.|[^"\\])*"/.source
68
+ )
69
+
70
+ WHITESPACE = RegexpGroup.new(
71
+ "(\\d)\\s+(\\.\\s*[a-z\\$_\\[(])" => "\\1 \\2", # http://dean.edwards.name/weblog/2007/04/packer3/#comment84066
72
+ "([+-])\\s+([+-])" => "\\1 \\2", # c = a++ +b;
73
+ "\\b\\s+\\$\\s+\\b" => " $ ", # var $ in
74
+ "\\$\\s+\\b" => "$ ", # object$ in
75
+ "\\b\\s+\\$" => " $", # return $object
76
+ "\\b\\s+\\b" => SPACE,
77
+ "\\s+" => REMOVE
78
+ )
79
+
80
+ def initialize
81
+ @data = {}
82
+ DATA.values.each { |item| @data[JAVASCRIPT.exec(item.expression)] = item.replacement }
83
+ @data = RegexpGroup.new(@data)
84
+ @whitespace = @data.union(WHITESPACE)
85
+ @clean = @data.union(CLEAN)
86
+ end
87
+
88
+ def minify(script)
89
+ script = script.gsub(CONTINUE, "")
90
+ script = @data.exec(script)
91
+ script = @whitespace.exec(script)
92
+ script = @clean.exec(script)
93
+ script
94
+ end
95
+
96
+ def pack(script, options = {})
97
+ script = minify(script + "\n")
98
+ script = shrink_variables(script) if options[:shrink_vars]
99
+ script = base62_encode(script) if options[:base62]
100
+ script
101
+ end
102
+
103
+ def pack_file(path, options = {})
104
+ path = path.gsub(Regexp.new("^((#{RAILS_ROOT.gsub(/\./, "\\.")})?/)?"), RAILS_ROOT + '/')
105
+ script = File.read(path)
106
+ script = pack(script, options)
107
+ File.open(path, 'wb') { |f| f.write(script) }
108
+ end
109
+
110
+ private
111
+
112
+ def base62_encode(script)
113
+ words = Words.new(script)
114
+ encode = lambda { |word| words.get(word).encoded }
115
+
116
+ # build the packed script
117
+
118
+ p = escape(script.gsub(Words::WORDS, &encode))
119
+ a = [[words.size, 2].max, 62].min
120
+ c = words.size
121
+ k = words.to_s
122
+ e = self.class.const_get("ENCODE#{a > 10 ? (a > 36 ? 62 : 36) : 10}")
123
+ r = a > 10 ? "e(c)" : "c"
124
+
125
+ # the whole thing
126
+ UNPACK.call(p,a,c,k,e,r)
127
+ end
128
+
129
+ def escape(script)
130
+ # single quotes wrap the final string so escape them
131
+ # also escape new lines required by conditional comments
132
+ script.gsub(/([\\'])/) { |match| "\\#{$1}" }.gsub(/[\r\n]+/, "\\n")
133
+ end
134
+
135
+ def shrink_variables(script)
136
+ data = [] # encoded strings and regular expressions
137
+ regexp= /^[^'"]\//
138
+ store = lambda do |string|
139
+ replacement = "##{data.length}"
140
+ if string =~ regexp
141
+ replacement = string[0].chr + replacement
142
+ string = string[1..-1]
143
+ end
144
+ data << string
145
+ replacement
146
+ end
147
+
148
+ # Base52 encoding (a-Z)
149
+ encode52 = lambda do |c|
150
+ (c < 52 ? '' : encode52.call((c.to_f / 52).to_i) ) +
151
+ ((c = c % 52) > 25 ? (c + 39).chr : (c + 97).chr)
152
+ end
153
+
154
+ # identify blocks, particularly identify function blocks (which define scope)
155
+ __block = /(function\s*[\w$]*\s*\(\s*([^\)]*)\s*\)\s*)?(\{([^{}]*)\})/
156
+ __var = /var\s+/
157
+ __var_name = /var\s+[\w$]+/
158
+ __comma = /\s*,\s*/
159
+ blocks = [] # store program blocks (anything between braces {})
160
+
161
+ # decoder for program blocks
162
+ encoded = /~(\d+)~/
163
+ decode = lambda do |script|
164
+ script = script.gsub(encoded) { |match| blocks[$1.to_i] } while script =~ encoded
165
+ script
166
+ end
167
+
168
+ # encoder for program blocks
169
+ encode = lambda do |match|
170
+ block, func, args = match, $1, $2
171
+ if func # the block is a function block
172
+
173
+ # decode the function block (THIS IS THE IMPORTANT BIT)
174
+ # We are retrieving all sub-blocks and will re-parse them in light
175
+ # of newly shrunk variables
176
+ block = decode.call(block)
177
+
178
+ # create the list of variable and argument names
179
+ vars = block.scan(__var_name).join(",").gsub(__var, "")
180
+ ids = (args.split(__comma) + vars.split(__comma)).uniq
181
+
182
+ #process each identifier
183
+ count = 0
184
+ ids.each do |id|
185
+ id = id.strip
186
+ if id and id.length > 1 # > 1 char
187
+ id = id.rescape
188
+ # find the next free short name (check everything in the current scope)
189
+ short_id = encode52.call(count)
190
+ while block =~ Regexp.new("[^\\w$.]#{short_id}[^\\w$:]")
191
+ count += 1
192
+ short_id = encode52.call(count)
193
+ end
194
+ # replace the long name with the short name
195
+ reg = Regexp.new("([^\\w$.])#{id}([^\\w$:])")
196
+ block = block.gsub(reg, "\\1#{short_id}\\2") while block =~ reg
197
+ reg = Regexp.new("([^{,\\w$.])#{id}:")
198
+ block = block.gsub(reg, "\\1#{short_id}:")
199
+ end
200
+ end
201
+ end
202
+ replacement = "~#{blocks.length}~"
203
+ blocks << block
204
+ replacement
205
+ end
206
+
207
+ # encode strings and regular expressions
208
+ script = @data.exec(script, &store)
209
+
210
+ # remove closures (this is for base2 namespaces only)
211
+ script = script.gsub(/new function\(_\)\s*\{/, "{;#;")
212
+
213
+ # encode blocks, as we encode we replace variable and argument names
214
+ script = script.gsub(__block, &encode) while script =~ __block
215
+
216
+ # put the blocks back
217
+ script = decode.call(script)
218
+
219
+ # put back the closure (for base2 namespaces only)
220
+ script = script.gsub(/\{;#;/, "new function(_){")
221
+
222
+ # put strings and regular expressions back
223
+ script = script.gsub(/#(\d+)/) { |match| data[$1.to_i] }
224
+
225
+ script
226
+ end
227
+ end
data/lib/string.rb ADDED
@@ -0,0 +1,5 @@
1
+ class String
2
+ def rescape
3
+ gsub(/([\/()\[\]{}|*+-.,^$?\\])/, "\\\\1")
4
+ end
5
+ end
@@ -0,0 +1 @@
1
+ if(typeof Effect=='undefined')throw("controls.js requires including script.aculo.us' effects.js library");var Autocompleter={}Autocompleter.Base=function(){};Autocompleter.Base.prototype={baseInitialize:function(element,update,options){this.element=$(element);this.update=$(update);this.hasFocus=false;this.changed=false;this.active=false;this.index=0;this.entryCount=0;if(this.setOptions)this.setOptions(options);else this.options=options||{};this.options.paramName=this.options.paramName||this.element.name;this.options.tokens=this.options.tokens||[];this.options.frequency=this.options.frequency||0.4;this.options.minChars=this.options.minChars||1;this.options.onShow=this.options.onShow||function(element,update){if(!update.style.position||update.style.position=='absolute'){update.style.position='absolute';Position.clone(element,update,{setHeight:false,offsetTop:element.offsetHeight})}Effect.Appear(update,{duration:0.15})};this.options.onHide=this.options.onHide||function(element,update){new Effect.Fade(update,{duration:0.15})};if(typeof(this.options.tokens)=='string')this.options.tokens=new Array(this.options.tokens);this.observer=null;this.element.setAttribute('autocomplete','off');Element.hide(this.update);Event.observe(this.element,"blur",this.onBlur.bindAsEventListener(this));Event.observe(this.element,"keypress",this.onKeyPress.bindAsEventListener(this))},show:function(){if(Element.getStyle(this.update,'display')=='none')this.options.onShow(this.element,this.update);if(!this.iefix&&(navigator.appVersion.indexOf('MSIE')>0)&&(navigator.userAgent.indexOf('Opera')<0)&&(Element.getStyle(this.update,'position')=='absolute')){new Insertion.After(this.update,'<iframe id="'+this.update.id+'_iefix" '+'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" '+'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.update.id+'_iefix')}if(this.iefix)setTimeout(this.fixIEOverlapping.bind(this),50)},fixIEOverlapping:function(){Position.clone(this.update,this.iefix,{setTop:(!this.update.style.height)});this.iefix.style.zIndex=1;this.update.style.zIndex=2;Element.show(this.iefix)},hide:function(){this.stopIndicator();if(Element.getStyle(this.update,'display')!='none')this.options.onHide(this.element,this.update);if(this.iefix)Element.hide(this.iefix)},startIndicator:function(){if(this.options.indicator)Element.show(this.options.indicator)},stopIndicator:function(){if(this.options.indicator)Element.hide(this.options.indicator)},onKeyPress:function(event){if(this.active)switch(event.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(event);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(event);return;case Event.KEY_LEFT:case Event.KEY_RIGHT:return;case Event.KEY_UP:this.markPrevious();this.render();if(navigator.appVersion.indexOf('AppleWebKit')>0)Event.stop(event);return;case Event.KEY_DOWN:this.markNext();this.render();if(navigator.appVersion.indexOf('AppleWebKit')>0)Event.stop(event);return}else if(event.keyCode==Event.KEY_TAB||event.keyCode==Event.KEY_RETURN||(navigator.appVersion.indexOf('AppleWebKit')>0&&event.keyCode==0))return;this.changed=true;this.hasFocus=true;if(this.observer)clearTimeout(this.observer);this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1000)},activate:function(){this.changed=false;this.hasFocus=true;this.getUpdatedChoices()},onHover:function(event){var element=Event.findElement(event,'LI');if(this.index!=element.autocompleteIndex){this.index=element.autocompleteIndex;this.render()}Event.stop(event)},onClick:function(event){var element=Event.findElement(event,'LI');this.index=element.autocompleteIndex;this.selectEntry();this.hide()},onBlur:function(event){setTimeout(this.hide.bind(this),250);this.hasFocus=false;this.active=false},render:function(){if(this.entryCount>0){for(var i=0;i<this.entryCount;i++)this.index==i?Element.addClassName(this.getEntry(i),"selected"):Element.removeClassName(this.getEntry(i),"selected");if(this.hasFocus){this.show();this.active=true}}else{this.active=false;this.hide()}},markPrevious:function(){if(this.index>0)this.index--else this.index=this.entryCount-1;this.getEntry(this.index)},markNext:function(){if(this.index<this.entryCount-1)this.index++else this.index=0;this.getEntry(this.index)},getEntry:function(index){return this.update.firstChild.childNodes[index]},getCurrentEntry:function(){return this.getEntry(this.index)},selectEntry:function(){this.active=false;this.updateElement(this.getCurrentEntry())},updateElement:function(selectedElement){if(this.options.updateElement){this.options.updateElement(selectedElement);return}var value='';if(this.options.select){var nodes=document.getElementsByClassName(this.options.select,selectedElement)||[];if(nodes.length>0)value=Element.collectTextNodes(nodes[0],this.options.select)}else value=Element.collectTextNodesIgnoreClass(selectedElement,'informal');var lastTokenPos=this.findLastToken();if(lastTokenPos!=-1){var newValue=this.element.value.substr(0,lastTokenPos+1);var whitespace=this.element.value.substr(lastTokenPos+1).match(/^\s+/);if(whitespace)newValue+=whitespace[0];this.element.value=newValue+value}else{this.element.value=value}this.element.focus();if(this.options.afterUpdateElement)this.options.afterUpdateElement(this.element,selectedElement)},updateChoices:function(choices){if(!this.changed&&this.hasFocus){this.update.innerHTML=choices;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.down());if(this.update.firstChild&&this.update.down().childNodes){this.entryCount=this.update.down().childNodes.length;for(var i=0;i<this.entryCount;i++){var entry=this.getEntry(i);entry.autocompleteIndex=i;this.addObservers(entry)}}else{this.entryCount=0}this.stopIndicator();this.index=0;if(this.entryCount==1&&this.options.autoSelect){this.selectEntry();this.hide()}else{this.render()}}},addObservers:function(element){Event.observe(element,"mouseover",this.onHover.bindAsEventListener(this));Event.observe(element,"click",this.onClick.bindAsEventListener(this))},onObserverEvent:function(){this.changed=false;if(this.getToken().length>=this.options.minChars){this.startIndicator();this.getUpdatedChoices()}else{this.active=false;this.hide()}},getToken:function(){var tokenPos=this.findLastToken();if(tokenPos!=-1)var ret=this.element.value.substr(tokenPos+1).replace(/^\s+/,'').replace(/\s+$/,'');else var ret=this.element.value;return/\n/.test(ret)?'':ret},findLastToken:function(){var lastTokenPos=-1;for(var i=0;i<this.options.tokens.length;i++){var thisTokenPos=this.element.value.lastIndexOf(this.options.tokens[i]);if(thisTokenPos>lastTokenPos)lastTokenPos=thisTokenPos}return lastTokenPos}}Ajax.Autocompleter=Class.create();Object.extend(Object.extend(Ajax.Autocompleter.prototype,Autocompleter.Base.prototype),{initialize:function(element,update,url,options){this.baseInitialize(element,update,options);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=url},getUpdatedChoices:function(){entry=encodeURIComponent(this.options.paramName)+'='+encodeURIComponent(this.getToken());this.options.parameters=this.options.callback?this.options.callback(this.element,entry):entry;if(this.options.defaultParams)this.options.parameters+='&'+this.options.defaultParams;new Ajax.Request(this.url,this.options)},onComplete:function(request){this.updateChoices(request.responseText)}});Autocompleter.Local=Class.create();Autocompleter.Local.prototype=Object.extend(new Autocompleter.Base(),{initialize:function(element,update,array,options){this.baseInitialize(element,update,options);this.options.array=array},getUpdatedChoices:function(){this.updateChoices(this.options.selector(this))},setOptions:function(options){this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(instance){var ret=[];var partial=[];var entry=instance.getToken();var count=0;for(var i=0;i<instance.options.array.length&&ret.length<instance.options.choices;i++){var elem=instance.options.array[i];var foundPos=instance.options.ignoreCase?elem.toLowerCase().indexOf(entry.toLowerCase()):elem.indexOf(entry);while(foundPos!=-1){if(foundPos==0&&elem.length!=entry.length){ret.push("<li><strong>"+elem.substr(0,entry.length)+"</strong>"+elem.substr(entry.length)+"</li>");break}else if(entry.length>=instance.options.partialChars&&instance.options.partialSearch&&foundPos!=-1){if(instance.options.fullSearch||/\s/.test(elem.substr(foundPos-1,1))){partial.push("<li>"+elem.substr(0,foundPos)+"<strong>"+elem.substr(foundPos,entry.length)+"</strong>"+elem.substr(foundPos+entry.length)+"</li>");break}}foundPos=instance.options.ignoreCase?elem.toLowerCase().indexOf(entry.toLowerCase(),foundPos+1):elem.indexOf(entry,foundPos+1)}}if(partial.length)ret=ret.concat(partial.slice(0,instance.options.choices-ret.length))return"<ul>"+ret.join('')+"</ul>"}},options||{})}});Field.scrollFreeActivate=function(field){setTimeout(function(){Field.activate(field)},1)}Ajax.InPlaceEditor=Class.create();Ajax.InPlaceEditor.defaultHighlightColor="#FFFF99";Ajax.InPlaceEditor.prototype={initialize:function(element,url,options){this.url=url;this.element=$(element);this.options=Object.extend({paramName:"value",okButton:true,okText:"ok",cancelLink:true,cancelText:"cancel",savingText:"Saving...",clickToEditText:"Click to edit",okText:"ok",rows:1,onComplete:function(transport,element){new Effect.Highlight(element,{startcolor:this.options.highlightcolor})},onFailure:function(transport){alert("Error communicating with the server: "+transport.responseText.stripTags())},callback:function(form){return Form.serialize(form)},handleLineBreaks:true,loadingText:'Loading...',savingClassName:'inplaceeditor-saving',loadingClassName:'inplaceeditor-loading',formClassName:'inplaceeditor-form',highlightcolor:Ajax.InPlaceEditor.defaultHighlightColor,highlightendcolor:"#FFFFFF",externalControl:null,submitOnBlur:false,ajaxOptions:{},evalScripts:false},options||{});if(!this.options.formId&&this.element.id){this.options.formId=this.element.id+"-inplaceeditor";if($(this.options.formId)){this.options.formId=null}}if(this.options.externalControl){this.options.externalControl=$(this.options.externalControl)}this.originalBackground=Element.getStyle(this.element,'background-color');if(!this.originalBackground){this.originalBackground="transparent"}this.element.title=this.options.clickToEditText;this.onclickListener=this.enterEditMode.bindAsEventListener(this);this.mouseoverListener=this.enterHover.bindAsEventListener(this);this.mouseoutListener=this.leaveHover.bindAsEventListener(this);Event.observe(this.element,'click',this.onclickListener);Event.observe(this.element,'mouseover',this.mouseoverListener);Event.observe(this.element,'mouseout',this.mouseoutListener);if(this.options.externalControl){Event.observe(this.options.externalControl,'click',this.onclickListener);Event.observe(this.options.externalControl,'mouseover',this.mouseoverListener);Event.observe(this.options.externalControl,'mouseout',this.mouseoutListener)}},enterEditMode:function(evt){if(this.saving)return;if(this.editing)return;this.editing=true;this.onEnterEditMode();if(this.options.externalControl){Element.hide(this.options.externalControl)}Element.hide(this.element);this.createForm();this.element.parentNode.insertBefore(this.form,this.element);if(!this.options.loadTextURL)Field.scrollFreeActivate(this.editField);if(evt){Event.stop(evt)}return false},createForm:function(){this.form=document.createElement("form");this.form.id=this.options.formId;Element.addClassName(this.form,this.options.formClassName)this.form.onsubmit=this.onSubmit.bind(this);this.createEditField();if(this.options.textarea){var br=document.createElement("br");this.form.appendChild(br)}if(this.options.okButton){okButton=document.createElement("input");okButton.type="submit";okButton.value=this.options.okText;okButton.className='editor_ok_button';this.form.appendChild(okButton)}if(this.options.cancelLink){cancelLink=document.createElement("a");cancelLink.href="#";cancelLink.appendChild(document.createTextNode(this.options.cancelText));cancelLink.onclick=this.onclickCancel.bind(this);cancelLink.className='editor_cancel';this.form.appendChild(cancelLink)}},hasHTMLLineBreaks:function(string){if(!this.options.handleLineBreaks)return false;return string.match(/<br/i)||string.match(/<p>/i)},convertHTMLLineBreaks:function(string){return string.replace(/<br>/gi,"\n").replace(/<br\/>/gi,"\n").replace(/<\/p>/gi,"\n").replace(/<p>/gi,"")},createEditField:function(){var text;if(this.options.loadTextURL){text=this.options.loadingText}else{text=this.getText()}var obj=this;if(this.options.rows==1&&!this.hasHTMLLineBreaks(text)){this.options.textarea=false;var textField=document.createElement("input");textField.obj=this;textField.type="text";textField.name=this.options.paramName;textField.value=text;textField.style.backgroundColor=this.options.highlightcolor;textField.className='editor_field';var size=this.options.size||this.options.cols||0;if(size!=0)textField.size=size;if(this.options.submitOnBlur)textField.onblur=this.onSubmit.bind(this);this.editField=textField}else{this.options.textarea=true;var textArea=document.createElement("textarea");textArea.obj=this;textArea.name=this.options.paramName;textArea.value=this.convertHTMLLineBreaks(text);textArea.rows=this.options.rows;textArea.cols=this.options.cols||40;textArea.className='editor_field';if(this.options.submitOnBlur)textArea.onblur=this.onSubmit.bind(this);this.editField=textArea}if(this.options.loadTextURL){this.loadExternalText()}this.form.appendChild(this.editField)},getText:function(){return this.element.innerHTML},loadExternalText:function(){Element.addClassName(this.form,this.options.loadingClassName);this.editField.disabled=true;new Ajax.Request(this.options.loadTextURL,Object.extend({asynchronous:true,onComplete:this.onLoadedExternalText.bind(this)},this.options.ajaxOptions))},onLoadedExternalText:function(transport){Element.removeClassName(this.form,this.options.loadingClassName);this.editField.disabled=false;this.editField.value=transport.responseText.stripTags();Field.scrollFreeActivate(this.editField)},onclickCancel:function(){this.onComplete();this.leaveEditMode();return false},onFailure:function(transport){this.options.onFailure(transport);if(this.oldInnerHTML){this.element.innerHTML=this.oldInnerHTML;this.oldInnerHTML=null}return false},onSubmit:function(){var form=this.form;var value=this.editField.value;this.onLoading();if(this.options.evalScripts){new Ajax.Request(this.url,Object.extend({parameters:this.options.callback(form,value),onComplete:this.onComplete.bind(this),onFailure:this.onFailure.bind(this),asynchronous:true,evalScripts:true},this.options.ajaxOptions))}else{new Ajax.Updater({success:this.element,failure:null},this.url,Object.extend({parameters:this.options.callback(form,value),onComplete:this.onComplete.bind(this),onFailure:this.onFailure.bind(this)},this.options.ajaxOptions))}if(arguments.length>1){Event.stop(arguments[0])}return false},onLoading:function(){this.saving=true;this.removeForm();this.leaveHover();this.showSaving()},showSaving:function(){this.oldInnerHTML=this.element.innerHTML;this.element.innerHTML=this.options.savingText;Element.addClassName(this.element,this.options.savingClassName);this.element.style.backgroundColor=this.originalBackground;Element.show(this.element)},removeForm:function(){if(this.form){if(this.form.parentNode)Element.remove(this.form);this.form=null}},enterHover:function(){if(this.saving)return;this.element.style.backgroundColor=this.options.highlightcolor;if(this.effect){this.effect.cancel()}Element.addClassName(this.element,this.options.hoverClassName)},leaveHover:function(){if(this.options.backgroundColor){this.element.style.backgroundColor=this.oldBackground}Element.removeClassName(this.element,this.options.hoverClassName)if(this.saving)return;this.effect=new Effect.Highlight(this.element,{startcolor:this.options.highlightcolor,endcolor:this.options.highlightendcolor,restorecolor:this.originalBackground})},leaveEditMode:function(){Element.removeClassName(this.element,this.options.savingClassName);this.removeForm();this.leaveHover();this.element.style.backgroundColor=this.originalBackground;Element.show(this.element);if(this.options.externalControl){Element.show(this.options.externalControl)}this.editing=false;this.saving=false;this.oldInnerHTML=null;this.onLeaveEditMode()},onComplete:function(transport){this.leaveEditMode();this.options.onComplete.bind(this)(transport,this.element)},onEnterEditMode:function(){},onLeaveEditMode:function(){},dispose:function(){if(this.oldInnerHTML){this.element.innerHTML=this.oldInnerHTML}this.leaveEditMode();Event.stopObserving(this.element,'click',this.onclickListener);Event.stopObserving(this.element,'mouseover',this.mouseoverListener);Event.stopObserving(this.element,'mouseout',this.mouseoutListener);if(this.options.externalControl){Event.stopObserving(this.options.externalControl,'click',this.onclickListener);Event.stopObserving(this.options.externalControl,'mouseover',this.mouseoverListener);Event.stopObserving(this.options.externalControl,'mouseout',this.mouseoutListener)}}};Ajax.InPlaceCollectionEditor=Class.create();Object.extend(Ajax.InPlaceCollectionEditor.prototype,Ajax.InPlaceEditor.prototype);Object.extend(Ajax.InPlaceCollectionEditor.prototype,{createEditField:function(){if(!this.cached_selectTag){var selectTag=document.createElement("select");var collection=this.options.collection||[];var optionTag;collection.each(function(e,i){optionTag=document.createElement("option");optionTag.value=(e instanceof Array)?e[0]:e;if((typeof this.options.value=='undefined')&&((e instanceof Array)?this.element.innerHTML==e[1]:e==optionTag.value))optionTag.selected=true;if(this.options.value==optionTag.value)optionTag.selected=true;optionTag.appendChild(document.createTextNode((e instanceof Array)?e[1]:e));selectTag.appendChild(optionTag)}.bind(this));this.cached_selectTag=selectTag}this.editField=this.cached_selectTag;if(this.options.loadTextURL)this.loadExternalText();this.form.appendChild(this.editField);this.options.callback=function(form,value){return"value="+encodeURIComponent(value)}}});Form.Element.DelayedObserver=Class.create();Form.Element.DelayedObserver.prototype={initialize:function(element,delay,callback){this.delay=delay||0.5;this.element=$(element);this.callback=callback;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this))},delayedListener:function(event){if(this.lastValue==$F(this.element))return;if(this.timer)clearTimeout(this.timer);this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1000);this.lastValue=$F(this.element)},onTimerEvent:function(){this.timer=null;this.callback(this.element,$F(this.element))}};
@@ -0,0 +1 @@
1
+ if(typeof Effect=='undefined')throw("dragdrop.js requires including script.aculo.us' effects.js library");var Droppables={drops:[],remove:function(a){this.drops=this.drops.reject(function(d){return d.element==$(a)})},add:function(a){a=$(a);var b=Object.extend({greedy:true,hoverclass:null,tree:false},arguments[1]||{});if(b.containment){b._containers=[];var d=b.containment;if((typeof d=='object')&&(d.constructor==Array)){d.each(function(c){b._containers.push($(c))})}else{b._containers.push($(d))}}if(b.accept)b.accept=[b.accept].flatten();Element.makePositioned(a);b.element=a;this.drops.push(b)},findDeepestChild:function(a){deepest=a[0];for(i=1;i<a.length;++i)if(Element.isParent(a[i].element,deepest.element))deepest=a[i];return deepest},isContained:function(a,b){var d;if(b.tree){d=a.treeNode}else{d=a.parentNode}return b._containers.detect(function(c){return d==c})},isAffected:function(a,b,c){return((c.element!=b)&&((!c._containers)||this.isContained(b,c))&&((!c.accept)||(Element.classNames(b).detect(function(v){return c.accept.include(v)})))&&Position.within(c.element,a[0],a[1]))},deactivate:function(a){if(a.hoverclass)Element.removeClassName(a.element,a.hoverclass);this.last_active=null},activate:function(a){if(a.hoverclass)Element.addClassName(a.element,a.hoverclass);this.last_active=a},show:function(b,c){if(!this.drops.length)return;var d=[];if(this.last_active)this.deactivate(this.last_active);this.drops.each(function(a){if(Droppables.isAffected(b,c,a))d.push(a)});if(d.length>0){drop=Droppables.findDeepestChild(d);Position.within(drop.element,b[0],b[1]);if(drop.onHover)drop.onHover(c,drop.element,Position.overlap(drop.overlap,drop.element));Droppables.activate(drop)}},fire:function(a,b){if(!this.last_active)return;Position.prepare();if(this.isAffected([Event.pointerX(a),Event.pointerY(a)],b,this.last_active))if(this.last_active.onDrop)this.last_active.onDrop(b,this.last_active.element,a)},reset:function(){if(this.last_active)this.deactivate(this.last_active)}}var Draggables={drags:[],observers:[],register:function(a){if(this.drags.length==0){this.eventMouseUp=this.endDrag.bindAsEventListener(this);this.eventMouseMove=this.updateDrag.bindAsEventListener(this);this.eventKeypress=this.keyPress.bindAsEventListener(this);Event.observe(document,"mouseup",this.eventMouseUp);Event.observe(document,"mousemove",this.eventMouseMove);Event.observe(document,"keypress",this.eventKeypress)}this.drags.push(a)},unregister:function(a){this.drags=this.drags.reject(function(d){return d==a});if(this.drags.length==0){Event.stopObserving(document,"mouseup",this.eventMouseUp);Event.stopObserving(document,"mousemove",this.eventMouseMove);Event.stopObserving(document,"keypress",this.eventKeypress)}},activate:function(a){if(a.options.delay){this._timeout=setTimeout(function(){Draggables._timeout=null;window.focus();Draggables.activeDraggable=a}.bind(this),a.options.delay)}else{window.focus();this.activeDraggable=a}},deactivate:function(){this.activeDraggable=null},updateDrag:function(a){if(!this.activeDraggable)return;var b=[Event.pointerX(a),Event.pointerY(a)];if(this._lastPointer&&(this._lastPointer.inspect()==b.inspect()))return;this._lastPointer=b;this.activeDraggable.updateDrag(a,b)},endDrag:function(a){if(this._timeout){clearTimeout(this._timeout);this._timeout=null}if(!this.activeDraggable)return;this._lastPointer=null;this.activeDraggable.endDrag(a);this.activeDraggable=null},keyPress:function(a){if(this.activeDraggable)this.activeDraggable.keyPress(a)},addObserver:function(a){this.observers.push(a);this._cacheObserverCallbacks()},removeObserver:function(a){this.observers=this.observers.reject(function(o){return o.element==a});this._cacheObserverCallbacks()},notify:function(a,b,c){if(this[a+'Count']>0)this.observers.each(function(o){if(o[a])o[a](a,b,c)});if(b.options[a])b.options[a](b,c)},_cacheObserverCallbacks:function(){['onStart','onEnd','onDrag'].each(function(a){Draggables[a+'Count']=Draggables.observers.select(function(o){return o[a]}).length})}}var Draggable=Class.create();Draggable._dragging={};Draggable.prototype={initialize:function(e){var f={handle:false,reverteffect:function(a,b,c){var d=Math.sqrt(Math.abs(b^2)+Math.abs(c^2))*0.02;new Effect.Move(a,{x:-c,y:-b,duration:d,queue:{scope:'_draggable',position:'end'}})},endeffect:function(a){var b=typeof a._opacity=='number'?a._opacity:1.0;new Effect.Opacity(a,{duration:0.2,from:0.7,to:b,queue:{scope:'_draggable',position:'end'},afterFinish:function(){Draggable._dragging[a]=false}})},zindex:1000,revert:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,snap:false,delay:0};if(!arguments[1]||typeof arguments[1].endeffect=='undefined')Object.extend(f,{starteffect:function(a){a._opacity=Element.getOpacity(a);Draggable._dragging[a]=true;new Effect.Opacity(a,{duration:0.2,from:a._opacity,to:0.7})}});var g=Object.extend(f,arguments[1]||{});this.element=$(e);if(g.handle&&(typeof g.handle=='string'))this.handle=this.element.down('.'+g.handle,0);if(!this.handle)this.handle=$(g.handle);if(!this.handle)this.handle=this.element;if(g.scroll&&!g.scroll.scrollTo&&!g.scroll.outerHTML){g.scroll=$(g.scroll);this._isScrollChild=Element.childOf(this.element,g.scroll)}Element.makePositioned(this.element);this.delta=this.currentDelta();this.options=g;this.dragging=false;this.eventMouseDown=this.initDrag.bindAsEventListener(this);Event.observe(this.handle,"mousedown",this.eventMouseDown);Draggables.register(this)},destroy:function(){Event.stopObserving(this.handle,"mousedown",this.eventMouseDown);Draggables.unregister(this)},currentDelta:function(){return([parseInt(Element.getStyle(this.element,'left')||'0'),parseInt(Element.getStyle(this.element,'top')||'0')])},initDrag:function(a){if(typeof Draggable._dragging[this.element]!='undefined'&&Draggable._dragging[this.element])return;if(Event.isLeftClick(a)){var b=Event.element(a);if(b.tagName&&(b.tagName=='INPUT'||b.tagName=='SELECT'||b.tagName=='OPTION'||b.tagName=='BUTTON'||b.tagName=='TEXTAREA'))return;var c=[Event.pointerX(a),Event.pointerY(a)];var d=Position.cumulativeOffset(this.element);this.offset=[0,1].map(function(i){return(c[i]-d[i])});Draggables.activate(this);Event.stop(a)}},startDrag:function(a){this.dragging=true;if(this.options.zindex){this.originalZ=parseInt(Element.getStyle(this.element,'z-index')||0);this.element.style.zIndex=this.options.zindex}if(this.options.ghosting){this._clone=this.element.cloneNode(true);Position.absolutize(this.element);this.element.parentNode.insertBefore(this._clone,this.element)}if(this.options.scroll){if(this.options.scroll==window){var b=this._getWindowScroll(this.options.scroll);this.originalScrollLeft=b.left;this.originalScrollTop=b.top}else{this.originalScrollLeft=this.options.scroll.scrollLeft;this.originalScrollTop=this.options.scroll.scrollTop}}Draggables.notify('onStart',this,a);if(this.options.starteffect)this.options.starteffect(this.element)},updateDrag:function(a,b){if(!this.dragging)this.startDrag(a);Position.prepare();Droppables.show(b,this.element);Draggables.notify('onDrag',this,a);this.draw(b);if(this.options.change)this.options.change(this);if(this.options.scroll){this.stopScrolling();var p;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){p=[left,top,left+width,top+height]}}else{p=Position.page(this.options.scroll);p[0]+=this.options.scroll.scrollLeft+Position.deltaX;p[1]+=this.options.scroll.scrollTop+Position.deltaY;p.push(p[0]+this.options.scroll.offsetWidth);p.push(p[1]+this.options.scroll.offsetHeight)}var c=[0,0];if(b[0]<(p[0]+this.options.scrollSensitivity))c[0]=b[0]-(p[0]+this.options.scrollSensitivity);if(b[1]<(p[1]+this.options.scrollSensitivity))c[1]=b[1]-(p[1]+this.options.scrollSensitivity);if(b[0]>(p[2]-this.options.scrollSensitivity))c[0]=b[0]-(p[2]-this.options.scrollSensitivity);if(b[1]>(p[3]-this.options.scrollSensitivity))c[1]=b[1]-(p[3]-this.options.scrollSensitivity);this.startScrolling(c)}if(navigator.appVersion.indexOf('AppleWebKit')>0)window.scrollBy(0,0);Event.stop(a)},finishDrag:function(a,b){this.dragging=false;if(this.options.ghosting){Position.relativize(this.element);Element.remove(this._clone);this._clone=null}if(b)Droppables.fire(a,this.element);Draggables.notify('onEnd',this,a);var c=this.options.revert;if(c&&typeof c=='function')c=c(this.element);var d=this.currentDelta();if(c&&this.options.reverteffect){this.options.reverteffect(this.element,d[1]-this.delta[1],d[0]-this.delta[0])}else{this.delta=d}if(this.options.zindex)this.element.style.zIndex=this.originalZ;if(this.options.endeffect)this.options.endeffect(this.element);Draggables.deactivate(this);Droppables.reset()},keyPress:function(a){if(a.keyCode!=Event.KEY_ESC)return;this.finishDrag(a,false);Event.stop(a)},endDrag:function(a){if(!this.dragging)return;this.stopScrolling();this.finishDrag(a,true);Event.stop(a)},draw:function(a){var b=Position.cumulativeOffset(this.element);if(this.options.ghosting){var r=Position.realOffset(this.element);b[0]+=r[0]-Position.deltaX;b[1]+=r[1]-Position.deltaY}var d=this.currentDelta();b[0]-=d[0];b[1]-=d[1];if(this.options.scroll&&(this.options.scroll!=window&&this._isScrollChild)){b[0]-=this.options.scroll.scrollLeft-this.originalScrollLeft;b[1]-=this.options.scroll.scrollTop-this.originalScrollTop}var p=[0,1].map(function(i){return(a[i]-b[i]-this.offset[i])}.bind(this));if(this.options.snap){if(typeof this.options.snap=='function'){p=this.options.snap(p[0],p[1],this)}else{if(this.options.snap instanceof Array){p=p.map(function(v,i){return Math.round(v/this.options.snap[i])*this.options.snap[i]}.bind(this))}else{p=p.map(function(v){return Math.round(v/this.options.snap)*this.options.snap}.bind(this))}}}var c=this.element.style;if((!this.options.constraint)||(this.options.constraint=='horizontal'))c.left=p[0]+"px";if((!this.options.constraint)||(this.options.constraint=='vertical'))c.top=p[1]+"px";if(c.visibility=="hidden")c.visibility=""},stopScrolling:function(){if(this.scrollInterval){clearInterval(this.scrollInterval);this.scrollInterval=null;Draggables._lastScrollPointer=null}},startScrolling:function(a){if(!(a[0]||a[1]))return;this.scrollSpeed=[a[0]*this.options.scrollSpeed,a[1]*this.options.scrollSpeed];this.lastScrolled=new Date();this.scrollInterval=setInterval(this.scroll.bind(this),10)},scroll:function(){var a=new Date();var b=a-this.lastScrolled;this.lastScrolled=a;if(this.options.scroll==window){with(this._getWindowScroll(this.options.scroll)){if(this.scrollSpeed[0]||this.scrollSpeed[1]){var d=b/1000;this.options.scroll.scrollTo(left+d*this.scrollSpeed[0],top+d*this.scrollSpeed[1])}}}else{this.options.scroll.scrollLeft+=this.scrollSpeed[0]*b/1000;this.options.scroll.scrollTop+=this.scrollSpeed[1]*b/1000}Position.prepare();Droppables.show(Draggables._lastPointer,this.element);Draggables.notify('onDrag',this);if(this._isScrollChild){Draggables._lastScrollPointer=Draggables._lastScrollPointer||$A(Draggables._lastPointer);Draggables._lastScrollPointer[0]+=this.scrollSpeed[0]*b/1000;Draggables._lastScrollPointer[1]+=this.scrollSpeed[1]*b/1000;if(Draggables._lastScrollPointer[0]<0)Draggables._lastScrollPointer[0]=0;if(Draggables._lastScrollPointer[1]<0)Draggables._lastScrollPointer[1]=0;this.draw(Draggables._lastScrollPointer)}if(this.options.change)this.options.change(this)},_getWindowScroll:function(w){var T,L,W,H;with(w.document){if(w.document.documentElement&&documentElement.scrollTop){T=documentElement.scrollTop;L=documentElement.scrollLeft}else if(w.document.body){T=body.scrollTop;L=body.scrollLeft}if(w.innerWidth){W=w.innerWidth;H=w.innerHeight}else if(w.document.documentElement&&documentElement.clientWidth){W=documentElement.clientWidth;H=documentElement.clientHeight}else{W=body.offsetWidth;H=body.offsetHeight}}return{top:T,left:L,width:W,height:H}}}var SortableObserver=Class.create();SortableObserver.prototype={initialize:function(a,b){this.element=$(a);this.observer=b;this.lastValue=Sortable.serialize(this.element)},onStart:function(){this.lastValue=Sortable.serialize(this.element)},onEnd:function(){Sortable.unmark();if(this.lastValue!=Sortable.serialize(this.element))this.observer(this.element)}}var Sortable={SERIALIZE_RULE:/^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,sortables:{},_findRootElement:function(a){while(a.tagName!="BODY"){if(a.id&&Sortable.sortables[a.id])return a;a=a.parentNode}},options:function(a){a=Sortable._findRootElement($(a));if(!a)return;return Sortable.sortables[a.id]},destroy:function(a){var s=Sortable.options(a);if(s){Draggables.removeObserver(s.element);s.droppables.each(function(d){Droppables.remove(d)});s.draggables.invoke('destroy');delete Sortable.sortables[s.element.id]}},create:function(b){b=$(b);var c=Object.extend({element:b,tag:'li',dropOnEmpty:false,tree:false,treeTag:'ul',overlap:'vertical',constraint:'vertical',containment:b,handle:false,only:false,delay:0,hoverclass:null,ghosting:false,scroll:false,scrollSensitivity:20,scrollSpeed:15,format:this.SERIALIZE_RULE,onChange:Prototype.emptyFunction,onUpdate:Prototype.emptyFunction},arguments[1]||{});this.destroy(b);var d={revert:true,scroll:c.scroll,scrollSpeed:c.scrollSpeed,scrollSensitivity:c.scrollSensitivity,delay:c.delay,ghosting:c.ghosting,constraint:c.constraint,handle:c.handle};if(c.starteffect)d.starteffect=c.starteffect;if(c.reverteffect)d.reverteffect=c.reverteffect;else if(c.ghosting)d.reverteffect=function(a){a.style.top=0;a.style.left=0};if(c.endeffect)d.endeffect=c.endeffect;if(c.zindex)d.zindex=c.zindex;var f={overlap:c.overlap,containment:c.containment,tree:c.tree,hoverclass:c.hoverclass,onHover:Sortable.onHover}var g={onHover:Sortable.onEmptyHover,overlap:c.overlap,containment:c.containment,hoverclass:c.hoverclass}Element.cleanWhitespace(b);c.draggables=[];c.droppables=[];if(c.dropOnEmpty||c.tree){Droppables.add(b,g);c.droppables.push(b)}(this.findElements(b,c)||[]).each(function(e){var a=c.handle?$(e).down('.'+c.handle,0):e;c.draggables.push(new Draggable(e,Object.extend(d,{handle:a})));Droppables.add(e,f);if(c.tree)e.treeNode=b;c.droppables.push(e)});if(c.tree){(Sortable.findTreeElements(b,c)||[]).each(function(e){Droppables.add(e,g);e.treeNode=b;c.droppables.push(e)})}this.sortables[b.id]=c;Draggables.addObserver(new SortableObserver(b,c.onUpdate))},findElements:function(a,b){return Element.findChildren(a,b.only,b.tree?true:false,b.tag)},findTreeElements:function(a,b){return Element.findChildren(a,b.only,b.tree?true:false,b.treeTag)},onHover:function(a,b,c){if(Element.isParent(b,a))return;if(c>.33&&c<.66&&Sortable.options(b).tree){return}else if(c>0.5){Sortable.mark(b,'before');if(b.previousSibling!=a){var d=a.parentNode;a.style.visibility="hidden";b.parentNode.insertBefore(a,b);if(b.parentNode!=d)Sortable.options(d).onChange(a);Sortable.options(b.parentNode).onChange(a)}}else{Sortable.mark(b,'after');var e=b.nextSibling||null;if(e!=a){var d=a.parentNode;a.style.visibility="hidden";b.parentNode.insertBefore(a,e);if(b.parentNode!=d)Sortable.options(d).onChange(a);Sortable.options(b.parentNode).onChange(a)}}},onEmptyHover:function(a,b,c){var d=a.parentNode;var e=Sortable.options(b);if(!Element.isParent(b,a)){var f;var g=Sortable.findElements(b,{tag:e.tag,only:e.only});var h=null;if(g){var i=Element.offsetSize(b,e.overlap)*(1.0-c);for(f=0;f<g.length;f+=1){if(i-Element.offsetSize(g[f],e.overlap)>=0){i-=Element.offsetSize(g[f],e.overlap)}else if(i-(Element.offsetSize(g[f],e.overlap)/2)>=0){h=f+1<g.length?g[f+1]:null;break}else{h=g[f];break}}}b.insertBefore(a,h);Sortable.options(d).onChange(a);e.onChange(a)}},unmark:function(){if(Sortable._marker)Sortable._marker.hide()},mark:function(a,b){var c=Sortable.options(a.parentNode);if(c&&!c.ghosting)return;if(!Sortable._marker){Sortable._marker=($('dropmarker')||Element.extend(document.createElement('DIV'))).hide().addClassName('dropmarker').setStyle({position:'absolute'});document.getElementsByTagName("body").item(0).appendChild(Sortable._marker)}var d=Position.cumulativeOffset(a);Sortable._marker.setStyle({left:d[0]+'px',top:d[1]+'px'});if(b=='after')if(c.overlap=='horizontal')Sortable._marker.setStyle({left:(d[0]+a.clientWidth)+'px'});else Sortable._marker.setStyle({top:(d[1]+a.clientHeight)+'px'});Sortable._marker.show()},_tree:function(a,b,c){var d=Sortable.findElements(a,b)||[];for(var i=0;i<d.length;++i){var e=d[i].id.match(b.format);if(!e)continue;var f={id:encodeURIComponent(e?e[1]:null),element:a,parent:c,children:[],position:c.children.length,container:$(d[i]).down(b.treeTag)}if(f.container)this._tree(f.container,b,f)c.children.push(f)}return c},tree:function(a){a=$(a);var b=this.options(a);var c=Object.extend({tag:b.tag,treeTag:b.treeTag,only:b.only,name:a.id,format:b.format},arguments[1]||{});var d={id:null,parent:null,children:[],container:a,position:0}return Sortable._tree(a,c,d)},_constructIndex:function(a){var b='';do{if(a.id)b='['+a.position+']'+b}while((a=a.parent)!=null);return b},sequence:function(b){b=$(b);var c=Object.extend(this.options(b),arguments[1]||{});return $(this.findElements(b,c)||[]).map(function(a){return a.id.match(c.format)?a.id.match(c.format)[1]:''})},setSequence:function(b,c){b=$(b);var d=Object.extend(this.options(b),arguments[2]||{});var e={};this.findElements(b,d).each(function(n){if(n.id.match(d.format))e[n.id.match(d.format)[1]]=[n,n.parentNode];n.parentNode.removeChild(n)});c.each(function(a){var n=e[a];if(n){n[1].appendChild(n[0]);delete e[a]}})},serialize:function(b){b=$(b);var c=Object.extend(Sortable.options(b),arguments[1]||{});var d=encodeURIComponent((arguments[1]&&arguments[1].name)?arguments[1].name:b.id);if(c.tree){return Sortable.tree(b,arguments[1]).children.map(function(a){return[d+Sortable._constructIndex(a)+"[id]="+encodeURIComponent(a.id)].concat(a.children.map(arguments.callee))}).flatten().join('&')}else{return Sortable.sequence(b,arguments[1]).map(function(a){return d+"[]="+encodeURIComponent(a)}).join('&')}}}Element.isParent=function(a,b){if(!a.parentNode||a==b)return false;if(a.parentNode==b)return true;return Element.isParent(a.parentNode,b)}Element.findChildren=function(b,c,d,f){if(!b.hasChildNodes())return null;f=f.toUpperCase();if(c)c=[c].flatten();var g=[];$A(b.childNodes).each(function(e){if(e.tagName&&e.tagName.toUpperCase()==f&&(!c||(Element.classNames(e).detect(function(v){return c.include(v)}))))g.push(e);if(d){var a=Element.findChildren(e,c,d,f);if(a)g.push(a)}});return(g.length>0?g.flatten():[])}Element.offsetSize=function(a,b){return a['offset'+((b=='vertical'||b=='height')?'Height':'Width')]}
@@ -0,0 +1 @@
1
+ eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('3H.J.1K=a(){j N=\'#\';h(8.2e(0,4)==\'6A(\'){j 4d=8.2e(4,8.1J-1).8d(\',\');j i=0;7V{N+=2z(4d[i]).34()}7p(++i<3)}2j{h(8.2e(0,1)==\'#\'){h(8.1J==4)3Z(j i=1;i<4;i++)N+=(8.39(i)+8.39(i)).3h();h(8.1J==7)N=8.3h()}}l(N.1J==7?N:(C[0]||8))}L.3J=a(6){l $A($(6).2U).4U(a(1c){l(1c.3u==3?1c.3B:(1c.4z()?L.3J(1c):\'\'))}).2P().4u(\'\')}L.3j=a(6,3g){l $A($(6).2U).4U(a(1c){l(1c.3u==3?1c.3B:((1c.4z()&&!L.7h(1c,3g))?L.3j(1c,3g):\'\'))}).2P().4u(\'\')}L.4b=a(6,2H){6=$(6);6.u({1l:(2H/19)+\'38\'});h(1Q.6s.4A(\'6d\')>0)W.5X(0,0);l 6}L.2h=a(6){6=$(6);j Q;h(Q=6.O(\'Q\'))l 1V(Q);h(Q=(6.O(\'2v\')||\'\').3L(/30\\(Q=(.*)\\)/))h(Q[1])l 1V(Q[1])/19;l 1.0}L.2V=a(6,P){6=$(6);h(P==1){6.u({Q:(/8k/.1M(1Q.2f)&&!/89|85|83/.1M(1Q.2f))?0.81:1.0});h(/2Q/.1M(1Q.2f)&&!W.1h)6.u({2v:L.O(6,\'2v\').4N(/30\\([^\\)]*\\)/4J,\'\')})}2j{h(P<0.7N)P=0;6.u({Q:P});h(/2Q/.1M(1Q.2f)&&!W.1h)6.u({2v:6.O(\'2v\').4N(/30\\([^\\)]*\\)/4J,\'\')+\'30(Q=\'+P*19+\')\'})}l 6}L.1x=a(6){l $(6).r.Q||\'\'}L.3q=a(6){7H{6=$(6);j n=29.7x(\' \');6.7v(n);6.7q(n)}7o(e){}};7g.J.7b=a(){j 4a=C;8.13(a(f){f.6Y(8,4a)})}j c={2b:{6Q:\'6L\',6H:\'6D 6C 6B 6 6z 6v 6r, 6o 6l 6g 3Z 8 b 1j 66\'},4g:a(6){h(21 4i==\'5Q\')26("c.4g 5J 5F 5D.5y.5v\' 5r.5o 5j");j 3I=\'w:59\';h(/2Q/.1M(1Q.2f)&&!W.1h)3I+=\';56:1\';6=$(6);$A(6.2U).13(a(2n){h(2n.3u==3){2n.3B.8s().13(a(3K){6.8n(4i.1c(\'8j\',{r:3I},3K==\' \'?3H.8g(8b):3K),2n)});L.3A(2n)}})},8a:a(6,b){j 2d;h(((21 6==\'87\')||(21 6==\'a\'))&&(6.1J))2d=6;2j 2d=$(6).2U;j g=p.o({4T:0.1,2r:0.0},C[2]||{});j 4S=g.2r;$A(2d).13(a(6,4Q){q b(6,p.o(g,{2r:4Q*g.4T+4S}))})},3v:{\'7Z\':[\'4M\',\'4K\'],\'7R\':[\'4H\',\'4G\'],\'4D\':[\'3t\',\'4C\']},7J:a(6,b){6=$(6);b=(b||\'4D\').3h();j g=p.o({1g:{w:\'4w\',3p:(6.7F||\'2A\'),3m:1}},C[2]||{});c[6.7A()?c.3v[b][1]:c.3v[b][0]](6,g)}};j 7z=c;c.1f={7w:4q.K,1N:a(B){l(-S.35(B*S.3e)/2)+0.5},7i:a(B){l 1-B},4h:a(B){l((-S.35(B*S.3e)/4)+0.75)+S.7a()/4},77:a(B){l(-S.35(B*S.3e*(9*B))/2)+0.5},49:a(B,1w){1w=1w||5;l(S.1z((B%(1/1w))*1w)==0?((B*1w*2)-S.47(B*1w*2)):1-((B*1w*2)-S.47(B*1w*2)))},2m:a(B){l 0},44:a(B){l 1}};c.3d=1r.1t();p.o(p.o(c.3d.J,6S),{1v:a(){8.F=[];8.2o=1P},41:a(3Y){8.F.41(3Y)},3X:a(b){j 1R=q 3U().3T();j w=(21 b.g.1g==\'2I\')?b.g.1g:b.g.1g.w;37(w){14\'6y\':8.F.6w(a(e){l e.28==\'3c\'}).13(a(e){e.1L+=b.1I;e.1I+=b.1I});15;14\'6m-6k\':1R=8.F.4c(\'1L\').2i()||1R;15;14\'4w\':1R=8.F.4c(\'1I\').2i()||1R;15}b.1L+=1R;b.1I+=1R;h(!b.g.1g.3m||(8.F.1J<b.g.1g.3m))8.F.45(b);h(!8.2o)8.2o=6c(8.2E.1k(8),40)},3A:a(b){8.F=8.F.4e(a(e){l e==b});h(8.F.1J==0){63(8.2o);8.2o=1P}},2E:a(){j 27=q 3U().3T();8.F.4f(\'2E\',27)}});c.2D={2G:$H(),2C:a(2a){h(21 2a!=\'2I\')l 2a;h(!8.2G[2a])8.2G[2a]=q c.3d();l 8.2G[2a]}}c.5N=c.2D.2C(\'2A\');c.4p={X:c.1f.1N,V:1.0,4r:25.0,10:T,1e:0.0,1j:1.0,2r:0.0,1g:\'5x\'}c.1q=a(){};c.1q.J={w:1P,1E:a(g){8.g=p.o(p.o({},c.4p),g||{});8.3y=0;8.28=\'3c\';8.1L=8.g.2r*2S;8.1I=8.1L+(8.g.V*2S);8.1m(\'5n\');h(!8.g.10)c.2D.2C(21 8.g.1g==\'2I\'?\'2A\':8.g.1g.3p).3X(8)},2E:a(27){h(27>=8.1L){h(27>=8.1I){8.2t(1.0);8.2R();8.1m(\'4O\');h(8.1W)8.1W();8.1m(\'51\');l}j B=(27-8.1L)/(8.1I-8.1L);j 3z=S.1z(B*8.g.4r*8.g.V);h(3z>8.3y){8.2t(B);8.3y=3z}}},2t:a(B){h(8.28==\'3c\'){8.28=\'4Z\';8.1m(\'1Y\');h(8.1U)8.1U();8.1m(\'3D\')}h(8.28==\'4Z\'){h(8.g.X)B=8.g.X(B);B*=(8.g.1j-8.g.1e);B+=8.g.1e;8.w=B;8.1m(\'8x\');h(8.1n)8.1n(B);8.1m(\'8t\')}},2R:a(){h(!8.g.10)c.2D.2C(21 8.g.1g==\'2I\'?\'2A\':8.g.1g.3p).3A(8);8.28=\'8r\'},1m:a(2p){h(8.g[2p+\'54\'])8.g[2p+\'54\'](8);h(8.g[2p])8.g[2p](8)},3i:a(){l\'#<c:\'+$H(8).3i()+\',g:\'+$H(8.g).3i()+\'>\'}}c.1Z=1r.1t();p.o(p.o(c.1Z.J,c.1q.J),{1v:a(F){8.F=F||[];8.1E(C[1])},1n:a(w){8.F.4f(\'2t\',w)},1W:a(w){8.F.13(a(b){b.2t(1.0);b.2R();b.1m(\'4O\');h(b.1W)b.1W(w);b.1m(\'51\')})}});c.5a=1r.1t();p.o(p.o(c.5a.J,c.1q.J),{1v:a(){j g=p.o({V:0},C[0]||{});8.1E(g)},1n:4q.8i});c.1B=1r.1t();p.o(p.o(c.1B.J,c.1q.J),{1v:a(6){8.6=$(6);h(!8.6)26(c.2b);h(/2Q/.1M(1Q.2f)&&!W.1h&&(!8.6.8f.8e))8.6.u({56:1});j g=p.o({1e:8.6.2h()||0.0,1j:1.0},C[1]||{});8.1E(g)},1n:a(w){8.6.2V(w)}});c.18=1r.1t();p.o(p.o(c.18.J,c.1q.J),{1v:a(6){8.6=$(6);h(!8.6)26(c.2b);j g=p.o({x:0,y:0,50:\'59\'},C[1]||{});8.1E(g)},1U:a(){8.6.1A();8.2x=1V(8.6.O(\'M\')||\'0\');8.2w=1V(8.6.O(\'G\')||\'0\');h(8.g.50==\'4Y\'){8.g.x=8.g.x-8.2x;8.g.y=8.g.y-8.2w}},1n:a(w){8.6.u({M:S.1z(8.g.x*w+8.2x)+\'1a\',G:S.1z(8.g.y*w+8.2w)+\'1a\'})}});c.86=a(6,4X,4W){l q c.18(6,p.o({x:4W,y:4X},C[3]||{}))};c.17=1r.1t();p.o(p.o(c.17.J,c.1q.J),{1v:a(6,2H){8.6=$(6);h(!8.6)26(c.2b);j g=p.o({1s:E,2u:E,1p:E,2T:T,1D:\'3x\',1X:19.0,4R:2H},C[2]||{});8.1E(g)},1U:a(){8.1b=8.g.1b||T;8.4P=8.6.O(\'w\');8.3w={};[\'G\',\'M\',\'D\',\'z\',\'1l\'].13(a(k){8.3w[k]=8.6.r[k]}.1k(8));8.2w=8.6.7Y;8.2x=8.6.7X;j 1l=8.6.O(\'7T-4L\')||\'19%\';[\'38\',\'1a\',\'%\',\'4V\'].13(a(2s){h(1l.4A(2s)>0){8.1l=1V(1l);8.2s=2s}}.1k(8));8.4I=(8.g.4R-8.g.1X)/19;8.t=1P;h(8.g.1D==\'3x\')8.t=[8.6.7Q,8.6.7P];h(/^4F/.1M(8.g.1D))8.t=[8.6.4E,8.6.7K];h(!8.t)8.t=[8.g.1D.2Z,8.g.1D.2Y]},1n:a(w){j 2X=(8.g.1X/19.0)+(8.4I*w);h(8.g.1p&&8.1l)8.6.u({1l:8.1l*2X+8.2s});8.4B(8.t[0]*2X,8.t[1]*2X)},1W:a(w){h(8.1b)8.6.u(8.3w)},4B:a(z,D){j d={};h(8.g.1s)d.D=S.1z(D)+\'1a\';h(8.g.2u)d.z=S.1z(z)+\'1a\';h(8.g.2T){j 3s=(z-8.t[0])/2;j 3r=(D-8.t[1])/2;h(8.4P==\'4Y\'){h(8.g.2u)d.G=8.2w-3s+\'1a\';h(8.g.1s)d.M=8.2x-3r+\'1a\'}2j{h(8.g.2u)d.G=-3s+\'1a\';h(8.g.1s)d.M=-3r+\'1a\'}}8.6.u(d)}});c.4y=1r.1t();p.o(p.o(c.4y.J,c.1q.J),{1v:a(6){8.6=$(6);h(!8.6)26(c.2b);j g=p.o({4x:\'#7I\'},C[1]||{});8.1E(g)},1U:a(){h(8.6.O(\'32\')==\'2m\'){8.2R();l}8.Z={31:8.6.O(\'3o-7B\')};8.6.u({31:\'2m\'});h(!8.g.3n)8.g.3n=8.6.O(\'3o-N\').1K(\'#4v\');h(!8.g.3l)8.g.3l=8.6.O(\'3o-N\');8.33=$R(0,2).22(a(i){l 2z(8.g.4x.2e(i*2+1,i*2+3),16)}.1k(8));8.4t=$R(0,2).22(a(i){l 2z(8.g.3n.2e(i*2+1,i*2+3),16)-8.33[i]}.1k(8))},1n:a(w){8.6.u({3k:$R(0,2).4s(\'#\',a(m,v,i){l m+(S.1z(8.33[i]+(8.4t[i]*w)).34())}.1k(8))})},1W:a(){8.6.u(p.o(8.Z,{3k:8.g.3l}))}});c.3M=1r.1t();p.o(p.o(c.3M.J,c.1q.J),{1v:a(6){8.6=$(6);8.1E(C[1]||{})},1U:a(){24.4o();j 2B=24.7s(8.6);h(8.g.4n)2B[1]+=8.g.4n;j 2i=W.4m?W.z-W.4m:29.4l.4E-(29.4k.2g?29.4k.2g:29.4l.2g);8.3f=24.7m;8.4j=(2B[1]>2i?2i:2B[1])-8.3f},1n:a(w){24.4o();W.7l(24.7k,8.3f+(w*8.4j))}});c.4C=a(6){6=$(6);j 2c=6.1x();j g=p.o({1e:6.2h()||1.0,1j:0.0,I:a(b){h(b.g.1j!=0)l;b.6.1u().u({Q:2c})}},C[1]||{});l q c.1B(6,g)}c.3t=a(6){6=$(6);j g=p.o({1e:(6.O(\'32\')==\'2m\'?0.0:6.2h()||0.0),1j:1.0,I:a(b){b.6.3q()},1Y:a(b){b.6.2V(b.g.1e).2q()}},C[1]||{});l q c.1B(6,g)}c.7f=a(6){6=$(6);j Z={Q:6.1x(),w:6.O(\'w\'),G:6.r.G,M:6.r.M,D:6.r.D,z:6.r.z};l q c.1Z([q c.17(6,7e,{10:E,2T:E,1p:E,1b:E}),q c.1B(6,{10:E,1j:0.0})],p.o({V:1.0,7d:a(b){24.79(b.F[0].6)},I:a(b){b.F[0].6.1u().u(Z)}},C[1]||{}))}c.4G=a(6){6=$(6);6.1y();l q c.17(6,0,p.o({1p:T,1s:T,1b:E,I:a(b){b.6.1u().1C()}},C[1]||{}))}c.4H=a(6){6=$(6);j 23=6.2F();l q c.17(6,19,p.o({1p:T,1s:T,1X:0,1D:{2Z:23.z,2Y:23.D},1b:E,3D:a(b){b.6.1y().u({z:\'36\'}).2q()},I:a(b){b.6.1C()}},C[1]||{}))}c.74=a(6){6=$(6);j 2c=6.1x();l q c.3t(6,p.o({V:0.4,1e:0,X:c.1f.4h,I:a(b){q c.17(b.6,1,{V:0.3,2T:E,1s:T,1p:T,1b:E,1Y:a(b){b.6.1A().1y()},I:a(b){b.6.1u().1C().1G().u({Q:2c})}})}},C[1]||{}))}c.72=a(6){6=$(6);j Z={G:6.O(\'G\'),M:6.O(\'M\'),Q:6.1x()};l q c.1Z([q c.18(6,{x:0,y:19,10:E}),q c.1B(6,{10:E,1j:0.0})],p.o({V:0.5,1Y:a(b){b.F[0].6.1A()},I:a(b){b.F[0].6.1u().1G().u(Z)}},C[1]||{}))}c.70=a(6){6=$(6);j Z={G:6.O(\'G\'),M:6.O(\'M\')};l q c.18(6,{x:20,y:0,V:0.48,I:a(b){q c.18(b.6,{x:-40,y:0,V:0.1,I:a(b){q c.18(b.6,{x:40,y:0,V:0.1,I:a(b){q c.18(b.6,{x:-40,y:0,V:0.1,I:a(b){q c.18(b.6,{x:40,y:0,V:0.1,I:a(b){q c.18(b.6,{x:-20,y:0,V:0.48,I:a(b){b.6.1G().u(Z)}})}})}})}})}})}})}c.4M=a(6){6=$(6).46();j 2O=6.1F().O(\'1i\');j 23=6.2F();l q c.17(6,19,p.o({1p:T,1s:T,1X:W.1h?0:1,1D:{2Z:23.z,2Y:23.D},1b:E,3D:a(b){b.6.1A();b.6.1F().1A();h(W.1h)b.6.u({G:\'\'});b.6.1y().u({z:\'36\'}).2q()},3N:a(b){b.6.1F().u({1i:(b.t[0]-b.6.2g)+\'1a\'})},I:a(b){b.6.1C().1G();b.6.1F().1G().u({1i:2O})}},C[1]||{}))}c.4K=a(6){6=$(6).46();j 2O=6.1F().O(\'1i\');l q c.17(6,W.1h?0:1,p.o({1p:T,1s:T,1D:\'3x\',1X:19,1b:E,43:a(b){b.6.1A();b.6.1F().1A();h(W.1h)b.6.u({G:\'\'});b.6.1y().2q()},3N:a(b){b.6.1F().u({1i:(b.t[0]-b.6.2g)+\'1a\'})},I:a(b){b.6.1u().1C().1G().u({1i:2O});b.6.1F().1G()}},C[1]||{}))}c.6X=a(6){l q c.17(6,W.1h?1:0,{1b:E,1Y:a(b){b.6.1y()},I:a(b){b.6.1u().1C()}})}c.6W=a(6){6=$(6);j g=p.o({2y:\'2N\',2M:c.1f.1N,2L:c.1f.1N,2K:c.1f.44},C[1]||{});j Z={G:6.r.G,M:6.r.M,z:6.r.z,D:6.r.D,Q:6.1x()};j t=6.2F();j 1O,1S;j 12,Y;37(g.2y){14\'G-M\':1O=1S=12=Y=0;15;14\'G-2l\':1O=t.D;1S=Y=0;12=-t.D;15;14\'1i-M\':1O=12=0;1S=t.z;Y=-t.z;15;14\'1i-2l\':1O=t.D;1S=t.z;12=-t.D;Y=-t.z;15;14\'2N\':1O=t.D/2;1S=t.z/2;12=-t.D/2;Y=-t.z/2;15}l q c.18(6,{x:1O,y:1S,V:0.6O,1Y:a(b){b.6.1u().1y().1A()},I:a(b){q c.1Z([q c.1B(b.6,{10:E,1j:1.0,1e:0.0,X:g.2K}),q c.18(b.6,{x:12,y:Y,10:E,X:g.2M}),q c.17(b.6,19,{1D:{2Z:t.z,2Y:t.D},10:E,1X:W.1h?1:0,X:g.2L,1b:E})],p.o({1Y:a(b){b.F[0].6.u({z:\'36\'}).2q()},I:a(b){b.F[0].6.1C().1G().u(Z)}},g))}})}c.6M=a(6){6=$(6);j g=p.o({2y:\'2N\',2M:c.1f.1N,2L:c.1f.1N,2K:c.1f.2m},C[1]||{});j Z={G:6.r.G,M:6.r.M,z:6.r.z,D:6.r.D,Q:6.1x()};j t=6.2F();j 12,Y;37(g.2y){14\'G-M\':12=Y=0;15;14\'G-2l\':12=t.D;Y=0;15;14\'1i-M\':12=0;Y=t.z;15;14\'1i-2l\':12=t.D;Y=t.z;15;14\'2N\':12=t.D/2;Y=t.z/2;15}l q c.1Z([q c.1B(6,{10:E,1j:0.0,1e:1.0,X:g.2K}),q c.17(6,W.1h?1:0,{10:E,X:g.2L,1b:E}),q c.18(6,{x:12,y:Y,10:E,X:g.2M})],p.o({43:a(b){b.F[0].6.1A().1y()},I:a(b){b.F[0].6.1u().1C().1G().u(Z)}},g))}c.6K=a(6){6=$(6);j g=C[1]||{};j 2c=6.1x();j X=g.X||c.1f.1N;j 3b=a(B){l X(1-c.1f.49(B,g.1w))};3b.1k(X);l q c.1B(6,p.o(p.o({V:2.0,1e:0,I:a(b){b.6.u({Q:2c})}},g),{X:3b}))}c.6I=a(6){6=$(6);j Z={G:6.r.G,M:6.r.M,D:6.r.D,z:6.r.z};6.1y();l q c.17(6,5,p.o({1p:T,1s:T,I:a(b){q c.17(6,1,{1p:T,2u:T,I:a(b){b.6.1u().1C().u(Z)}})}},C[1]||{}))};c.2J=1r.1t();p.o(p.o(c.2J.J,c.1q.J),{1v:a(6){8.6=$(6);h(!8.6)26(c.2b);j g=p.o({r:\'\'},C[1]||{});8.1E(g)},1U:a(){a 1K(N){h(!N||[\'6G(0, 0, 0, 0)\',\'6F\'].6E(N))N=\'#4v\';N=N.1K();l $R(0,2).22(a(i){l 2z(N.2e(i*2+1,i*2+3),16)})}8.3W=8.g.r.3V().22(a(11){j 1o=8.6.O(11[0]);l $H({r:11[0],1o:11[1].1d==\'N\'?1K(1o):1V(1o||0),2k:11[1].1d==\'N\'?1K(11[1].P):11[1].P,1d:11[1].1d})}.1k(8)).4e(a(U){l((U.1o==U.2k)||(U.1d!=\'N\'&&(3S(U.1o)||3S(U.2k))))})},1n:a(w){j r=$H(),P=1P;8.3W.13(a(U){P=U.1d==\'N\'?$R(0,2).4s(\'#\',a(m,v,i){l m+(S.1z(U.1o[i]+(U.2k[i]-U.1o[i])*w)).34()}):U.1o+S.1z(((U.2k-U.1o)*w)*2S)/2S+U.1d;r[U.r]=P});8.6.u(r)}});c.3R=1r.1t();p.o(c.3R.J,{1v:a(1T){8.1T=[];8.g=C[1]||{};8.3Q(1T)},3Q:a(1T){1T.13(a(1H){j 3P=$H(1H).6x().3O();8.1T.45($H({3a:$H(1H).6J().3O(),b:c.2J,g:{r:3P}}))}.1k(8));l 8},6u:a(){l q c.1Z(8.1T.22(a(1H){j 2d=[$(1H.3a)||$$(1H.3a)].2P();l 2d.22(a(e){l q 1H.b(e,p.o({10:E},1H.g))})}).2P(),8.g)}});L.42=[\'6t\',\'6N\',\'3k\',\'31\',\'6q\',\'6P\',\'6p\',\'6R\',\'6n\',\'6T\',\'6U\',\'6V\',\'6j\',\'6i\',\'6h\',\'6Z\',\'6f\',\'71\',\'6e\',\'73\',\'1i\',\'6b\',\'76\',\'6a\',\'N\',\'4F\',\'78\',\'69\',\'68\',\'67\',\'7c\',\'65\',\'2y\',\'32\',\'64\',\'62\',\'61\',\'1l\',\'60\',\'5Z\',\'5Y\',\'7j\',\'5W\',\'z\',\'M\',\'5V\',\'5U\',\'7n\',\'5T\',\'5S\',\'5R\',\'7r\',\'5P\',\'5O\',\'7t\',\'7u\',\'5M\',\'5L\',\'5K\',\'7y\',\'Q\',\'5I\',\'5H\',\'5G\',\'7C\',\'7D\',\'7E\',\'5E\',\'7G\',\'5C\',\'5B\',\'5A\',\'5z\',\'7L\',\'7M\',\'5w\',\'7O\',\'5u\',\'5t\',\'5s\',\'w\',\'7S\',\'5q\',\'2l\',\'4L\',\'7U\',\'5p\',\'7W\',\'5m\',\'5l\',\'5k\',\'80\',\'5i\',\'82\',\'5h\',\'84\',\'G\',\'5g\',\'5f\',\'5e\',\'88\',\'5d\',\'5c\',\'5b\',\'D\',\'8c\',\'8E\'];L.58=/^(([\\+\\-]?[0-9\\.]+)(38|8D|1a|8B|8z|8y|4V|8w|\\%))|0$/;3H.J.3V=a(){j 6=L.o(29.8v(\'3G\'));6.8u=\'<3G r="\'+8+\'"></3G>\';j r=6.1F().r,3F=$H();L.42.13(a(11){h(r[11])3F[11]=r[11]});j 3C=$H();3F.13(a(3E){j 11=3E[0],P=3E[1],1d=1P;h(P.1K(\'#55\')!=\'#55\'){P=P.1K();1d=\'N\'}2j h(L.58.1M(P))j 2W=P.3L(/^([\\+\\-]?[0-9\\.]+)(.*)$/),P=1V(2W[1]),1d=(2W.1J==3)?2W[2]:1P;3C[11.8q().8p()]=$H({P:P,1d:1d})}.1k(8));l 3C};L.53=a(6,r){q c.2J(6,p.o({r:r},C[2]||{}));l 6};[\'2V\',\'2h\',\'1x\',\'3q\',\'4b\',\'3J\',\'3j\',\'53\'].13(a(f){L.52[f]=L[f]});L.52.8o=a(6,b,g){s=b.8m(/8l/,\'-\').8A();57=s.39(0).8C()+s.8h(1);q c[57](6,g);l $(6)};L.8F();',62,538,'||||||element||this||function|effect|Effect||||options|if||var||return|||extend|Object|new|style||dims|setStyle||position|||height||pos|arguments|width|true|effects|top||afterFinishInternal|prototype||Element|left|color|getStyle|value|opacity||Math|false|transform|duration|window|transition|moveY|oldStyle|sync|property|moveX|each|case|break||Scale|Move|100|px|restoreAfterFinish|node|unit|from|Transitions|queue|opera|bottom|to|bind|fontSize|event|update|originalValue|scaleContent|Base|Class|scaleX|create|hide|initialize|pulses|getInlineOpacity|makeClipping|round|makePositioned|Opacity|undoClipping|scaleMode|start|down|undoPositioned|track|finishOn|length|parseColor|startOn|test|sinoidal|initialMoveX|null|navigator|timestamp|initialMoveY|tracks|setup|parseFloat|finish|scaleFrom|beforeSetup|Parallel||typeof|map|elementDimensions|Position||throw|timePos|state|document|queueName|_elementDoesNotExistError|oldOpacity|elements|slice|userAgent|clientHeight|getOpacity|max|else|targetValue|right|none|child|interval|eventName|show|delay|fontSizeType|render|scaleY|filter|originalTop|originalLeft|direction|parseInt|global|offsets|get|Queues|loop|getDimensions|instances|percent|string|Morph|opacityTransition|scaleTransition|moveTransition|center|oldInnerBottom|flatten|MSIE|cancel|1000|scaleFromCenter|childNodes|setOpacity|components|currentScale|originalWidth|originalHeight|alpha|backgroundImage|display|_base|toColorPart|cos|0px|switch|em|charAt|ids|reverser|idle|ScopedQueue|PI|scrollStart|className|toLowerCase|inspect|collectTextNodesIgnoreClass|backgroundColor|restorecolor|limit|endcolor|background|scope|forceRerendering|leftd|topd|Appear|nodeType|PAIRS|originalStyle|box|currentFrame|frame|remove|nodeValue|result|afterSetup|pair|styleRules|div|String|tagifyStyle|collectTextNodes|character|match|ScrollTo|afterUpdateInternal|first|data|addTracks|Transform|isNaN|getTime|Date|parseStyle|transforms|add|iterator|for||_each|CSS_PROPERTIES|beforeStartInternal|full|push|cleanWhitespace|floor|05|pulse|args|setContentZoom|pluck|cols|reject|invoke|tagifyText|flicker|Builder|delta|documentElement|body|innerHeight|offset|prepare|DefaultOptions|Prototype|fps|inject|_delta|join|ffffff|end|startcolor|Highlight|hasChildNodes|indexOf|setDimensions|Fade|appear|scrollHeight|content|BlindUp|BlindDown|factor|gi|SlideUp|size|SlideDown|replace|beforeFinish|elementPositioning|index|scaleTo|masterDelay|speed|collect|pt|toLeft|toTop|absolute|running|mode|afterFinish|Methods|morph|Internal|zzzzzz|zoom|effect_class|CSS_LENGTH|relative|Event|widows|whiteSpace|volume|visibility|verticalAlign|unicodeBidi|textShadow|textDecoration|library|tableLayout|stress|speechRate|beforeStart|js|speakNumeral|richness|builder|pitchRange|pitch|pauseBefore|us|pageBreakInside|parallel|aculo|page|paddingTop|paddingRight|paddingLeft|script|overflowY|including|outlineOffset|outlineColor|orphans|requires|minHeight|maxWidth|maxHeight|Queue|marginTop|marginRight|undefined|marginBottom|listStyleType|listStylePosition|lineHeight|letterSpacing|fontWeight|scrollBy|fontStyle|fontStretch|fontSizeAdjust|fontFamily|emptyCells|clearInterval|elevation|cursor|operate|cueAfter|cssFloat|counterReset|clip|captionSide|setInterval|AppleWebKit|borderTopStyle|borderSpacing|required|borderRightStyle|borderRightColor|borderLeftWidth|last|is|with|borderBottomWidth|but|borderBottomColor|backgroundPosition|exist|appVersion|azimuth|play|not|findAll|values|front|does|rgb|DOM|specified|The|include|transparent|rgba|message|Fold|keys|Pulsate|ElementDoesNotExistError|Shrink|backgroundAttachment|01|backgroundRepeat|name|borderBottomStyle|Enumerable|borderCollapse|borderLeftColor|borderLeftStyle|Grow|Squish|apply|borderRightWidth|Shake|borderTopColor|DropOut|borderTopWidth|SwitchOff||clear|wobble|counterIncrement|absolutize|random|call|cueBefore|beforeSetupInternal|200|Puff|Array|hasClassName|reverse|fontVariant|deltaX|scrollTo|deltaY|listStyleImage|catch|while|removeChild|marginLeft|cumulativeOffset|markerOffset|marks|appendChild|linear|createTextNode|minWidth|Effect2|visible|image|outlineStyle|outlineWidth|overflowX|id|paddingBottom|try|ffff99|toggle|scrollWidth|pageBreakAfter|pageBreakBefore|00001|pauseAfter|offsetWidth|offsetHeight|blind|quotes|font|speakHeader|do|speakPunctuation|offsetLeft|offsetTop|slide|textAlign|999999|textIndent|KHTML|textTransform|Safari|MoveBy|object|voiceFamily|Konqueror|multiple|160|wordSpacing|split|hasLayout|currentStyle|fromCharCode|substring|emptyFunction|span|Gecko|_|gsub|insertBefore|visualEffect|dasherize|underscore|finished|toArray|afterUpdate|innerHTML|createElement|pc|beforeUpdate|mm|cm|camelize|in|toUpperCase|ex|zIndex|addMethods'.split('|'),0,{}))