├── .gitignore ├── Gemfile ├── README ├── Rakefile ├── app ├── controllers │ ├── application_controller.rb │ └── posts_controller.rb ├── helpers │ ├── application_helper.rb │ └── posts_helper.rb ├── middleware │ └── flash_session_cookie_middleware.rb ├── models │ ├── asset.rb │ ├── assetable.rb │ ├── image.rb │ ├── image_upload.rb │ ├── post.rb │ └── session_workaround.rb └── views │ ├── layouts │ └── application.html.erb │ ├── posts │ ├── _form.html.erb │ ├── _image_upload.html.erb │ ├── edit.html.erb │ ├── index.html.erb │ ├── new.html.erb │ └── show.html.erb │ └── share │ ├── _error_messages.html.erb │ └── _header.html.erb ├── config.ru ├── config ├── application.rb ├── boot.rb ├── database.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── backtrace_silencers.rb │ ├── dragonfly.rb │ ├── inflections.rb │ ├── mime_types.rb │ ├── secret_token.rb │ └── session_store.rb ├── locales │ └── en.yml └── routes.rb ├── db ├── migrate │ ├── 20101231055711_create_assetable.rb │ ├── 20101231055744_create_images.rb │ ├── 20101231060356_create_posts.rb │ ├── 20101231062326_create_image_uploads.rb │ └── 20110128073108_create_session_workarounds.rb ├── schema.rb └── seeds.rb ├── doc └── README_FOR_APP ├── formfly-screenshot.png ├── lib ├── collection_size_validator.rb └── tasks │ └── .gitkeep ├── public ├── .DS_Store ├── 404.html ├── 422.html ├── 500.html ├── favicon.ico ├── images │ ├── cancel.png │ ├── onepixel.png │ └── rails.png ├── javascripts │ ├── application.js │ ├── jquery-1.4.2.min.js │ ├── jquery.tools.min.js │ ├── jquery.uploadify.v2.1.4.js │ ├── rails.js │ ├── swfobject.js │ └── uploadify │ │ └── uploadify.swf ├── robots.txt └── stylesheets │ ├── .gitkeep │ ├── scaffold.css │ └── uploadify.css ├── script └── rails ├── test ├── fixtures │ ├── assetables.yml │ ├── image_uploads.yml │ ├── images.yml │ ├── posts.yml │ └── session_workarounds.yml ├── functional │ └── posts_controller_test.rb ├── performance │ └── browsing_test.rb ├── test_helper.rb └── unit │ ├── assetable_test.rb │ ├── helpers │ └── posts_helper_test.rb │ ├── image_test.rb │ ├── image_upload_test.rb │ ├── post_test.rb │ └── session_workaround_test.rb └── vendor └── plugins └── .gitkeep /.gitignore: -------------------------------------------------------------------------------- 1 | .bundle 2 | db/*.sqlite3 3 | log/*.log 4 | tmp/**/* 5 | public/system/* 6 | .DS_Store 7 | */.DS_Store 8 | Gemfile.lock 9 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'http://rubygems.org' 2 | 3 | gem 'rails', '3.0.9' 4 | 5 | # Bundle edge Rails instead: 6 | # gem 'rails', :git => 'git://github.com/rails/rails.git' 7 | 8 | gem 'sqlite3-ruby', :require => 'sqlite3' 9 | gem 'rack-cache', :require => 'rack/cache' 10 | gem 'dragonfly' 11 | 12 | # Use unicorn as the web server 13 | # gem 'unicorn' 14 | 15 | # Deploy with Capistrano 16 | # gem 'capistrano' 17 | 18 | # To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+) 19 | # gem 'ruby-debug' 20 | # gem 'ruby-debug19' 21 | 22 | # Bundle the extra gems: 23 | # gem 'bj' 24 | # gem 'nokogiri' 25 | # gem 'sqlite3-ruby', :require => 'sqlite3' 26 | # gem 'aws-s3', :require => 'aws/s3' 27 | 28 | # Bundle gems for the local environment. Make sure to 29 | # put test-only gems in this group so their generators 30 | # and rake tasks are available in development mode: 31 | # group :development, :test do 32 | # gem 'webrat' 33 | # end 34 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | FormFly is a demo for Rails 3 that uses DragonFly and Uploadify 2 | 3 | This version uses a technique where intermediary images are saved to a separate ImageUpload model while the server waits for the Post to be submitted. 4 | 5 | To Install 6 | 7 | $ bundle install 8 | $ rake db:migrate 9 | $ rails s 10 | 11 | Go to localhost:3000 12 | 13 | ------------------------------- 14 | TODO: 15 | 1. Add Flash Detection 16 | 17 | 2. Video Uploads 18 | 19 | 3. Implement Resque to clean up stale SessionWorkaround objects and abandoned files. 20 | 21 | ------------------------------- 22 | CHANGELOG: 23 | January 28, 2011 24 | 1. Completely re-wrote the 'edit' portion 25 | 26 | 2. Session variables were disappearing randomly (no idea why). 27 | As a workaround, I made my own mini session handling using ActiveRecord. 28 | Session variables would disappear and reappear between requests about 10% of the time, 29 | so I added a SessionWorkaround model that holds the action state, as well as the session_id. 30 | The session_id doesn't appear to change at all. 31 | I tried using an ActiveRecord Session Store, but this caused issues with the Uploadify Middleware workaround. 32 | 33 | January 23, 2011 34 | 1. Added form edit 35 | 36 | 2. Verified it works in production mode in Mongrel/WebBrick/Passenger 37 | 38 | 39 | 40 | --- 41 | Resources: 42 | 43 | http://github.com/markevans/dragonfly 44 | http://groups.google.com/group/dragonfly-users 45 | http://www.glrzad.com/ruby-on-rails/using-uploadify-with-rails-3/ 46 | http://www.uploadify.com/documentation/methods/uploadifysettings/ 47 | 48 | 49 | --- 50 | Thanks to Daihua for helping me implement Uploadify. -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require File.expand_path('../config/application', __FILE__) 5 | require 'rake' 6 | 7 | Formfly::Application.load_tasks 8 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | protect_from_forgery 3 | helper :all 4 | 5 | helper_method :my_thumb 6 | 7 | def my_thumb(image, w, h) 8 | image.data.process(:resize_and_crop, :width => w, :height=> h, :gravity => 'ne') 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/controllers/posts_controller.rb: -------------------------------------------------------------------------------- 1 | class PostsController < ApplicationController 2 | before_filter :translate_action, :except => [:index, :show] 3 | before_filter :get_image_uploads, :except => [:index, :show] 4 | 5 | @@return_early = Proc.new do 6 | render :json => {:status => 0, :message => "Error"}.to_json 7 | return false 8 | end 9 | 10 | def index 11 | @posts = Post.all 12 | end 13 | 14 | def show 15 | @post = Post.find(params[:id]) 16 | end 17 | 18 | def ajax_photo_destroy 19 | @image_uploads.images.where(:slot => params[:slot]).all.each do |image| 20 | @status = image.destroy 21 | end 22 | if @status.nil? 23 | render :json => {:status => 0, :message => "Could Not Destroy Image!"}.to_json 24 | else 25 | render :json => {:status => 1, :message => "Successfully Destroyed Image!"}.to_json 26 | end 27 | end 28 | 29 | def ajax_photo_upload 30 | # To make things easier in Uploadify, I hijacked the `folder` parameter 31 | slot = params[:folder].match(/pic(\d)/) unless params[:folder].nil? 32 | slot = slot[1] unless slot.nil? 33 | @@return_early.call if slot.nil? 34 | slot = "pic#{slot}" 35 | 36 | @current_images = @image_uploads.images.where(:slot => slot).all 37 | @upload = Image.new(:slot => slot, :data => params[:Filedata]) 38 | # debugger 39 | if not @image_uploads.images << @upload 40 | render :json => {:status => 0, :message => "Error Uploading Image!"}.to_json 41 | else 42 | @current_images.each{|image| image.destroy} 43 | render :json => {:status => 1, :img => my_thumb(@upload, 118, 118).url }.to_json 44 | end 45 | end 46 | 47 | def new 48 | @post = Post.new 49 | end 50 | 51 | def create 52 | @post = Post.new(params[:post]) 53 | @post.assetable = @image_uploads.assetable 54 | Post.transaction do 55 | if @post.save 56 | @image_uploads.assetable = nil 57 | @image_uploads.save # Is this really necessary? 58 | @session_workaround.destroy 59 | redirect_to(posts_path, :notice => 'Post was successfully created.') 60 | else 61 | render :new 62 | end 63 | end 64 | end 65 | 66 | def edit 67 | @post = Post.find(params[:id]) 68 | @image_uploads.images.each{ |image| image.destroy } 69 | @post.images.each do |image| 70 | cloned_image = image.clone 71 | cloned_image.delete_from_disk = false 72 | @image_uploads.images << cloned_image 73 | end 74 | end 75 | 76 | def update 77 | @post = Post.find(params[:id]) 78 | Post.transaction do 79 | old_assetable = @post.assetable 80 | @post.assetable = @image_uploads.assetable 81 | respond_to do |format| 82 | if @post.update_attributes(params[:post]) 83 | @post.images.each{|image| image.delete_from_disk = true } 84 | # find where old and new don't overlap, we will keep the overlap and delete the rest 85 | # for small numbers, might as well just brute force in memory 86 | old_assetable.images.each do |old_image| 87 | old_image.delete_from_disk = true 88 | @post.images.each do |new_image| 89 | old_image.delete_from_disk = false if old_image.data_uid == new_image.data_uid 90 | end 91 | end 92 | old_assetable.destroy 93 | @image_uploads.assetable = nil 94 | @image_uploads.save # Is this really necessary? 95 | @session_workaround.destroy 96 | format.html { redirect_to(@post, :notice => 'Post was successfully updated.') } 97 | else 98 | format.html { render :action => "edit" } 99 | end 100 | end 101 | end 102 | end 103 | 104 | private 105 | 106 | def translate_action 107 | action = params[:_action] || params[:action] 108 | @_action = SessionWorkaround.translate_action(action) 109 | end 110 | 111 | def get_image_uploads 112 | # => Have to implement this instead of doing something like session[:image_upload_id] 113 | # => because 10% of the time the session variables would vanish????? :-/ 114 | @session_workaround = SessionWorkaround.find_or_create_by_session_id_and_action(session[:session_id], @_action) 115 | if @session_workaround.image_uploads.empty? 116 | @session_workaround.image_uploads << ImageUpload.create! 117 | end 118 | @image_uploads = @session_workaround.image_uploads.first 119 | end 120 | 121 | end 122 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/posts_helper.rb: -------------------------------------------------------------------------------- 1 | module PostsHelper 2 | def upload_image_path(klass) 3 | if klass.class == ImageUpload 4 | upload_photo_posts_path 5 | else 6 | member_upload_photo_posts_path(klass) 7 | end 8 | end 9 | def destroy_image_path(klass, slot="") 10 | if klass.class == ImageUpload 11 | destroy_photo_posts_path(slot) 12 | else 13 | member_destroy_photo_posts_path(klass, slot) 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /app/middleware/flash_session_cookie_middleware.rb: -------------------------------------------------------------------------------- 1 | require 'rack/utils' 2 | 3 | class FlashSessionCookieMiddleware 4 | def initialize(app, session_key = '_session_id') 5 | @app = app 6 | @session_key = session_key 7 | end 8 | 9 | def call(env) 10 | if env['HTTP_USER_AGENT'] =~ /^(Adobe|Shockwave) Flash/ 11 | req = Rack::Request.new(env) 12 | env['HTTP_COOKIE'] = [ @session_key, req.params[@session_key] ].join('=').freeze unless req.params[@session_key].nil? 13 | env['HTTP_ACCEPT'] = "#{req.params['_http_accept']}".freeze unless req.params['_http_accept'].nil? 14 | end 15 | # debugger 16 | @app.call(env) 17 | end 18 | end -------------------------------------------------------------------------------- /app/models/asset.rb: -------------------------------------------------------------------------------- 1 | class Asset < ActiveRecord::Base 2 | end -------------------------------------------------------------------------------- /app/models/assetable.rb: -------------------------------------------------------------------------------- 1 | class Assetable < ActiveRecord::Base 2 | set_table_name "assetable" 3 | has_many :images, :dependent => :destroy 4 | end 5 | -------------------------------------------------------------------------------- /app/models/image.rb: -------------------------------------------------------------------------------- 1 | class Image < Asset 2 | set_table_name "images" 3 | image_accessor :data 4 | validates_size_of :data, :maximum => 500.kilobytes 5 | validates_property :mime_type, :of => :data, :in => %w(image/jpeg image/jpg image/png image/gif) 6 | 7 | def destroy 8 | hack = self.data 9 | if not self.delete_from_disk 10 | self.data = nil 11 | hack.instance_variable_set("@previous_uid", nil) 12 | end 13 | super 14 | end 15 | 16 | end 17 | -------------------------------------------------------------------------------- /app/models/image_upload.rb: -------------------------------------------------------------------------------- 1 | class ImageUpload < ActiveRecord::Base 2 | belongs_to :assetable, :dependent => :destroy, :autosave => true 3 | delegate :images, :to => :assetable 4 | belongs_to :session_workaround 5 | 6 | after_initialize { build_assetable if assetable.nil? } 7 | 8 | end 9 | -------------------------------------------------------------------------------- /app/models/post.rb: -------------------------------------------------------------------------------- 1 | class Post < ActiveRecord::Base 2 | belongs_to :assetable, :dependent => :destroy 3 | delegate :images, :to => :assetable 4 | 5 | after_initialize { build_assetable if assetable.nil? } 6 | 7 | validates :title, :presence => true 8 | validates :body, :presence => true 9 | validates :images, :collection_size => { :min_size => 1, :max_size => 3 } 10 | 11 | end 12 | -------------------------------------------------------------------------------- /app/models/session_workaround.rb: -------------------------------------------------------------------------------- 1 | class SessionWorkaround < ActiveRecord::Base 2 | has_many :image_uploads, :dependent => :destroy 3 | 4 | def self.translate_action(action) 5 | return "new" if action == "new" or action == "create" 6 | return "edit" if action == "edit" or action == "update" 7 | nil 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Formfly 5 | <%= stylesheet_link_tag :all %> 6 | <%= javascript_include_tag 'jquery.tools.min', 'application' %> 7 | <%= yield :sub_js %> 8 | <%= csrf_meta_tag %> 9 | 10 | 11 | 12 | <%= yield %> 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/views/posts/_form.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= form_for @image_uploads, :url => upload_photo_posts_path(@image_uploads) do |f| %> 3 | 4 | <% (1..3).each do |i| %> 5 | <% slot = "pic#{i}" %> 6 |
7 | 8 | <% @images = @image_uploads.images.where(:slot => slot).all %> 9 | 10 | <% imgurl = "onepixel.png" if @images.empty? %> 11 | <% imgurl = my_thumb(@images.first, 118, 118).url unless @images.empty? %> 12 | 13 | <%= image_tag imgurl, :style => "width:118px; height:118px;", :id => slot %> 14 | 15 |
16 |
17 | <%= render :partial => "image_upload", :locals => { :picname => slot } %> 18 |
19 | <% end %> 20 | <% end %> 21 |
22 | 23 |
24 | <%= form_for @post do |f| %> 25 | <%= render "share/error_messages", :target => @post %> 26 |
27 | <%= f.label :title %> 28 | <%= f.text_field :title %> 29 |
30 |
31 | <%= f.label :body %> 32 | <%= f.text_area :body %> 33 |
34 |
35 | <%= f.submit "Post It!" %> 36 |
37 | <% end %> 38 |
39 | 40 | -------------------------------------------------------------------------------- /app/views/posts/_image_upload.html.erb: -------------------------------------------------------------------------------- 1 |
2 | <%= file_field_tag "post[photos][#{picname}]", :class => "uploadify", :picname => picname %> 3 |
"> 4 | <%= link_to("remove", destroy_photo_posts_path(@images.first.slot, @_action), :class => "remove_link", :picname => "#{picname}") if @images.present? %> 5 |
6 |
-------------------------------------------------------------------------------- /app/views/posts/edit.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_for :sub_js do %> 2 | <%= javascript_include_tag 'swfobject', 'jquery.uploadify.v2.1.4' %> 3 | <% end %> 4 | 5 | <%= render 'share/header' %> 6 | 7 | <%= render :partial => 'form' %> 8 | 9 | -------------------------------------------------------------------------------- /app/views/posts/index.html.erb: -------------------------------------------------------------------------------- 1 | <%= render 'share/header' %> 2 | 3 |
    4 | <% @posts.each do |post| %> 5 |
  1. 6 | <%= image_tag post.images.first.data.thumb("200x>").url %> 7 | <%= link_to post.title, post_path(post) %> 8 | <%= link_to "edit", edit_post_path(post) %> 9 |
  2. 10 | <% end %> 11 |
12 | 13 |
14 | <%= link_to "New Post", new_post_path %> 15 |
-------------------------------------------------------------------------------- /app/views/posts/new.html.erb: -------------------------------------------------------------------------------- 1 | <%= content_for :sub_js do %> 2 | <%= javascript_include_tag 'swfobject', 'jquery.uploadify.v2.1.4' %> 3 | <% end %> 4 | 5 | <%= render 'share/header' %> 6 | 7 | <%= render :partial => 'form' %> 8 | 9 | -------------------------------------------------------------------------------- /app/views/posts/show.html.erb: -------------------------------------------------------------------------------- 1 | <% @post.images.each do |image| %> 2 |
3 | <%= link_to (image_tag image.data.thumb("200x>").url), image.data.url %> 4 |
5 | <% end %> 6 | 7 |

<%= @post.title %>

8 | 9 |
10 | <%= @post.body %> 11 |
12 | 13 | 14 |
<%= link_to "Back to Posts", posts_path %>
15 |
<%= link_to "Edit to Post", edit_post_path(@post) %>
-------------------------------------------------------------------------------- /app/views/share/_error_messages.html.erb: -------------------------------------------------------------------------------- 1 | <% if target.errors.any? %> 2 |
3 |

<%= pluralize(target.errors.count, "error") %> prohibited this record from being saved:

4 | 5 | 10 |
11 | <% end %> 12 | -------------------------------------------------------------------------------- /app/views/share/_header.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

FormFly

3 |

A <%= link_to "Dragonfly", "http://github.com/markevans/dragonfly" %> and <%= link_to "Uploadify", "http://uploadify.com" %> demo for Rails 3

4 |

<%= link_to "http://github.com/rdetert/FormFly", "http://github.com/rdetert/FormFly" %>

5 |
-------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Formfly::Application 5 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | require 'rails/all' 4 | 5 | # If you have a Gemfile, require the gems listed there, including any gems 6 | # you've limited to :test, :development, or :production. 7 | Bundler.require(:default, Rails.env) if defined?(Bundler) 8 | 9 | module Formfly 10 | class Application < Rails::Application 11 | # Settings in config/environments/* take precedence over those specified here. 12 | # Application configuration should go into files in config/initializers 13 | # -- all .rb files in that directory are automatically loaded. 14 | 15 | # Custom directories with classes and modules you want to be autoloadable. 16 | # config.autoload_paths += %W(#{config.root}/extras) 17 | config.autoload_paths += %W(#{Rails.root}/lib) 18 | config.autoload_paths += %W(#{config.root}/app/middleware/) 19 | 20 | # Only load the plugins named here, in the order given (default is alphabetical). 21 | # :all can be used as a placeholder for all plugins not explicitly named. 22 | # config.plugins = [ :exception_notification, :ssl_requirement, :all ] 23 | 24 | # Activate observers that should always be running. 25 | # config.active_record.observers = :cacher, :garbage_collector, :forum_observer 26 | 27 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 28 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 29 | # config.time_zone = 'Central Time (US & Canada)' 30 | 31 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 32 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 33 | # config.i18n.default_locale = :de 34 | 35 | # JavaScript files you want as :defaults (application.js is always included). 36 | # config.action_view.javascript_expansions[:defaults] = %w(jquery rails) 37 | 38 | # Configure the default encoding used in templates for Ruby 1.9. 39 | config.encoding = "utf-8" 40 | 41 | # Configure sensitive parameters which will be filtered from the log file. 42 | config.filter_parameters += [:password] 43 | 44 | config.middleware.insert_after 'Rack::Lock', 'Dragonfly::Middleware', :images 45 | config.middleware.insert_before 'Dragonfly::Middleware', 'Rack::Cache', { 46 | :verbose => true, 47 | :metastore => "file:#{Rails.root}/tmp/dragonfly/cache/meta", 48 | :entitystore => "file:#{Rails.root}/tmp/dragonfly/cache/body" 49 | } 50 | # config.middleware.insert_before 'ActionDispatch::Session::CookieStore', 'FlashSessionCookieMiddleware', config.session_options[:key] 51 | end 52 | end 53 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | 3 | # Set up gems listed in the Gemfile. 4 | gemfile = File.expand_path('../../Gemfile', __FILE__) 5 | begin 6 | ENV['BUNDLE_GEMFILE'] = gemfile 7 | require 'bundler' 8 | Bundler.setup 9 | rescue Bundler::GemNotFound => e 10 | STDERR.puts e.message 11 | STDERR.puts "Try running `bundle install`." 12 | exit! 13 | end if File.exist?(gemfile) 14 | -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # SQLite version 3.x 2 | # gem install sqlite3-ruby (not necessary on OS X Leopard) 3 | development: 4 | adapter: sqlite3 5 | database: db/development.sqlite3 6 | pool: 5 7 | timeout: 5000 8 | 9 | # Warning: The database defined as "test" will be erased and 10 | # re-generated from your development database when you run "rake". 11 | # Do not set this db to the same as development or production. 12 | test: 13 | adapter: sqlite3 14 | database: db/test.sqlite3 15 | pool: 5 16 | timeout: 5000 17 | 18 | production: 19 | adapter: sqlite3 20 | database: db/production.sqlite3 21 | pool: 5 22 | timeout: 5000 23 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the rails application 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the rails application 5 | Formfly::Application.initialize! 6 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Formfly::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the webserver when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Log error messages when you accidentally call methods on nil. 10 | config.whiny_nils = true 11 | 12 | # Show full error reports and disable caching 13 | config.consider_all_requests_local = true 14 | config.action_view.debug_rjs = true 15 | config.action_controller.perform_caching = false 16 | 17 | # Don't care if the mailer can't send 18 | config.action_mailer.raise_delivery_errors = false 19 | 20 | # Print deprecation notices to the Rails logger 21 | config.active_support.deprecation = :log 22 | 23 | # Only use best-standards-support built into browsers 24 | config.action_dispatch.best_standards_support = :builtin 25 | end 26 | 27 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Formfly::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb 3 | 4 | # The production environment is meant for finished, "live" apps. 5 | # Code is not reloaded between requests 6 | config.cache_classes = true 7 | 8 | # Full error reports are disabled and caching is turned on 9 | config.consider_all_requests_local = false 10 | config.action_controller.perform_caching = true 11 | 12 | # Specifies the header that your server uses for sending files 13 | config.action_dispatch.x_sendfile_header = "X-Sendfile" 14 | 15 | # For nginx: 16 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' 17 | 18 | # If you have no front-end server that supports something like X-Sendfile, 19 | # just comment this out and Rails will serve the files 20 | 21 | # See everything in the log (default is :info) 22 | # config.log_level = :debug 23 | 24 | # Use a different logger for distributed setups 25 | # config.logger = SyslogLogger.new 26 | 27 | # Use a different cache store in production 28 | # config.cache_store = :mem_cache_store 29 | 30 | # Disable Rails's static asset server 31 | # In production, Apache or nginx will already do this 32 | config.serve_static_assets = false 33 | 34 | # Enable serving of images, stylesheets, and javascripts from an asset server 35 | # config.action_controller.asset_host = "http://assets.example.com" 36 | 37 | # Disable delivery errors, bad email addresses will be ignored 38 | # config.action_mailer.raise_delivery_errors = false 39 | 40 | # Enable threaded mode 41 | # config.threadsafe! 42 | 43 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 44 | # the I18n.default_locale when a translation can not be found) 45 | config.i18n.fallbacks = true 46 | 47 | # Send deprecation notices to registered listeners 48 | config.active_support.deprecation = :notify 49 | end 50 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Formfly::Application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Log error messages when you accidentally call methods on nil. 11 | config.whiny_nils = true 12 | 13 | # Show full error reports and disable caching 14 | config.consider_all_requests_local = true 15 | config.action_controller.perform_caching = false 16 | 17 | # Raise exceptions instead of rendering exception templates 18 | config.action_dispatch.show_exceptions = false 19 | 20 | # Disable request forgery protection in test environment 21 | config.action_controller.allow_forgery_protection = false 22 | 23 | # Tell Action Mailer not to deliver emails to the real world. 24 | # The :test delivery method accumulates sent emails in the 25 | # ActionMailer::Base.deliveries array. 26 | config.action_mailer.delivery_method = :test 27 | 28 | # Use SQL instead of Active Record's schema dumper when creating the test database. 29 | # This is necessary if your schema can't be completely dumped by the schema dumper, 30 | # like if you have constraints or database-specific column types 31 | # config.active_record.schema_format = :sql 32 | 33 | # Print deprecation notices to the stderr 34 | config.active_support.deprecation = :stderr 35 | end 36 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /config/initializers/dragonfly.rb: -------------------------------------------------------------------------------- 1 | require 'dragonfly' 2 | 3 | app = Dragonfly[:images] 4 | app.configure_with(:imagemagick) 5 | app.configure_with(:rails) 6 | 7 | app.define_macro(ActiveRecord::Base, :image_accessor) -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format 4 | # (all these examples are active by default): 5 | # ActiveSupport::Inflector.inflections do |inflect| 6 | # inflect.plural /^(ox)$/i, '\1en' 7 | # inflect.singular /^(ox)en/i, '\1' 8 | # inflect.irregular 'person', 'people' 9 | # inflect.uncountable %w( fish sheep ) 10 | # end 11 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | # Mime::Type.register_alias "text/html", :iphone 6 | -------------------------------------------------------------------------------- /config/initializers/secret_token.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | # Make sure the secret is at least 30 characters and all random, 6 | # no regular words or you'll be exposed to dictionary attacks. 7 | Formfly::Application.config.secret_token = '0092812b6573747c96bcfe584d9649492d6440c9c116749fd64c1d87fed5eb17ff4b15c6f8d568db3b06662092072b04fadd95bf54f30eef1496d352bd2cee54' 8 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Formfly::Application.config.session_store :cookie_store, :key => '_formfly_session' 4 | 5 | # Use the database for sessions instead of the cookie-based default, 6 | # which shouldn't be used to store highly confidential information 7 | # (create the session table with "rails generate session_migration") 8 | # Formfly::Application.config.session_store :active_record_store 9 | 10 | Rails.application.config.middleware.insert_before( 11 | ActionDispatch::Session::CookieStore, 12 | FlashSessionCookieMiddleware, 13 | Rails.application.config.session_options[:key] 14 | ) 15 | 16 | # Rails.application.config.middleware.insert_before( 17 | # ActionDispatch::Cookies, 18 | # FlashSessionCookieMiddleware, 19 | # Rails.application.config.session_options[:key] 20 | # ) -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Sample localization file for English. Add more files in this directory for other locales. 2 | # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points. 3 | 4 | en: 5 | hello: "Hello world" 6 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Formfly::Application.routes.draw do 2 | 3 | match '/media(/:dragonfly)', :to => Dragonfly[:images] 4 | 5 | match '/posts/ajax_photo_destroy/(:slot/:_action)' => "posts#ajax_photo_destroy", :as => :destroy_photo_posts 6 | resources :posts do 7 | match 'ajax_photo_upload', :on => :collection, :as => :upload_photo 8 | end 9 | 10 | root :to => 'posts#index' 11 | 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20101231055711_create_assetable.rb: -------------------------------------------------------------------------------- 1 | class CreateAssetable < ActiveRecord::Migration 2 | def self.up 3 | create_table :assetable do |t| 4 | end 5 | end 6 | 7 | def self.down 8 | drop_table :assetable 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20101231055744_create_images.rb: -------------------------------------------------------------------------------- 1 | class CreateImages < ActiveRecord::Migration 2 | def self.up 3 | create_table :images do |t| 4 | t.belongs_to :assetable 5 | t.string :slot 6 | t.string :data_uid 7 | t.boolean :delete_from_disk, :default => true 8 | t.timestamps 9 | end 10 | end 11 | 12 | def self.down 13 | drop_table :images 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20101231060356_create_posts.rb: -------------------------------------------------------------------------------- 1 | class CreatePosts < ActiveRecord::Migration 2 | def self.up 3 | create_table :posts do |t| 4 | t.references :assetable 5 | t.string :title 6 | t.text :body 7 | t.timestamps 8 | end 9 | end 10 | 11 | def self.down 12 | drop_table :posts 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20101231062326_create_image_uploads.rb: -------------------------------------------------------------------------------- 1 | class CreateImageUploads < ActiveRecord::Migration 2 | def self.up 3 | create_table :image_uploads do |t| 4 | t.belongs_to :session_workaround 5 | # t.belongs_to :post 6 | t.belongs_to :assetable 7 | t.timestamps 8 | end 9 | end 10 | 11 | def self.down 12 | drop_table :image_uploads 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20110128073108_create_session_workarounds.rb: -------------------------------------------------------------------------------- 1 | class CreateSessionWorkarounds < ActiveRecord::Migration 2 | def self.up 3 | create_table :session_workarounds do |t| 4 | t.string :session_id 5 | t.string :action 6 | t.timestamps 7 | end 8 | add_index :session_workarounds, [:session_id, :action] 9 | end 10 | 11 | def self.down 12 | drop_table :session_workarounds 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/schema.rb: -------------------------------------------------------------------------------- 1 | # This file is auto-generated from the current state of the database. Instead 2 | # of editing this file, please use the migrations feature of Active Record to 3 | # incrementally modify your database, and then regenerate this schema definition. 4 | # 5 | # Note that this schema.rb definition is the authoritative source for your 6 | # database schema. If you need to create the application database on another 7 | # system, you should be using db:schema:load, not running all the migrations 8 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations 9 | # you'll amass, the slower it'll run and the greater likelihood for issues). 10 | # 11 | # It's strongly recommended to check this file into your version control system. 12 | 13 | ActiveRecord::Schema.define(:version => 20110128073108) do 14 | 15 | create_table "assetable", :force => true do |t| 16 | end 17 | 18 | create_table "image_uploads", :force => true do |t| 19 | t.integer "session_workaround_id" 20 | t.integer "assetable_id" 21 | t.datetime "created_at" 22 | t.datetime "updated_at" 23 | end 24 | 25 | create_table "images", :force => true do |t| 26 | t.integer "assetable_id" 27 | t.string "slot" 28 | t.string "data_uid" 29 | t.boolean "delete_from_disk", :default => true 30 | t.datetime "created_at" 31 | t.datetime "updated_at" 32 | end 33 | 34 | create_table "posts", :force => true do |t| 35 | t.integer "assetable_id" 36 | t.string "title" 37 | t.text "body" 38 | t.datetime "created_at" 39 | t.datetime "updated_at" 40 | end 41 | 42 | create_table "session_workarounds", :force => true do |t| 43 | t.string "session_id" 44 | t.string "action" 45 | t.datetime "created_at" 46 | t.datetime "updated_at" 47 | end 48 | 49 | add_index "session_workarounds", ["session_id", "action"], :name => "index_session_workarounds_on_session_id_and_action" 50 | 51 | end 52 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }]) 7 | # Mayor.create(:name => 'Daley', :city => cities.first) 8 | -------------------------------------------------------------------------------- /doc/README_FOR_APP: -------------------------------------------------------------------------------- 1 | Use this README file to introduce your application and point to useful places in the API for learning more. 2 | Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries. 3 | -------------------------------------------------------------------------------- /formfly-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdetert/FormFly/a8d652eabc24fb014731f4e3875033a3b14fbb58/formfly-screenshot.png -------------------------------------------------------------------------------- /lib/collection_size_validator.rb: -------------------------------------------------------------------------------- 1 | class CollectionSizeValidator < ActiveModel::EachValidator 2 | def validate_each(record, attribute, value) 3 | if value.size < options[:min_size] 4 | record.errors[attribute] << (options[:message] || "You must upload at least #{options[:min_size]} image.") 5 | end 6 | if value.size > options[:max_size] 7 | record.errors[attribute] << (options[:message] || "You can only upload up to #{options[:max_size]} images.") 8 | end 9 | end 10 | end -------------------------------------------------------------------------------- /lib/tasks/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdetert/FormFly/a8d652eabc24fb014731f4e3875033a3b14fbb58/lib/tasks/.gitkeep -------------------------------------------------------------------------------- /public/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdetert/FormFly/a8d652eabc24fb014731f4e3875033a3b14fbb58/public/.DS_Store -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

The page you were looking for doesn't exist.

23 |

You may have mistyped the address or the page may have moved.

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

The change you wanted was rejected.

23 |

Maybe you tried to change something you didn't have access to.

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 17 | 18 | 19 | 20 | 21 |
22 |

We're sorry, but something went wrong.

23 |

We've been notified about this issue and we'll take a look at it shortly.

24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdetert/FormFly/a8d652eabc24fb014731f4e3875033a3b14fbb58/public/favicon.ico -------------------------------------------------------------------------------- /public/images/cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdetert/FormFly/a8d652eabc24fb014731f4e3875033a3b14fbb58/public/images/cancel.png -------------------------------------------------------------------------------- /public/images/onepixel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdetert/FormFly/a8d652eabc24fb014731f4e3875033a3b14fbb58/public/images/onepixel.png -------------------------------------------------------------------------------- /public/images/rails.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rdetert/FormFly/a8d652eabc24fb014731f4e3875033a3b14fbb58/public/images/rails.png -------------------------------------------------------------------------------- /public/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // Place your application-specific JavaScript functions and classes here 2 | // This file is automatically included by javascript_include_tag :defaults 3 | 4 | jQuery.ajaxSetup({ 5 | 'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")} 6 | }); -------------------------------------------------------------------------------- /public/javascripts/jquery-1.4.2.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery JavaScript Library v1.4.2 3 | * http://jquery.com/ 4 | * 5 | * Copyright 2010, John Resig 6 | * Dual licensed under the MIT or GPL Version 2 licenses. 7 | * http://jquery.org/license 8 | * 9 | * Includes Sizzle.js 10 | * http://sizzlejs.com/ 11 | * Copyright 2010, The Dojo Foundation 12 | * Released under the MIT, BSD, and GPL Licenses. 13 | * 14 | * Date: Sat Feb 13 22:33:48 2010 -0500 15 | */ 16 | (function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, 21 | Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& 22 | (d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, 23 | a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== 24 | "find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, 25 | function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b
a"; 34 | var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, 35 | parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= 36 | false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= 37 | s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, 38 | applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; 39 | else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, 40 | a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== 41 | w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, 42 | cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= 47 | c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); 48 | a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, 49 | function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); 50 | k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), 51 | C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B=0){a.type= 53 | e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& 54 | f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; 55 | if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", 63 | e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, 64 | "_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, 65 | d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, 71 | e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); 72 | t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| 73 | g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, 80 | CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, 81 | g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, 82 | text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, 83 | setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return hl[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= 84 | h[3];l=0;for(m=h.length;l=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== 86 | "="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, 87 | h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& 90 | q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML=""; 91 | if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="

";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); 92 | (function(){var g=s.createElement("div");g.innerHTML="
";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: 93 | function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f0)for(var j=d;j0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= 96 | {},i;if(f&&a.length){e=0;for(var o=a.length;e-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== 97 | "string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", 98 | d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? 99 | a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== 100 | 1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/"},F={option:[1,""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div
","
"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= 102 | c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, 103 | wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, 104 | prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, 105 | this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); 106 | return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, 107 | ""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); 111 | return this}else{e=0;for(var j=d.length;e0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", 112 | ""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]===""&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= 113 | c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? 114 | c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= 115 | function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= 116 | Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, 117 | "border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= 118 | a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= 119 | a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=//gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!== 120 | "string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("
").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this}, 121 | serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), 122 | function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href, 123 | global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&& 124 | e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)? 125 | "&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache=== 126 | false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B= 127 | false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since", 128 | c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E|| 129 | d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x); 130 | g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status=== 131 | 1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b=== 132 | "json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional; 133 | if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration=== 139 | "number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]|| 140 | c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start; 141 | this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now= 142 | this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem, 143 | e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b
"; 149 | a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b); 150 | c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a, 151 | d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top- 152 | f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset": 153 | "pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in 154 | e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window); 155 | -------------------------------------------------------------------------------- /public/javascripts/jquery.uploadify.v2.1.4.js: -------------------------------------------------------------------------------- 1 | /* 2 | Uploadify v2.1.4 3 | Release Date: November 8, 2010 4 | 5 | Copyright (c) 2010 Ronnie Garcia, Travis Nickels 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | */ 25 | 26 | if(jQuery)( 27 | function(jQuery){ 28 | jQuery.extend(jQuery.fn,{ 29 | uploadify:function(options) { 30 | jQuery(this).each(function(){ 31 | var settings = jQuery.extend({ 32 | id : jQuery(this).attr('id'), // The ID of the object being Uploadified 33 | uploader : 'uploadify.swf', // The path to the uploadify swf file 34 | script : 'uploadify.php', // The path to the uploadify backend upload script 35 | expressInstall : null, // The path to the express install swf file 36 | folder : '', // The path to the upload folder 37 | height : 30, // The height of the flash button 38 | width : 120, // The width of the flash button 39 | cancelImg : 'cancel.png', // The path to the cancel image for the default file queue item container 40 | wmode : 'opaque', // The wmode of the flash file 41 | scriptAccess : 'sameDomain', // Set to "always" to allow script access across domains 42 | fileDataName : 'Filedata', // The name of the file collection object in the backend upload script 43 | method : 'POST', // The method for sending variables to the backend upload script 44 | queueSizeLimit : 999, // The maximum size of the file queue 45 | simUploadLimit : 1, // The number of simultaneous uploads allowed 46 | queueID : false, // The optional ID of the queue container 47 | displayData : 'percentage', // Set to "speed" to show the upload speed in the default queue item 48 | removeCompleted : true, // Set to true if you want the queue items to be removed when a file is done uploading 49 | onInit : function() {}, // Function to run when uploadify is initialized 50 | onSelect : function() {}, // Function to run when a file is selected 51 | onSelectOnce : function() {}, // Function to run once when files are added to the queue 52 | onQueueFull : function() {}, // Function to run when the queue reaches capacity 53 | onCheck : function() {}, // Function to run when script checks for duplicate files on the server 54 | onCancel : function() {}, // Function to run when an item is cleared from the queue 55 | onClearQueue : function() {}, // Function to run when the queue is manually cleared 56 | onError : function() {}, // Function to run when an upload item returns an error 57 | onProgress : function() {}, // Function to run each time the upload progress is updated 58 | onComplete : function() {}, // Function to run when an upload is completed 59 | onAllComplete : function() {} // Function to run when all uploads are completed 60 | }, options); 61 | jQuery(this).data('settings',settings); 62 | var pagePath = location.pathname; 63 | pagePath = pagePath.split('/'); 64 | pagePath.pop(); 65 | pagePath = pagePath.join('/') + '/'; 66 | var data = {}; 67 | data.uploadifyID = settings.id; 68 | data.pagepath = pagePath; 69 | if (settings.buttonImg) data.buttonImg = escape(settings.buttonImg); 70 | if (settings.buttonText) data.buttonText = escape(settings.buttonText); 71 | if (settings.rollover) data.rollover = true; 72 | data.script = settings.script; 73 | data.folder = escape(settings.folder); 74 | if (settings.scriptData) { 75 | var scriptDataString = ''; 76 | for (var name in settings.scriptData) { 77 | scriptDataString += '&' + name + '=' + settings.scriptData[name]; 78 | } 79 | data.scriptData = escape(scriptDataString.substr(1)); 80 | } 81 | data.width = settings.width; 82 | data.height = settings.height; 83 | data.wmode = settings.wmode; 84 | data.method = settings.method; 85 | data.queueSizeLimit = settings.queueSizeLimit; 86 | data.simUploadLimit = settings.simUploadLimit; 87 | if (settings.hideButton) data.hideButton = true; 88 | if (settings.fileDesc) data.fileDesc = settings.fileDesc; 89 | if (settings.fileExt) data.fileExt = settings.fileExt; 90 | if (settings.multi) data.multi = true; 91 | if (settings.auto) data.auto = true; 92 | if (settings.sizeLimit) data.sizeLimit = settings.sizeLimit; 93 | if (settings.checkScript) data.checkScript = settings.checkScript; 94 | if (settings.fileDataName) data.fileDataName = settings.fileDataName; 95 | if (settings.queueID) data.queueID = settings.queueID; 96 | if (settings.onInit() !== false) { 97 | jQuery(this).css('display','none'); 98 | jQuery(this).after('
'); 99 | swfobject.embedSWF(settings.uploader, settings.id + 'Uploader', settings.width, settings.height, '9.0.24', settings.expressInstall, data, {'quality':'high','wmode':settings.wmode,'allowScriptAccess':settings.scriptAccess},{},function(event) { 100 | if (typeof(settings.onSWFReady) == 'function' && event.success) settings.onSWFReady(); 101 | }); 102 | if (settings.queueID == false) { 103 | jQuery("#" + jQuery(this).attr('id') + "Uploader").after('
'); 104 | } else { 105 | jQuery("#" + settings.queueID).addClass('uploadifyQueue'); 106 | } 107 | } 108 | if (typeof(settings.onOpen) == 'function') { 109 | jQuery(this).bind("uploadifyOpen", settings.onOpen); 110 | } 111 | jQuery(this).bind("uploadifySelect", {'action': settings.onSelect, 'queueID': settings.queueID}, function(event, ID, fileObj) { 112 | if (event.data.action(event, ID, fileObj) !== false) { 113 | var byteSize = Math.round(fileObj.size / 1024 * 100) * .01; 114 | var suffix = 'KB'; 115 | if (byteSize > 1000) { 116 | byteSize = Math.round(byteSize *.001 * 100) * .01; 117 | suffix = 'MB'; 118 | } 119 | var sizeParts = byteSize.toString().split('.'); 120 | if (sizeParts.length > 1) { 121 | byteSize = sizeParts[0] + '.' + sizeParts[1].substr(0,2); 122 | } else { 123 | byteSize = sizeParts[0]; 124 | } 125 | if (fileObj.name.length > 20) { 126 | fileName = fileObj.name.substr(0,20) + '...'; 127 | } else { 128 | fileName = fileObj.name; 129 | } 130 | queue = '#' + jQuery(this).attr('id') + 'Queue'; 131 | if (event.data.queueID) { 132 | queue = '#' + event.data.queueID; 133 | } 134 | jQuery(queue).append('
\ 135 |
\ 136 | \ 137 |
\ 138 | ' + fileName + ' (' + byteSize + suffix + ')\ 139 |
\ 140 |
\ 141 |
\ 142 |
'); 143 | } 144 | }); 145 | jQuery(this).bind("uploadifySelectOnce", {'action': settings.onSelectOnce}, function(event, data) { 146 | event.data.action(event, data); 147 | if (settings.auto) { 148 | if (settings.checkScript) { 149 | jQuery(this).uploadifyUpload(null, false); 150 | } else { 151 | jQuery(this).uploadifyUpload(null, true); 152 | } 153 | } 154 | }); 155 | jQuery(this).bind("uploadifyQueueFull", {'action': settings.onQueueFull}, function(event, queueSizeLimit) { 156 | if (event.data.action(event, queueSizeLimit) !== false) { 157 | alert('The queue is full. The max size is ' + queueSizeLimit + '.'); 158 | } 159 | }); 160 | jQuery(this).bind("uploadifyCheckExist", {'action': settings.onCheck}, function(event, checkScript, fileQueueObj, folder, single) { 161 | var postData = new Object(); 162 | postData = fileQueueObj; 163 | postData.folder = (folder.substr(0,1) == '/') ? folder : pagePath + folder; 164 | if (single) { 165 | for (var ID in fileQueueObj) { 166 | var singleFileID = ID; 167 | } 168 | } 169 | jQuery.post(checkScript, postData, function(data) { 170 | for(var key in data) { 171 | if (event.data.action(event, data, key) !== false) { 172 | var replaceFile = confirm("Do you want to replace the file " + data[key] + "?"); 173 | if (!replaceFile) { 174 | document.getElementById(jQuery(event.target).attr('id') + 'Uploader').cancelFileUpload(key,true,true); 175 | } 176 | } 177 | } 178 | if (single) { 179 | document.getElementById(jQuery(event.target).attr('id') + 'Uploader').startFileUpload(singleFileID, true); 180 | } else { 181 | document.getElementById(jQuery(event.target).attr('id') + 'Uploader').startFileUpload(null, true); 182 | } 183 | }, "json"); 184 | }); 185 | jQuery(this).bind("uploadifyCancel", {'action': settings.onCancel}, function(event, ID, fileObj, data, remove, clearFast) { 186 | if (event.data.action(event, ID, fileObj, data, clearFast) !== false) { 187 | if (remove) { 188 | var fadeSpeed = (clearFast == true) ? 0 : 250; 189 | jQuery("#" + jQuery(this).attr('id') + ID).fadeOut(fadeSpeed, function() { jQuery(this).remove() }); 190 | } 191 | } 192 | }); 193 | jQuery(this).bind("uploadifyClearQueue", {'action': settings.onClearQueue}, function(event, clearFast) { 194 | var queueID = (settings.queueID) ? settings.queueID : jQuery(this).attr('id') + 'Queue'; 195 | if (clearFast) { 196 | jQuery("#" + queueID).find('.uploadifyQueueItem').remove(); 197 | } 198 | if (event.data.action(event, clearFast) !== false) { 199 | jQuery("#" + queueID).find('.uploadifyQueueItem').each(function() { 200 | var index = jQuery('.uploadifyQueueItem').index(this); 201 | jQuery(this).delay(index * 100).fadeOut(250, function() { jQuery(this).remove() }); 202 | }); 203 | } 204 | }); 205 | var errorArray = []; 206 | jQuery(this).bind("uploadifyError", {'action': settings.onError}, function(event, ID, fileObj, errorObj) { 207 | if (event.data.action(event, ID, fileObj, errorObj) !== false) { 208 | var fileArray = new Array(ID, fileObj, errorObj); 209 | errorArray.push(fileArray); 210 | jQuery("#" + jQuery(this).attr('id') + ID).find('.percentage').text(" - " + errorObj.type + " Error"); 211 | jQuery("#" + jQuery(this).attr('id') + ID).find('.uploadifyProgress').hide(); 212 | jQuery("#" + jQuery(this).attr('id') + ID).addClass('uploadifyError'); 213 | } 214 | }); 215 | if (typeof(settings.onUpload) == 'function') { 216 | jQuery(this).bind("uploadifyUpload", settings.onUpload); 217 | } 218 | jQuery(this).bind("uploadifyProgress", {'action': settings.onProgress, 'toDisplay': settings.displayData}, function(event, ID, fileObj, data) { 219 | if (event.data.action(event, ID, fileObj, data) !== false) { 220 | jQuery("#" + jQuery(this).attr('id') + ID + "ProgressBar").animate({'width': data.percentage + '%'},250,function() { 221 | if (data.percentage == 100) { 222 | jQuery(this).closest('.uploadifyProgress').fadeOut(250,function() {jQuery(this).remove()}); 223 | } 224 | }); 225 | if (event.data.toDisplay == 'percentage') displayData = ' - ' + data.percentage + '%'; 226 | if (event.data.toDisplay == 'speed') displayData = ' - ' + data.speed + 'KB/s'; 227 | if (event.data.toDisplay == null) displayData = ' '; 228 | jQuery("#" + jQuery(this).attr('id') + ID).find('.percentage').text(displayData); 229 | } 230 | }); 231 | jQuery(this).bind("uploadifyComplete", {'action': settings.onComplete}, function(event, ID, fileObj, response, data) { 232 | if (event.data.action(event, ID, fileObj, unescape(response), data) !== false) { 233 | jQuery("#" + jQuery(this).attr('id') + ID).find('.percentage').text(' - Completed'); 234 | if (settings.removeCompleted) { 235 | jQuery("#" + jQuery(event.target).attr('id') + ID).fadeOut(250,function() {jQuery(this).remove()}); 236 | } 237 | jQuery("#" + jQuery(event.target).attr('id') + ID).addClass('completed'); 238 | } 239 | }); 240 | if (typeof(settings.onAllComplete) == 'function') { 241 | jQuery(this).bind("uploadifyAllComplete", {'action': settings.onAllComplete}, function(event, data) { 242 | if (event.data.action(event, data) !== false) { 243 | errorArray = []; 244 | } 245 | }); 246 | } 247 | }); 248 | }, 249 | uploadifySettings:function(settingName, settingValue, resetObject) { 250 | var returnValue = false; 251 | jQuery(this).each(function() { 252 | if (settingName == 'scriptData' && settingValue != null) { 253 | if (resetObject) { 254 | var scriptData = settingValue; 255 | } else { 256 | var scriptData = jQuery.extend(jQuery(this).data('settings').scriptData, settingValue); 257 | } 258 | var scriptDataString = ''; 259 | for (var name in scriptData) { 260 | scriptDataString += '&' + name + '=' + scriptData[name]; 261 | } 262 | settingValue = escape(scriptDataString.substr(1)); 263 | } 264 | returnValue = document.getElementById(jQuery(this).attr('id') + 'Uploader').updateSettings(settingName, settingValue); 265 | }); 266 | if (settingValue == null) { 267 | if (settingName == 'scriptData') { 268 | var returnSplit = unescape(returnValue).split('&'); 269 | var returnObj = new Object(); 270 | for (var i = 0; i < returnSplit.length; i++) { 271 | var iSplit = returnSplit[i].split('='); 272 | returnObj[iSplit[0]] = iSplit[1]; 273 | } 274 | returnValue = returnObj; 275 | } 276 | } 277 | return returnValue; 278 | }, 279 | uploadifyUpload:function(ID,checkComplete) { 280 | jQuery(this).each(function() { 281 | if (!checkComplete) checkComplete = false; 282 | document.getElementById(jQuery(this).attr('id') + 'Uploader').startFileUpload(ID, checkComplete); 283 | }); 284 | }, 285 | uploadifyCancel:function(ID) { 286 | jQuery(this).each(function() { 287 | document.getElementById(jQuery(this).attr('id') + 'Uploader').cancelFileUpload(ID, true, true, false); 288 | }); 289 | }, 290 | uploadifyClearQueue:function() { 291 | jQuery(this).each(function() { 292 | document.getElementById(jQuery(this).attr('id') + 'Uploader').clearFileUploadQueue(false); 293 | }); 294 | } 295 | }) 296 | })(jQuery); -------------------------------------------------------------------------------- /public/javascripts/rails.js: -------------------------------------------------------------------------------- 1 | jQuery(function ($) { 2 | var csrf_token = $('meta[name=csrf-token]').attr('content'), 3 | csrf_param = $('meta[name=csrf-param]').attr('content'); 4 | 5 | $.fn.extend({ 6 | /** 7 | * Triggers a custom event on an element and returns the event result 8 | * this is used to get around not being able to ensure callbacks are placed 9 | * at the end of the chain. 10 | * 11 | * TODO: deprecate with jQuery 1.4.2 release, in favor of subscribing to our 12 | * own events and placing ourselves at the end of the chain. 13 | */ 14 | triggerAndReturn: function (name, data) { 15 | var event = new $.Event(name); 16 | this.trigger(event, data); 17 | 18 | return event.result !== false; 19 | }, 20 | 21 | /** 22 | * Handles execution of remote calls firing overridable events along the way 23 | */ 24 | callRemote: function () { 25 | var el = this, 26 | method = el.attr('method') || el.attr('data-method') || 'GET', 27 | url = el.attr('action') || el.attr('href'), 28 | dataType = el.attr('data-type') || 'script'; 29 | 30 | if (url === undefined) { 31 | throw "No URL specified for remote call (action or href must be present)."; 32 | } else { 33 | if (el.triggerAndReturn('ajax:before')) { 34 | var data = el.is('form') ? el.serializeArray() : []; 35 | $.ajax({ 36 | url: url, 37 | data: data, 38 | dataType: dataType, 39 | type: method.toUpperCase(), 40 | beforeSend: function (xhr) { 41 | el.trigger('ajax:loading', xhr); 42 | }, 43 | success: function (data, status, xhr) { 44 | el.trigger('ajax:success', [data, status, xhr]); 45 | }, 46 | complete: function (xhr) { 47 | el.trigger('ajax:complete', xhr); 48 | }, 49 | error: function (xhr, status, error) { 50 | el.trigger('ajax:failure', [xhr, status, error]); 51 | } 52 | }); 53 | } 54 | 55 | el.trigger('ajax:after'); 56 | } 57 | } 58 | }); 59 | 60 | /** 61 | * confirmation handler 62 | */ 63 | $('a[data-confirm],input[data-confirm]').live('click', function () { 64 | var el = $(this); 65 | if (el.triggerAndReturn('confirm')) { 66 | if (!confirm(el.attr('data-confirm'))) { 67 | return false; 68 | } 69 | } 70 | }); 71 | 72 | 73 | /** 74 | * remote handlers 75 | */ 76 | $('form[data-remote]').live('submit', function (e) { 77 | $(this).callRemote(); 78 | e.preventDefault(); 79 | }); 80 | 81 | $('a[data-remote],input[data-remote]').live('click', function (e) { 82 | $(this).callRemote(); 83 | e.preventDefault(); 84 | }); 85 | 86 | $('a[data-method]:not([data-remote])').live('click', function (e){ 87 | var link = $(this), 88 | href = link.attr('href'), 89 | method = link.attr('data-method'), 90 | form = $('
'), 91 | metadata_input = ''; 92 | 93 | if (csrf_param != null && csrf_token != null) { 94 | metadata_input += ''; 95 | } 96 | 97 | form.hide() 98 | .append(metadata_input) 99 | .appendTo('body'); 100 | 101 | e.preventDefault(); 102 | form.submit(); 103 | }); 104 | 105 | /** 106 | * disable-with handlers 107 | */ 108 | var disable_with_input_selector = 'input[data-disable-with]'; 109 | var disable_with_form_remote_selector = 'form[data-remote]:has(' + disable_with_input_selector + ')'; 110 | var disable_with_form_not_remote_selector = 'form:not([data-remote]):has(' + disable_with_input_selector + ')'; 111 | 112 | var disable_with_input_function = function () { 113 | $(this).find(disable_with_input_selector).each(function () { 114 | var input = $(this); 115 | input.data('enable-with', input.val()) 116 | .attr('value', input.attr('data-disable-with')) 117 | .attr('disabled', 'disabled'); 118 | }); 119 | }; 120 | 121 | $(disable_with_form_remote_selector).live('ajax:before', disable_with_input_function); 122 | $(disable_with_form_not_remote_selector).live('submit', disable_with_input_function); 123 | 124 | $(disable_with_form_remote_selector).live('ajax:complete', function () { 125 | $(this).find(disable_with_input_selector).each(function () { 126 | var input = $(this); 127 | input.removeAttr('disabled') 128 | .val(input.data('enable-with')); 129 | }); 130 | }); 131 | 132 | }); 133 | -------------------------------------------------------------------------------- /public/javascripts/swfobject.js: -------------------------------------------------------------------------------- 1 | /* SWFObject v2.2 2 | is released under the MIT License 3 | */ 4 | var swfobject=function(){var D="undefined",r="object",S="Shockwave Flash",W="ShockwaveFlash.ShockwaveFlash",q="application/x-shockwave-flash",R="SWFObjectExprInst",x="onreadystatechange",O=window,j=document,t=navigator,T=false,U=[h],o=[],N=[],I=[],l,Q,E,B,J=false,a=false,n,G,m=true,M=function(){var aa=typeof j.getElementById!=D&&typeof j.getElementsByTagName!=D&&typeof j.createElement!=D,ah=t.userAgent.toLowerCase(),Y=t.platform.toLowerCase(),ae=Y?/win/.test(Y):/win/.test(ah),ac=Y?/mac/.test(Y):/mac/.test(ah),af=/webkit/.test(ah)?parseFloat(ah.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,X=!+"\v1",ag=[0,0,0],ab=null;if(typeof t.plugins!=D&&typeof t.plugins[S]==r){ab=t.plugins[S].description;if(ab&&!(typeof t.mimeTypes!=D&&t.mimeTypes[q]&&!t.mimeTypes[q].enabledPlugin)){T=true;X=false;ab=ab.replace(/^.*\s+(\S+\s+\S+$)/,"$1");ag[0]=parseInt(ab.replace(/^(.*)\..*$/,"$1"),10);ag[1]=parseInt(ab.replace(/^.*\.(.*)\s.*$/,"$1"),10);ag[2]=/[a-zA-Z]/.test(ab)?parseInt(ab.replace(/^.*[a-zA-Z]+(.*)$/,"$1"),10):0}}else{if(typeof O.ActiveXObject!=D){try{var ad=new ActiveXObject(W);if(ad){ab=ad.GetVariable("$version");if(ab){X=true;ab=ab.split(" ")[1].split(",");ag=[parseInt(ab[0],10),parseInt(ab[1],10),parseInt(ab[2],10)]}}}catch(Z){}}}return{w3:aa,pv:ag,wk:af,ie:X,win:ae,mac:ac}}(),k=function(){if(!M.w3){return}if((typeof j.readyState!=D&&j.readyState=="complete")||(typeof j.readyState==D&&(j.getElementsByTagName("body")[0]||j.body))){f()}if(!J){if(typeof j.addEventListener!=D){j.addEventListener("DOMContentLoaded",f,false)}if(M.ie&&M.win){j.attachEvent(x,function(){if(j.readyState=="complete"){j.detachEvent(x,arguments.callee);f()}});if(O==top){(function(){if(J){return}try{j.documentElement.doScroll("left")}catch(X){setTimeout(arguments.callee,0);return}f()})()}}if(M.wk){(function(){if(J){return}if(!/loaded|complete/.test(j.readyState)){setTimeout(arguments.callee,0);return}f()})()}s(f)}}();function f(){if(J){return}try{var Z=j.getElementsByTagName("body")[0].appendChild(C("span"));Z.parentNode.removeChild(Z)}catch(aa){return}J=true;var X=U.length;for(var Y=0;Y0){for(var af=0;af0){var ae=c(Y);if(ae){if(F(o[af].swfVersion)&&!(M.wk&&M.wk<312)){w(Y,true);if(ab){aa.success=true;aa.ref=z(Y);ab(aa)}}else{if(o[af].expressInstall&&A()){var ai={};ai.data=o[af].expressInstall;ai.width=ae.getAttribute("width")||"0";ai.height=ae.getAttribute("height")||"0";if(ae.getAttribute("class")){ai.styleclass=ae.getAttribute("class")}if(ae.getAttribute("align")){ai.align=ae.getAttribute("align")}var ah={};var X=ae.getElementsByTagName("param");var ac=X.length;for(var ad=0;ad'}}aa.outerHTML='"+af+"";N[N.length]=ai.id;X=c(ai.id)}else{var Z=C(r);Z.setAttribute("type",q);for(var ac in ai){if(ai[ac]!=Object.prototype[ac]){if(ac.toLowerCase()=="styleclass"){Z.setAttribute("class",ai[ac])}else{if(ac.toLowerCase()!="classid"){Z.setAttribute(ac,ai[ac])}}}}for(var ab in ag){if(ag[ab]!=Object.prototype[ab]&&ab.toLowerCase()!="movie"){e(Z,ab,ag[ab])}}aa.parentNode.replaceChild(Z,aa);X=Z}}return X}function e(Z,X,Y){var aa=C("param");aa.setAttribute("name",X);aa.setAttribute("value",Y);Z.appendChild(aa)}function y(Y){var X=c(Y);if(X&&X.nodeName=="OBJECT"){if(M.ie&&M.win){X.style.display="none";(function(){if(X.readyState==4){b(Y)}else{setTimeout(arguments.callee,10)}})()}else{X.parentNode.removeChild(X)}}}function b(Z){var Y=c(Z);if(Y){for(var X in Y){if(typeof Y[X]=="function"){Y[X]=null}}Y.parentNode.removeChild(Y)}}function c(Z){var X=null;try{X=j.getElementById(Z)}catch(Y){}return X}function C(X){return j.createElement(X)}function i(Z,X,Y){Z.attachEvent(X,Y);I[I.length]=[Z,X,Y]}function F(Z){var Y=M.pv,X=Z.split(".");X[0]=parseInt(X[0],10);X[1]=parseInt(X[1],10)||0;X[2]=parseInt(X[2],10)||0;return(Y[0]>X[0]||(Y[0]==X[0]&&Y[1]>X[1])||(Y[0]==X[0]&&Y[1]==X[1]&&Y[2]>=X[2]))?true:false}function v(ac,Y,ad,ab){if(M.ie&&M.mac){return}var aa=j.getElementsByTagName("head")[0];if(!aa){return}var X=(ad&&typeof ad=="string")?ad:"screen";if(ab){n=null;G=null}if(!n||G!=X){var Z=C("style");Z.setAttribute("type","text/css");Z.setAttribute("media",X);n=aa.appendChild(Z);if(M.ie&&M.win&&typeof j.styleSheets!=D&&j.styleSheets.length>0){n=j.styleSheets[j.styleSheets.length-1]}G=X}if(M.ie&&M.win){if(n&&typeof n.addRule==r){n.addRule(ac,Y)}}else{if(n&&typeof j.createTextNode!=D){n.appendChild(j.createTextNode(ac+" {"+Y+"}"))}}}function w(Z,X){if(!m){return}var Y=X?"visible":"hidden";if(J&&c(Z)){c(Z).style.visibility=Y}else{v("#"+Z,"visibility:"+Y)}}function L(Y){var Z=/[\\\"<>\.;]/;var X=Z.exec(Y)!=null;return X&&typeof encodeURIComponent!=D?encodeURIComponent(Y):Y}var d=function(){if(M.ie&&M.win){window.attachEvent("onunload",function(){var ac=I.length;for(var ab=0;ab