Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit

  • Loading branch information...
commit d3d19dc3c67bd2ed9499dc1ac63fba089d2a3759 0 parents
Paul Engel authored
Showing with 1,002 additions and 0 deletions.
  1. +2 −0  .gitignore
  2. +5 −0 CHANGELOG
  3. +20 −0 MIT-LICENSE
  4. +108 −0 README.textile
  5. +43 −0 Rakefile
  6. +1 −0  VERSION
  7. +56 −0 app/controllers/rich/cms_controller.rb
  8. +4 −0 app/views/rich/cms/_bar.html.erb
  9. +3 −0  app/views/rich/cms/_config.html.erb
  10. +16 −0 app/views/rich/cms/bar/_menu.html.erb
  11. +3 −0  app/views/rich/cms/bar/_panel.html.erb
  12. +10 −0 app/views/rich/cms/bar/panel/_edit.html.erb
  13. +11 −0 app/views/rich/cms/bar/panel/_login.html.erb
  14. +5 −0 app/views/rich_cms.html.erb
  15. +168 −0 assets/jzip/jquery/core.js
  16. +26 −0 assets/jzip/jquery/extensions/ajaxify.js
  17. +12 −0 assets/jzip/jquery/extensions/modules.js
  18. +17 −0 assets/jzip/jquery/extensions/object.js
  19. +2 −0  assets/jzip/rich/cms.js
  20. +109 −0 assets/jzip/rich/cms/editor.js
  21. +12 −0 assets/jzip/rich/cms/login.js
  22. +11 −0 assets/jzip/rich_cms.jz
  23. +25 −0 assets/jzip/shared/rich.js
  24. +45 −0 assets/sass/_bar.sass
  25. +6 −0 assets/sass/_editables.sass
  26. +52 −0 assets/sass/_mixins.sass
  27. +4 −0 assets/sass/rich_cms.sass
  28. +12 −0 config/routes.rb
  29. +1 −0  init.rb
  30. +1 −0  install.rb
  31. +60 −0 lib/rich/cms/controller.rb
  32. +44 −0 lib/rich/cms/editable_content.rb
  33. +62 −0 lib/rich/cms/engine.rb
  34. +17 −0 lib/rich/cms/helper.rb
  35. +5 −0 lib/rich_cms.rb
  36. +1 −0  rails/init.rb
  37. +4 −0 tasks/rich_cms_tasks.rake
  38. +15 −0 test/engine_test.rb
  39. +3 −0  test/test_helper.rb
  40. +1 −0  uninstall.rb
2  .gitignore
@@ -0,0 +1,2 @@
+.DS_Store
+pkg/*
5 CHANGELOG
@@ -0,0 +1,5 @@
+= Rich-CMS CHANGELOG
+
+== Version 1.0.0 (August 13, 2010)
+
+* Initial release
20 MIT-LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2010 Paul Engel
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
108 README.textile
@@ -0,0 +1,108 @@
+
+h1. Rich-CMS
+
+A Rails gem (and also plugin) for a pluggable CMS frontend
+
+h2. Introduction
+
+Rich-CMS is a module of E9s ("http://github.com/archan937/e9s":http://github.com/archan937/e9s) which provides a frontend for your CMS content.
+
+h2. Installation
+
+h3. Using Rich-CMS as gem
+
+Install the Rich-CMS gem:
+
+<pre>
+ sudo gem install rich_cms
+</pre>
+
+Add rich_cms in @environment.rb@ as a gem dependency:
+
+<pre>
+ config.gem "rich_cms"
+</pre>
+
+h3. Using Rich-CMS as plugin
+
+Install the Rich-CMS plugin:
+
+<pre>
+ ./script/plugin install git://github.com/archan937/rich_cms.git
+</pre>
+
+h2. Usage
+
+h3. Specify the authentication mechanism
+
+Provide the mechanism as a symbol (e.g. @:authlogic@) and the authenticated class along with the attribute used to identify the instance in a hash.
+
+<pre>
+ Rich::Cms::Engine.authenticate(:authlogic, {:class => Betty::User, :identifier => :name})
+</pre>
+
+Unfortunately, only AuthLogic ("http://github.com/binarylogic/authlogic":http://github.com/binarylogic/authlogic) is supported, but we are working hard on making Rich-CMS compatible with other mechanisms.
+
+h3. Register CMS content
+
+Every type of content is identified with its correspending CSS selector (used by the jQuery based Javascript module of Rich-CMS). You will have to provide some specifications:
+
+* @:class@ - The class of the CMS content model which contain the data
+* @:key@ (optional) - The attribute used for identification of the content instance (which at default is @:key@). You can also provide an array for a combined key (e.g. @[:key, :locale]@)
+* @:value@ (optional) - The attribute which stores the value of the content instance (which at default is @:value@).
+
+<pre>
+ Rich::Cms::Engine.register(".betty_cms_content", {:class => Betty::Cms::StaticContent})
+</pre>
+
+h3. Render Rich-CMS content within your views
+
+Rich-CMS requires a rendered DOM element provided with meta data of the content instance. Fortunately, you can call a method provided by Rich-CMS. Just specify the identifier of the content type and the key of the CMS content instance in question:
+
+<pre>
+ >> key = "test_content"
+ => "test_content"
+ >> Rich::Cms::Engine.to_content_tag({".betty_cms_content" => key})
+ => "<div class='betty_cms_content' data-key='test_content' data-value='Hello world!'>Hello world!</div>"
+</pre>
+
+h2. Contact me
+
+For support, remarks and requests please mail me at "paul.engel@holder.nl":mailto:paul.engel@holder.nl.
+
+h2. Credit
+
+This Rails gem / plugin depends on:
+
+jQuery<br>
+"http://jquery.com":http://jquery.com
+
+Jzip<br>
+"http://github.com/archan937/jzip":http://github.com/archan937/jzip
+
+SASS<br>
+"http://sass-lang.com":http://sass-lang.com
+
+Formtastic<br>
+"http://github.com/justinfrench/formtastic":http://github.com/justinfrench/formtastic
+
+SeatHolder (optional)<br>
+"http://github.com/archan937/seat_holder":http://github.com/archan937/seat_holder
+
+h2. ToDo's
+
+* Complete README.textile (provide documentation about optional features)
+* Integrate Rich-CMS in the E9s demo application ("http://github.com/archan937/e9s-demo":http://github.com/archan937/e9s-demo)
+* Provide compatibility with other authentication mechanisms other than AuthLogic
+
+h2. License
+
+Copyright (c) 2010 Paul Engel, released under the MIT license
+
+"http://holder.nl":http://holder.nl - "http://codehero.es":http://codehero.es - "http://gettopup.com":http://gettopup.com - "http://twitter.com/archan937":http://twitter.com/archan937 - "paul.engel@holder.nl":mailto:paul.engel@holder.nl
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
43 Rakefile
@@ -0,0 +1,43 @@
+require "rake"
+require "rake/testtask"
+require "rake/rdoctask"
+
+begin
+ require "jeweler"
+ Jeweler::Tasks.new do |gemspec|
+ gemspec.name = "rich_cms"
+ gemspec.summary = "Enrichments (e9s) module for a pluggable CMS frontend"
+ gemspec.description = "Rich-CMS is a module of E9s (http://github.com/archan937/e9s) which provides a frontend for your CMS content. You can use this gem to manage CMS content or translations (in an internationalized application). The installation and setup process is very easily done. You will have to register content at the Rich-CMS engine and also you will have to specify the authentication mechanism. Both are one-liners."
+ gemspec.email = "paul.engel@holder.nl"
+ gemspec.homepage = "http://github.com/archan937/rich_cms"
+ gemspec.author = "Paul Engel"
+
+ gemspec.add_dependency "jzip"
+ gemspec.add_dependency "haml", ">= 3"
+ gemspec.add_dependency "formtastic"
+ end
+ Jeweler::GemcutterTasks.new
+rescue LoadError
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
+end
+
+desc "Default: run unit tests."
+task :default => :test
+
+desc "Test the rich_cms plugin."
+Rake::TestTask.new(:test) do |t|
+ t.libs << "lib"
+ t.libs << "test"
+ t.pattern = "test/**/*_test.rb"
+ t.verbose = true
+end
+
+desc "Generate documentation for the rich_cms plugin."
+Rake::RDocTask.new(:rdoc) do |rdoc|
+ rdoc.rdoc_dir = "rdoc"
+ rdoc.title = "Rich-CMS"
+ rdoc.options << "--line-numbers" << "--inline-source"
+ rdoc.rdoc_files.include "README"
+ rdoc.rdoc_files.include "MIT-LICENSE"
+ rdoc.rdoc_files.include "lib/**/*.rb"
+end
1  VERSION
@@ -0,0 +1 @@
+1.0.0
56 app/controllers/rich/cms_controller.rb
@@ -0,0 +1,56 @@
+
+module Rich
+ class CmsController < ::ApplicationController
+
+ before_filter :require_current_rich_cms_admin, :except => [:show, :hide, :login]
+
+ def show
+ display_bar(true)
+ end
+
+ def hide
+ display_bar(false)
+ end
+
+ def login
+ case rich_cms_auth.logic
+ when :authlogic
+ @current_rich_cms_admin_session = rich_cms_authenticated_class.new params[key = rich_cms_authenticated_class.name.underscore.gsub("/", "_")]
+ authenticated = @current_rich_cms_admin_session.save
+
+ if request.xhr?
+ render :update do |page|
+ if authenticated
+ page.reload
+ else
+ page["##{key}_#{rich_cms_authentication_inputs.first}"].focus
+ end
+ end
+ else
+ redirect_to request.referrer
+ end
+ end
+ end
+
+ def logout
+ case rich_cms_auth.logic
+ when :authlogic
+ (@current_rich_cms_admin_session ||= rich_cms_authenticated_class.find).destroy
+ end
+ hide
+ end
+
+ def update
+ render :json => Cms::EditableContent.new(params[:editable_content]).save
+ end
+
+ private
+
+ def display_bar(display)
+ (session[:rich_cms] ||= {})[:display] = display
+ redirect_to request.referrer
+ end
+
+ end
+
+end
4 app/views/rich/cms/_bar.html.erb
@@ -0,0 +1,4 @@
+<div id="rich_cms_bar">
+ <%= render :partial => "rich/cms/bar/menu" %>
+ <%= render :partial => "rich/cms/bar/panel" %>
+</div>
3  app/views/rich/cms/_config.html.erb
@@ -0,0 +1,3 @@
+<% javascript_tag do %>
+ Rich.Cms.Editor.register(<%= Rich::Cms::Engine.editable_content_javascript_hash %>);
+<% end %>
16 app/views/rich/cms/bar/_menu.html.erb
@@ -0,0 +1,16 @@
+<div class="menu">
+ <% if current_rich_cms_admin %>
+ <%= link "Mark copy", :class => "mark" %>
+ <% end %>
+
+ <% unless current_rich_cms_admin %>
+ <%= link "Login" %>
+ <% else %>
+ <div class="admin">
+ Logged in as <strong><%= current_rich_cms_admin_name %></strong>
+ &nbsp;&nbsp;
+ <%= link_to "Hide" , rich_cms_hide_path %>
+ <%= link_to "Logout", rich_cms_logout_path %>
+ </div>
+ <% end %>
+</div>
3  app/views/rich/cms/bar/_panel.html.erb
@@ -0,0 +1,3 @@
+<div class="panel">
+ <%= render :partial => "rich/cms/bar/panel/#{current_rich_cms_admin.nil? ? "login" : "edit"}" %>
+</div>
10 app/views/rich/cms/bar/panel/_edit.html.erb
@@ -0,0 +1,10 @@
+<div class="edit" style="display: none">
+ <% form_tag rich_cms_update_path, :name => "rich_cms_editable", :class => "ajaxify" do %>
+ <fieldset class="inputs">
+ <label></label>
+ </fieldset>
+ <fieldset class="buttons">
+ <%= submit_tag "Save" %> <%= link "Close" %>
+ </fieldset>
+ <% end %>
+</div>
11 app/views/rich/cms/bar/panel/_login.html.erb
@@ -0,0 +1,11 @@
+<div class="login" style="display: none">
+ <% semantic_form_for rich_cms_authenticated_class.new, :url => rich_cms_login_path, :html => {:class => "ajaxify"} do |form| %>
+
+ <%= form.inputs *rich_cms_authentication_inputs %>
+
+ <% form.buttons do %>
+ <%= form.submit "Login" %>
+ <% end %>
+
+ <% end %>
+</div>
5 app/views/rich_cms.html.erb
@@ -0,0 +1,5 @@
+<%= stylesheet_link_tag "rich_cms" %>
+<%= javascript_include_tag "rich_cms" %>
+
+<%= render :partial => "rich/cms/config" %>
+<%= render :partial => "rich/cms/bar" %>
168 assets/jzip/jquery/core.js
@@ -0,0 +1,168 @@
+
+// *
+// * jQuery JavaScript Library v1.4.3pre
+// * http://jquery.com/
+// *
+// * Copyright 2010, John Resig
+// * Dual licensed under the MIT or GPL Version 2 licenses.
+// * http://jquery.org/license
+// *
+// * Includes Sizzle.js
+// * http://sizzlejs.com/
+// * Copyright 2010, The Dojo Foundation
+// * Released under the MIT, BSD, and GPL Licenses.
+// *
+// * Date: Wed Mar 31 14:36:24 2010 -0400
+// *
+
+if (typeof(jQuery) == "undefined") {
+ (function(y,x){function K(){return false}function Q(){return true}function ca(a,b,c){c[0].type=a;return jQuery.event.handle.apply(b,c)}function Ca(a){var b,c,d=[],g=[],i,m,l,n,t,u,v,s;m=jQuery.data(this,"events");if(!(a.liveFired===this||!m||!m.live||a.button&&a.type==="click")){if(a.namespace)s=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var z=m.live.slice(0);for(n=0;n<z.length;n++){m=z[n];m.origType.replace(R,"")===a.type?g.push(m.selector):z.splice(n--,
+1)}i=jQuery(a.target).closest(g,a.currentTarget);t=0;for(u=i.length;t<u;t++){v=i[t];for(n=0;n<z.length;n++){m=z[n];if(v.selector===m.selector&&(!s||s.test(m.namespace))){l=v.elem;g=null;if(m.preType==="mouseenter"||m.preType==="mouseleave"){a.type=m.preType;g=jQuery(a.relatedTarget).closest(m.selector)[0]}if(!g||g!==l)d.push({elem:l,handleObj:m,level:v.level})}}}t=0;for(u=d.length;t<u;t++){i=d[t];if(c&&i.level>c)break;a.currentTarget=i.elem;a.data=i.handleObj.data;a.handleObj=i.handleObj;ret=i.handleObj.origHandler.apply(i.elem,
+arguments);if(ret===false||a.isPropagationStopped()){c=i.level;if(ret===false)b=false}}return b}}function L(a,b){return(a&&a!=="*"?a+".":"")+b.replace(/\./g,"`").replace(/ /g,"&")}function da(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function ea(a,b,c){if(jQuery.isFunction(b))return jQuery.grep(a,function(g,i){return!!b.call(g,i,g)===c});else if(b.nodeType)return jQuery.grep(a,function(g){return g===b===c});else if(typeof b==="string"){var d=jQuery.grep(a,function(g){return g.nodeType===
+1});if(Da.test(b))return jQuery.filter(b,d,!c);else b=jQuery.filter(b,d)}return jQuery.grep(a,function(g){return jQuery.inArray(g,b)>=0===c})}function Ea(a){return jQuery.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function fa(a,b){var c=0;b.each(function(){if(this.nodeName===(a[c]&&a[c].nodeName)){var d=jQuery.data(a[c++]),g=jQuery.data(this,d);if(d=d&&d.events){delete g.handle;g.events={};for(var i in d)for(var m in d[i])jQuery.event.add(this,
+i,d[i][m],d[i][m].data)}}})}function ga(a,b,c){var d,g,i;b=b&&b[0]?b[0].ownerDocument||b[0]:document;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===document&&!ha.test(a[0])&&(jQuery.support.checkClone||!ia.test(a[0]))){g=true;if(i=jQuery.fragments[a[0]])if(i!==1)d=i}if(!d){d=b.createDocumentFragment();jQuery.clean(a,b,d,c)}if(g)jQuery.fragments[a[0]]=i?d:1;return{fragment:d,cacheable:g}}function Fa(a,b){b.src?jQuery.ajax({url:b.src,async:false,dataType:"script"}):jQuery.globalEval(b.text||
+b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function ja(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight;if(c==="border")return d;jQuery.each(b==="width"?Ga:Ha,function(){c||(d-=parseFloat(jQuery.curCSS(a,"padding"+this,true))||0);if(c==="margin")d+=parseFloat(jQuery.curCSS(a,"margin"+this,true))||0;else d-=parseFloat(jQuery.curCSS(a,"border"+this+"Width",true))||0});return d}function S(a,b,c,d){if(jQuery.isArray(b))jQuery.each(b,function(g,i){c||/\[\]$/.test(a)?
+d(a,i):S(a+"["+(typeof i==="object"||jQuery.isArray(i)?g:"")+"]",i,c,d)});else!c&&b!=null&&typeof b==="object"?jQuery.each(b,function(g,i){S(a+"["+g+"]",i,c,d)}):d(a,b)}function I(a,b){var c={};jQuery.each(ka.concat.apply([],ka.slice(0,b)),function(){c[this]=a});return c}function T(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}(function(){function a(){if(!b.isReady){try{document.documentElement.doScroll("left")}catch(h){setTimeout(a,1);return}b.ready()}}
+var b=function(h,k){return new b.fn.init(h,k)},c=y.jQuery,d=y.$,g,i=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w\-]+)$/,m=/\S/,l=/^\s+/,n=/\s+$/,t=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,u=navigator.userAgent,v=false,s=[],z,B=Object.prototype.toString,E=Object.prototype.hasOwnProperty,f=Array.prototype.push,j=Array.prototype.slice,o=String.prototype.trim,p=Array.prototype.indexOf;b.fn=b.prototype={init:function(h,k){var q,r;if(!h)return this;if(h.nodeType){this.context=this[0]=h;this.length=1;return this}if(h==="body"&&
+!k){this.context=document;this[0]=document.body;this.selector="body";this.length=1;return this}if(typeof h==="string")if((q=i.exec(h))&&(q[1]||!k))if(q[1]){r=k?k.ownerDocument||k:document;if(h=t.exec(h))if(b.isPlainObject(k)){h=[document.createElement(h[1])];b.fn.attr.call(h,k,true)}else h=[r.createElement(h[1])];else{h=ga([q[1]],[r]);h=(h.cacheable?h.fragment.cloneNode(true):h.fragment).childNodes}return b.merge(this,h)}else{if(k=document.getElementById(q[2])){if(k.id!==q[2])return g.find(h);this.length=
+1;this[0]=k}this.context=document;this.selector=h;return this}else if(!k&&/^\w+$/.test(h)){this.selector=h;this.context=document;h=document.getElementsByTagName(h);return b.merge(this,h)}else return!k||k.jquery?(k||g).find(h):b(k).find(h);else if(b.isFunction(h))return g.ready(h);if(h.selector!==x){this.selector=h.selector;this.context=h.context}return b.makeArray(h,this)},selector:"",jquery:"1.4.3pre",length:0,size:function(){return this.length},toArray:function(){return j.call(this,0)},get:function(h){return h==
+null?this.toArray():h<0?this.slice(h)[0]:this[h]},pushStack:function(h,k,q){var r=b();b.isArray(h)?f.apply(r,h):b.merge(r,h);r.prevObject=this;r.context=this.context;if(k==="find")r.selector=this.selector+(this.selector?" ":"")+q;else if(k)r.selector=this.selector+"."+k+"("+q+")";return r},each:function(h,k){return b.each(this,h,k)},ready:function(h){b.bindReady();if(b.isReady)h.call(document,b);else s&&s.push(h);return this},eq:function(h){return h===-1?this.slice(h):this.slice(h,+h+1)},first:function(){return this.eq(0)},
+last:function(){return this.eq(-1)},slice:function(){return this.pushStack(j.apply(this,arguments),"slice",j.call(arguments).join(","))},map:function(h){return this.pushStack(b.map(this,function(k,q){return h.call(k,q,k)}))},end:function(){return this.prevObject||b(null)},push:f,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var h=arguments[0]||{},k=1,q=arguments.length,r=false,w,A,C,D;if(typeof h==="boolean"){r=h;h=arguments[1]||{};k=2}if(typeof h!=="object"&&
+!b.isFunction(h))h={};if(q===k){h=this;--k}for(;k<q;k++)if((w=arguments[k])!=null)for(A in w){C=h[A];D=w[A];if(h!==D)if(r&&D&&(b.isPlainObject(D)||b.isArray(D))){C=C&&(b.isPlainObject(C)||b.isArray(C))?C:b.isArray(D)?[]:{};h[A]=b.extend(r,C,D)}else if(D!==x)h[A]=D}return h};b.extend({noConflict:function(h){y.$=d;if(h)y.jQuery=c;return b},isReady:false,ready:function(){if(!b.isReady){if(!document.body)return setTimeout(b.ready,13);b.isReady=true;if(s){for(var h,k=0;h=s[k++];)h.call(document,b);s=null}b.fn.triggerHandler&&
+b(document).triggerHandler("ready")}},bindReady:function(){if(!v){v=true;if(document.readyState==="complete")return b.ready();if(document.addEventListener){document.addEventListener("DOMContentLoaded",z,false);y.addEventListener("load",b.ready,false)}else if(document.attachEvent){document.attachEvent("onreadystatechange",z);y.attachEvent("onload",b.ready);var h=false;try{h=y.frameElement==null}catch(k){}document.documentElement.doScroll&&h&&a()}}},isFunction:function(h){return B.call(h)==="[object Function]"},
+isArray:function(h){return B.call(h)==="[object Array]"},isPlainObject:function(h){if(!h||B.call(h)!=="[object Object]"||h.nodeType||h.setInterval)return false;if(h.constructor&&!E.call(h,"constructor")&&!E.call(h.constructor.prototype,"isPrototypeOf"))return false;var k;for(k in h);return k===x||E.call(h,k)},isEmptyObject:function(h){for(var k in h)return false;return true},error:function(h){throw h;},parseJSON:function(h){if(typeof h!=="string"||!h)return null;h=b.trim(h);if(/^[\],:{}\s]*$/.test(h.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
+"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return y.JSON&&y.JSON.parse?y.JSON.parse(h):(new Function("return "+h))();else b.error("Invalid JSON: "+h)},noop:function(){},globalEval:function(h){if(h&&m.test(h)){var k=document.getElementsByTagName("head")[0]||document.documentElement,q=document.createElement("script");q.type="text/javascript";if(b.support.scriptEval)q.appendChild(document.createTextNode(h));else q.text=h;k.insertBefore(q,
+k.firstChild);k.removeChild(q)}},nodeName:function(h,k){return h.nodeName&&h.nodeName.toUpperCase()===k.toUpperCase()},each:function(h,k,q){var r,w=0,A=h.length,C=A===x||b.isFunction(h);if(q)if(C)for(r in h){if(k.apply(h[r],q)===false)break}else for(;w<A;){if(k.apply(h[w++],q)===false)break}else if(C)for(r in h){if(k.call(h[r],r,h[r])===false)break}else for(q=h[0];w<A&&k.call(q,w,q)!==false;q=h[++w]);return h},trim:o?function(h){return h==null?"":o.call(h)}:function(h){return h==null?"":h.toString().replace(l,
+"").replace(n,"")},makeArray:function(h,k){k=k||[];if(h!=null)h.length==null||typeof h==="string"||b.isFunction(h)||typeof h!=="function"&&h.setInterval?f.call(k,h):b.merge(k,h);return k},inArray:function(h,k){if(k.indexOf)return k.indexOf(h);for(var q=0,r=k.length;q<r;q++)if(k[q]===h)return q;return-1},merge:function(h,k){var q=h.length,r=0;if(typeof k.length==="number")for(var w=k.length;r<w;r++)h[q++]=k[r];else for(;k[r]!==x;)h[q++]=k[r++];h.length=q;return h},grep:function(h,k,q){var r=[],w;q=
+!!q;for(var A=0,C=h.length;A<C;A++){w=!!k(h[A],A);q!==w&&r.push(h[A])}return r},map:function(h,k,q){for(var r=[],w,A=0,C=h.length;A<C;A++){w=k(h[A],A,q);if(w!=null)r[r.length]=w}return r.concat.apply([],r)},guid:1,proxy:function(h,k,q){if(arguments.length===2)if(typeof k==="string"){q=h;h=q[k];k=x}else if(k&&!b.isFunction(k)){q=k;k=x}if(!k&&h)k=function(){return h.apply(q||this,arguments)};if(h)k.guid=h.guid=h.guid||k.guid||b.guid++;return k},access:function(h,k,q,r,w,A){var C=h.length;if(typeof k===
+"object"){for(var D in k)b.access(h,D,k[D],r,w,q);return h}if(q!==x){r=!A&&r&&b.isFunction(q);for(D=0;D<C;D++)w(h[D],k,r?q.call(h[D],D,w(h[D],k)):q,A);return h}return C?w(h[0],k):x},now:function(){return(new Date).getTime()},uaMatch:function(h){h=h.toLowerCase();h=/(webkit)[ \/]([\w.]+)/.exec(h)||/(opera)(?:.*version)?[ \/]([\w.]+)/.exec(h)||/(msie) ([\w.]+)/.exec(h)||!/compatible/.test(h)&&/(mozilla)(?:.*? rv:([\w.]+))?/.exec(h)||[];return{browser:h[1]||"",version:h[2]||"0"}},browser:{}});u=b.uaMatch(u);
+if(u.browser){b.browser[u.browser]=true;b.browser.version=u.version}if(b.browser.webkit)b.browser.safari=true;if(p)b.inArray=function(h,k){return p.call(k,h)};if(!/\s/.test("\u00a0")){l=/^[\s\xA0]+/;n=/[\s\xA0]+$/}g=b(document);if(document.addEventListener)z=function(){document.removeEventListener("DOMContentLoaded",z,false);b.ready()};else if(document.attachEvent)z=function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",z);b.ready()}};y.jQuery=y.$=b})();(function(){jQuery.support=
+{};var a=document.documentElement,b=document.createElement("script"),c=document.createElement("div"),d="script"+jQuery.now();c.style.display="none";c.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var g=c.getElementsByTagName("*"),i=c.getElementsByTagName("a")[0];if(!(!g||!g.length||!i)){jQuery.support={leadingWhitespace:c.firstChild.nodeType===3,tbody:!c.getElementsByTagName("tbody").length,htmlSerialize:!!c.getElementsByTagName("link").length,
+style:/red/.test(i.getAttribute("style")),hrefNormalized:i.getAttribute("href")==="/a",opacity:/^0.55$/.test(i.style.opacity),cssFloat:!!i.style.cssFloat,checkOn:c.getElementsByTagName("input")[0].value==="on",optSelected:document.createElement("select").appendChild(document.createElement("option")).selected,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(document.createTextNode("window."+d+"=1;"))}catch(m){}a.insertBefore(b,a.firstChild);
+if(y[d]){jQuery.support.scriptEval=true;delete y[d]}a.removeChild(b);if(c.attachEvent&&c.fireEvent){c.attachEvent("onclick",function l(){jQuery.support.noCloneEvent=false;c.detachEvent("onclick",l)});c.cloneNode(true).fireEvent("onclick")}c=document.createElement("div");c.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=document.createDocumentFragment();a.appendChild(c.firstChild);jQuery.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;jQuery(function(){var l=
+document.createElement("div");l.style.width=l.style.paddingLeft="1px";document.body.appendChild(l);jQuery.boxModel=jQuery.support.boxModel=l.offsetWidth===2;document.body.removeChild(l).style.display="none"});a=function(l){var n=document.createElement("div");l="on"+l;var t=l in n;if(!t){n.setAttribute(l,"return;");t=typeof n[l]==="function"}return t};jQuery.support.submitBubbles=a("submit");jQuery.support.changeBubbles=a("change");a=b=c=g=i=null}})();jQuery.props={"for":"htmlFor","class":"className",
+readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var M="jQuery"+jQuery.now(),Ia=0,la={};jQuery.extend({cache:{},expando:M,noData:{embed:true,object:true,applet:true},data:function(a,b,c){if(!(a.nodeName&&jQuery.noData[a.nodeName.toLowerCase()])){a=a==y?la:a;var d=a[jQuery.expando],g=jQuery.cache;if(!(!d&&typeof b==="string"&&c===x)){if(a.nodeType)d||(a[jQuery.expando]=d=++Ia);else{g=
+a;d=jQuery.expando}if(typeof b==="object")g[d]=jQuery.extend(true,{},b);else g[d]||(g[d]={});a=g[d];if(c!==x)a[b]=c;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(!(a.nodeName&&jQuery.noData[a.nodeName.toLowerCase()])){a=a==y?la:a;var c=a[jQuery.expando],d=jQuery.cache,g=a.nodeType,i=g?d[c]:c;if(b){if(i){delete i[b];jQuery.isEmptyObject(i)&&jQuery.removeData(a)}}else{if(jQuery.support.deleteExpando||!g)delete a[jQuery.expando];else a.removeAttribute&&a.removeAttribute(jQuery.expando);
+g&&delete d[c]}}}});jQuery.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return jQuery.data(this[0]);else if(typeof a==="object")return this.each(function(){jQuery.data(this,a)});var c=a.split(".");c[1]=c[1]?"."+c[1]:"";if(b===x){var d=this.triggerHandler("getData"+c[1]+"!",[c[0]]);if(d===x&&this.length)d=jQuery.data(this[0],a);return d===x&&c[1]?this.data(c[0]):d}else return this.trigger("setData"+c[1]+"!",[c[0],b]).each(function(){jQuery.data(this,a,b)})},removeData:function(a){return this.each(function(){jQuery.removeData(this,
+a)})}});jQuery.extend({queue:function(a,b,c){if(a){b=(b||"fx")+"queue";var d=jQuery.data(a,b);if(!c)return d||[];if(!d||jQuery.isArray(c))d=jQuery.data(a,b,jQuery.makeArray(c));else d.push(c);return d}},dequeue:function(a,b){b=b||"fx";var c=jQuery.queue(a,b),d=c.shift();if(d==="inprogress")d=c.shift();if(d){b==="fx"&&c.unshift("inprogress");d.call(a,function(){jQuery.dequeue(a,b)})}}});jQuery.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===x)return jQuery.queue(this[0],a);
+return this.each(function(){var c=jQuery.queue(this,a,b);a==="fx"&&c[0]!=="inprogress"&&jQuery.dequeue(this,a)})},dequeue:function(a){return this.each(function(){jQuery.dequeue(this,a)})},delay:function(a,b){a=jQuery.fx?jQuery.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){jQuery.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var ma=/[\n\t]/g,U=/\s+/,Ja=/\r/g,Ka=/href|src|style/,La=/(button|input)/i,Ma=/(button|input|object|select|textarea)/i,
+Na=/^(a|area)$/i,na=/radio|checkbox/;jQuery.fn.extend({attr:function(a,b){return jQuery.access(this,a,b,true,jQuery.attr)},removeAttr:function(a){return this.each(function(){jQuery.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(jQuery.isFunction(a))return this.each(function(t){var u=jQuery(this);u.addClass(a.call(this,t,u.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(U),c=0,d=this.length;c<d;c++){var g=this[c];if(g.nodeType===1)if(g.className){for(var i=
+" "+g.className+" ",m=g.className,l=0,n=b.length;l<n;l++)if(i.indexOf(" "+b[l]+" ")<0)m+=" "+b[l];g.className=jQuery.trim(m)}else g.className=a}return this},removeClass:function(a){if(jQuery.isFunction(a))return this.each(function(n){var t=jQuery(this);t.removeClass(a.call(this,n,t.attr("class")))});if(a&&typeof a==="string"||a===x)for(var b=(a||"").split(U),c=0,d=this.length;c<d;c++){var g=this[c];if(g.nodeType===1&&g.className)if(a){for(var i=(" "+g.className+" ").replace(ma," "),m=0,l=b.length;m<
+l;m++)i=i.replace(" "+b[m]+" "," ");g.className=jQuery.trim(i)}else g.className=""}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b==="boolean";if(jQuery.isFunction(a))return this.each(function(g){var i=jQuery(this);i.toggleClass(a.call(this,g,i.attr("class"),b),b)});return this.each(function(){if(c==="string")for(var g,i=0,m=jQuery(this),l=b,n=a.split(U);g=n[i++];){l=d?l:!m.hasClass(g);m[l?"addClass":"removeClass"](g)}else if(c==="undefined"||c==="boolean"){this.className&&jQuery.data(this,
+"__className__",this.className);this.className=this.className||a===false?"":jQuery.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,c=this.length;b<c;b++)if((" "+this[b].className+" ").replace(ma," ").indexOf(a)>-1)return true;return false},val:function(a){if(a===x){var b=this[0];if(b){if(jQuery.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(jQuery.nodeName(b,"select")){var c=b.selectedIndex,d=[],g=b.options;b=b.type==="select-one";if(c<
+0)return null;var i=b?c:0;for(c=b?c+1:g.length;i<c;i++){var m=g[i];if(m.selected){a=jQuery(m).val();if(b)return a;d.push(a)}}return d}if(na.test(b.type)&&!jQuery.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Ja,"")}return x}var l=jQuery.isFunction(a);return this.each(function(n){var t=jQuery(this),u=a;if(this.nodeType===1){if(l)u=a.call(this,n,t.val());if(typeof u==="number")u+="";if(jQuery.isArray(u)&&na.test(this.type))this.checked=jQuery.inArray(t.val(),
+u)>=0;else if(jQuery.nodeName(this,"select")){var v=jQuery.makeArray(u);jQuery("option",this).each(function(){this.selected=jQuery.inArray(jQuery(this).val(),v)>=0});if(!v.length)this.selectedIndex=-1}else this.value=u}})}});jQuery.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,c,d){if(!a||a.nodeType===3||a.nodeType===8)return x;if(d&&b in jQuery.attrFn)return jQuery(a)[b](c);d=a.nodeType!==1||!jQuery.isXMLDoc(a);var g=c!==x;b=
+d&&jQuery.props[b]||b;if(a.nodeType===1){var i=Ka.test(b);if(b in a&&d&&!i){if(g){b==="type"&&La.test(a.nodeName)&&a.parentNode&&jQuery.error("type property can't be changed");a[b]=c}if(jQuery.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:Ma.test(a.nodeName)||Na.test(a.nodeName)&&a.href?0:x;return a[b]}if(!jQuery.support.style&&d&&b==="style"){if(g)a.style.cssText=""+c;return a.style.cssText}g&&
+a.setAttribute(b,""+c);a=!jQuery.support.hrefNormalized&&d&&i?a.getAttribute(b,2):a.getAttribute(b);return a===null?x:a}return jQuery.style(a,b,c)}});var R=/\.(.*)$/,Oa=function(a){return a.replace(/[^\w\s\.\|`]/g,function(b){return"\\"+b})};jQuery.event={add:function(a,b,c,d){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==y&&!a.frameElement)a=y;if(c===false)c=K;var g,i;if(c.handler){g=c;c=g.handler}if(!c.guid)c.guid=jQuery.guid++;if(i=jQuery.data(a)){var m=i.events=i.events||{},l=i.handle;
+if(!l)i.handle=l=function(){return typeof jQuery!=="undefined"&&!jQuery.event.triggered?jQuery.event.handle.apply(l.elem,arguments):x};l.elem=a;b=b.split(" ");for(var n,t=0,u;n=b[t++];){i=g?jQuery.extend({},g):{handler:c,data:d};if(n.indexOf(".")>-1){u=n.split(".");n=u.shift();i.namespace=u.slice(0).sort().join(".")}else{u=[];i.namespace=""}i.type=n;if(!i.guid)i.guid=c.guid;var v=m[n],s=jQuery.event.special[n]||{};if(!v){v=m[n]=[];if(!s.setup||s.setup.call(a,d,u,l)===false)if(a.addEventListener)a.addEventListener(n,
+l,false);else a.attachEvent&&a.attachEvent("on"+n,l)}if(s.add){s.add.call(a,i);if(!i.handler.guid)i.handler.guid=c.guid}v.push(i);jQuery.event.global[n]=true}a=null}}},global:{},remove:function(a,b,c,d){if(!(a.nodeType===3||a.nodeType===8)){if(c===false)c=K;var g,i,m=0,l,n,t,u,v,s,z=jQuery.data(a),B=z&&z.events;if(z&&B){if(b&&b.type){c=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(g in B)jQuery.event.remove(a,g+b)}else{for(b=b.split(" ");g=b[m++];){u=g;l=g.indexOf(".")<
+0;n=[];if(!l){n=g.split(".");g=n.shift();t=new RegExp("(^|\\.)"+jQuery.map(n.slice(0).sort(),Oa).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(v=B[g])if(c){u=jQuery.event.special[g]||{};for(i=d||0;i<v.length;i++){s=v[i];if(c.guid===s.guid){if(l||t.test(s.namespace)){d==null&&v.splice(i--,1);u.remove&&u.remove.call(a,s)}if(d!=null)break}}if(v.length===0||d!=null&&v.length===1){if(!u.teardown||u.teardown.call(a,n)===false)oa(a,g,z.handle);delete B[g]}}else for(i=0;i<v.length;i++){s=v[i];if(l||t.test(s.namespace)){jQuery.event.remove(a,
+u,s.handler,i);v.splice(i--,1)}}}if(jQuery.isEmptyObject(B)){if(b=z.handle)b.elem=null;delete z.events;delete z.handle;jQuery.isEmptyObject(z)&&jQuery.removeData(a)}}}}},trigger:function(a,b,c,d){var g=a.type||a;if(!d){a=typeof a==="object"?a[M]?a:jQuery.extend(jQuery.Event(g),a):jQuery.Event(g);if(g.indexOf("!")>=0){a.type=g=g.slice(0,-1);a.exclusive=true}if(!c){a.stopPropagation();jQuery.event.global[g]&&jQuery.each(jQuery.cache,function(){this.events&&this.events[g]&&jQuery.event.trigger(a,b,this.handle.elem)})}if(!c||
+c.nodeType===3||c.nodeType===8)return x;a.result=x;a.target=c;b=jQuery.makeArray(b);b.unshift(a)}a.currentTarget=c;(d=jQuery.data(c,"handle"))&&d.apply(c,b);d=c.parentNode||c.ownerDocument;try{if(!(c&&c.nodeName&&jQuery.noData[c.nodeName.toLowerCase()]))if(c["on"+g]&&c["on"+g].apply(c,b)===false)a.result=false}catch(i){}if(!a.isPropagationStopped()&&d)jQuery.event.trigger(a,b,d,true);else if(!a.isDefaultPrevented()){d=a.target;var m,l=g.replace(/\..*$/,""),n=jQuery.nodeName(d,"a")&&l==="click",t=
+jQuery.event.special[l]||{};if((!t._default||t._default.call(c,a)===false)&&!n&&!(d&&d.nodeName&&jQuery.noData[d.nodeName.toLowerCase()])){try{if(d[l]){if(m=d["on"+l])d["on"+l]=null;jQuery.event.triggered=true;d[l]()}}catch(u){}if(m)d["on"+l]=m;jQuery.event.triggered=false}}},handle:function(a){var b,c,d;c=[];var g,i=jQuery.makeArray(arguments);a=i[0]=jQuery.event.fix(a||y.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){d=a.type.split(".");a.type=d.shift();c=d.slice(0).sort();
+d=new RegExp("(^|\\.)"+c.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||c.join(".");g=jQuery.data(this,"events");c=(g||{})[a.type];if(g&&c){c=c.slice(0);g=0;for(var m=c.length;g<m;g++){var l=c[g];if(b||d.test(l.namespace)){a.handler=l.handler;a.data=l.data;a.handleObj=l;l=l.handler.apply(this,i);if(l!==x){a.result=l;if(l===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
+fix:function(a){if(a[M])return a;var b=a;a=jQuery.Event(b);for(var c=this.props.length,d;c;){d=this.props[--c];a[d]=b[d]}if(!a.target)a.target=a.srcElement||document;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=document.documentElement;c=document.body;a.pageX=a.clientX+(b&&b.scrollLeft||c&&c.scrollLeft||0)-(b&&b.clientLeft||c&&c.clientLeft||0);a.pageY=
+a.clientY+(b&&b.scrollTop||c&&c.scrollTop||0)-(b&&b.clientTop||c&&c.clientTop||0)}if(!a.which&&(a.charCode||a.charCode===0?a.charCode:a.keyCode))a.which=a.charCode||a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==x)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:jQuery.proxy,special:{ready:{setup:jQuery.bindReady,teardown:jQuery.noop},live:{add:function(a){jQuery.event.add(this,L(a.origType,a.selector),jQuery.extend({},a,{handler:Ca,guid:a.handler.guid}))},
+remove:function(a){jQuery.event.remove(this,L(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){if(this.setInterval)this.onbeforeunload=c},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};var oa=document.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,false)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)};jQuery.Event=function(a){if(!this.preventDefault)return new jQuery.Event(a);if(a&&a.type){this.originalEvent=
+a;this.type=a.type}else this.type=a;this.timeStamp=jQuery.now();this[M]=true};jQuery.Event.prototype={preventDefault:function(){this.isDefaultPrevented=Q;var a=this.originalEvent;if(a){a.preventDefault&&a.preventDefault();a.returnValue=false}},stopPropagation:function(){this.isPropagationStopped=Q;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=Q;this.stopPropagation()},isDefaultPrevented:K,
+isPropagationStopped:K,isImmediatePropagationStopped:K};var pa=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;jQuery.event.handle.apply(this,arguments)}}catch(c){}},qa=function(a){a.type=a.data;jQuery.event.handle.apply(this,arguments)};jQuery.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){jQuery.event.special[a]={setup:function(c){jQuery.event.add(this,b,c&&c.selector?qa:pa,a)},teardown:function(c){jQuery.event.remove(this,b,c&&
+c.selector?qa:pa)}}});if(!jQuery.support.submitBubbles)jQuery.event.special.submit={setup:function(){if(this.nodeName.toLowerCase()!=="form"){jQuery.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=b.type;if((c==="submit"||c==="image")&&jQuery(b).closest("form").length)return ca("submit",this,arguments)});jQuery.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=b.type;if((c==="text"||c==="password")&&jQuery(b).closest("form").length&&a.keyCode===13)return ca("submit",
+this,arguments)})}else return false},teardown:function(){jQuery.event.remove(this,".specialSubmit")}};if(!jQuery.support.changeBubbles){var V=/textarea|input|select/i,W,ra=function(a){var b=a.type,c=a.value;if(b==="radio"||b==="checkbox")c=a.checked;else if(b==="select-multiple")c=a.selectedIndex>-1?jQuery.map(a.options,function(d){return d.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")c=a.selectedIndex;return c},X=function(a,b){var c=a.target,d,g;if(!(!V.test(c.nodeName)||c.readOnly)){d=
+jQuery.data(c,"_change_data");g=ra(c);if(a.type!=="focusout"||c.type!=="radio")jQuery.data(c,"_change_data",g);if(!(d===x||g===d))if(d!=null||g){a.type="change";return jQuery.event.trigger(a,b,c)}}};jQuery.event.special.change={filters:{focusout:X,click:function(a){var b=a.target,c=b.type;if(c==="radio"||c==="checkbox"||b.nodeName.toLowerCase()==="select")return X.call(this,a)},keydown:function(a){var b=a.target,c=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(c===
+"checkbox"||c==="radio")||c==="select-multiple")return X.call(this,a)},beforeactivate:function(a){a=a.target;jQuery.data(a,"_change_data",ra(a))}},setup:function(){if(this.type==="file")return false;for(var a in W)jQuery.event.add(this,a+".specialChange",W[a]);return V.test(this.nodeName)},teardown:function(){jQuery.event.remove(this,".specialChange");return V.test(this.nodeName)}};W=jQuery.event.special.change.filters}document.addEventListener&&jQuery.each({focus:"focusin",blur:"focusout"},function(a,
+b){function c(d){d=jQuery.event.fix(d);d.type=b;return jQuery.event.handle.call(this,d)}jQuery.event.special[b]={setup:function(){this.addEventListener(a,c,true)},teardown:function(){this.removeEventListener(a,c,true)}}});jQuery.each(["bind","one"],function(a,b){jQuery.fn[b]=function(c,d,g){if(typeof c==="object"){for(var i in c)this[b](i,d,c[i],g);return this}if(jQuery.isFunction(d)||d===false){g=d;d=x}var m=b==="one"?jQuery.proxy(g,function(n){jQuery(this).unbind(n,m);return g.apply(this,arguments)}):
+g;if(c==="unload"&&b!=="one")this.one(c,d,g);else{i=0;for(var l=this.length;i<l;i++)jQuery.event.add(this[i],c,m,d)}return this}});jQuery.fn.extend({unbind:function(a,b){if(typeof a==="object"&&!a.preventDefault)for(var c in a)this.unbind(c,a[c]);else{c=0;for(var d=this.length;c<d;c++)jQuery.event.remove(this[c],a,b)}return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,
+b){return this.each(function(){jQuery.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){a=jQuery.Event(a);a.preventDefault();a.stopPropagation();jQuery.event.trigger(a,b,this[0]);return a.result}},toggle:function(a){for(var b=arguments,c=1;c<b.length;)jQuery.proxy(a,b[c++]);return this.click(jQuery.proxy(a,function(d){var g=(jQuery.data(this,"lastToggle"+a.guid)||0)%c;jQuery.data(this,"lastToggle"+a.guid,g+1);d.preventDefault();return b[g].apply(this,arguments)||false}))},hover:function(a,
+b){return this.mouseenter(a).mouseleave(b||a)}});var sa={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};jQuery.each(["live","die"],function(a,b){jQuery.fn[b]=function(c,d,g,i){var m=0,l,n,t=i||this.selector,u=i?this:jQuery(this.context);if(jQuery.isFunction(d)){g=d;d=x}for(c=(c||"").split(" ");(i=c[m++])!=null;){l=R.exec(i);n="";if(l){n=l[0];i=i.replace(R,"")}if(i==="hover")c.push("mouseenter"+n,"mouseleave"+n);else{l=i;if(i==="focus"||i==="blur"){c.push(sa[i]+n);i+=
+n}else i=(sa[i]||i)+n;if(b==="live"){n=0;for(var v=u.length;n<v;n++)jQuery.event.add(u[n],"live."+L(i,t),{data:d,selector:t,handler:g,origType:i,origHandler:g,preType:l})}else u.unbind("live."+L(i,t),g)}}return this}});jQuery.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){jQuery.fn[b]=function(c,d){if(d==null){d=c;c=null}return arguments.length>
+0?this.bind(b,c,d):this.trigger(b)};if(jQuery.attrFn)jQuery.attrFn[b]=true});y.attachEvent&&!y.addEventListener&&y.attachEvent("onunload",function(){for(var a in jQuery.cache)if(jQuery.cache[a].handle)try{jQuery.event.remove(jQuery.cache[a].handle.elem)}catch(b){}});(function(){function a(f,j,o,p,h,k){h=0;for(var q=p.length;h<q;h++){var r=p[h];if(r){r=r[f];for(var w=false;r;){if(r.sizcache===o){w=p[r.sizset];break}if(r.nodeType===1&&!k){r.sizcache=o;r.sizset=h}if(r.nodeName.toLowerCase()===j){w=r;
+break}r=r[f]}p[h]=w}}}function b(f,j,o,p,h,k){h=0;for(var q=p.length;h<q;h++){var r=p[h];if(r){r=r[f];for(var w=false;r;){if(r.sizcache===o){w=p[r.sizset];break}if(r.nodeType===1){if(!k){r.sizcache=o;r.sizset=h}if(typeof j!=="string"){if(r===j){w=true;break}}else if(l.filter(j,[r]).length>0){w=r;break}}r=r[f]}p[h]=w}}}var c=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,g=Object.prototype.toString,i=false,m=
+true;[0,0].sort(function(){m=false;return 0});var l=function(f,j,o,p){o=o||[];var h=j=j||document;if(j.nodeType!==1&&j.nodeType!==9)return[];if(!f||typeof f!=="string")return o;var k=[],q,r,w,A,C=true,D=l.isXML(j),H=f,F;do{c.exec("");if(q=c.exec(H)){H=q[3];k.push(q[1]);if(q[2]){A=q[3];break}}}while(q);if(k.length>1&&t.exec(f))if(k.length===2&&n.relative[k[0]])r=E(k[0]+k[1],j);else for(r=n.relative[k[0]]?[j]:l(k.shift(),j);k.length;){f=k.shift();if(n.relative[f])f+=k.shift();r=E(f,r)}else{if(!p&&k.length>
+1&&j.nodeType===9&&!D&&n.match.ID.test(k[0])&&!n.match.ID.test(k[k.length-1])){q=l.find(k.shift(),j,D);j=q.expr?l.filter(q.expr,q.set)[0]:q.set[0]}if(j){q=p?{expr:k.pop(),set:s(p)}:l.find(k.pop(),k.length===1&&(k[0]==="~"||k[0]==="+")&&j.parentNode?j.parentNode:j,D);r=q.expr?l.filter(q.expr,q.set):q.set;if(k.length>0)w=s(r);else C=false;for(;k.length;){q=F=k.pop();if(n.relative[F])q=k.pop();else F="";if(q==null)q=j;n.relative[F](w,q,D)}}else w=[]}w||(w=r);w||l.error(F||f);if(g.call(w)==="[object Array]")if(C)if(j&&
+j.nodeType===1)for(f=0;w[f]!=null;f++){if(w[f]&&(w[f]===true||w[f].nodeType===1&&l.contains(j,w[f])))o.push(r[f])}else for(f=0;w[f]!=null;f++)w[f]&&w[f].nodeType===1&&o.push(r[f]);else o.push.apply(o,w);else s(w,o);if(A){l(A,h,o,p);l.uniqueSort(o)}return o};l.uniqueSort=function(f){if(B){i=m;f.sort(B);if(i)for(var j=1;j<f.length;j++)f[j]===f[j-1]&&f.splice(j--,1)}return f};l.matches=function(f,j){return l(f,null,null,j)};l.find=function(f,j,o){var p;if(!f)return[];for(var h=0,k=n.order.length;h<k;h++){var q=
+n.order[h],r;if(r=n.leftMatch[q].exec(f)){var w=r[1];r.splice(1,1);if(w.substr(w.length-1)!=="\\"){r[1]=(r[1]||"").replace(/\\/g,"");p=n.find[q](r,j,o);if(p!=null){f=f.replace(n.match[q],"");break}}}}p||(p=j.getElementsByTagName("*"));return{set:p,expr:f}};l.filter=function(f,j,o,p){for(var h=f,k=[],q=j,r,w,A=j&&j[0]&&l.isXML(j[0]);f&&j.length;){for(var C in n.filter)if((r=n.leftMatch[C].exec(f))!=null&&r[2]){var D=n.filter[C],H,F;F=r[1];w=false;r.splice(1,1);if(F.substr(F.length-1)!=="\\"){if(q===
+k)k=[];if(n.preFilter[C])if(r=n.preFilter[C](r,q,o,k,p,A)){if(r===true)continue}else w=H=true;if(r)for(var N=0;(F=q[N])!=null;N++)if(F){H=D(F,r,N,q);var ta=p^!!H;if(o&&H!=null)if(ta)w=true;else q[N]=false;else if(ta){k.push(F);w=true}}if(H!==x){o||(q=k);f=f.replace(n.match[C],"");if(!w)return[];break}}}if(f===h)if(w==null)l.error(f);else break;h=f}return q};l.error=function(f){throw"Syntax error, unrecognized expression: "+f;};var n=l.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
+CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(f){return f.getAttribute("href")}},
+relative:{"+":function(f,j){var o=typeof j==="string",p=o&&!/\W/.test(j);o=o&&!p;if(p)j=j.toLowerCase();p=0;for(var h=f.length,k;p<h;p++)if(k=f[p]){for(;(k=k.previousSibling)&&k.nodeType!==1;);f[p]=o||k&&k.nodeName.toLowerCase()===j?k||false:k===j}o&&l.filter(j,f,true)},">":function(f,j){var o=typeof j==="string",p,h=0,k=f.length;if(o&&!/\W/.test(j))for(j=j.toLowerCase();h<k;h++){if(p=f[h]){o=p.parentNode;f[h]=o.nodeName.toLowerCase()===j?o:false}}else{for(;h<k;h++)if(p=f[h])f[h]=o?p.parentNode:p.parentNode===
+j;o&&l.filter(j,f,true)}},"":function(f,j,o){var p=d++,h=b,k;if(typeof j==="string"&&!/\W/.test(j)){k=j=j.toLowerCase();h=a}h("parentNode",j,p,f,k,o)},"~":function(f,j,o){var p=d++,h=b,k;if(typeof j==="string"&&!/\W/.test(j)){k=j=j.toLowerCase();h=a}h("previousSibling",j,p,f,k,o)}},find:{ID:function(f,j,o){if(typeof j.getElementById!=="undefined"&&!o)return(f=j.getElementById(f[1]))?[f]:[]},NAME:function(f,j){if(typeof j.getElementsByName!=="undefined"){var o=[];j=j.getElementsByName(f[1]);for(var p=
+0,h=j.length;p<h;p++)j[p].getAttribute("name")===f[1]&&o.push(j[p]);return o.length===0?null:o}},TAG:function(f,j){return j.getElementsByTagName(f[1])}},preFilter:{CLASS:function(f,j,o,p,h,k){f=" "+f[1].replace(/\\/g,"")+" ";if(k)return f;k=0;for(var q;(q=j[k])!=null;k++)if(q)if(h^(q.className&&(" "+q.className+" ").replace(/[\t\n]/g," ").indexOf(f)>=0))o||p.push(q);else if(o)j[k]=false;return false},ID:function(f){return f[1].replace(/\\/g,"")},TAG:function(f){return f[1].toLowerCase()},CHILD:function(f){if(f[1]===
+"nth"){var j=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(f[2]==="even"&&"2n"||f[2]==="odd"&&"2n+1"||!/\D/.test(f[2])&&"0n+"+f[2]||f[2]);f[2]=j[1]+(j[2]||1)-0;f[3]=j[3]-0}f[0]=d++;return f},ATTR:function(f,j,o,p,h,k){j=f[1].replace(/\\/g,"");if(!k&&n.attrMap[j])f[1]=n.attrMap[j];if(f[2]==="~=")f[4]=" "+f[4]+" ";return f},PSEUDO:function(f,j,o,p,h){if(f[1]==="not")if((c.exec(f[3])||"").length>1||/^\w/.test(f[3]))f[3]=l(f[3],null,null,j);else{f=l.filter(f[3],j,o,true^h);o||p.push.apply(p,f);return false}else if(n.match.POS.test(f[0])||
+n.match.CHILD.test(f[0]))return true;return f},POS:function(f){f.unshift(true);return f}},filters:{enabled:function(f){return f.disabled===false&&f.type!=="hidden"},disabled:function(f){return f.disabled===true},checked:function(f){return f.checked===true},selected:function(f){return f.selected===true},parent:function(f){return!!f.firstChild},empty:function(f){return!f.firstChild},has:function(f,j,o){return!!l(o[3],f).length},header:function(f){return/h\d/i.test(f.nodeName)},text:function(f){return"text"===
+f.type},radio:function(f){return"radio"===f.type},checkbox:function(f){return"checkbox"===f.type},file:function(f){return"file"===f.type},password:function(f){return"password"===f.type},submit:function(f){return"submit"===f.type},image:function(f){return"image"===f.type},reset:function(f){return"reset"===f.type},button:function(f){return"button"===f.type||f.nodeName.toLowerCase()==="button"},input:function(f){return/input|select|textarea|button/i.test(f.nodeName)}},setFilters:{first:function(f,j){return j===
+0},last:function(f,j,o,p){return j===p.length-1},even:function(f,j){return j%2===0},odd:function(f,j){return j%2===1},lt:function(f,j,o){return j<o[3]-0},gt:function(f,j,o){return j>o[3]-0},nth:function(f,j,o){return o[3]-0===j},eq:function(f,j,o){return o[3]-0===j}},filter:{PSEUDO:function(f,j,o,p){var h=j[1],k=n.filters[h];if(k)return k(f,o,j,p);else if(h==="contains")return(f.textContent||f.innerText||l.getText([f])||"").indexOf(j[3])>=0;else if(h==="not"){j=j[3];o=0;for(p=j.length;o<p;o++)if(j[o]===
+f)return false;return true}else l.error("Syntax error, unrecognized expression: "+h)},CHILD:function(f,j){var o=j[1],p=f;switch(o){case "only":case "first":for(;p=p.previousSibling;)if(p.nodeType===1)return false;if(o==="first")return true;p=f;case "last":for(;p=p.nextSibling;)if(p.nodeType===1)return false;return true;case "nth":o=j[2];var h=j[3];if(o===1&&h===0)return true;j=j[0];var k=f.parentNode;if(k&&(k.sizcache!==j||!f.nodeIndex)){var q=0;for(p=k.firstChild;p;p=p.nextSibling)if(p.nodeType===
+1)p.nodeIndex=++q;k.sizcache=j}f=f.nodeIndex-h;return o===0?f===0:f%o===0&&f/o>=0}},ID:function(f,j){return f.nodeType===1&&f.getAttribute("id")===j},TAG:function(f,j){return j==="*"&&f.nodeType===1||f.nodeName.toLowerCase()===j},CLASS:function(f,j){return(" "+(f.className||f.getAttribute("class"))+" ").indexOf(j)>-1},ATTR:function(f,j){var o=j[1];f=n.attrHandle[o]?n.attrHandle[o](f):f[o]!=null?f[o]:f.getAttribute(o);o=f+"";var p=j[2];j=j[4];return f==null?p==="!=":p==="="?o===j:p==="*="?o.indexOf(j)>=
+0:p==="~="?(" "+o+" ").indexOf(j)>=0:!j?o&&f!==false:p==="!="?o!==j:p==="^="?o.indexOf(j)===0:p==="$="?o.substr(o.length-j.length)===j:p==="|="?o===j||o.substr(0,j.length+1)===j+"-":false},POS:function(f,j,o,p){var h=n.setFilters[j[2]];if(h)return h(f,o,j,p)}}},t=n.match.POS,u=function(f,j){return"\\"+(j-0+1)};for(var v in n.match){n.match[v]=new RegExp(n.match[v].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[v]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[v].source.replace(/\\(\d+)/g,u))}var s=
+function(f,j){f=Array.prototype.slice.call(f,0);if(j){j.push.apply(j,f);return j}return f};try{Array.prototype.slice.call(document.documentElement.childNodes,0)}catch(z){s=function(f,j){j=j||[];var o=0;if(g.call(f)==="[object Array]")Array.prototype.push.apply(j,f);else if(typeof f.length==="number")for(var p=f.length;o<p;o++)j.push(f[o]);else for(;f[o];o++)j.push(f[o]);return j}}var B;if(document.documentElement.compareDocumentPosition)B=function(f,j){if(!f.compareDocumentPosition||!j.compareDocumentPosition){if(f==
+j)i=true;return f.compareDocumentPosition?-1:1}f=f.compareDocumentPosition(j)&4?-1:f===j?0:1;if(f===0)i=true;return f};else if("sourceIndex"in document.documentElement)B=function(f,j){if(!f.sourceIndex||!j.sourceIndex){if(f==j)i=true;return f.sourceIndex?-1:1}f=f.sourceIndex-j.sourceIndex;if(f===0)i=true;return f};else if(document.createRange)B=function(f,j){if(!f.ownerDocument||!j.ownerDocument){if(f==j)i=true;return f.ownerDocument?-1:1}var o=f.ownerDocument.createRange(),p=j.ownerDocument.createRange();
+o.setStart(f,0);o.setEnd(f,0);p.setStart(j,0);p.setEnd(j,0);f=o.compareBoundaryPoints(Range.START_TO_END,p);if(f===0)i=true;return f};l.getText=function(f){for(var j="",o,p=0;f[p];p++){o=f[p];if(o.nodeType===3||o.nodeType===4)j+=o.nodeValue;else if(o.nodeType!==8)j+=l.getText(o.childNodes)}return j};(function(){var f=document.createElement("div"),j="script"+(new Date).getTime();f.innerHTML="<a name='"+j+"'/>";var o=document.documentElement;o.insertBefore(f,o.firstChild);if(document.getElementById(j)){n.find.ID=
+function(p,h,k){if(typeof h.getElementById!=="undefined"&&!k)return(h=h.getElementById(p[1]))?h.id===p[1]||typeof h.getAttributeNode!=="undefined"&&h.getAttributeNode("id").nodeValue===p[1]?[h]:x:[]};n.filter.ID=function(p,h){var k=typeof p.getAttributeNode!=="undefined"&&p.getAttributeNode("id");return p.nodeType===1&&k&&k.nodeValue===h}}o.removeChild(f);o=f=null})();(function(){var f=document.createElement("div");f.appendChild(document.createComment(""));if(f.getElementsByTagName("*").length>0)n.find.TAG=
+function(j,o){o=o.getElementsByTagName(j[1]);if(j[1]==="*"){j=[];for(var p=0;o[p];p++)o[p].nodeType===1&&j.push(o[p]);o=j}return o};f.innerHTML="<a href='#'></a>";if(f.firstChild&&typeof f.firstChild.getAttribute!=="undefined"&&f.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(j){return j.getAttribute("href",2)};f=null})();document.querySelectorAll&&function(){var f=l,j=document.createElement("div");j.innerHTML="<p class='TEST'></p>";if(!(j.querySelectorAll&&j.querySelectorAll(".TEST").length===
+0)){l=function(p,h,k,q){h=h||document;if(!q&&h.nodeType===9&&!l.isXML(h))try{return s(h.querySelectorAll(p),k)}catch(r){}return f(p,h,k,q)};for(var o in f)l[o]=f[o];j=null}}();(function(){var f=document.createElement("div");f.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!f.getElementsByClassName||f.getElementsByClassName("e").length===0)){f.lastChild.className="e";if(f.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(j,o,p){if(typeof o.getElementsByClassName!==
+"undefined"&&!p)return o.getElementsByClassName(j[1])};f=null}}})();l.contains=document.compareDocumentPosition?function(f,j){return!!(f.compareDocumentPosition(j)&16)}:function(f,j){return f!==j&&(f.contains?f.contains(j):true)};l.isXML=function(f){return(f=(f?f.ownerDocument||f:0).documentElement)?f.nodeName!=="HTML":false};var E=function(f,j){var o=[],p="",h;for(j=j.nodeType?[j]:j;h=n.match.PSEUDO.exec(f);){p+=h[0];f=f.replace(n.match.PSEUDO,"")}f=n.relative[f]?f+"*":f;h=0;for(var k=j.length;h<
+k;h++)l(f,j[h],o);return l.filter(p,o)};jQuery.find=l;jQuery.expr=l.selectors;jQuery.expr[":"]=jQuery.expr.filters;jQuery.unique=l.uniqueSort;jQuery.text=l.getText;jQuery.isXMLDoc=l.isXML;jQuery.contains=l.contains})();var Pa=/Until$/,Qa=/^(?:parents|prevUntil|prevAll)/,Ra=/,/,Da=/^.[^:#\[\.,]*$/,Sa=Array.prototype.slice;jQuery.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),c=0,d=0,g=this.length;d<g;d++){c=b.length;jQuery.find(a,this[d],b);if(d>0)for(var i=c;i<b.length;i++)for(var m=
+0;m<c;m++)if(b[m]===b[i]){b.splice(i--,1);break}}return b},has:function(a){var b=jQuery(a);return this.filter(function(){for(var c=0,d=b.length;c<d;c++)if(jQuery.contains(this,b[c]))return true})},not:function(a){return this.pushStack(ea(this,a,false),"not",a)},filter:function(a){return this.pushStack(ea(this,a,true),"filter",a)},is:function(a){return!!a&&jQuery.filter(a,this).length>0},closest:function(a,b){if(jQuery.isArray(a)){var c=[],d=this[0],g,i={},m,l=1;if(d&&a.length){g=0;for(var n=a.length;g<
+n;g++){m=a[g];i[m]||(i[m]=jQuery.expr.match.POS.test(m)?jQuery(m,b||this.context):m)}for(;d&&d.ownerDocument&&d!==b;){for(m in i){g=i[m];if(g.jquery?g.index(d)>-1:jQuery(d).is(g))c.push({selector:m,elem:d,level:l})}d=d.parentNode;l++}}return c}var t=jQuery.expr.match.POS.test(a)?jQuery(a,b||this.context):null;return this.map(function(u,v){for(;v&&v.ownerDocument&&v!==b;){if(t?t.index(v)>-1:jQuery(v).is(a))return v;v=v.parentNode}return null})},index:function(a){if(!a||typeof a==="string")return jQuery.inArray(this[0],
+a?jQuery(a):this.parent().children());return jQuery.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?jQuery(a,b||this.context):jQuery.makeArray(a);b=jQuery.merge(this.get(),a);return this.pushStack(da(a[0])||da(b[0])?b:jQuery.unique(b))},andSelf:function(){return this.add(this.prevObject)}});jQuery.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return jQuery.dir(a,"parentNode")},parentsUntil:function(a,b,c){return jQuery.dir(a,"parentNode",
+c)},next:function(a){return jQuery.nth(a,2,"nextSibling")},prev:function(a){return jQuery.nth(a,2,"previousSibling")},nextAll:function(a){return jQuery.dir(a,"nextSibling")},prevAll:function(a){return jQuery.dir(a,"previousSibling")},nextUntil:function(a,b,c){return jQuery.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return jQuery.dir(a,"previousSibling",c)},siblings:function(a){return jQuery.sibling(a.parentNode.firstChild,a)},children:function(a){return jQuery.sibling(a.firstChild)},contents:function(a){return jQuery.nodeName(a,
+"iframe")?a.contentDocument||a.contentWindow.document:jQuery.makeArray(a.childNodes)}},function(a,b){jQuery.fn[a]=function(c,d){var g=jQuery.map(this,b,c);Pa.test(a)||(d=c);if(d&&typeof d==="string")g=jQuery.filter(d,g);g=this.length>1?jQuery.unique(g):g;if((this.length>1||Ra.test(d))&&Qa.test(a))g=g.reverse();return this.pushStack(g,a,Sa.call(arguments).join(","))}});jQuery.extend({filter:function(a,b,c){if(c)a=":not("+a+")";return jQuery.find.matches(a,b)},dir:function(a,b,c){var d=[];for(a=a[b];a&&
+a.nodeType!==9&&(c===x||a.nodeType!==1||!jQuery(a).is(c));){a.nodeType===1&&d.push(a);a=a[b]}return d},nth:function(a,b,c){b=b||1;for(var d=0;a;a=a[c])if(a.nodeType===1&&++d===b)break;return a},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var ua=/ jQuery\d+="(?:\d+|null)"/g,O=/^\s+/,va=/(<([\w:]+)[^>]*?)\/>/g,Ta=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,wa=/<([\w:]+)/,Ua=/<tbody/i,Va=/<|&#?\w+;/,ha=/<script|<object|<embed|<option|<style/i,
+ia=/checked\s*(?:[^=]|=\s*.checked.)/i,xa=function(a,b,c){return Ta.test(c)?a:b+"></"+c+">"},G={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};G.optgroup=G.option;G.tbody=G.tfoot=G.colgroup=G.caption=G.thead;G.th=G.td;if(!jQuery.support.htmlSerialize)G._default=
+[1,"div<div>","</div>"];jQuery.fn.extend({text:function(a){if(jQuery.isFunction(a))return this.each(function(b){var c=jQuery(this);c.text(a.call(this,b,c.text()))});if(typeof a!=="object"&&a!==x)return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(a));return jQuery.text(this)},wrapAll:function(a){if(jQuery.isFunction(a))return this.each(function(c){jQuery(this).wrapAll(a.call(this,c))});if(this[0]){var b=jQuery(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&
+b.insertBefore(this[0]);b.map(function(){for(var c=this;c.firstChild&&c.firstChild.nodeType===1;)c=c.firstChild;return c}).append(this)}return this},wrapInner:function(a){if(jQuery.isFunction(a))return this.each(function(b){jQuery(this).wrapInner(a.call(this,b))});return this.each(function(){var b=jQuery(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){jQuery(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){jQuery.nodeName(this,
+"body")||jQuery(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},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=jQuery(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,this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,jQuery(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||jQuery.filter(a,[d]).length){if(!b&&d.nodeType===1){jQuery.cleanData(d.getElementsByTagName("*"));jQuery.cleanData([d])}d.parentNode&&
+d.parentNode.removeChild(d)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&jQuery.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);return this},clone:function(a){var b=this.map(function(){if(!jQuery.support.noCloneEvent&&!jQuery.isXMLDoc(this)){var c=this.outerHTML,d=this.ownerDocument;if(!c){c=d.createElement("div");c.appendChild(this.cloneNode(true));c=c.innerHTML}return jQuery.clean([c.replace(ua,"").replace(/\=([^="'>\s]+\/)>/g,
+'="$1">').replace(O,"")],d)[0]}else return this.cloneNode(true)});if(a===true){fa(this,b);fa(this.find("*"),b.find("*"))}return b},html:function(a){if(a===x)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(ua,""):null;else if(typeof a==="string"&&!ha.test(a)&&(jQuery.support.leadingWhitespace||!O.test(a))&&!G[(wa.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(va,xa);try{for(var b=0,c=this.length;b<c;b++)if(this[b].nodeType===1){jQuery.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=
+a}}catch(d){this.empty().append(a)}}else jQuery.isFunction(a)?this.each(function(g){var i=jQuery(this),m=i.html();i.empty().append(function(){return a.call(this,g,m)})}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(jQuery.isFunction(a))return this.each(function(b){var c=jQuery(this),d=c.html();c.replaceWith(a.call(this,b,d))});if(typeof a!=="string")a=jQuery(a).detach();return this.each(function(){var b=this.nextSibling,c=this.parentNode;jQuery(this).remove();
+b?jQuery(b).before(a):jQuery(c).append(a)})}else return this.pushStack(jQuery(jQuery.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,c){var d,g,i=a[0],m=[],l;if(!jQuery.support.checkClone&&arguments.length===3&&typeof i==="string"&&ia.test(i))return this.each(function(){jQuery(this).domManip(a,b,c,true)});if(jQuery.isFunction(i))return this.each(function(u){var v=jQuery(this);a[0]=i.call(this,u,b?v.html():x);v.domManip(a,b,c)});if(this[0]){d=
+i&&i.parentNode;d=jQuery.support.parentNode&&d&&d.nodeType===11&&d.childNodes.length===this.length?{fragment:d}:ga(a,this,m);l=d.fragment;if(g=l.childNodes.length===1?(l=l.firstChild):l.firstChild){b=b&&jQuery.nodeName(g,"tr");for(var n=0,t=this.length;n<t;n++)c.call(b?Ea(this[n],g):this[n],n>0||d.cacheable||this.length>1?l.cloneNode(true):l)}m.length&&jQuery.each(m,Fa)}return this}});jQuery.fragments={};jQuery.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",
+replaceAll:"replaceWith"},function(a,b){jQuery.fn[a]=function(c){var d=[];c=jQuery(c);var g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&c.length===1){c[b](this[0]);return this}else{g=0;for(var i=c.length;g<i;g++){var m=(g>0?this.clone(true):this).get();jQuery(c[g])[b](m);d=d.concat(m)}return this.pushStack(d,a,c.selector)}}});jQuery.extend({clean:function(a,b,c,d){b=b||document;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||
+document;for(var g=[],i=0,m;(m=a[i])!=null;i++){if(typeof m==="number")m+="";if(m){if(typeof m==="string"&&!Va.test(m))m=b.createTextNode(m);else if(typeof m==="string"){m=m.replace(va,xa);var l=(wa.exec(m)||["",""])[1].toLowerCase(),n=G[l]||G._default,t=n[0],u=b.createElement("div");for(u.innerHTML=n[1]+m+n[2];t--;)u=u.lastChild;if(!jQuery.support.tbody){t=Ua.test(m);l=l==="table"&&!t?u.firstChild&&u.firstChild.childNodes:n[1]==="<table>"&&!t?u.childNodes:[];for(n=l.length-1;n>=0;--n)jQuery.nodeName(l[n],
+"tbody")&&!l[n].childNodes.length&&l[n].parentNode.removeChild(l[n])}!jQuery.support.leadingWhitespace&&O.test(m)&&u.insertBefore(b.createTextNode(O.exec(m)[0]),u.firstChild);m=u.childNodes}if(m.nodeType)g.push(m);else g=jQuery.merge(g,m)}}if(c)for(i=0;g[i];i++)if(d&&jQuery.nodeName(g[i],"script")&&(!g[i].type||g[i].type.toLowerCase()==="text/javascript"))d.push(g[i].parentNode?g[i].parentNode.removeChild(g[i]):g[i]);else{g[i].nodeType===1&&g.splice.apply(g,[i+1,0].concat(jQuery.makeArray(g[i].getElementsByTagName("script"))));
+c.appendChild(g[i])}return g},cleanData:function(a){for(var b,c,d=jQuery.cache,g=jQuery.event.special,i=jQuery.support.deleteExpando,m=0,l;(l=a[m])!=null;m++)if(!(l.nodeName&&jQuery.noData[l.nodeName.toLowerCase()]))if(c=l[jQuery.expando]){if((b=d[c])&&b.events)for(var n in b.events)g[n]?jQuery.event.remove(l,n):oa(l,n,b.handle);if(i)delete l[jQuery.expando];else l.removeAttribute&&l.removeAttribute(jQuery.expando);delete d[c]}}});var Wa=/z-?index|font-?weight|opacity|zoom|line-?height/i,ya=/alpha\([^)]*\)/,
+za=/opacity=([^)]*)/,Y=/float/i,Z=/-([a-z])/ig,Xa=/([A-Z])/g,Ya=/^-?\d+(?:px)?$/i,Za=/^-?\d/,$a={position:"absolute",visibility:"hidden",display:"block"},Ga=["Left","Right"],Ha=["Top","Bottom"],ab=document.defaultView&&document.defaultView.getComputedStyle,Aa=jQuery.support.cssFloat?"cssFloat":"styleFloat",$=function(a,b){return b.toUpperCase()};jQuery.fn.css=function(a,b){return jQuery.access(this,a,b,true,function(c,d,g){if(g===x)return jQuery.curCSS(c,d);if(typeof g==="number"&&!Wa.test(d))g+=
+"px";jQuery.style(c,d,g)})};jQuery.extend({style:function(a,b,c){if(!a||a.nodeType===3||a.nodeType===8)return x;if((b==="width"||b==="height")&&parseFloat(c)<0)c=x;var d=a.style||a,g=c!==x;if(!jQuery.support.opacity&&b==="opacity"){if(g){d.zoom=1;b=parseInt(c,10)+""==="NaN"?"":"alpha(opacity="+c*100+")";a=d.filter||jQuery.curCSS(a,"filter")||"";d.filter=ya.test(a)?a.replace(ya,b):b}return d.filter&&d.filter.indexOf("opacity=")>=0?parseFloat(za.exec(d.filter)[1])/100+"":""}if(Y.test(b))b=Aa;b=b.replace(Z,
+$);if(g)d[b]=c;return d[b]},css:function(a,b,c,d){if(b==="width"||b==="height"){if(a.offsetWidth!==0)val=ja(a,b,d);else jQuery.swap(a,$a,function(){val=ja(a,b,d)});return Math.max(0,Math.round(val))}return jQuery.curCSS(a,b,c)},curCSS:function(a,b,c){var d,g=a.style;if(!jQuery.support.opacity&&b==="opacity"&&a.currentStyle){d=za.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return d===""?"1":d}if(Y.test(b))b=Aa;if(!c&&g&&g[b])d=g[b];else if(ab){if(Y.test(b))b="float";b=b.replace(Xa,
+"-$1").toLowerCase();g=a.ownerDocument.defaultView;if(!g)return null;if(a=g.getComputedStyle(a,null))d=a.getPropertyValue(b);if(b==="opacity"&&d==="")d="1"}else if(a.currentStyle){c=b.replace(Z,$);d=a.currentStyle[b]||a.currentStyle[c];if(!Ya.test(d)&&Za.test(d)){b=g.left;var i=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;g.left=c==="fontSize"?"1em":d||0;d=g.pixelLeft+"px";g.left=b;a.runtimeStyle.left=i}}return d},swap:function(a,b,c){var d={};for(var g in b){d[g]=a.style[g];a.style[g]=
+b[g]}c.call(a);for(g in b)a.style[g]=d[g]}});if(jQuery.expr&&jQuery.expr.filters){jQuery.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight,d=a.nodeName.toLowerCase()==="tr";return b===0&&c===0&&!d?true:b>0&&c>0&&!d?false:jQuery.curCSS(a,"display")==="none"};jQuery.expr.filters.visible=function(a){return!jQuery.expr.filters.hidden(a)}}var bb=jQuery.now(),cb=/<script(.|\s)*?\/script>/gi,db=/select|textarea/i,eb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,
+J=/\=\?(&|$)/,aa=/\?/,fb=/(\?|&)_=.*?(&|$)/,gb=/^(\w+:)?\/\/([^\/?#]+)/,hb=/%20/g,Ba=jQuery.fn.load;jQuery.fn.extend({load:function(a,b,c){if(typeof a!=="string"&&Ba)return Ba.apply(this,arguments);else if(!this.length)return this;var d=a.indexOf(" ");if(d>=0){var g=a.slice(d,a.length);a=a.slice(0,d)}d="GET";if(b)if(jQuery.isFunction(b)){c=b;b=null}else if(typeof b==="object"){b=jQuery.param(b,jQuery.ajaxSettings.traditional);d="POST"}var i=this;jQuery.ajax({url:a,type:d,dataType:"html",data:b,complete:function(m,
+l){if(l==="success"||l==="notmodified")i.html(g?jQuery("<div />").append(m.responseText.replace(cb,"")).find(g):m.responseText);c&&i.each(c,[m.responseText,l,m])}});return this},serialize:function(){return jQuery.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?jQuery.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||db.test(this.nodeName)||eb.test(this.type))}).map(function(a,b){a=jQuery(this).val();
+return a==null?null:jQuery.isArray(a)?jQuery.map(a,function(c){return{name:b.name,value:c}}):{name:b.name,value:a}}).get()}});jQuery.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){jQuery.fn[b]=function(c){return this.bind(b,c)}});jQuery.extend({get:function(a,b,c,d){if(jQuery.isFunction(b)){d=d||c;c=b;b=null}return jQuery.ajax({type:"GET",url:a,data:b,success:c,dataType:d})},getScript:function(a,b){return jQuery.get(a,null,b,"script")},getJSON:function(a,
+b,c){return jQuery.get(a,b,c,"json")},post:function(a,b,c,d){if(jQuery.isFunction(b)){d=d||c;c=b;b={}}return jQuery.ajax({type:"POST",url:a,data:b,success:c,dataType:d})},ajaxSetup:function(a){jQuery.extend(jQuery.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:y.XMLHttpRequest&&(y.location.protocol!=="file:"||!y.ActiveXObject)?function(){return new y.XMLHttpRequest}:function(){try{return new y.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:"*/*"}},ajax:function(a){var b=jQuery.extend(true,{},jQuery.ajaxSettings,a),c,d,g,i=b.type.toUpperCase();b.context=a&&a.context||b;if(b.data&&b.processData&&typeof b.data!=="string")b.data=jQuery.param(b.data,b.traditional);if(b.dataType==="jsonp"){if(i==="GET")J.test(b.url)||(b.url+=(aa.test(b.url)?"&":"?")+(b.jsonp||"callback")+
+"=?");else if(!b.data||!J.test(b.data))b.data=(b.data?b.data+"&":"")+(b.jsonp||"callback")+"=?";b.dataType="json"}if(b.dataType==="json"&&(b.data&&J.test(b.data)||J.test(b.url))){c=b.jsonpCallback||"jsonp"+bb++;if(b.data)b.data=(b.data+"").replace(J,"="+c+"$1");b.url=b.url.replace(J,"="+c+"$1");b.dataType="script";y[c]=y[c]||function(o){g=o;jQuery.ajax.handleSuccess(b,s,d,g);jQuery.ajax.handleComplete(b,s,d,g);y[c]=x;try{delete y[c]}catch(p){}n&&n.removeChild(t)}}if(b.dataType==="script"&&b.cache===
+null)b.cache=false;if(b.cache===false&&i==="GET"){var m=jQuery.now(),l=b.url.replace(fb,"$1_="+m+"$2");b.url=l+(l===b.url?(aa.test(b.url)?"&":"?")+"_="+m:"")}if(b.data&&i==="GET")b.url+=(aa.test(b.url)?"&":"?")+b.data;b.global&&jQuery.ajax.active++===0&&jQuery.event.trigger("ajaxStart");m=(m=gb.exec(b.url))&&(m[1]&&m[1]!==location.protocol||m[2]!==location.host);if(b.dataType==="script"&&i==="GET"&&m){var n=document.getElementsByTagName("head")[0]||document.documentElement,t=document.createElement("script");
+t.src=b.url;if(b.scriptCharset)t.charset=b.scriptCharset;if(!c){var u=false;t.onload=t.onreadystatechange=function(){if(!u&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){u=true;jQuery.ajax.handleSuccess(b,s,d,g);jQuery.ajax.handleComplete(b,s,d,g);t.onload=t.onreadystatechange=null;n&&t.parentNode&&n.removeChild(t)}}}n.insertBefore(t,n.firstChild);return x}var v=false,s=b.xhr();if(s){b.username?s.open(i,b.url,b.async,b.username,b.password):s.open(i,b.url,b.async);try{if(b.data||
+a&&a.contentType)s.setRequestHeader("Content-Type",b.contentType);if(b.ifModified){jQuery.lastModified[b.url]&&s.setRequestHeader("If-Modified-Since",jQuery.lastModified[b.url]);jQuery.ajax.etag[b.url]&&s.setRequestHeader("If-None-Match",jQuery.ajax.etag[b.url])}m||s.setRequestHeader("X-Requested-With","XMLHttpRequest");s.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?b.accepts[b.dataType]+", */*":b.accepts._default)}catch(z){}if(b.beforeSend&&b.beforeSend.call(b.context,s,b)===false){b.global&&
+jQuery.ajax.active--===1&&jQuery.event.trigger("ajaxStop");s.abort();return false}b.global&&jQuery.ajax.triggerGlobal(b,"ajaxSend",[s,b]);var B=s.onreadystatechange=function(o){if(!s||s.readyState===0||o==="abort"){v||jQuery.ajax.handleComplete(b,s,d,g);v=true;if(s)s.onreadystatechange=jQuery.noop}else if(!v&&s&&(s.readyState===4||o==="timeout")){v=true;s.onreadystatechange=jQuery.noop;d=o==="timeout"?"timeout":!jQuery.ajax.httpSuccess(s)?"error":b.ifModified&&jQuery.ajax.httpNotModified(s,b.url)?
+"notmodified":"success";var p;if(d==="success")try{g=jQuery.ajax.httpData(s,b.dataType,b)}catch(h){d="parsererror";p=h}if(d==="success"||d==="notmodified")c||jQuery.ajax.handleSuccess(b,s,d,g);else jQuery.ajax.handleError(b,s,d,p);jQuery.ajax.handleComplete(b,s,d,g);o==="timeout"&&s.abort();if(b.async)s=null}};try{var E=s.abort;s.abort=function(){s&&E.call(s);B("abort")}}catch(f){}b.async&&b.timeout>0&&setTimeout(function(){s&&!v&&B("timeout")},b.timeout);try{s.send(i==="POST"||i==="PUT"||i==="DELETE"?
+b.data:null)}catch(j){jQuery.ajax.handleError(b,s,null,e);jQuery.ajax.handleComplete(b,s,d,g)}b.async||B();return s}},param:function(a,b){var c=[],d=function(i,m){m=jQuery.isFunction(m)?m():m;c[c.length]=encodeURIComponent(i)+"="+encodeURIComponent(m)};if(b===x)b=jQuery.ajaxSettings.traditional;if(jQuery.isArray(a)||a.jquery)jQuery.each(a,function(){d(this.name,this.value)});else for(var g in a)S(g,a[g],b,d);return c.join("&").replace(hb,"+")}});jQuery.extend(jQuery.ajax,{active:0,lastModified:{},
+etag:{},handleError:function(a,b,c,d){a.error&&a.error.call(a.context,b,c,d);a.global&&jQuery.ajax.triggerGlobal(a,"ajaxError",[b,a,d])},handleSuccess:function(a,b,c,d){a.success&&a.success.call(a.context,d,c,b);a.global&&jQuery.ajax.triggerGlobal(a,"ajaxSuccess",[b,a])},handleComplete:function(a,b,c){a.complete&&a.complete.call(a.context,b,c);a.global&&jQuery.ajax.triggerGlobal(a,"ajaxComplete",[b,a]);a.global&&jQuery.ajax.active--===1&&jQuery.event.trigger("ajaxStop")},triggerGlobal:function(a,
+b,c){(a.context&&a.context.url==null?jQuery(a.context):jQuery.event).trigger(b,c)},httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var c=a.getResponseHeader("Last-Modified"),d=a.getResponseHeader("Etag");if(c)jQuery.ajax.lastModified[b]=c;if(d)jQuery.ajax.etag[b]=d;return a.status===304||a.status===0},httpData:function(a,b,c){var d=a.getResponseHeader("content-type")||
+"",g=b==="xml"||!b&&d.indexOf("xml")>=0;a=g?a.responseXML:a.responseText;g&&a.documentElement.nodeName==="parsererror"&&jQuery.error("parsererror");if(c&&c.dataFilter)a=c.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&d.indexOf("json")>=0)a=jQuery.parseJSON(a);else if(b==="script"||!b&&d.indexOf("javascript")>=0)jQuery.globalEval(a);return a}});jQuery.extend(jQuery.ajax);var ba={},ib=/toggle|show|hide/,jb=/^([+\-]=)?([\d+.\-]+)(.*)$/,P,ka=[["height","marginTop","marginBottom","paddingTop",
+"paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];jQuery.fn.extend({show:function(a,b){if(a||a===0)return this.animate(I("show",3),a,b);else{a=0;for(b=this.length;a<b;a++){var c=jQuery.data(this[a],"olddisplay");this[a].style.display=c||"";if(jQuery.css(this[a],"display")==="none"){c=this[a].nodeName;var d;if(ba[c])d=ba[c];else{var g=jQuery("<"+c+" />").appendTo("body");d=g.css("display");if(d==="none")d="block";g.remove();ba[c]=d}jQuery.data(this[a],
+"olddisplay",d)}}a=0;for(b=this.length;a<b;a++)this[a].style.display=jQuery.data(this[a],"olddisplay")||"";return this}},hide:function(a,b){if(a||a===0)return this.animate(I("hide",3),a,b);else{a=0;for(b=this.length;a<b;a++){var c=jQuery.data(this[a],"olddisplay");!c&&c!=="none"&&jQuery.data(this[a],"olddisplay",jQuery.css(this[a],"display"))}a=0;for(b=this.length;a<b;a++)this[a].style.display="none";return this}},_toggle:jQuery.fn.toggle,toggle:function(a,b){var c=typeof a==="boolean";if(jQuery.isFunction(a)&&
+jQuery.isFunction(b))this._toggle.apply(this,arguments);else a==null||c?this.each(function(){var d=c?a:jQuery(this).is(":hidden");jQuery(this)[d?"show":"hide"]()}):this.animate(I("toggle",3),a,b);return this},fadeTo:function(a,b,c){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c)},animate:function(a,b,c,d){var g=jQuery.speed(b,c,d);if(jQuery.isEmptyObject(a))return this.each(g.complete);return this[g.queue===false?"each":"queue"](function(){var i=jQuery.extend({},
+g),m,l=this.nodeType===1&&jQuery(this).is(":hidden"),n=this;for(m in a){var t=m.replace(Z,$);if(m!==t){a[t]=a[m];delete a[m];m=t}if(a[m]==="hide"&&l||a[m]==="show"&&!l)return i.complete.call(this);if((m==="height"||m==="width")&&this.style){i.display=jQuery.css(this,"display");i.overflow=this.style.overflow}if(jQuery.isArray(a[m])){(i.specialEasing=i.specialEasing||{})[m]=a[m][1];a[m]=a[m][0]}}if(i.overflow!=null)this.style.overflow="hidden";i.curAnim=jQuery.extend({},a);jQuery.each(a,function(u,
+v){var s=new jQuery.fx(n,i,u);if(ib.test(v))s[v==="toggle"?l?"show":"hide":v](a);else{var z=jb.exec(v),B=s.cur(true)||0;if(z){v=parseFloat(z[2]);var E=z[3]||"px";if(E!=="px"){n.style[u]=(v||1)+E;B=(v||1)/s.cur(true)*B;n.style[u]=B+E}if(z[1])v=(z[1]==="-="?-1:1)*v+B;s.custom(B,v,E)}else s.custom(B,v,"")}});return true})},stop:function(a,b){var c=jQuery.timers;a&&this.queue([]);this.each(function(){for(var d=c.length-1;d>=0;d--)if(c[d].elem===this){b&&c[d](true);c.splice(d,1)}});b||this.dequeue();return this}});
+jQuery.each({slideDown:I("show",1),slideUp:I("hide",1),slideToggle:I("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){jQuery.fn[a]=function(c,d){return this.animate(b,c,d)}});jQuery.extend({speed:function(a,b,c){var d=a&&typeof a==="object"?a:{complete:c||!c&&b||jQuery.isFunction(a)&&a,duration:a,easing:c&&b||b&&!jQuery.isFunction(b)&&b};d.duration=jQuery.fx.off?0:typeof d.duration==="number"?d.duration:jQuery.fx.speeds[d.duration]||jQuery.fx.speeds._default;d.old=d.complete;
+d.complete=function(){d.queue!==false&&jQuery(this).dequeue();jQuery.isFunction(d.old)&&d.old.call(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+0.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b;this.elem=a;this.prop=c;if(!b.orig)b.orig={}}});jQuery.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(jQuery.fx.step[this.prop]||jQuery.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(jQuery.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(jQuery.curCSS(this.elem,this.prop))||0},custom:function(a,b,c){function d(i){return g.step(i)}this.startTime=jQuery.now();this.start=a;this.end=b;this.unit=c||this.unit||"px";this.now=this.start;this.pos=this.state=
+0;var g=this;d.elem=this.elem;if(d()&&jQuery.timers.push(d)&&!P)P=setInterval(jQuery.fx.tick,13)},show:function(){this.options.orig[this.prop]=jQuery.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());jQuery(this.elem).show()},hide:function(){this.options.orig[this.prop]=jQuery.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=jQuery.now(),c=true;if(a||b>=this.options.duration+this.startTime){this.now=
+this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var d in this.options.curAnim)if(this.options.curAnim[d]!==true)c=false;if(c){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=jQuery.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(jQuery.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&jQuery(this.elem).hide();if(this.options.hide||this.options.show)for(var g in this.options.curAnim)jQuery.style(this.elem,
+g,this.options.orig[g]);this.options.complete.call(this.elem)}return false}else{g=b-this.startTime;this.state=g/this.options.duration;a=this.options.easing||(jQuery.easing.swing?"swing":"linear");this.pos=jQuery.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,g,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};jQuery.extend(jQuery.fx,{tick:function(){for(var a=jQuery.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,
+1);a.length||jQuery.fx.stop()},stop:function(){clearInterval(P);P=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){jQuery.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(jQuery.expr&&jQuery.expr.filters)jQuery.expr.filters.animated=function(a){return jQuery.grep(jQuery.timers,function(b){return a===b.elem}).length};
+jQuery.fn.offset="getBoundingClientRect"in document.documentElement?function(a){var b=this[0];if(a)return this.each(function(i){jQuery.offset.setOffset(this,a,i)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return jQuery.offset.bodyOffset(b);var c=b.getBoundingClientRect(),d=b.ownerDocument;b=d.body;var g=d.documentElement;d=T(d);return{top:c.top+(d.pageYOffset||jQuery.support.boxModel&&g.scrollTop||b.scrollTop)-(g.clientTop||b.clientTop||0),left:c.left+(d.pageXOffset||jQuery.support.boxModel&&
+g.scrollLeft||b.scrollLeft)-(g.clientLeft||b.clientLeft||0)}}:function(a){var b=this[0];if(a)return this.each(function(u){jQuery.offset.setOffset(this,a,u)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return jQuery.offset.bodyOffset(b);jQuery.offset.initialize();var c=b.offsetParent,d=b,g=b.ownerDocument,i,m=g.documentElement,l=g.body;d=(g=g.defaultView)?g.getComputedStyle(b,null):b.currentStyle;for(var n=b.offsetTop,t=b.offsetLeft;(b=b.parentNode)&&b!==l&&b!==m;){if(jQuery.offset.supportsFixedPosition&&
+d.position==="fixed")break;i=g?g.getComputedStyle(b,null):b.currentStyle;n-=b.scrollTop;t-=b.scrollLeft;if(b===c){n+=b.offsetTop;t+=b.offsetLeft;if(jQuery.offset.doesNotAddBorder&&!(jQuery.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(b.nodeName))){n+=parseFloat(i.borderTopWidth)||0;t+=parseFloat(i.borderLeftWidth)||0}d=c;c=b.offsetParent}if(jQuery.offset.subtractsBorderForOverflowNotVisible&&i.overflow!=="visible"){n+=parseFloat(i.borderTopWidth)||0;t+=parseFloat(i.borderLeftWidth)||
+0}d=i}if(d.position==="relative"||d.position==="static"){n+=l.offsetTop;t+=l.offsetLeft}if(jQuery.offset.supportsFixedPosition&&d.position==="fixed"){n+=Math.max(m.scrollTop,l.scrollTop);t+=Math.max(m.scrollLeft,l.scrollLeft)}return{top:n,left:t}};jQuery.offset={initialize:function(){var a=document.body,b=document.createElement("div"),c,d,g,i=parseFloat(jQuery.curCSS(a,"marginTop",true))||0;jQuery.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"});
+b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";a.insertBefore(b,a.firstChild);c=b.firstChild;d=c.firstChild;g=c.nextSibling.firstChild.firstChild;this.doesNotAddBorder=d.offsetTop!==5;this.doesAddBorderForTableAndCells=g.offsetTop===5;d.style.position=
+"fixed";d.style.top="20px";this.supportsFixedPosition=d.offsetTop===20||d.offsetTop===15;d.style.position=d.style.top="";c.style.overflow="hidden";c.style.position="relative";this.subtractsBorderForOverflowNotVisible=d.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i;a.removeChild(b);jQuery.offset.initialize=jQuery.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;jQuery.offset.initialize();if(jQuery.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(jQuery.curCSS(a,
+"marginTop",true))||0;c+=parseFloat(jQuery.curCSS(a,"marginLeft",true))||0}return{top:b,left:c}},setOffset:function(a,b,c){var d=jQuery.curCSS(a,"position");if(d==="static")a.style.position="relative";var g=jQuery(a),i=g.offset(),m=jQuery.curCSS(a,"top",true),l=jQuery.curCSS(a,"left",true),n=d==="absolute"&&jQuery.inArray("auto",[m,l])>-1;d={};var t={};if(n)t=g.position();m=n?t.top:parseInt(m,10)||0;l=n?t.left:parseInt(l,10)||0;if(jQuery.isFunction(b))b=b.call(a,c,i);if(b.top!=null)d.top=b.top-i.top+
+m;if(b.left!=null)d.left=b.left-i.left+l;"using"in b?b.using.call(a,d):g.css(d)}};jQuery.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(jQuery.curCSS(a,"marginTop",true))||0;c.left-=parseFloat(jQuery.curCSS(a,"marginLeft",true))||0;d.top+=parseFloat(jQuery.curCSS(b[0],"borderTopWidth",true))||0;d.left+=parseFloat(jQuery.curCSS(b[0],"borderLeftWidth",true))||
+0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||document.body;a&&!/^body|html$/i.test(a.nodeName)&&jQuery.css(a,"position")==="static";)a=a.offsetParent;return a})}});jQuery.each(["Left","Top"],function(a,b){var c="scroll"+b;jQuery.fn[c]=function(d){var g=this[0],i;if(!g)return null;if(d!==x)return this.each(function(){if(i=T(this))i.scrollTo(!a?d:jQuery(i).scrollLeft(),a?d:jQuery(i).scrollTop());else this[c]=d});else return(i=
+T(g))?"pageXOffset"in i?i[a?"pageYOffset":"pageXOffset"]:jQuery.support.boxModel&&i.document.documentElement[c]||i.document.body[c]:g[c]}});jQuery.each(["Height","Width"],function(a,b){var c=b.toLowerCase();jQuery.fn["inner"+b]=function(){return this[0]?jQuery.css(this[0],c,false,"padding"):null};jQuery.fn["outer"+b]=function(d){return this[0]?jQuery.css(this[0],c,false,d?"margin":"border"):null};jQuery.fn[c]=function(d){var g=this[0];if(!g)return d==null?null:this;if(jQuery.isFunction(d))return this.each(function(i){var m=
+jQuery(this);m[c](d.call(this,i,m[c]()))});return"scrollTo"in g&&g.document?g.document.compatMode==="CSS1Compat"&&g.document.documentElement["client"+b]||g.document.body["client"+b]:g.nodeType===9?Math.max(g.documentElement["client"+b],g.body["scroll"+b],g.documentElement["scroll"+b],g.body["offset"+b],g.documentElement["offset"+b]):d===x?jQuery.css(g,c):this.css(c,typeof d==="string"?d:d+"px")}})})(window);
+
+}
26 assets/jzip/jquery/extensions/ajaxify.js
@@ -0,0 +1,26 @@
+
+$.ajaxFormHandlers = {};
+
+$.extend({
+ registerAjaxFormHandler: function(handlers) {
+ $.extend($.ajaxFormHandlers, handlers);
+ }
+});
+
+$("form.ajaxify").live("submit", function(event) {
+ var form = $(this);
+
+ $.ajax({
+ type: form.attr("method") || "GET",
+ url : form.attr("action") || window.location.href,
+ data: form.serialize(),
+ success: function(response) {
+ var handler = $.ajaxFormHandlers[form.attr("name")];
+ if (handler) {
+ handler(form, response);
+ }
+ }
+ });
+
+ event.preventDefault();
+});
12 assets/jzip/jquery/extensions/modules.js
@@ -0,0 +1,12 @@
+
+$.extend({
+ modules: function(object) {
+ var array = [];
+ $.each(object, function(property, names_only) {
+ if (property.match(/^[ABCDEFGHIJKLMNOPQRSTUVWXYZ][abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ]+$/)) {
+ array.push(names_only === true ? property : object[property]);
+ }
+ });
+ return array;
+ }
+});
17 assets/jzip/jquery/extensions/object.js
@@ -0,0 +1,17 @@
+
+$.extend({
+ keys: function(object) {
+ var result = [];
+ for (var key in object) {
+ result.push(key);
+ }
+ return result;
+ },
+ values: function(object) {
+ var result = [];
+ $.each($.keys(object), function(i, key) {
+ result.push(object[key]);
+ });
+ return result;
+ }
+});
2  assets/jzip/rich/cms.js
@@ -0,0 +1,2 @@
+
+Rich.Cms = {};
109 assets/jzip/rich/cms/editor.js
@@ -0,0 +1,109 @@
+
+Rich.Cms.Editor = (function() {
+ var edit_panel = "#rich_cms_bar .panel .edit",
+ editable_class = "rich_cms_content",
+ mark_class = "marked",
+ editable_content = {},
+ editables = "";
+
+ var register = function(hash) {
+ $.extend(editable_content, hash);
+ editables = $.keys(editable_content).join(",");
+ };
+
+ var editHandler = function(event) {
+ edit($(this));
+ event.preventDefault();
+ };
+
+ var bind = function() {
+ $("." + editable_class + "." + mark_class).live("click", editHandler );
+ $("#rich_cms_bar .menu a.mark" ).bind("click", mark );
+ $(edit_panel + " a.close" ).bind("click", function() { $(edit_panel).hide(); });
+ };
+
+ var bindSeatHolders = function() {
+ $(editables + "." + mark_class + ".sh_hint").bind("focus", editHandler);
+ };
+
+ var mark = function(event) {
+ $(editables).addClass(editable_class).toggleClass(mark_class);
+
+ var markedEditables = $(editables + "." + mark_class);
+ if (markedEditables.length) {
+ $.each(markedEditables, function() {
+ var editable = $(this);
+ if (editable.parent().is("p") && editable.parent().children().length == 1) {
+ editable.addClass("block");
+ }
+ });
+ bindSeatHolders();
+ } else {
+ $(editables + ".block").removeClass("block");
+ $(edit_panel).hide();
+ }
+
+ event.preventDefault();
+ };
+
+ var edit = function(editable) {
+ var label = $("#rich_cms_bar .edit label");
+ var inputs = $("#rich_cms_bar .edit form fieldset.inputs");
+ var text = editable.is("textarea") || editable.hasClass("block");
+ var attrs = editable.get(0).attributes;
+
+ var match = $.grep($.makeArray(editable_content), function(hash) {
+ return editable.is($.keys(hash)[0]);
+ })[0];
+ var selector = $.keys(match)[0];
+ var specs = $.values(match)[0];
+
+ label.html(specs.value.replace(/^data-/, ""));
+ inputs.find(":input").remove();
+ inputs.append("<input name='editable_content[__selector__]' type='hidden' value='" + selector + "'/>");
+
+ $.each(attrs, function(index, attribute) {
+ var attr = attribute.name;
+
+ if (attr.match(/^data-/)) {
+ var name = "editable_content[" + attr.replace(/^data-/, "") + "]";
+ var value = editable.attr(attr);
+
+ if (attr == specs.value) {
+ if (text) {
+ inputs.append("<textarea name='" + name + "'>" + value + "</textarea>");
+ } else {
+ inputs.append("<input name='" + name + "' type='text' value='" + value + "'/>");
+ }
+ } else {
+ inputs.append("<input name='" + name + "' type='hidden' value='" + value + "'/>");
+ }
+ }
+ });
+
+ $(edit_panel).show();
+ };
+
+ var afterUpdate = function(form, response) {
+ var specs = editable_content[response["__selector__"]];
+
+ var defaultFunction = function(form, response) {
+ $("[" + specs.key + "=" + response[specs.key.replace(/^data-/, "")] + "]").html(response[specs.value.replace(/^data-/, "")]);
+ if (typeof(SeatHolder) != "undefined") {
+ SeatHolder.rebind();
+ }
+ };
+
+ (specs.afterUpdate || defaultFunction).apply(null, [form, response]);
+ };
+
+ return {
+ init: function() {
+ bind();
+ $.registerAjaxFormHandler({
+ "rich_cms_editable": afterUpdate
+ });
+ },
+ register: register
+ };
+}());
12 assets/jzip/rich/cms/login.js
@@ -0,0 +1,12 @@
+
+Rich.Cms.Login = (function() {
+ var login_panel = "#rich_cms_bar .panel .login";
+
+ return {
+ init: function() {
+ $("#rich_cms_bar .menu a.login").bind("click", function() {
+ $(login_panel).show();
+ });
+ }
+ };
+}());
11 assets/jzip/rich_cms.jz
@@ -0,0 +1,11 @@
+
+//= require jquery/core
+//= require jquery/extensions/ajaxify
+//= require jquery/extensions/modules
+//= require jquery/extensions/object
+
+//= require shared/rich
+
+//= require rich/cms
+//= require rich/cms/login
+//= require rich/cms/editor
25 assets/jzip/shared/rich.js
@@ -0,0 +1,25 @@
+
+Rich = (function() {
+ var initModules = function() {
+ $.each($.modules(Rich), function(i, module) {
+ initSubModules(module);
+ });
+ };
+
+ var initSubModules = function(mod) {
+ if (mod.init) {
+ mod.init();
+ }
+ $.each($.modules(mod), function(i, m) {
+ initSubModules(m);
+ });
+ };
+
+ return {
+ init: function() {
+ initModules();
+ }
+ };
+}());
+
+$(Rich.init);
45 assets/sass/_bar.sass
@@ -0,0 +1,45 @@
+
+#rich_cms_bar
+ top: 25px
+ left: 25px
+ width: 370px
+ padding: 7px 10px
+ +fixed
+ background: #777
+ border: 1px solid #111
+ z-index: 999999999
+
+ &, & a
+ color: white
+
+ .menu
+ +clearfix
+
+ .admin
+ +right
+
+ .panel
+
+ .login, .edit
+ padding-top: 12px
+
+ fieldset
+ border: 0
+
+ &.inputs
+
+ label
+ padding-bottom: 4px
+ font:
+ size: 13px
+ weight: bold
+
+ input, textarea
+ width: 365px
+ margin: 12px 0
+
+ textarea
+ height: 120px
+
+ .hidden
+ display: none !important
6 assets/sass/_editables.sass
@@ -0,0 +1,6 @@
+
+.rich_cms_content
+ &.marked
+ outline: 1px dotted red
+ &.block
+ display: block
52 assets/sass/_mixins.sass
@@ -0,0 +1,52 @@
+
+=relative
+ position: relative
+
+=absolute
+ position: absolute
+
+=fixed
+ position: fixed
+
+=left
+ float: left
+
+=right
+ float: right
+
+=clear
+ clear: both
+
+=hidden
+ display: none
+
+=block
+ display: block
+
+=inline
+ display: inline
+
+=inline_block
+ display: -moz-inline-block
+ display: inline-block
+ zoom: 1
+ *display: inline
+
+=clearfix
+ *display: inline-block
+ &:after
+ content: " "
+ height: 0
+ +block
+ clear: both
+ visibility: hidden
+
+=indent
+ +inline_block
+ text-indent: -9999px
+
+=opacity(!opacity)
+ filter: alpha(opacity= !opacity * 100)
+ -moz-opacity = !opacity
+ -khtml-opacity = !opacity
+ opacity = !opacity
4 assets/sass/rich_cms.sass
@@ -0,0 +1,4 @@
+
+@import mixins
+@import bar
+@import editables
12 config/routes.rb
@@ -0,0 +1,12 @@
+ActionController::Routing::Routes.draw do |map|
+
+ map.namespace :rich, :path_prefix => "" do |rich|
+
+ rich.cms_root "cms", :controller => "cms", :action => "show"
+ %w(hide login logout update).each do |action|
+ rich.send "cms_#{action}", "cms/#{action}", :controller => "cms", :action => action
+ end
+
+ end
+
+end
1  init.rb
@@ -0,0 +1 @@
+require File.join(File.dirname(__FILE__), "rails", "init")
1  install.rb
@@ -0,0 +1 @@
+# Install hook code here
60 lib/rich/cms/controller.rb
@@ -0,0 +1,60 @@
+
+module Rich
+ module Cms
+ module Controller
+
+ def self.included(base)
+ base.class_eval do
+ include InstanceMethods
+ helper_method :current_rich_cms_admin , :current_rich_cms_admin_name,
+ :rich_cms_authenticated_class, :rich_cms_authentication_inputs
+ end
+ end
+
+ module InstanceMethods
+
+ protected
+
+ def require_current_rich_cms_admin
+ unless current_rich_cms_admin
+ redirect_to root_url
+ return false
+ end
+ end
+
+ def current_rich_cms_admin
+ case rich_cms_auth.logic
+ when :authlogic
+ return @current_rich_cms_admin if defined?(@current_rich_cms_admin)
+ @current_rich_cms_admin_session ||= rich_cms_authenticated_class.find
+ @current_rich_cms_admin = @current_rich_cms_admin_session.try rich_cms_auth.specs[:class].name.demodulize.underscore
+ end
+ end
+
+ def current_rich_cms_admin_name
+ current_rich_cms_admin[rich_cms_auth.specs[:identifier]] if current_rich_cms_admin
+ end
+
+ def rich_cms_auth
+ ::Rich::Cms::Engine.authentication
+ end
+
+ def rich_cms_authenticated_class
+ case rich_cms_auth.logic
+ when :authlogic
+ "#{rich_cms_auth.specs[:class].name}Session".constantize
+ end
+ end
+
+ def rich_cms_authentication_inputs
+ case rich_cms_auth.logic
+ when :authlogic
+ rich_cms_auth.specs[:inputs] || [:email, :password]
+ end
+ end
+
+ end
+
+ end
+ end
+end
44 lib/rich/cms/editable_content.rb
@@ -0,0 +1,44 @@
+
+module Rich
+ module Cms
+ class EditableContent
+
+ def initialize(params)
+ @params = params.dup
+ end
+
+ def to_tag
+ "<div class='betty_cms_content' data-#{specs[:key]}='#{object.send specs[:key]}' data-#{specs[:value]}='#{object.send specs[:value]}'>#{object.new_record? ? "< #{object.send specs[:key]} >" : object.send(specs[:value])}</div>"
+ end
+
+ def save
+ object.update_attributes updated_attributes
+ object.respond_to?(:to_rich_cms_response) ? object.to_rich_cms_response : object.attributes.reject{|k, v| [:id, :created_at, :updated_at].include?(k)}.merge({:__selector__ => @params[:__selector__]})
+ end
+
+ private
+
+ def specs
+ @specs ||= Engine.editable_content[@params[:__selector__]]
+ end
+
+ def model_class
+ specs[:class]
+ end
+
+ def identifiers
+ [specs[:key]].flatten
+ end
+
+ def object
+ @object ||= model_class.send :"find_or_initialize_by_#{identifiers.join "_and_"}", *@params.values_at(*identifiers)
+ end
+
+ def updated_attributes
+ attribute = specs[:value]
+ {attribute => @params[specs[:value]]}
+ end
+
+ end
+ end
+end
62 lib/rich/cms/engine.rb
@@ -0,0 +1,62 @@
+
+module Rich
+ module Cms
+ module Engine
+
+ class RichCmsError < StandardError
+ end
+
+ extend self
+
+ attr_reader :authentication
+
+ def init
+ @authentication = AuthenticationSpecs.new
+ @editable_content = {}
+
+ ApplicationController.send :include, ::Rich::Cms::Controller
+ ActionView::Base .send :include, ::Rich::Cms::Helper
+
+ ::Jzip::Plugin.add_template_location({File.join(File.dirname(__FILE__), "..", "..", "..", "assets", "jzip") => RAILS_ROOT + "/public/javascripts"})
+ ::Sass::Plugin.add_template_location( File.join(File.dirname(__FILE__), "..", "..", "..", "assets", "sass"), RAILS_ROOT + "/public/stylesheets" )
+ end
+
+ def authenticate(logic, specs)
+ @authentication = AuthenticationSpecs.new(logic, specs)
+ end
+
+ def register(*args)
+ (editables = args.first.is_a?(Hash) ? args.first : Hash[*args]).each do |selector, specs|
+ if @editable_content.keys.include?(selector)
+ raise RichCmsError, "Already registered editable content identified with #{selector.inspect}"
+ else
+ @editable_content[selector] = specs
+ end
+ end
+ end
+
+ def editable_content
+ @editable_content.inject({}) do |h, (key, value)|
+ h[key] = {:key => :key, :value => :value}.merge(value)
+ h
+ end
+ end
+
+ def editable_content_javascript_hash
+ "{#{editable_content.collect{|key, value| "#{key.to_s.inspect}: {#{value.reject{|k, v| [:class].include?(k)}.collect{|k, v| "#{k.to_s}: 'data-#{v.to_s}'"}.join(", ")}}"}.join(", ")}}"
+ end
+
+ def to_content_tag(reference)
+ selector, key = reference.to_a.first
+ Cms::EditableContent.new(:__selector__ => selector, editable_content[selector][:key] => key).to_tag
+ end
+
+ private
+
+ AuthenticationSpecs = Struct.new(:logic, :specs)
+
+ end
+ end
+end
+
+Rich::Cms::Engine.init
17 lib/rich/cms/helper.rb
@@ -0,0 +1,17 @@
+
+module Rich
+ module Cms
+ module Helper
+
+ def rich_cms
+ render :file => File.join(File.dirname(__FILE__), "..", "..", "..", "app", "views", "rich_cms.html.erb") if session[:rich_cms].try(:fetch, :display, nil)
+ end
+
+ def link(name, options = nil)
+ options = {:class => options || name.underscore} unless options.is_a?(Hash)
+ link_to name, "#", options
+ end
+
+ end
+ end
+end
5 lib/rich_cms.rb
@@ -0,0 +1,5 @@
+
+require "rich/cms/engine"
+
+module RichCms
+end
1  rails/init.rb
@@ -0,0 +1 @@
+require "rich_cms"
4 tasks/rich_cms_tasks.rake
@@ -0,0 +1,4 @@
+# desc "Explaining what the task does"
+# task :rich_cms do
+# # Task goes here
+# end
15 test/engine_test.rb
@@ -0,0 +1,15 @@
+require "test_helper"
+
+module Rich
+ module Cms
+ module Test
+
+ class EngineTest < ActiveSupport::TestCase
+ # test "something" do
+ # assert true
+ # end
+ end
+
+ end
+ end
+end
3  test/test_helper.rb
@@ -0,0 +1,3 @@
+require "rubygems"
+require "active_support"
+require "active_support/test_case"
1  uninstall.rb
@@ -0,0 +1 @@
+# Uninstall hook code here
Please sign in to comment.
Something went wrong with that request. Please try again.